Merge lp:~josharenson/unity8/dash-refactor into lp:unity8
- dash-refactor
- Merge into trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~josharenson/unity8/dash-refactor |
Merge into: | lp:unity8 |
Prerequisite: | lp:~cimi/unity8/dash-visual-tweaks_pageHeader-bottomEdge |
Diff against target: |
1485 lines (+577/-373) 10 files modified
qml/Dash/Dash.qml (+2/-1) qml/Dash/DashContent.qml (+7/-5) qml/Dash/DashNavigationList.qml (+8/-0) qml/Dash/DashPageHeader.qml (+123/-215) qml/Dash/GenericScopeView.qml (+9/-58) qml/Dash/PageHeaderExtraPanel.qml (+3/-3) qml/Dash/SearchHeaderContents.qml (+293/-0) tests/qmltests/Dash/tst_Dash.qml (+12/-2) tests/qmltests/Dash/tst_DashContent.qml (+109/-51) tests/qmltests/Dash/tst_DashPageHeader.qml (+11/-38) |
To merge this branch: | bzr merge lp:~josharenson/unity8/dash-refactor |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Albert Astals Cid (community) | Needs Fixing | ||
Unity8 CI Bot | continuous-integration | Needs Fixing | |
Andrea Cimitan (community) | Needs Fixing | ||
Review via email: mp+309004@code.launchpad.net |
This proposal supersedes a proposal from 2016-09-15.
Commit message
Refactor the dash to make implementing a wide view dash easier in the future.
Description of the change
* Are there any related MPs required for this MP to build/function as expected? Please list.
lp:~cimi/unity8/dash-visual-tweaks_pageHeader-bottomEdge/
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes, extensively. However given the nature of the dash and the nature of this branch, I probably didn't test everything.
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
* If you changed the UI, has there been a design review?
N/A (UI should appear identical)
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2091
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2092
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2095
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2096
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2653
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Andrea Cimitan (cimi) wrote : Posted in a previous version of this proposal | # |
looks good, mostly cosmetic changes for now (need to dive fully and test this first in a silo), I'd like you to see if we can add more tests if you think we should, just to make sure nothing breaks
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2656
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
testDashPageHeader doesn't compile
When doing tryDash and then search icon on the header and click on rootChild3 i get
dash-refactor/
Josh Arenson (josharenson) wrote : Posted in a previous version of this proposal | # |
Changing to WIP until I get the test albert mentioned passing. I missed it somehow.
Josh Arenson (josharenson) wrote : Posted in a previous version of this proposal | # |
> testDashPageHeader doesn't compile
>
> When doing tryDash and then search icon on the header and click on rootChild3
> i get
>
> dash-refactor/
> 'unfocus' of object DashPageHeader_
> "scopePageHeader") is not a function
Should work and pass now.
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2661
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2662
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2663
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2664
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2666
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal | # |
qml/Dash/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2667
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:2668
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2669
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Andrea Cimitan (cimi) wrote : Posted in a previous version of this proposal | # |
you want to merge https:/
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
currentCategoryView property added but not used?
Do we have duplicate-ish code in showFiltersPopup and onShowFiltersPopup ?
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
Can you fix
qml/Dash/
qml/Dash/
qml/Dash/
When starting tryDash?
Josh Arenson (josharenson) wrote : Posted in a previous version of this proposal | # |
Addressed concerns.
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2671
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 2674. By Josh Arenson
-
Remove tab
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2673
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 2675. By Josh Arenson
-
Readd missing search reset
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2674
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2675
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
SUCCESS: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Albert Astals Cid (aacid) wrote : | # |
There's a regression on the keyboard still shown then showing the dash navigation, previously when "scrolling" the dash navigation the keyboard would hide, now it stays, making it impossible to reach the last categories on the app scope.
Andrea Cimitan (cimi) wrote : | # |
The dash page header reverted back some of the old looks of the pagination that went away with the related branch. Also, testing the Previews, it seems like the padding between pageheader and preview content is bigger with this branch (I guess they are related). Removing this branch from the silo fixed both issues
- 2676. By Josh Arenson
-
Merge trunk
- 2677. By Josh Arenson
-
Fix pagination dots
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2677
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 2678. By Josh Arenson
-
Fix focus issue
Josh Arenson (josharenson) wrote : | # |
Albert, the keyboard issue should be resolved.
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2678
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Albert Astals Cid (aacid) wrote : | # |
xvfbtestDashContent is not happy
Andrea Cimitan (cimi) wrote : | # |
Text conflict in qml/Dash/
1 conflicts encountered.
in silo
- 2679. By Josh Arenson
-
Fix tests
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2679
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Albert Astals Cid (aacid) wrote : | # |
Running
while [ true ]; do make xvfbtestDashCon
I've beeen able to reproduce the test error in DashContent:
Can you see if you can also reproduce it?
Josh Arenson (josharenson) wrote : | # |
> Running
> while [ true ]; do make xvfbtestDashCon
> done
> I've beeen able to reproduce the test error in
> DashContent:
>
> Can you see if you can also reproduce it?
Do you have the test output from the failure? I've been running the full test, as well as just test_clearSearc
Albert Astals Cid (aacid) wrote : | # |
FAIL! : qmltestrunner:
Actual (): false
Expected (): true
Loc: [/home/
Albert Astals Cid (aacid) wrote : | # |
Text conflict in qml/Dash/
1 conflicts encountered.
Albert Astals Cid (aacid) wrote : | # |
Conflicts for more than a month moving to WiP to clear the queue.
Unmerged revisions
- 2679. By Josh Arenson
-
Fix tests
- 2678. By Josh Arenson
-
Fix focus issue
- 2677. By Josh Arenson
-
Fix pagination dots
- 2676. By Josh Arenson
-
Merge trunk
- 2675. By Josh Arenson
-
Readd missing search reset
- 2674. By Josh Arenson
-
Remove tab
- 2673. By Josh Arenson
-
Clean warnings
- 2672. By Josh Arenson
-
Remove unused code
- 2671. By Josh Arenson
-
Relocate pagination dots
- 2670. By Josh Arenson
-
Merge (new) prereq
Preview Diff
1 | === modified file 'qml/Dash/Dash.qml' |
2 | --- qml/Dash/Dash.qml 2016-09-02 15:38:15 +0000 |
3 | +++ qml/Dash/Dash.qml 2016-11-18 00:12:31 +0000 |
4 | @@ -262,7 +262,8 @@ |
5 | bottomMargin: Qt.inputMethod.keyboardRectangle.height |
6 | } |
7 | height: units.dp(3) |
8 | - color: scopeStyle.backgroundLuminance > 0.7 ? "#50000000" : "#50ffffff" |
9 | + color: typeof(scopeStyle) !== "undefined" && |
10 | + scopeStyle.backgroundLuminance > 0.7 ? "#50000000" : "#50ffffff" |
11 | opacity: 0 |
12 | visible: opacity > 0 |
13 | |
14 | |
15 | === modified file 'qml/Dash/DashContent.qml' |
16 | --- qml/Dash/DashContent.qml 2016-07-27 16:23:18 +0000 |
17 | +++ qml/Dash/DashContent.qml 2016-11-18 00:12:31 +0000 |
18 | @@ -30,11 +30,12 @@ |
19 | readonly property string currentScopeId: dashContentList.currentItem ? dashContentList.currentItem.scopeId : "" |
20 | readonly property var currentScope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null |
21 | readonly property bool subPageShown: dashContentList.currentItem && dashContentList.currentItem.item ? |
22 | - dashContentList.currentItem.item.subPageShown : false |
23 | - readonly property bool processing: dashContentList.currentItem && dashContentList.currentItem.item |
24 | + dashContentList.currentItem.item.subPageShown : false |
25 | + readonly property bool processing: dashContentList.currentItem |
26 | + && dashContentList.currentItem.item |
27 | && dashContentList.currentItem.item.processing || false |
28 | readonly property bool pageHeaderTotallyVisible: dashContentList.currentItem && dashContentList.currentItem.item |
29 | - && dashContentList.currentItem.item.pageHeaderTotallyVisible || false |
30 | + && dashContentList.currentItem.item.pageHeaderTotallyVisible || false |
31 | |
32 | signal scopeLoaded(string scopeId) |
33 | signal gotoScope(string scopeId) |
34 | @@ -84,7 +85,7 @@ |
35 | |
36 | if (reset) { |
37 | dashContentList.currentItem.item.positionAtBeginning() |
38 | - dashContentList.currentItem.item.resetSearch() |
39 | + dashContentList.currentItem.item.searchContents.resetSearch(false); |
40 | } |
41 | } |
42 | |
43 | @@ -168,7 +169,7 @@ |
44 | objectName: "scopeLoader" + index |
45 | |
46 | readonly property bool moving: item ? item.moving : false |
47 | - readonly property bool extraPanelShown: item ? item.extraPanelShown : false |
48 | + readonly property bool extraPanelShown: item ? item.searchContents.extraPanelVisible : false |
49 | readonly property bool subPageShown: item ? item.subPageShown : false |
50 | readonly property var categoryView: item ? item.categoryView : null |
51 | readonly property var theScope: scope |
52 | @@ -189,6 +190,7 @@ |
53 | item.holdingList = dashContentList; |
54 | item.forceNonInteractive = Qt.binding(function() { return dashContent.forceNonInteractive } ) |
55 | } |
56 | + |
57 | Connections { |
58 | target: isCurrent ? scope : null |
59 | onGotoScope: { |
60 | |
61 | === modified file 'qml/Dash/DashNavigationList.qml' |
62 | --- qml/Dash/DashNavigationList.qml 2016-06-28 09:53:40 +0000 |
63 | +++ qml/Dash/DashNavigationList.qml 2016-11-18 00:12:31 +0000 |
64 | @@ -97,6 +97,14 @@ |
65 | elide: Text.ElideMiddle |
66 | } |
67 | |
68 | + MouseArea { |
69 | + anchors.fill: parent |
70 | + onPressed: { |
71 | + forceActiveFocus(); |
72 | + mouse.accepted = false; |
73 | + } |
74 | + } |
75 | + |
76 | Icon { |
77 | id: rightIcon |
78 | anchors { |
79 | |
80 | === modified file 'qml/Dash/DashPageHeader.qml' |
81 | --- qml/Dash/DashPageHeader.qml 2016-11-09 15:04:57 +0000 |
82 | +++ qml/Dash/DashPageHeader.qml 2016-11-18 00:12:31 +0000 |
83 | @@ -26,38 +26,44 @@ |
84 | objectName: "pageHeader" |
85 | implicitHeight: headerContainer.height + signatureLineHeight |
86 | readonly property real signatureLineHeight: showSignatureLine ? units.gu(2.5) : headerBottomLine.height |
87 | - readonly property real headerDividerLuminance: Style.luminance(bottomBorder.color) |
88 | - |
89 | - property int activeFiltersCount: 0 |
90 | - property bool scopeHasFilters: false |
91 | - property bool showBackButton: false |
92 | + readonly property real headerDividerLuminance: Style.luminance(root.scopeStyle ? root.scopeStyle.headerDividerColor : "#e0e0e0") |
93 | + |
94 | + property alias extraPanelHeight: searchHeaderContents.extraPanelHeight |
95 | + property alias searchContents: searchHeaderContents |
96 | + property alias searchTextField: searchHeaderContents.searchTextField |
97 | + |
98 | property bool backIsClose: false |
99 | - property string title |
100 | - property var extraPanel |
101 | - property string navigationTag |
102 | - |
103 | - property bool storeEntryEnabled: false |
104 | + property bool favorite: false |
105 | + property bool favoriteEnabled: false |
106 | property bool searchEntryEnabled: false |
107 | property bool settingsEnabled: false |
108 | - property bool favoriteEnabled: false |
109 | - property bool favorite: false |
110 | - property ListModel searchHistory |
111 | - property alias searchQuery: searchTextField.text |
112 | - property alias searchHint: searchTextField.placeholderText |
113 | - property bool showSignatureLine: false |
114 | + property bool showBackButton: false |
115 | + property bool showSignatureLine: true |
116 | + property bool storeEntryEnabled: false |
117 | |
118 | + property int activeFiltersCount: 0 |
119 | property int paginationCount: 0 |
120 | property int paginationIndex: -1 |
121 | |
122 | + property ListModel searchHistory |
123 | + |
124 | + property string navigationTag |
125 | + property string searchQuery |
126 | + property string title |
127 | + |
128 | + property var categoryView |
129 | + property var scope |
130 | property var scopeStyle: null |
131 | + property var scopeView |
132 | + property var searchHint: searchTextField.placeholderText |
133 | |
134 | + signal backClicked() |
135 | signal clearSearch(bool keepPanelOpen) |
136 | - signal backClicked() |
137 | - signal storeClicked() |
138 | - signal settingsClicked() |
139 | signal favoriteClicked() |
140 | signal searchTextFieldFocused() |
141 | + signal settingsClicked() |
142 | signal showFiltersPopup(var item) |
143 | + signal storeClicked() |
144 | |
145 | onScopeStyleChanged: refreshLogo() |
146 | onSearchQueryChanged: { |
147 | @@ -80,40 +86,8 @@ |
148 | } |
149 | } |
150 | |
151 | - function closePopup(keepFocus, keepSearch) { |
152 | - if (extraPanel.visible) { |
153 | - extraPanel.visible = false; |
154 | - } |
155 | - if (!keepFocus) { |
156 | - unfocus(keepSearch); |
157 | - } |
158 | - if (!keepSearch && !searchTextField.text && !root.navigationTag && searchHistory.count == 0) { |
159 | - headerContainer.showSearch = false; |
160 | - } |
161 | - } |
162 | - |
163 | - function resetSearch(keepFocus) { |
164 | - if (searchHistory) { |
165 | - searchHistory.addQuery(searchTextField.text); |
166 | - } |
167 | - searchTextField.text = ""; |
168 | - closePopup(keepFocus); |
169 | - } |
170 | - |
171 | - function unfocus(keepSearch) { |
172 | - searchTextField.focus = false; |
173 | - if (!keepSearch && !searchTextField.text && !root.navigationTag) { |
174 | - headerContainer.showSearch = false; |
175 | - } |
176 | - } |
177 | - |
178 | - function openPopup() { |
179 | - if (openSearchAnimation.running) { |
180 | - openSearchAnimation.openPopup = true; |
181 | - } else if (extraPanel.hasContents) { |
182 | - // Show extraPanel |
183 | - extraPanel.visible = true; |
184 | - } |
185 | + function resetSearch() { |
186 | + searchHeaderContents.resetSearch(); |
187 | } |
188 | |
189 | function refreshLogo() { |
190 | @@ -125,20 +99,93 @@ |
191 | } |
192 | } |
193 | |
194 | + function unfocus(keepSearch) { |
195 | + searchHeaderContents.unfocus(keepSearch); |
196 | + } |
197 | + |
198 | + Binding { |
199 | + target: searchHeaderContents.searchTextField |
200 | + property: "text" |
201 | + value: root.searchQuery |
202 | + } |
203 | + |
204 | Connections { |
205 | target: root.scopeStyle |
206 | onHeaderLogoChanged: root.refreshLogo() |
207 | } |
208 | |
209 | InverseMouseArea { |
210 | - anchors { fill: parent; margins: units.gu(1); bottomMargin: units.gu(3) + (extraPanel ? extraPanel.height : 0) } |
211 | + anchors { |
212 | + fill: parent |
213 | + margins: units.gu(1) |
214 | + bottomMargin: units.gu(3) + extraPanelHeight |
215 | + } |
216 | + |
217 | visible: headerContainer.showSearch |
218 | onPressed: { |
219 | - closePopup(/* keepFocus */false); |
220 | + searchHeaderContents.closePopup(/* keepFocus */false); |
221 | mouse.accepted = false; |
222 | } |
223 | } |
224 | |
225 | + /*Rectangle { |
226 | + id: bottomBorder |
227 | + visible: showSignatureLine |
228 | + anchors { |
229 | + top: headerContainer.bottom |
230 | + left: parent.left |
231 | + right: parent.right |
232 | + bottom: parent.bottom |
233 | + } |
234 | + |
235 | + color: root.scopeStyle ? root.scopeStyle.headerDividerColor : "#e0e0e0" |
236 | + |
237 | + Rectangle { |
238 | + anchors { |
239 | + top: parent.top |
240 | + left: parent.left |
241 | + right: parent.right |
242 | + } |
243 | + height: units.dp(1) |
244 | + color: Qt.darker(parent.color, 1.1) |
245 | + } |
246 | + }*/ |
247 | + |
248 | + |
249 | + Rectangle { |
250 | + id: headerBottomLine |
251 | + anchors { |
252 | + top: headerContainer.bottom |
253 | + left: parent.left |
254 | + right: parent.right |
255 | + } |
256 | + height: units.dp(1) |
257 | + color: theme.palette.normal.base |
258 | + } |
259 | + |
260 | + Row { |
261 | + anchors { |
262 | + top: headerContainer.bottom |
263 | + horizontalCenter: headerContainer.horizontalCenter |
264 | + topMargin: units.gu(1) |
265 | + } |
266 | + visible: showSignatureLine |
267 | + spacing: units.gu(.5) |
268 | + Repeater { |
269 | + objectName: "paginationRepeater" |
270 | + model: root.paginationCount |
271 | + Rectangle { |
272 | + objectName: "paginationDots_" + index |
273 | + height: units.gu(1) |
274 | + width: height |
275 | + radius: height / 2 |
276 | + color: index == root.paginationIndex ? UbuntuColors.blue : "transparent" |
277 | + border.width: index == root.paginationIndex ? 0 : 1 // yes, one pixel and not 1dp |
278 | + border.color: theme.palette.normal.baseText |
279 | + } |
280 | + } |
281 | + } |
282 | + |
283 | Item { |
284 | id: headerContainer |
285 | objectName: "headerContainer" |
286 | @@ -202,134 +249,29 @@ |
287 | dividerColor: "transparent" |
288 | } |
289 | |
290 | - contents: Item { |
291 | + contents: SearchHeaderContents { |
292 | + id: searchHeaderContents |
293 | + objectName: "searchHeaderContents" |
294 | + |
295 | anchors.fill: parent |
296 | |
297 | - Keys.onEscapePressed: { // clear the search text, dismiss the search in the second step |
298 | - if (searchTextField.text != "") { |
299 | - root.clearSearch(true); |
300 | - } else { |
301 | - root.clearSearch(false); |
302 | - headerContainer.showSearch = false; |
303 | - } |
304 | - } |
305 | - |
306 | - TextField { |
307 | - id: searchTextField |
308 | - objectName: "searchTextField" |
309 | - inputMethodHints: Qt.ImhNoPredictiveText |
310 | - hasClearButton: false |
311 | - anchors { |
312 | - top: parent.top |
313 | - topMargin: units.gu(1) |
314 | - left: parent.left |
315 | - bottom: parent.bottom |
316 | - bottomMargin: units.gu(1) |
317 | - right: settingsButton.left |
318 | - rightMargin: settingsButton.visible ? 0 : units.gu(2) |
319 | - } |
320 | - |
321 | - primaryItem: Rectangle { |
322 | - color: "#F5F4F5" |
323 | - width: root.navigationTag != "" ? tagLabel.width + units.gu(2) : 0 |
324 | - height: root.navigationTag != "" ? tagLabel.height + units.gu(1) : 0 |
325 | - radius: units.gu(0.5) |
326 | - Label { |
327 | - id: tagLabel |
328 | - text: root.navigationTag |
329 | - anchors.centerIn: parent |
330 | - color: "#333333" |
331 | - } |
332 | - } |
333 | - |
334 | - secondaryItem: AbstractButton { |
335 | - id: clearButton |
336 | - height: searchTextField.height |
337 | - width: height |
338 | - enabled: searchTextField.text.length > 0 || root.navigationTag != "" |
339 | - |
340 | - Image { |
341 | - objectName: "clearIcon" |
342 | - anchors.fill: parent |
343 | - anchors.margins: units.gu(1) |
344 | - source: "image://theme/clear" |
345 | - sourceSize.width: width |
346 | - sourceSize.height: height |
347 | - opacity: parent.enabled |
348 | - visible: opacity > 0 |
349 | - Behavior on opacity { |
350 | - UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration } |
351 | - } |
352 | - } |
353 | - |
354 | - onClicked: { |
355 | - root.clearSearch(true); |
356 | - } |
357 | - } |
358 | - |
359 | - onActiveFocusChanged: { |
360 | - if (activeFocus) { |
361 | - root.searchTextFieldFocused(); |
362 | - root.openPopup(); |
363 | - } |
364 | - } |
365 | - |
366 | - onTextChanged: { |
367 | - if (text != "") { |
368 | - closePopup(/* keepFocus */true); |
369 | - } |
370 | - } |
371 | - } |
372 | - |
373 | - AbstractButton { |
374 | - id: settingsButton |
375 | - objectName: "settingsButton" |
376 | - |
377 | - width: root.scopeHasFilters ? height : 0 |
378 | - visible: width > 0 |
379 | - anchors { |
380 | - top: parent.top |
381 | - right: cancelButton.left |
382 | - bottom: parent.bottom |
383 | - rightMargin: units.gu(-1) |
384 | - } |
385 | - |
386 | - Icon { |
387 | - anchors.fill: parent |
388 | - anchors.margins: units.gu(2) |
389 | - name: "filters" |
390 | - color: root.activeFiltersCount > 0 ? theme.palette.normal.positive : header.__styleInstance.foregroundColor |
391 | - } |
392 | - |
393 | - onClicked: { |
394 | - root.showFiltersPopup(settingsButton); |
395 | - } |
396 | - } |
397 | - |
398 | - AbstractButton { |
399 | - id: cancelButton |
400 | - objectName: "cancelButton" |
401 | - width: cancelLabel.width + cancelLabel.anchors.rightMargin + cancelLabel.anchors.leftMargin |
402 | - anchors { |
403 | - top: parent.top |
404 | - right: parent.right |
405 | - bottom: parent.bottom |
406 | - } |
407 | - onClicked: { |
408 | - root.clearSearch(false); |
409 | - headerContainer.showSearch = false; |
410 | - } |
411 | - Label { |
412 | - id: cancelLabel |
413 | - text: i18n.tr("Cancel") |
414 | - color: header.__styleInstance.foregroundColor |
415 | - verticalAlignment: Text.AlignVCenter |
416 | - anchors { |
417 | - verticalCenter: parent.verticalCenter |
418 | - right: parent.right |
419 | - leftMargin: units.gu(1) |
420 | - } |
421 | - } |
422 | + activeFiltersCount: root.activeFiltersCount |
423 | + categoryView: root.categoryView |
424 | + extraPanelYOffset: root.signatureLineHeight |
425 | + navigationTag: root.navigationTag |
426 | + scope: root.scope |
427 | + scopeView: root.scopeView |
428 | + searchHistory: root.searchHistory |
429 | + |
430 | + // PageHeader adds margins and that throws off the width |
431 | + parentWidth: root.width |
432 | + onCancelSearch: headerContainer.showSearch = showSearch; |
433 | + onSearchTextFieldFocused: root.searchTextFieldFocused(); |
434 | + |
435 | + Binding { |
436 | + target: root |
437 | + property: "searchQuery" |
438 | + value: searchTextField.text |
439 | } |
440 | } |
441 | } |
442 | @@ -411,38 +353,4 @@ |
443 | } |
444 | } |
445 | } |
446 | - |
447 | - Rectangle { |
448 | - id: headerBottomLine |
449 | - anchors { |
450 | - top: headerContainer.bottom |
451 | - left: parent.left |
452 | - right: parent.right |
453 | - } |
454 | - height: units.dp(1) |
455 | - color: theme.palette.normal.base |
456 | - } |
457 | - |
458 | - Row { |
459 | - anchors { |
460 | - top: headerContainer.bottom |
461 | - horizontalCenter: headerContainer.horizontalCenter |
462 | - topMargin: units.gu(1) |
463 | - } |
464 | - visible: showSignatureLine |
465 | - spacing: units.gu(.5) |
466 | - Repeater { |
467 | - objectName: "paginationRepeater" |
468 | - model: root.paginationCount |
469 | - Rectangle { |
470 | - objectName: "paginationDots_" + index |
471 | - height: units.gu(1) |
472 | - width: height |
473 | - radius: height / 2 |
474 | - color: index == root.paginationIndex ? UbuntuColors.blue : "transparent" |
475 | - border.width: index == root.paginationIndex ? 0 : 1 // yes, one pixel and not 1dp |
476 | - border.color: theme.palette.normal.baseText |
477 | - } |
478 | - } |
479 | - } |
480 | } |
481 | |
482 | === modified file 'qml/Dash/GenericScopeView.qml' |
483 | --- qml/Dash/GenericScopeView.qml 2016-11-09 15:04:57 +0000 |
484 | +++ qml/Dash/GenericScopeView.qml 2016-11-18 00:12:31 +0000 |
485 | @@ -36,7 +36,7 @@ |
486 | property bool enableHeightBehaviorOnNextCreation: false |
487 | property var categoryView: categoryView |
488 | readonly property alias subPageShown: subPageLoader.subPageShown |
489 | - readonly property alias extraPanelShown: peExtraPanel.visible |
490 | + property var searchHeader |
491 | property int paginationCount: 0 |
492 | property int paginationIndex: 0 |
493 | property bool visibleToParent: false |
494 | @@ -44,6 +44,7 @@ |
495 | property var holdingList: null |
496 | property bool wasCurrentOnMoveStart: false |
497 | property var filtersPopover: null |
498 | + property alias searchContents: scopePageHeader.searchContents |
499 | |
500 | property var scopeStyle: ScopeStyle { |
501 | style: scope ? scope.customizations : {} |
502 | @@ -69,10 +70,6 @@ |
503 | subPageLoader.closeSubPage() |
504 | } |
505 | |
506 | - function resetSearch() { |
507 | - categoryView.pageHeader.resetSearch() |
508 | - } |
509 | - |
510 | property var maybePreviewResult; |
511 | property string maybePreviewCategoryId; |
512 | |
513 | @@ -568,16 +565,19 @@ |
514 | } |
515 | |
516 | pageHeader: DashPageHeader { |
517 | + id: scopePageHeader |
518 | objectName: "scopePageHeader" |
519 | width: parent.width |
520 | title: scopeView.scope ? scopeView.scope.name : "" |
521 | - extraPanel: peExtraPanel |
522 | + |
523 | + categoryView: scopeView.categoryView |
524 | + scope: scopeView.scope |
525 | + scopeView: scopeView |
526 | + |
527 | searchHistory: SearchHistoryModel |
528 | searchHint: scopeView.scope && scopeView.scope.searchHint || i18n.ctr("Label: Hint for dash search line edit", "Search") |
529 | - scopeHasFilters: scopeView.scope.filters != null |
530 | - activeFiltersCount: scopeView.scope.activeFiltersCount |
531 | + activeFiltersCount: scopeView.scope ? scopeView.scope.activeFiltersCount : 0 |
532 | showBackButton: scopeView.hasBackAction |
533 | - showSignatureLine: !showBackButton |
534 | searchEntryEnabled: true |
535 | settingsEnabled: scopeView.scope && scopeView.scope.settings && scopeView.scope.settings.count > 0 || false |
536 | favoriteEnabled: scopeView.scope && scopeView.scope.id !== "clickscope" |
537 | @@ -591,55 +591,6 @@ |
538 | onSettingsClicked: subPageLoader.openSubPage("settings") |
539 | onFavoriteClicked: scopeView.scope.favorite = !scopeView.scope.favorite |
540 | onSearchTextFieldFocused: scopeView.showHeader() |
541 | - onClearSearch: { // keepPanelOpen |
542 | - var panelOpen = peExtraPanel.visible; |
543 | - resetSearch(keepPanelOpen); |
544 | - scopeView.scope.resetPrimaryNavigationTag(); |
545 | - peExtraPanel.resetNavigation(); |
546 | - if ((panelOpen || searchHistory.count > 0) && keepPanelOpen) { |
547 | - openPopup(); |
548 | - } |
549 | - } |
550 | - onShowFiltersPopup: { // item |
551 | - extraPanel.visible = false; |
552 | - scopeView.filtersPopover = PopupUtils.open(Qt.resolvedUrl("FiltersPopover.qml"), item, { "contentWidth": Qt.binding(function() { return scopeView.width - units.gu(2); } ) } ); |
553 | - scopeView.filtersPopover.Component.onDestruction.connect(function () { |
554 | - categoryView.pageHeader.closePopup(false, true); |
555 | - categoryView.pageHeader.unfocus(true); // remove the focus from the search field |
556 | - }) |
557 | - } |
558 | - } |
559 | - |
560 | - PageHeaderExtraPanel { |
561 | - id: peExtraPanel |
562 | - objectName: "peExtraPanel" |
563 | - width: parent.width >= units.gu(60) ? units.gu(40) : parent.width |
564 | - anchors { |
565 | - top: categoryView.pageHeader.bottom |
566 | - topMargin: -categoryView.pageHeader.signatureLineHeight |
567 | - } |
568 | - z: 1 |
569 | - visible: false |
570 | - |
571 | - searchHistory: SearchHistoryModel |
572 | - scope: scopeView.scope |
573 | - windowHeight: scopeView.height |
574 | - |
575 | - onHistoryItemClicked: { |
576 | - SearchHistoryModel.addQuery(text); |
577 | - categoryView.pageHeader.searchQuery = text; |
578 | - categoryView.pageHeader.unfocus(); |
579 | - } |
580 | - |
581 | - onDashNavigationLeafClicked: { |
582 | - categoryView.pageHeader.closePopup(); |
583 | - categoryView.pageHeader.unfocus(); |
584 | - } |
585 | - |
586 | - onExtraPanelOptionSelected: { |
587 | - categoryView.pageHeader.closePopup(); |
588 | - categoryView.pageHeader.unfocus(); |
589 | - } |
590 | } |
591 | } |
592 | |
593 | |
594 | === modified file 'qml/Dash/PageHeaderExtraPanel.qml' |
595 | --- qml/Dash/PageHeaderExtraPanel.qml 2016-09-22 10:33:39 +0000 |
596 | +++ qml/Dash/PageHeaderExtraPanel.qml 2016-11-18 00:12:31 +0000 |
597 | @@ -33,7 +33,7 @@ |
598 | property real windowHeight |
599 | |
600 | // Used by PageHeader |
601 | - readonly property bool hasContents: searchHistory.count > 0 || scope && scope.hasNavigation || scope && scope.primaryNavigationFilter |
602 | + readonly property bool hasContents: searchHistory ? searchHistory.count > 0 || scope && scope.hasNavigation || scope && scope.primaryNavigationFilter : false |
603 | |
604 | signal historyItemClicked(string text) |
605 | signal dashNavigationLeafClicked() |
606 | @@ -176,10 +176,10 @@ |
607 | id: primaryFilter |
608 | objectName: "primaryFilter" |
609 | |
610 | - active: scope && !scope.hasNavigation |
611 | + active: scope && !scope.hasNavigation ? true : false // Prevent warning |
612 | |
613 | anchors.fill: parent |
614 | - property var filter: active ? scope.primaryNavigationFilter : null |
615 | + property var filter: active && scope ? scope.primaryNavigationFilter : null |
616 | |
617 | widgetId: filter ? filter.filterId : "" |
618 | widgetType: filter ? filter.filterType : -1 |
619 | |
620 | === added file 'qml/Dash/SearchHeaderContents.qml' |
621 | --- qml/Dash/SearchHeaderContents.qml 1970-01-01 00:00:00 +0000 |
622 | +++ qml/Dash/SearchHeaderContents.qml 2016-11-18 00:12:31 +0000 |
623 | @@ -0,0 +1,293 @@ |
624 | +/* |
625 | + * Copyright (C) 2016 Canonical, Ltd. |
626 | + * |
627 | + * This program is free software; you can redistribute it and/or modify |
628 | + * it under the terms of the GNU General Public License as published by |
629 | + * the Free Software Foundation; version 3. |
630 | + * |
631 | + * This program is distributed in the hope that it will be useful, |
632 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
633 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
634 | + * GNU General Public License for more details. |
635 | + * |
636 | + * You should have received a copy of the GNU General Public License |
637 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
638 | + */ |
639 | + |
640 | +import QtQuick 2.4 |
641 | +import Ubuntu.Components 1.3 |
642 | +import Ubuntu.Components.Popups 1.3 |
643 | + |
644 | +Item { |
645 | + id: root |
646 | + |
647 | + property int activeFiltersCount |
648 | + property real parentWidth |
649 | + property string navigationTag |
650 | + |
651 | + property ListModel searchHistory |
652 | + property real extraPanelYOffset |
653 | + property var categoryView: null |
654 | + property var scope: null |
655 | + property var scopeView: null |
656 | + |
657 | + readonly property alias searchTextField: searchTextField |
658 | + readonly property bool extraPanelVisible: pageHeaderExtraPanel.visible |
659 | + readonly property bool scopeHasFilters: scope && scope.filters != null ? true : false // Prevent warning |
660 | + readonly property real extraPanelHeight: extraPanelVisible ? |
661 | + pageHeaderExtraPanel.height : 0 |
662 | + |
663 | + signal cancelSearch(bool showSearch); |
664 | + signal searchTextFieldFocused(); |
665 | + |
666 | + state: "noExtraPanel" |
667 | + states: [ |
668 | + State { |
669 | + name: "noExtraPanel" |
670 | + }, |
671 | + |
672 | + State { |
673 | + name: "yesExtraPanel" |
674 | + |
675 | + PropertyChanges { |
676 | + target: pageHeaderExtraPanel |
677 | + visible: true |
678 | + } |
679 | + } |
680 | + ] |
681 | + |
682 | + function clearSearch(keepPanelOpen) { |
683 | + resetSearch(keepPanelOpen); |
684 | + if (scope) scope.resetPrimaryNavigationTag(); |
685 | + if (root.pageHeaderExtraPanel) { |
686 | + root.pageHeaderExtraPanel.resetNavigation(); |
687 | + } |
688 | + |
689 | + if ((root.extraPanelVisible || searchHistory.count > 0) && keepPanelOpen) { |
690 | + root.showExtraPanel(); |
691 | + } else { |
692 | + root.hideExtraPanel(); |
693 | + } |
694 | + } |
695 | + |
696 | + function closePopup(keepFocus, keepSearch) { |
697 | + root.hideExtraPanel(); |
698 | + if (!keepFocus) { |
699 | + unfocus(keepSearch); |
700 | + } |
701 | + |
702 | + if (!keepSearch && !searchTextField.text && |
703 | + !root.navigationTag && searchHistory.count === 0) { |
704 | + root.cancelSearch(false); |
705 | + } |
706 | + } |
707 | + |
708 | + function dashNavigationLeafClicked() { |
709 | + root.closePopup(); |
710 | + root.unfocus(); |
711 | + } |
712 | + |
713 | + function resetSearch(keepPanelOpen) { |
714 | + if (root.searchHistory) { |
715 | + root.searchHistory.addQuery(searchTextField.text); |
716 | + } |
717 | + searchTextField.text = ""; |
718 | + cancelSearch(keepPanelOpen); |
719 | + closePopup(true); |
720 | + } |
721 | + |
722 | + function unfocus(keepSearch) { |
723 | + searchTextField.focus = false; |
724 | + if (!keepSearch && !searchTextField.text && !root.navigationTag) { |
725 | + root.cancelSearch(false); |
726 | + } |
727 | + } |
728 | + |
729 | + function showFiltersPopup(popupParent) { |
730 | + var url = Qt.resolvedUrl("FiltersPopover.qml"); |
731 | + |
732 | + root.hideExtraPanel(); |
733 | + scopeView.filtersPopover = PopupUtils.open(url, popupParent, { |
734 | + "contentWidth" : Qt.binding(function() { |
735 | + return scopeView.width - units.gu(2); |
736 | + })} |
737 | + ); |
738 | + |
739 | + scopeView.filtersPopover.Component.onDestruction.connect( |
740 | + function() { |
741 | + root.closePopup(false); |
742 | + } |
743 | + ); |
744 | + } |
745 | + |
746 | + function hideExtraPanel() { |
747 | + state = "noExtraPanel" |
748 | + } |
749 | + |
750 | + function showExtraPanel() { |
751 | + state = "yesExtraPanel" |
752 | + } |
753 | + |
754 | + Keys.onEscapePressed: { // clear the search text, dismiss the search in the second step |
755 | + if (searchTextField.text != "") { |
756 | + root.clearSearch(true); |
757 | + root.cancelSearch(false); |
758 | + forceActiveFocus(); // Focus is lost, but still needed. |
759 | + } else { |
760 | + root.clearSearch(false); |
761 | + } |
762 | + } |
763 | + |
764 | + PageHeaderExtraPanel { |
765 | + id: pageHeaderExtraPanel |
766 | + objectName: "extraPanel" |
767 | + |
768 | + anchors.horizontalCenter: root.horizontalCenter |
769 | + width: parent.width >= units.gu(60) ? units.gu(40) : root.parentWidth |
770 | + height: implicitHeight |
771 | + y: categoryView ? categoryView.pageHeader.height - root.extraPanelYOffset : 0 |
772 | + |
773 | + windowHeight: scopeView ? scopeView.height : 0 |
774 | + visible: false |
775 | + |
776 | + scope: root.scope |
777 | + searchHistory: root.searchHistory |
778 | + |
779 | + onDashNavigationLeafClicked: root.dashNavigationLeafClicked(); |
780 | + |
781 | + onExtraPanelOptionSelected: { |
782 | + root.closePopup(); |
783 | + categoryView.pageHeader.unfocus(); |
784 | + } |
785 | + |
786 | + onHistoryItemClicked: { |
787 | + searchHistory.addQuery(text); |
788 | + searchTextField.text = text; |
789 | + root.unfocus(false); |
790 | + } |
791 | + } |
792 | + |
793 | + TextField { |
794 | + id: searchTextField |
795 | + |
796 | + objectName: "searchTextField" |
797 | + inputMethodHints: Qt.ImhNoPredictiveText |
798 | + hasClearButton: false |
799 | + placeholderText: scope ? root.scope.searchHint : "" |
800 | + anchors { |
801 | + top: root.top |
802 | + topMargin: units.gu(1) |
803 | + left: parent.left |
804 | + bottom: parent.bottom |
805 | + bottomMargin: units.gu(1) |
806 | + right: settingsButton.left |
807 | + rightMargin: settingsButton.visible ? 0 : units.gu(2) |
808 | + } |
809 | + |
810 | + primaryItem: Rectangle { |
811 | + color: "#F5F4F5" |
812 | + width: root.navigationTag != "" ? tagLabel.width + units.gu(2) : 0 |
813 | + height: root.navigationTag != "" ? tagLabel.height + units.gu(1) : 0 |
814 | + radius: units.gu(0.5) |
815 | + Label { |
816 | + id: tagLabel |
817 | + text: root.navigationTag |
818 | + anchors.centerIn: parent |
819 | + color: "#333333" |
820 | + } |
821 | + } |
822 | + |
823 | + secondaryItem: AbstractButton { |
824 | + id: clearButton |
825 | + height: searchTextField.height |
826 | + width: height |
827 | + enabled: searchTextField.text.length > 0 || root.navigationTag != "" |
828 | + |
829 | + Image { |
830 | + objectName: "clearIcon" |
831 | + anchors.fill: parent |
832 | + anchors.margins: units.gu(1) |
833 | + source: "image://theme/clear" |
834 | + opacity: parent.enabled |
835 | + visible: opacity > 0 |
836 | + Behavior on opacity { |
837 | + UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration } |
838 | + } |
839 | + } |
840 | + |
841 | + onClicked: { |
842 | + root.clearSearch(true); |
843 | + } |
844 | + } |
845 | + |
846 | + onActiveFocusChanged: { |
847 | + if (activeFocus) { |
848 | + root.searchTextFieldFocused(); |
849 | + root.showExtraPanel(); |
850 | + } |
851 | + } |
852 | + |
853 | + onTextChanged: { |
854 | + if (text != "") { |
855 | + root.closePopup(/* keepFocus */true); |
856 | + } |
857 | + } |
858 | + } |
859 | + |
860 | + AbstractButton { |
861 | + id: settingsButton |
862 | + objectName: "settingsButton" |
863 | + |
864 | + width: root.scopeHasFilters ? height : 0 |
865 | + visible: width > 0 |
866 | + |
867 | + anchors { |
868 | + top: parent.top |
869 | + right: cancelButton.left |
870 | + bottom: parent.bottom |
871 | + rightMargin: units.gu(-1) |
872 | + } |
873 | + |
874 | + Icon { |
875 | + anchors.fill: parent |
876 | + anchors.margins: units.gu(2) |
877 | + name: "filters" |
878 | + color: root.activeFiltersCount > 0 ? theme.palette.normal.positive : header.__styleInstance.foregroundColor |
879 | + } |
880 | + |
881 | + onClicked: { |
882 | + root.showFiltersPopup(settingsButton); |
883 | + } |
884 | + } |
885 | + |
886 | + AbstractButton { |
887 | + id: cancelButton |
888 | + objectName: "cancelButton" |
889 | + width: cancelLabel.width + cancelLabel.anchors.rightMargin + cancelLabel.anchors.leftMargin |
890 | + |
891 | + anchors { |
892 | + top: parent.top |
893 | + right: parent.right |
894 | + bottom: parent.bottom |
895 | + } |
896 | + |
897 | + onClicked: { |
898 | + root.clearSearch(false); |
899 | + cancelSearch(false); |
900 | + root.unfocus(false); |
901 | + } |
902 | + |
903 | + Label { |
904 | + id: cancelLabel |
905 | + text: i18n.tr("Cancel") |
906 | + color: header.__styleInstance.foregroundColor |
907 | + verticalAlignment: Text.AlignVCenter |
908 | + anchors { |
909 | + verticalCenter: parent.verticalCenter |
910 | + right: parent.right |
911 | + rightMargin: units.gu(2) |
912 | + leftMargin: units.gu(1) |
913 | + } |
914 | + } |
915 | + } |
916 | +} |
917 | |
918 | === modified file 'tests/qmltests/Dash/tst_Dash.qml' |
919 | --- tests/qmltests/Dash/tst_Dash.qml 2016-09-22 10:33:39 +0000 |
920 | +++ tests/qmltests/Dash/tst_Dash.qml 2016-11-18 00:12:31 +0000 |
921 | @@ -88,6 +88,14 @@ |
922 | return findChild(genericScopeView, categoryName); |
923 | } |
924 | |
925 | + function getExtraPanel(searchHeaderContents) { |
926 | + if (searchHeaderContents.extraPanelVisible) { |
927 | + return findChild(searchHeaderContents.thePopover, "extraPanel"); |
928 | + } else { |
929 | + return findChild(searchHeaderContents, "extraPanel"); |
930 | + } |
931 | + } |
932 | + |
933 | function getCategoryDelegate(category, delegate) { |
934 | var dashContentList = findChild(dash, "dashContentList"); |
935 | var genericScopeView = dashContentList.currentItem; |
936 | @@ -133,7 +141,8 @@ |
937 | |
938 | var dashContentList = findChild(dashContent, "dashContentList") |
939 | var searchButton = findChild(dashContentList.currentItem, "search_button") |
940 | - var extraPanel = findChild(dashContentList.currentItem, "peExtraPanel") |
941 | + var searchHeaderContents = findChild(dashContentList.currentItem, "searchHeaderContents"); |
942 | + var extraPanel = getExtraPanel(searchHeaderContents); |
943 | waitForRendering(extraPanel); |
944 | tryCompare(extraPanel, "visible", false) |
945 | |
946 | @@ -171,7 +180,8 @@ |
947 | var dashContentList = findChild(dashContent, "dashContentList") |
948 | var searchButton = findChild(dashContentList.currentItem, "search_button") |
949 | verify(searchButton) |
950 | - var extraPanel = findChild(dashContentList.currentItem, "peExtraPanel") |
951 | + var searchHeaderContents = findChild(dashContentList.currentItem, "searchHeaderContents"); |
952 | + var extraPanel = getExtraPanel(searchHeaderContents); |
953 | verify(extraPanel) |
954 | |
955 | var primaryFilter = findChild(extraPanel, "primaryFilter") |
956 | |
957 | === modified file 'tests/qmltests/Dash/tst_DashContent.qml' |
958 | --- tests/qmltests/Dash/tst_DashContent.qml 2016-08-30 09:33:01 +0000 |
959 | +++ tests/qmltests/Dash/tst_DashContent.qml 2016-11-18 00:12:31 +0000 |
960 | @@ -100,6 +100,21 @@ |
961 | tryCompare(dashContentList, "count", 0); |
962 | } |
963 | |
964 | + function test_escape_clears_search() { |
965 | + var dashContentList = findChild(dashContent, "dashContentList"); |
966 | + var searchHeaderContents = findChild(dashContentList.currentItem, "searchHeaderContents"); |
967 | + var searchButton = findChild(dashContentList.currentItem, "search_button"); |
968 | + var headerContainer = findChild(dashContentList.currentItem, "headerContainer"); |
969 | + var query = "This is a fun search query!"; |
970 | + mouseClick(searchButton); |
971 | + typeString(query); |
972 | + compare(searchHeaderContents.searchTextField.text, query); |
973 | + |
974 | + keyClick(Qt.Key_Escape); |
975 | + compare(searchHeaderContents.searchTextField.text, ""); |
976 | + tryCompare(headerContainer, "showSearch", false); |
977 | + } |
978 | + |
979 | function test_current_index() { |
980 | var dashContentList = findChild(dashContent, "dashContentList"); |
981 | verify(dashContentList != undefined) |
982 | @@ -282,15 +297,18 @@ |
983 | |
984 | function test_mainNavigation() { |
985 | var dashContentList = findChild(dashContent, "dashContentList"); |
986 | - var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation"); |
987 | - var peExtraPanel = findChild(dashContentList.currentItem, "peExtraPanel"); |
988 | + tryCompareFunction(function() { return findChild(dashContentList.currentItem, "dashNavigation") != null; }, true); |
989 | + var searchHeaderContents = findChild(dashContentList.currentItem, "searchHeaderContents"); |
990 | + var peExtraPanel = findChild(searchHeaderContents, "extraPanel"); |
991 | + var dashNavigation = findChild(peExtraPanel, "dashNavigation"); |
992 | var searchButton = findChild(dashContentList.currentItem, "search_button"); |
993 | var searchTextField = findChild(dashContentList.currentItem, "searchTextField"); |
994 | compare(peExtraPanel.visible, false); |
995 | mouseClick(searchButton); |
996 | tryCompare(peExtraPanel, "visible", true); |
997 | - peExtraPanel.searchHistory.clear(); |
998 | + searchHeaderContents.searchHistory.clear(); |
999 | |
1000 | + tryCompareFunction(function() { return dashNavigation != null; }, true); |
1001 | var navigationListView = findChild(dashNavigation, "navigationListView"); |
1002 | tryCompareFunction(function() { |
1003 | return navigationListView.currentItem && |
1004 | @@ -300,9 +318,11 @@ |
1005 | waitForRendering(navigationListView); |
1006 | waitForRendering(navigationListView.currentItem); |
1007 | |
1008 | + tryCompareFunction(function() { return dashNavigation != null; }, true); |
1009 | + |
1010 | var navigation = findChild(dashNavigation, "navigation0child3"); |
1011 | mouseClick(navigation); |
1012 | - compare(peExtraPanel.visible, false); |
1013 | + tryCompare(peExtraPanel, "visible", false); |
1014 | tryCompare(dashNavigation.currentNavigation, "navigationId", "middle3"); |
1015 | tryCompare(navigationListView.currentItem.navigation, "navigationId", "root"); |
1016 | |
1017 | @@ -314,19 +334,23 @@ |
1018 | var header0 = findChild(dashNavigation, "dashNavigationHeader0"); |
1019 | compare(header0.backVisible, false); |
1020 | mouseClick(header0); |
1021 | - compare(peExtraPanel.visible, false); |
1022 | + tryCompare(peExtraPanel, "visible", false); |
1023 | tryCompare(dashNavigation.currentNavigation, "navigationId", "root"); |
1024 | tryCompare(navigationListView.currentItem.navigation, "navigationId", "root"); |
1025 | |
1026 | var headerContainer = findChild(dashContentList.currentItem, "headerContainer"); |
1027 | + |
1028 | tryCompare(headerContainer, "clip", false); |
1029 | verify(headerContainer.state !== "search"); |
1030 | mouseClick(searchButton); |
1031 | + |
1032 | tryCompare(peExtraPanel, "visible", true); |
1033 | waitForRendering(navigationListView); |
1034 | waitForRendering(navigationListView.currentItem); |
1035 | |
1036 | navigation = findChild(dashNavigation, "navigation0child2"); |
1037 | + |
1038 | + getSettledButtons(); |
1039 | mouseClick(navigation); |
1040 | compare(peExtraPanel.visible, true); |
1041 | tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2"); |
1042 | @@ -340,7 +364,7 @@ |
1043 | tryCompare(navigationListView, "contentX", navigationList1.x); |
1044 | waitForRendering(navigationListView); |
1045 | mouseClick(header1); |
1046 | - compare(peExtraPanel.visible, false); |
1047 | + tryCompare(peExtraPanel, "visible", false); |
1048 | tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2"); |
1049 | tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2"); |
1050 | |
1051 | @@ -356,7 +380,7 @@ |
1052 | tryCompare(navigationList1, "height", navigationList1.implicitHeight); |
1053 | navigation = findChild(dashNavigation, "navigation1child2"); |
1054 | mouseClick(navigation); |
1055 | - compare(peExtraPanel.visible, false); |
1056 | + tryCompare(peExtraPanel, "visible", false); |
1057 | tryCompare(dashNavigation.currentNavigation, "navigationId", "childmiddle22"); |
1058 | tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2"); |
1059 | |
1060 | @@ -368,7 +392,7 @@ |
1061 | tryCompare(navigationList1.navigation, "loaded", true); |
1062 | navigation = findChild(dashNavigation, "navigation1child3"); |
1063 | mouseClick(navigation); |
1064 | - compare(peExtraPanel.visible, false); |
1065 | + tryCompare(peExtraPanel, "visible", false); |
1066 | tryCompare(dashNavigation.currentNavigation, "navigationId", "childmiddle23"); |
1067 | tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2"); |
1068 | |
1069 | @@ -380,9 +404,9 @@ |
1070 | |
1071 | tryCompare(dashNavigation.currentNavigation, "navigationId", "root"); |
1072 | tryCompare(navigationListView.currentItem.navigation, "navigationId", "root"); |
1073 | - compare(peExtraPanel.visible, true); |
1074 | + tryCompare(peExtraPanel, "visible", true); |
1075 | mouseClick(header0); |
1076 | - compare(peExtraPanel.visible, false); |
1077 | + tryCompare(peExtraPanel, "visible", false); |
1078 | |
1079 | tryCompare(headerContainer, "clip", false); |
1080 | verify(headerContainer.state !== "search"); |
1081 | @@ -394,7 +418,7 @@ |
1082 | tryCompare(navigationList0, "height", navigationList0.implicitHeight); |
1083 | navigation = findChild(dashNavigation, "navigation0child2"); |
1084 | mouseClick(navigation); |
1085 | - compare(peExtraPanel.visible, true); |
1086 | + tryCompare(peExtraPanel, "visible", true); |
1087 | navigationList1 = findChild(dashNavigation, "navigation1"); |
1088 | compare(navigationList1.navigation.loaded, false); |
1089 | tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2"); |
1090 | @@ -404,13 +428,16 @@ |
1091 | |
1092 | function goToSecondLevel() { |
1093 | var dashContentList = findChild(dashContent, "dashContentList"); |
1094 | - var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation"); |
1095 | - var peExtraPanel = findChild(dashContentList.currentItem, "peExtraPanel"); |
1096 | + var searchHeaderContents = findChild(dashContentList.currentItem, |
1097 | + "searchHeaderContents"); |
1098 | + var extraPanel = findChild(searchHeaderContents, "extraPanel"); |
1099 | + var dashNavigation = findChild(extraPanel, "dashNavigation"); |
1100 | var searchButton = findChild(dashContentList.currentItem, "search_button"); |
1101 | var searchTextField = findChild(dashContentList.currentItem, "searchTextField"); |
1102 | - compare(peExtraPanel.visible, false); |
1103 | + compare(extraPanel.visible, false); |
1104 | mouseClick(searchButton); |
1105 | - tryCompare(peExtraPanel, "visible", true); |
1106 | + tryCompareFunction(function() { return findChild(extraPanel, "dashNavigation") != null; }, true); |
1107 | + tryCompare(extraPanel, "visible", true); |
1108 | |
1109 | var navigationListView = findChild(dashNavigation, "navigationListView"); |
1110 | tryCompareFunction(function() { |
1111 | @@ -421,7 +448,10 @@ |
1112 | waitForRendering(navigationListView.currentItem); |
1113 | |
1114 | var navigation4 = findChild(dashNavigation, "navigation0child4"); |
1115 | + waitForRendering(navigation4); |
1116 | + getSettledButtons(); |
1117 | mouseClick(navigation4); |
1118 | + |
1119 | tryCompare(dashNavigation.currentNavigation, "navigationId", "middle4"); |
1120 | tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle4"); |
1121 | tryCompare(dashNavigation.currentNavigation, "loaded", true); |
1122 | @@ -447,9 +477,17 @@ |
1123 | goToSecondLevel(); |
1124 | |
1125 | var dashContentList = findChild(dashContent, "dashContentList"); |
1126 | - var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation"); |
1127 | + |
1128 | + var searchHeaderContents = findChild(dashContentList.currentItem, "searchHeaderContents"); |
1129 | + var pageHeader = findChild(dashContentList.currentItem, "scopePageHeader") |
1130 | + var searchTextField = findChild(pageHeader, "searchTextField"); |
1131 | + var extraPanel = findChild(searchHeaderContents, "extraPanel"); |
1132 | + var dashNavigation = findChild(extraPanel, "dashNavigation"); |
1133 | + |
1134 | + mouseClick(searchTextField); |
1135 | + tryCompare(searchHeaderContents, "extraPanelVisible", true); |
1136 | + |
1137 | var navigationListView = findChild(dashNavigation, "navigationListView"); |
1138 | - var peExtraPanel = findChild(dashContentList.currentItem, "peExtraPanel"); |
1139 | |
1140 | // Go directly to the root pressing the back button of header1 |
1141 | var header1 = findChild(dashNavigation, "dashNavigationHeader1"); |
1142 | @@ -458,16 +496,22 @@ |
1143 | |
1144 | tryCompare(dashNavigation.currentNavigation, "navigationId", "root"); |
1145 | tryCompare(navigationListView.currentItem.navigation, "navigationId", "root"); |
1146 | - compare(peExtraPanel.visible, true); |
1147 | + tryCompare(searchHeaderContents, "extraPanelVisible", true); |
1148 | } |
1149 | |
1150 | function test_navigationSecondLevelToFirstName() { |
1151 | goToSecondLevel(); |
1152 | |
1153 | var dashContentList = findChild(dashContent, "dashContentList"); |
1154 | - var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation"); |
1155 | + var searchHeaderContents = findChild(dashContentList.currentItem, "searchHeaderContents"); |
1156 | + var extraPanel = findChild(searchHeaderContents, "extraPanel"); |
1157 | + var dashNavigation = findChild(extraPanel, "dashNavigation"); |
1158 | + var pageHeader = findChild(dashContentList.currentItem, "scopePageHeader") |
1159 | + var searchTextField = findChild(pageHeader, "searchTextField"); |
1160 | var navigationListView = findChild(dashNavigation, "navigationListView"); |
1161 | - var peExtraPanel = findChild(dashContentList.currentItem, "peExtraPanel"); |
1162 | + |
1163 | + mouseClick(searchTextField); |
1164 | + tryCompare(searchHeaderContents, "extraPanelVisible", true); |
1165 | |
1166 | // Go directly to the first pressing the header1 |
1167 | var header1 = findChild(dashNavigation, "dashNavigationHeader1"); |
1168 | @@ -475,57 +519,60 @@ |
1169 | |
1170 | tryCompare(dashNavigation.currentNavigation, "navigationId", "middle4"); |
1171 | tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle4"); |
1172 | - compare(peExtraPanel.visible, false); |
1173 | + tryCompare(searchHeaderContents, "extraPanelVisible", false); |
1174 | } |
1175 | |
1176 | - function test_navigationSecondLevelToFirstBack() { |
1177 | + |
1178 | + function test_navigationSecondLevelToFirstBack() { |
1179 | goToSecondLevel(); |
1180 | |
1181 | var dashContentList = findChild(dashContent, "dashContentList"); |
1182 | - var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation"); |
1183 | - var navigationListView = findChild(dashNavigation, "navigationListView"); |
1184 | - var peExtraPanel = findChild(dashContentList.currentItem, "peExtraPanel"); |
1185 | + var searchHeaderContents = findChild(dashContentList.currentItem, "searchHeaderContents"); |
1186 | + var extraPanel = findChild(searchHeaderContents, "extraPanel") |
1187 | + var dashNavigation = findChild(extraPanel, "dashNavigation"); |
1188 | |
1189 | // Go back to the first level pressing the back button of header2 |
1190 | var header2 = findChild(dashNavigation, "dashNavigationHeader2"); |
1191 | compare(header2.backVisible, true); |
1192 | mouseClick(findChild(header2, "backButton")); |
1193 | |
1194 | + var navigationListView = findChild(dashNavigation, "navigationListView"); |
1195 | tryCompare(dashNavigation.currentNavigation, "navigationId", "middle4"); |
1196 | tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle4"); |
1197 | - compare(peExtraPanel.visible, true); |
1198 | + tryCompare(searchHeaderContents, "extraPanelVisible", true); |
1199 | } |
1200 | |
1201 | function test_clearSearchWithNavigationClosed() { |
1202 | var dashContentList = findChild(dashContent, "dashContentList"); |
1203 | + var searchHeaderContents = findChild(dashContentList.currentItem, "searchHeaderContents"); |
1204 | var searchButton = findChild(dashContentList.currentItem, "search_button"); |
1205 | - var peExtraPanel = findChild(dashContentList.currentItem, "peExtraPanel"); |
1206 | var searchTextField = findChild(dashContentList.currentItem, "searchTextField"); |
1207 | |
1208 | - compare(peExtraPanel.visible, false); |
1209 | + tryCompare(searchHeaderContents, "extraPanelVisible", false); |
1210 | mouseClick(searchButton); |
1211 | - tryCompare(peExtraPanel, "visible", true); |
1212 | + tryCompare(searchHeaderContents, "extraPanelVisible", true); |
1213 | |
1214 | typeString("A"); |
1215 | - compare(peExtraPanel.visible, false); |
1216 | + tryCompare(searchHeaderContents, "extraPanelVisible", false); |
1217 | |
1218 | var clearIcon = findChild(searchTextField, "clearIcon"); |
1219 | mouseClick(clearIcon); |
1220 | - tryCompare(peExtraPanel, "visible", true); |
1221 | + tryCompare(searchHeaderContents, "extraPanelVisible", true); |
1222 | } |
1223 | |
1224 | function test_navigationShowFilterPopup() { |
1225 | var dashContentList = findChild(dashContent, "dashContentList"); |
1226 | var pageHeader = findChild(dashContentList.currentItem, "scopePageHeader") |
1227 | var settingsButton = findChild(dashContentList.currentItem, "settingsButton"); |
1228 | + var searchHeaderContents = findChild(dashContentList.currentItem, |
1229 | + "searchHeaderContents"); |
1230 | var searchButton = findChild(dashContentList.currentItem, "search_button"); |
1231 | - var cancelButton = findChild(dashContentList.currentItem, "cancelButton"); |
1232 | + var cancelButton = findChild(searchHeaderContents, "cancelButton"); |
1233 | var searchTextField = findChild(pageHeader, "searchTextField"); |
1234 | - var peExtraPanel = findChild(dashContentList.currentItem, "peExtraPanel"); |
1235 | var headerContainer = findChild(pageHeader, "headerContainer"); |
1236 | |
1237 | mouseClick(searchButton); |
1238 | - tryCompare(peExtraPanel, "visible", true); |
1239 | + tryCompare(searchHeaderContents, "extraPanelVisible", true); |
1240 | |
1241 | var filtersPopover = findChild(shell, "filtersPopover") |
1242 | verify(!filtersPopover); |
1243 | @@ -550,10 +597,11 @@ |
1244 | // test that closing the filters popover without a search unfocuses and removes the navigation |
1245 | mouseClick(shell, shell.width - 1, shell.height - 1); |
1246 | |
1247 | - tryCompare(pageHeader.extraPanel, "visible", false); |
1248 | + tryCompare(searchHeaderContents, "extraPanelVisible", false); |
1249 | tryCompare(headerContainer, "showSearch", true); |
1250 | tryCompare(searchTextField, "focus", false); |
1251 | |
1252 | + getSettledButtons(); |
1253 | mouseClick(cancelButton); |
1254 | tryCompare(headerContainer, "showSearch", false); |
1255 | tryCompare(headerContainer, "clip", false); |
1256 | @@ -572,34 +620,38 @@ |
1257 | |
1258 | mouseClick(shell, shell.width - 1, shell.height - 1); |
1259 | |
1260 | - tryCompare(pageHeader.extraPanel, "visible", false); |
1261 | + tryCompare(searchHeaderContents, "extraPanelVisible", false); |
1262 | tryCompare(headerContainer, "showSearch", true); |
1263 | } |
1264 | |
1265 | function test_primaryFilter() { |
1266 | var dashContentList = findChild(dashContent, "dashContentList"); |
1267 | - tryCompareFunction(function() { return findChild(dashContentList.currentItem, "dashNavigation", 0 /* timeout */) != null; }, true); |
1268 | dashContentList.currentItem.item.scope.setHasNavigation(false); |
1269 | - var peExtraPanel = findChild(dashContentList.currentItem, "peExtraPanel"); |
1270 | + var searchHeaderContents = findChild(dashContentList.currentItem, "searchHeaderContents"); |
1271 | var searchButton = findChild(dashContentList.currentItem, "search_button"); |
1272 | + var extraPanel = findChild(searchHeaderContents, "extraPanel"); |
1273 | + var dashNavigation = findChild(extraPanel, "dashNavigation"); |
1274 | |
1275 | - compare(peExtraPanel.visible, false); |
1276 | + tryCompare(searchHeaderContents, "extraPanelVisible", false); |
1277 | mouseClick(searchButton); |
1278 | - tryCompare(peExtraPanel, "visible", true); |
1279 | - |
1280 | - tryCompareFunction(function() { return findChild(peExtraPanel, "OSF3", 0 /* timeout */) != null; }, true); |
1281 | + tryCompare(searchHeaderContents, "extraPanelVisible", true); |
1282 | + tryCompareFunction(function() { return dashNavigation != null; }, true); |
1283 | + tryCompareFunction(function() { return findChild(extraPanel, "OSF3") != null; }, true); |
1284 | } |
1285 | |
1286 | function test_searchHint() { |
1287 | var dashContentList = findChild(dashContent, "dashContentList"); |
1288 | verify(dashContentList !== null); |
1289 | var scope = findChild(dashContent, "scopeLoader0"); |
1290 | + var searchHeaderContents = findChild(dashContentList.currentItem, "searchHeaderContents") |
1291 | + var searchTextField = findChild(searchHeaderContents, "searchTextField") |
1292 | waitForRendering(scope); |
1293 | |
1294 | var categoryListView = findChild(scope, "categoryListView"); |
1295 | waitForRendering(categoryListView); |
1296 | |
1297 | compare(categoryListView.pageHeader.searchHint, "Search People"); |
1298 | + compare(searchTextField.placeholderText, "Search People") |
1299 | } |
1300 | |
1301 | function compareArrays(a, b) { |
1302 | @@ -681,6 +733,9 @@ |
1303 | function test_extraPanel() { |
1304 | var dashContentList = findChild(dashContent, "dashContentList"); |
1305 | var pageHeader = findChild(dashContentList.currentItem, "scopePageHeader") |
1306 | + var searchHeaderContents = findChild(pageHeader, "searchHeaderContents"); |
1307 | + var extraPanel = findChild(searchHeaderContents, "extraPanel") |
1308 | + |
1309 | pageHeader.searchEntryEnabled = true; |
1310 | pageHeader.searchHistory.clear(); |
1311 | |
1312 | @@ -688,25 +743,28 @@ |
1313 | pageHeader.searchHistory.addQuery("Search2"); |
1314 | |
1315 | pageHeader.triggerSearch(); |
1316 | - tryCompare(pageHeader.extraPanel, "visible", true); |
1317 | + tryCompare(extraPanel, "visible", true); |
1318 | |
1319 | var searchTextField = findChild(pageHeader, "searchTextField"); |
1320 | compare(searchTextField.focus, true); |
1321 | |
1322 | - var recentSearches = findChild(pageHeader.extraPanel, "recentSearchesRepeater"); |
1323 | + var recentSearches = findChild(extraPanel, "recentSearchesRepeater"); |
1324 | verify(recentSearches, "Could not find recent searches"); |
1325 | - |
1326 | waitForRendering(recentSearches); |
1327 | |
1328 | + tryCompare(recentSearches.itemAt(0), "visible", true); |
1329 | + |
1330 | + getSettledButtons(); |
1331 | mouseClick(recentSearches.itemAt(0)); |
1332 | - compare(pageHeader.searchQuery, "Search2"); |
1333 | - tryCompare(pageHeader.extraPanel, "visible", false); |
1334 | + tryCompare(pageHeader, "searchQuery", "Search2"); |
1335 | + tryCompare(extraPanel, "visible", false); |
1336 | compare(searchTextField.focus, false); |
1337 | } |
1338 | |
1339 | function test_cancelSearch() { |
1340 | var dashContentList = findChild(dashContent, "dashContentList"); |
1341 | var pageHeader = findChild(dashContentList.currentItem, "scopePageHeader") |
1342 | + var searchHeaderContents = findChild(dashContentList.currentItem, "searchHeaderContents"); |
1343 | pageHeader.searchEntryEnabled = true; |
1344 | pageHeader.searchHistory.clear(); |
1345 | |
1346 | @@ -714,15 +772,15 @@ |
1347 | pageHeader.searchHistory.addQuery("Search2"); |
1348 | |
1349 | pageHeader.triggerSearch(); |
1350 | - tryCompare(pageHeader.extraPanel, "visible", true); |
1351 | |
1352 | var searchTextField = findChild(pageHeader, "searchTextField"); |
1353 | compare(searchTextField.focus, true); |
1354 | |
1355 | - var cancelButton = findChild(dashContentList.currentItem, "cancelButton") |
1356 | - |
1357 | + var searchHeaderContents = findChild(dashContentList.currentItem, "searchHeaderContents") |
1358 | + var cancelButton = findChild(searchHeaderContents, "cancelButton"); |
1359 | + waitForRendering(cancelButton) |
1360 | mouseClick(cancelButton); |
1361 | - tryCompare(pageHeader.extraPanel, "visible", false); |
1362 | + tryCompare(searchHeaderContents, "extraPanelVisible", false); |
1363 | compare(searchTextField.focus, false); |
1364 | } |
1365 | } |
1366 | |
1367 | === modified file 'tests/qmltests/Dash/tst_DashPageHeader.qml' |
1368 | --- tests/qmltests/Dash/tst_DashPageHeader.qml 2016-09-30 12:37:27 +0000 |
1369 | +++ tests/qmltests/Dash/tst_DashPageHeader.qml 2016-11-18 00:12:31 +0000 |
1370 | @@ -28,12 +28,6 @@ |
1371 | width: units.gu(110) |
1372 | height: units.gu(50) |
1373 | |
1374 | - SignalSpy { |
1375 | - id: escapeSpy |
1376 | - target: pageHeader |
1377 | - signalName: "clearSearch" |
1378 | - } |
1379 | - |
1380 | UT.UnityTestCase { |
1381 | name: "PageHeaderLabelTest" |
1382 | when: windowShown |
1383 | @@ -58,13 +52,13 @@ |
1384 | searchEnabled = true; |
1385 | |
1386 | // Reset to initial state |
1387 | - pageHeader.searchQuery = ""; |
1388 | - pageHeader.closePopup(); |
1389 | - pageHeader.searchHistory.clear(); |
1390 | + pageHeader.searchContents.searchTextField.text = ""; |
1391 | + pageHeader.searchContents.closePopup(); |
1392 | + pageHeader.searchContents.searchHistory.clear(); |
1393 | |
1394 | // Check initial state |
1395 | - tryCompare(pageHeader.extraPanel, "visible", false); |
1396 | - compare(pageHeader.searchHistory.count, 0); |
1397 | + tryCompare(pageHeader.searchContents, "extraPanelVisible", false); |
1398 | + compare(pageHeader.searchContents.searchHistory.count, 0); |
1399 | } |
1400 | |
1401 | function test_search_disabled() { |
1402 | @@ -153,7 +147,6 @@ |
1403 | |
1404 | function cleanup() { |
1405 | doResetSearch(); |
1406 | - escapeSpy.clear(); |
1407 | } |
1408 | |
1409 | function test_popup_closing_data() { |
1410 | @@ -194,7 +187,7 @@ |
1411 | pageHeader.triggerSearch(); |
1412 | |
1413 | var headerContainer = findChild(pageHeader, "headerContainer"); |
1414 | - tryCompare(pageHeader.extraPanel, "visible", true); |
1415 | + tryCompare(pageHeader.searchContents, "extraPanelVisible", true); |
1416 | |
1417 | pageHeader.searchQuery = data.searchText; |
1418 | |
1419 | @@ -205,7 +198,7 @@ |
1420 | } |
1421 | |
1422 | tryCompare(headerContainer, "showSearch", !data.hideSearch); |
1423 | - tryCompare(pageHeader.extraPanel, "visible", false); |
1424 | + tryCompare(pageHeader.searchContents, "extraPanelVisible", false); |
1425 | |
1426 | doResetSearch(); |
1427 | } |
1428 | @@ -220,26 +213,19 @@ |
1429 | pageHeader.triggerSearch(); |
1430 | |
1431 | var headerContainer = findChild(pageHeader, "headerContainer"); |
1432 | - tryCompare(pageHeader.extraPanel, "visible", true); |
1433 | + tryCompare(pageHeader.searchContents, "extraPanelVisible", true); |
1434 | |
1435 | pageHeader.searchQuery = "foobar"; |
1436 | |
1437 | // press Esc once, the search should be cleared |
1438 | keyClick(Qt.Key_Escape); |
1439 | - pageHeader.searchQuery = ""; // simulate clearing the text field, the clear button doesn't do anything on its own |
1440 | - compare(escapeSpy.count, 1); |
1441 | - compare(escapeSpy.signalArguments[0][0], true); |
1442 | - |
1443 | - escapeSpy.clear(); |
1444 | + verify(pageHeader.searchQuery.length === 0) |
1445 | |
1446 | // press Escape a second time, the whole search should be hidden |
1447 | keyClick(Qt.Key_Escape); |
1448 | tryCompare(headerContainer, "showSearch", false); |
1449 | - compare(escapeSpy.count, 1); |
1450 | - compare(escapeSpy.signalArguments[0][0], false); |
1451 | - tryCompare(pageHeader.extraPanel, "visible", false); |
1452 | - |
1453 | - doResetSearch(); |
1454 | + verify(pageHeader.searchQuery === "") |
1455 | + tryCompare(pageHeader.searchContents, "extraPanelVisible", false); |
1456 | } |
1457 | |
1458 | function test_search_change_shows_search() { |
1459 | @@ -266,7 +252,6 @@ |
1460 | searchHistory: SearchHistoryModel |
1461 | searchEntryEnabled: true |
1462 | title: "%^$%^%^&%^&%^$%GHR%" |
1463 | - extraPanel: peExtraPanel |
1464 | scopeStyle: QtObject { |
1465 | readonly property color foreground: theme.palette.normal.baseText |
1466 | readonly property url headerLogo: showImageCheckBox.checked ? pageHeader.titleImageSource : "" |
1467 | @@ -278,18 +263,6 @@ |
1468 | onBackClicked: lastBackClicked = new Date() |
1469 | } |
1470 | |
1471 | - PageHeaderExtraPanel { |
1472 | - id: peExtraPanel |
1473 | - width: parent.width |
1474 | - z: 1 |
1475 | - visible: false |
1476 | - searchHistory: SearchHistoryModel |
1477 | - onHistoryItemClicked: { |
1478 | - SearchHistoryModel.addQuery(text); |
1479 | - pageHeader.searchQuery = text; |
1480 | - } |
1481 | - } |
1482 | - |
1483 | Row { |
1484 | spacing: units.gu(1) |
1485 | anchors { |
FAILED: Continuous integration, rev:2087 /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/2187/ /unity8- jenkins. ubuntu. com/job/ build/2872 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= vivid+overlay, testname= qmluitests. sh/1584 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= xenial+ overlay, testname= qmluitests. sh/1584 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= yakkety, testname= qmluitests. sh/1584 /unity8- jenkins. ubuntu. com/job/ build-0- fetch/2900 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 2758 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 2758/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 2758 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 2758/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 2758 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 2758/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 2758 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 2758/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 2758 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 2758/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 2758 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 2758/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 2758 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 2758/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 2758 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 2758/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= yakkety/ 2758 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= yakkety/ 2758/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/2187/ rebuild
https:/