on xenial help sign in
Use new header with integrated search action, dropping the search entry from the panel
commit19a118988d45dcf56c6fb6a3f12ed8b6bfd84b43 authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 26 Jun 2014, 12:45 (12 years ago) parenta44e682
4 files changed+16−75
qml/Dash/DashContent.qml+15−35 qml/Dash/GenericScopeView.qml−8 qml/Panel/Panel.qml+1−31 qml/Shell.qml−1
qml/Dash/DashContent.qml+15−35
@@ -15,7 +15,8 @@
1515 */
1616
1717import QtQuick 2.0
18−import Ubuntu.Components 0.1
18+import Ubuntu.Components 1.1
19+import Ubuntu.Components.Themes.Ambiance 1.1
1920import Unity 0.2
2021import Utils 0.1
2122import "../Components"
@@ -177,44 +178,23 @@ Item {
177178 searchHistory: dashContent.searchHistory
178179 scope: dashContentList.currentItem && dashContentList.currentItem.theScope
179180
180− childItem: TabBar {
181+ childItem: NewHeaderStyle {
181182 id: tabBar
182183 objectName: "tabbar"
183− height: units.gu(6.5)
184184 width: parent.width
185− style: DashContentTabBarStyle {}
186−
187− SortFilterProxyModel {
188− id: tabBarModel
189−
190− model: dashContentList.model
191−
192− property int selectedIndex: -1
193− onSelectedIndexChanged: {
194− if (dashContentList.currentIndex == -1 && tabBar.selectedIndex != -1) {
195− // TODO This together with the Timer below
196− // are a workaround for the first tab sometimes not showing the text.
197− // But Tabs are going away in the future so not sure if makes
198− // sense invetigating what's the problem at this stage
199− selectionModeTimer.restart();
185+ height: units.gu(6.5)
186+ contentHeight: height
187+ separatorSource: ""
188+ textColor: "grey"
189+ property var styledItem: tabBar
190+ property var title: dashContentList.model.get(dashContentList.currentIndex).title
191+ property var config: HeaderConfiguration {
192+ actions: [
193+ Action {
194+ iconName: "search"
195+ onTriggered: dashPageHeader.triggerSearch()
200196 }
201− dashContentList.currentIndex = selectedIndex;
202− }
203− }
204−
205− model: tabBarModel.count > 0 ? tabBarModel : null
206−
207− Connections {
208− target: dashContentList
209− onCurrentIndexChanged: {
210− tabBarModel.selectedIndex = dashContentList.currentIndex
211− }
212− }
213−
214− Timer {
215− id: selectionModeTimer
216− interval: 1
217− onTriggered: tabBar.selectionMode = false
197+ ]
218198 }
219199 }
220200
qml/Dash/GenericScopeView.qml−8
@@ -88,14 +88,6 @@ FocusScope {
8888 when: isCurrent
8989 }
9090
91− Connections {
92− target: panel
93− onSearchClicked: if (isCurrent) {
94− pageHeader.triggerSearch()
95− categoryView.showHeader()
96− }
97− }
98−
9991 Connections {
10092 target: scopeView.scope
10193 onShowDash: previewListView.open = false;
qml/Panel/Panel.qml+1−31
@@ -24,13 +24,10 @@ Item {
2424 property real indicatorsMenuWidth: (shell.width > units.gu(60)) ? units.gu(40) : shell.width
2525 property alias indicators: indicatorsMenu
2626 property bool fullscreenMode: false
27− property bool searchVisible: true
2827
2928 readonly property real separatorLineHeight: leftSeparatorLine.height
3029 readonly property real __panelMinusSeparatorLineHeight: panelHeight - separatorLineHeight
3130
32− signal searchClicked
33−
3431 function hideIndicatorMenu(delay) {
3532 if (delay !== undefined) {
3633 hideTimer.interval = delay;
@@ -104,7 +101,7 @@ Item {
104101 panelHeight: __panelMinusSeparatorLineHeight
105102 openedHeight: parent.height + (pinnedMode ? 0 : root.panelHeight)
106103 pinnedMode: !fullscreenMode
107− overFlowWidth: search.state=="hidden" ? parent.width : parent.width - search.width
104+ overFlowWidth: parent.width
108105 }
109106
110107 PanelSeparatorLine {
@@ -130,33 +127,6 @@ Item {
130127 source: "graphics/rectangular_dropshadow.sci"
131128 }
132129
133− SearchIndicator {
134− id: search
135− objectName: "search"
136− enabled: root.searchVisible
137−
138− state: {
139− if (parent.width < indicatorsMenu.width + width) {
140− if (indicatorsMenu.state != "initial") {
141− return "hidden";
142− }
143− }
144− if (root.searchVisible && !indicatorsMenu.showAll) {
145− return "visible";
146− }
147−
148− return "hidden";
149− }
150−
151− height: __panelMinusSeparatorLineHeight
152− anchors {
153− top: panelBackground.top
154− left: panelBackground.left
155− }
156−
157− onClicked: root.searchClicked()
158− }
159−
160130 states: [
161131 State {
162132 name: "in" //fully opaque and visible at top edge of screen
qml/Shell.qml−1
@@ -468,7 +468,6 @@ FocusScope {
468468 property string focusedAppId: ApplicationManager.focusedApplicationId
469469 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
470470 fullscreenMode: focusedApplication && stages.fullscreen && !greeter.shown && !lockscreen.shown
471− searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
472471
473472 InputFilterArea {
474473 anchors {