Merge lp:~osomon/webbrowser-app/browserpage into lp:webbrowser-app

Proposed by Olivier Tilloy
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 1458
Merged at revision: 1456
Proposed branch: lp:~osomon/webbrowser-app/browserpage
Merge into: lp:webbrowser-app
Diff against target: 2190 lines (+688/-845)
17 files modified
src/app/webbrowser/BookmarksView.qml (+5/-48)
src/app/webbrowser/BookmarksViewWide.qml (+6/-49)
src/app/webbrowser/Browser.qml (+12/-21)
src/app/webbrowser/BrowserPage.qml (+79/-0)
src/app/webbrowser/BrowserPageHeader.qml (+0/-119)
src/app/webbrowser/DownloadsPage.qml (+99/-101)
src/app/webbrowser/HistoryView.qml (+52/-105)
src/app/webbrowser/HistoryViewWide.qml (+94/-167)
src/app/webbrowser/SettingsPage.qml (+102/-162)
tests/autopilot/webbrowser_app/emulators/browser.py (+16/-14)
tests/autopilot/webbrowser_app/tests/test_keyboard.py (+1/-1)
tests/autopilot/webbrowser_app/tests/test_settings.py (+2/-2)
tests/unittests/qml/tst_BookmarksView.qml (+6/-6)
tests/unittests/qml/tst_BookmarksViewWide.qml (+7/-7)
tests/unittests/qml/tst_BrowserPage.qml (+151/-0)
tests/unittests/qml/tst_HistoryView.qml (+11/-11)
tests/unittests/qml/tst_HistoryViewWide.qml (+45/-32)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/browserpage
Reviewer Review Type Date Requested Status
Olivier Tilloy Approve
system-apps-ci-bot continuous-integration Needs Fixing
Review via email: mp+293891@code.launchpad.net

Commit message

Introduce a BrowserPage type for consistency between all pages, and use the UITK Page and PageHeader types.

To post a comment you must log in.
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1457
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/478/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/480/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/480
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/479
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/479
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/486/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/486
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/486/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/486/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/486
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/486/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/486/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/486
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/486/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/478/rebuild

review: Needs Fixing (continuous-integration)
1458. By Olivier Tilloy

Make unit tests more robust.

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1458
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/479/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/481/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/481
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/480
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/480
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/487/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/487
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/487/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/487/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/487
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/487/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/487/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/487
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/487/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/479/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

There are two unit test failures that I can reliably reproduce in a vivid chroot (with the stable overlay PPA enabled). I don’t get those failures on xenial.

2: FAIL! : QmlTests::HistoryViewWide::test_search_highlight() property text
2: Actual ():
2: Expected (): 1 Example
2: Loc: [/tmp/browserpage/tests/unittests/qml/tst_HistoryViewWide.qml(334)]
2: FAIL! : QmlTests::HistoryViewWide::test_search_updates_dates_list() property text
2: Actual (): Alan
2: Expected (): Al
2: Loc: [/tmp/browserpage/tests/unittests/qml/tst_HistoryViewWide.qml(390)]

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

Those failures are yet another occurrence of bug #1545802: I’ve instrumented the tests, and when the failures happen the TextField has activeFocus, not the QQuickTextInput inside it, so sending key events doesn’t input any text.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Bug #1545802 has now been fixed, unit tests pass again.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/webbrowser/BookmarksView.qml'
2--- src/app/webbrowser/BookmarksView.qml 2016-02-04 10:50:31 +0000
3+++ src/app/webbrowser/BookmarksView.qml 2016-05-05 15:15:01 +0000
4@@ -18,33 +18,23 @@
5
6 import QtQuick 2.4
7 import Ubuntu.Components 1.3
8-import Ubuntu.Components.ListItems 1.3 as ListItems
9 import webbrowserapp.private 0.1
10 import "." as Local
11
12-FocusScope {
13+BrowserPage {
14 id: bookmarksView
15
16 property alias homepageUrl: bookmarksFoldersView.homeBookmarkUrl
17
18 signal bookmarkEntryClicked(url url)
19- signal done()
20 signal newTabClicked()
21
22- Rectangle {
23- anchors.fill: parent
24- color: "#f6f6f6"
25- }
26+ title: i18n.tr("Bookmarks")
27
28 BookmarksFoldersView {
29 id: bookmarksFoldersView
30
31- anchors {
32- top: topBar.bottom
33- left: parent.left
34- right: parent.right
35- bottom: toolbar.top
36- }
37+ anchors.fill: parent
38
39 interactive: true
40 focus: true
41@@ -52,46 +42,13 @@
42 onBookmarkClicked: bookmarksView.bookmarkEntryClicked(url)
43 onBookmarkRemoved: {
44 if (BookmarksModel.count == 1) {
45- done()
46+ bookmarksView.back()
47 }
48 BookmarksModel.remove(url)
49 }
50 }
51
52 Local.Toolbar {
53- id: topBar
54-
55- height: units.gu(7)
56- color: "#f7f7f7"
57-
58- anchors {
59- left: parent.left
60- right: parent.right
61- top: parent.top
62- }
63-
64- Label {
65- anchors {
66- top: parent.top
67- left: parent.left
68- topMargin: units.gu(2)
69- leftMargin: units.gu(2)
70- }
71-
72- text: i18n.tr("Bookmarks")
73- }
74-
75- ListItems.ThinDivider {
76- anchors {
77- left: parent.left
78- right: parent.right
79- bottom: parent.bottom
80- }
81- }
82- }
83-
84- Local.Toolbar {
85- id: toolbar
86 height: units.gu(7)
87
88 anchors {
89@@ -112,7 +69,7 @@
90 strokeColor: UbuntuColors.darkGrey
91 text: i18n.tr("Done")
92
93- onClicked: bookmarksView.done()
94+ onClicked: bookmarksView.back()
95 }
96
97 ToolbarAction {
98
99=== modified file 'src/app/webbrowser/BookmarksViewWide.qml'
100--- src/app/webbrowser/BookmarksViewWide.qml 2015-12-17 20:25:21 +0000
101+++ src/app/webbrowser/BookmarksViewWide.qml 2016-05-05 15:15:01 +0000
102@@ -1,5 +1,5 @@
103 /*
104- * Copyright 2015 Canonical Ltd.
105+ * Copyright 2015-2016 Canonical Ltd.
106 *
107 * This file is part of webbrowser-app.
108 *
109@@ -18,78 +18,35 @@
110
111 import QtQuick 2.4
112 import Ubuntu.Components 1.3
113-import Ubuntu.Components.ListItems 1.3 as ListItems
114 import webbrowserapp.private 0.1
115 import "." as Local
116
117-FocusScope {
118+BrowserPage {
119 id: bookmarksViewWide
120
121 property alias homepageUrl: bookmarksFoldersViewWide.homeBookmarkUrl
122
123 signal bookmarkEntryClicked(url url)
124- signal done()
125 signal newTabClicked()
126
127- Rectangle {
128- anchors.fill: parent
129- color: "#f6f6f6"
130- }
131+ title: i18n.tr("Bookmarks")
132
133 BookmarksFoldersViewWide {
134 id: bookmarksFoldersViewWide
135
136- anchors {
137- top: topBar.bottom
138- left: parent.left
139- right: parent.right
140- bottom: toolbar.top
141- }
142-
143+ anchors.fill: parent
144 focus: true
145
146 onBookmarkClicked: bookmarksViewWide.bookmarkEntryClicked(url)
147 onBookmarkRemoved: {
148 if (BookmarksModel.count == 1) {
149- done()
150+ bookmarksViewWide.back()
151 }
152 BookmarksModel.remove(url)
153 }
154 }
155
156 Local.Toolbar {
157- id: topBar
158-
159- height: units.gu(7)
160- color: "#f7f7f7"
161-
162- anchors {
163- left: parent.left
164- right: parent.right
165- top: parent.top
166- }
167-
168- Label {
169- anchors {
170- top: parent.top
171- left: parent.left
172- topMargin: units.gu(2)
173- leftMargin: units.gu(2)
174- }
175-
176- text: i18n.tr("Bookmarks")
177- }
178-
179- ListItems.ThinDivider {
180- anchors {
181- left: parent.left
182- right: parent.right
183- bottom: parent.bottom
184- }
185- }
186- }
187-
188- Local.Toolbar {
189 id: toolbar
190 height: units.gu(7)
191
192@@ -111,7 +68,7 @@
193
194 text: i18n.tr("Done")
195
196- onClicked: bookmarksViewWide.done()
197+ onClicked: bookmarksViewWide.back()
198 }
199
200 ToolbarAction {
201
202=== modified file 'src/app/webbrowser/Browser.qml'
203--- src/app/webbrowser/Browser.qml 2016-04-15 11:37:54 +0000
204+++ src/app/webbrowser/Browser.qml 2016-05-05 15:15:01 +0000
205@@ -815,8 +815,6 @@
206 }
207 }
208
209- Keys.onEscapePressed: active = false
210-
211 Connections {
212 target: bookmarksViewLoader.item
213
214@@ -824,7 +822,7 @@
215 browser.openUrlInNewTab(url, true)
216 bookmarksViewLoader.active = false
217 }
218- onDone: bookmarksViewLoader.active = false
219+ onBack: bookmarksViewLoader.active = false
220 onNewTabClicked: {
221 browser.openUrlInNewTab("", true)
222 bookmarksViewLoader.active = false
223@@ -869,8 +867,6 @@
224 }
225 }
226
227- Keys.onEscapePressed: active = false
228-
229 Component {
230 id: historyViewComponent
231
232@@ -889,7 +885,7 @@
233 expandedHistoryViewLoader.active = true
234 }
235 onNewTabRequested: browser.openUrlInNewTab("", true)
236- onDone: historyViewLoader.active = false
237+ onBack: historyViewLoader.active = false
238 }
239
240 Loader {
241@@ -923,21 +919,20 @@
242
243 HistoryViewWide {
244 anchors.fill: parent
245-
246 focus: true
247
248- Keys.onEscapePressed: {
249- historyViewLoader.active = false
250- internal.resetFocus()
251- }
252-
253 onHistoryEntryClicked: {
254+ historyViewLoader.active = false
255 browser.openUrlInNewTab(url, true)
256- done()
257- }
258-
259- onNewTabRequested: browser.openUrlInNewTab("", true)
260- onDone: historyViewLoader.active = false
261+ }
262+ onNewTabRequested: {
263+ historyViewLoader.active = false
264+ browser.openUrlInNewTab("", true)
265+ }
266+ onDone: {
267+ historyViewLoader.active = false
268+ internal.resetFocus()
269+ }
270 }
271 }
272 }
273@@ -957,8 +952,6 @@
274 }
275 }
276
277- Keys.onEscapePressed: active = false
278-
279 sourceComponent: SettingsPage {
280 anchors.fill: parent
281 focus: true
282@@ -996,8 +989,6 @@
283 internal.resetFocus()
284 }
285 }
286-
287- Keys.onEscapePressed: active = false
288 }
289
290 TabsModel {
291
292=== added file 'src/app/webbrowser/BrowserPage.qml'
293--- src/app/webbrowser/BrowserPage.qml 1970-01-01 00:00:00 +0000
294+++ src/app/webbrowser/BrowserPage.qml 2016-05-05 15:15:01 +0000
295@@ -0,0 +1,79 @@
296+/*
297+* Copyright 2015-2016 Canonical Ltd.
298+*
299+* This file is part of webbrowser-app.
300+*
301+* webbrowser-app is free software; you can redistribute it and/or modify
302+* it under the terms of the GNU General Public License as published by
303+* the Free Software Foundation; version 3.
304+*
305+* webbrowser-app is distributed in the hope that it will be useful,
306+* but WITHOUT ANY WARRANTY; without even the implied warranty of
307+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
308+* GNU General Public License for more details.
309+*
310+* You should have received a copy of the GNU General Public License
311+* along with this program. If not, see <http://www.gnu.org/licenses/>.
312+*/
313+
314+import QtQuick 2.4
315+import Ubuntu.Components 1.3
316+
317+Page {
318+ id: page
319+
320+ property bool showBackAction: true
321+ property list<Action> leadingActions
322+ property list<Action> trailingActions
323+ property alias title: pageHeader.title
324+ property alias headerContents: pageHeader.contents
325+
326+ default property alias contents: contentsItem.data
327+
328+ signal back()
329+
330+ Keys.onEscapePressed: back()
331+
332+ MouseArea {
333+ // Prevent click events from propagating through to the view below the page
334+ anchors.fill: parent
335+ acceptedButtons: Qt.AllButtons
336+ }
337+
338+ header: PageHeader {
339+ id: pageHeader
340+ StyleHints {
341+ backgroundColor: "#f6f6f6"
342+ }
343+ leadingActionBar.actions: page.showBackAction ? [backAction] : page.leadingActions
344+ trailingActionBar.actions: page.trailingActions
345+ }
346+
347+ Action {
348+ id: backAction
349+ objectName: "back"
350+ iconName: "back"
351+ onTriggered: page.back()
352+ }
353+
354+ Rectangle {
355+ anchors.fill: parent
356+ color: "#f6f6f6"
357+ }
358+
359+ onActiveFocusChanged: {
360+ if (activeFocus) {
361+ contentsItem.forceActiveFocus()
362+ }
363+ }
364+
365+ FocusScope {
366+ id: contentsItem
367+ anchors {
368+ top: pageHeader.bottom
369+ bottom: parent.bottom
370+ left: parent.left
371+ right: parent.right
372+ }
373+ }
374+}
375
376=== removed file 'src/app/webbrowser/BrowserPageHeader.qml'
377--- src/app/webbrowser/BrowserPageHeader.qml 2016-02-01 12:28:24 +0000
378+++ src/app/webbrowser/BrowserPageHeader.qml 1970-01-01 00:00:00 +0000
379@@ -1,119 +0,0 @@
380- /*
381- * Copyright 2015-2016 Canonical Ltd.
382- *
383- * This file is part of webbrowser-app.
384- *
385- * webbrowser-app is free software; you can redistribute it and/or modify
386- * it under the terms of the GNU General Public License as published by
387- * the Free Software Foundation; version 3.
388- *
389- * webbrowser-app is distributed in the hope that it will be useful,
390- * but WITHOUT ANY WARRANTY; without even the implied warranty of
391- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
392- * GNU General Public License for more details.
393- *
394- * You should have received a copy of the GNU General Public License
395- * along with this program. If not, see <http://www.gnu.org/licenses/>.
396- */
397-
398-import QtQuick 2.4
399-import Ubuntu.Components 1.3
400-import Ubuntu.Components.ListItems 1.3 as ListItem
401-
402-/*
403- * Component to use as page header in settings page, download page and
404- * subpages
405- *
406- * It has a back() signal fired when back button is pressed, a text
407- * property to set the page title and an actions property which
408- * displays action icons on the right of header.
409- */
410-
411-Item {
412- id: root
413- signal back()
414- property string text
415- property alias actions: actionBar.actions
416- property alias color: title.color
417-
418- height: title.height + divider.height
419-
420- anchors {
421- left: parent.left
422- right: parent.right
423- }
424-
425- MouseArea {
426- // Prevent click events from propagating through to the view below
427- anchors.fill: parent
428- acceptedButtons: Qt.AllButtons
429- }
430-
431- Rectangle {
432- id: title
433-
434- height: units.gu(6) - divider.height
435- anchors { left: parent.left; right: parent.right }
436- color: "#f6f6f6"
437-
438- AbstractButton {
439- id: backButton
440- objectName: "backButton"
441-
442- width: height
443-
444- activeFocusOnPress: false
445- onTriggered: root.back()
446- anchors {
447- top: parent.top
448- bottom: parent.bottom
449- left: parent.left
450- }
451-
452- Rectangle {
453- anchors.fill: parent
454- anchors.leftMargin: units.gu(1)
455- anchors.rightMargin: units.gu(1)
456- color: "#E6E6E6"
457- visible: parent.pressed
458- }
459-
460- Icon {
461- name: "back"
462- anchors {
463- fill: parent
464- topMargin: units.gu(2)
465- bottomMargin: units.gu(2)
466- }
467- }
468- }
469-
470- Label {
471- anchors {
472- left: backButton.right
473- verticalCenter: parent.verticalCenter
474- }
475- text: root.text
476- fontSize: 'x-large'
477- }
478-
479- ActionBar {
480- id: actionBar
481- anchors.right: parent.right
482- anchors.verticalCenter: parent.verticalCenter
483- }
484-
485-
486- }
487-
488- Rectangle {
489- id: divider
490- anchors {
491- left: parent.left
492- right: parent.right
493- bottom: parent.bottom
494- }
495- height: units.dp(1)
496- color: Qt.darker(title.color, 1.1)
497- }
498-}
499
500=== modified file 'src/app/webbrowser/DownloadsPage.qml'
501--- src/app/webbrowser/DownloadsPage.qml 2016-04-15 11:27:13 +0000
502+++ src/app/webbrowser/DownloadsPage.qml 2016-05-05 15:15:01 +0000
503@@ -24,7 +24,7 @@
504
505 import "../MimeTypeMapper.js" as MimeTypeMapper
506
507-FocusScope {
508+BrowserPage {
509 id: downloadsItem
510
511 property var downloadManager
512@@ -42,119 +42,117 @@
513
514 signal done()
515
516+ title: i18n.tr("Downloads")
517+
518+ showBackAction: !selectMode
519+
520+ leadingActions: [
521+ Action {
522+ objectName: "close"
523+ iconName: "close"
524+ onTriggered: downloadsItem.selectMode = false
525+ }
526+ ]
527+
528+ trailingActions: [
529+ Action {
530+ text: i18n.tr("Confirm selection")
531+ iconName: "tick"
532+ visible: pickingMode
533+ enabled: downloadsListView.ViewItems.selectedIndices.length > 0
534+ onTriggered: {
535+ var results = []
536+ if (internalFilePicker) {
537+ for (var i = 0; i < downloadsListView.ViewItems.selectedIndices.length; i++) {
538+ var selectedDownload = downloadsListView.model.get(downloadsListView.ViewItems.selectedIndices[i])
539+ results.push(selectedDownload.path)
540+ }
541+ internalFilePicker.accept(results)
542+ } else {
543+ for (var i = 0; i < downloadsListView.ViewItems.selectedIndices.length; i++) {
544+ var selectedDownload = downloadsListView.model.get(downloadsListView.ViewItems.selectedIndices[i])
545+ results.push(resultComponent.createObject(downloadsItem, {"url": "file://" + selectedDownload.path}))
546+ }
547+ activeTransfer.items = results
548+ activeTransfer.state = ContentTransfer.Charged
549+ }
550+ downloadsItem.done()
551+ }
552+ },
553+ Action {
554+ text: i18n.tr("Select all")
555+ iconName: "select"
556+ visible: selectMode
557+ onTriggered: {
558+ if (downloadsListView.ViewItems.selectedIndices.length === downloadsListView.count) {
559+ downloadsListView.ViewItems.selectedIndices = []
560+ } else {
561+ var indices = []
562+ for (var i = 0; i < downloadsListView.count; ++i) {
563+ indices.push(i)
564+ }
565+ downloadsListView.ViewItems.selectedIndices = indices
566+ }
567+ }
568+ },
569+ Action {
570+ text: i18n.tr("Delete")
571+ iconName: "delete"
572+ visible: selectMode
573+ enabled: downloadsListView.ViewItems.selectedIndices.length > 0
574+ onTriggered: {
575+ var toDelete = []
576+ for (var i = 0; i < downloadsListView.ViewItems.selectedIndices.length; i++) {
577+ var selectedDownload = downloadsListView.model.get(downloadsListView.ViewItems.selectedIndices[i])
578+ toDelete.push(selectedDownload.path)
579+ }
580+ for (var i = 0; i < toDelete.length; i++) {
581+ DownloadsModel.deleteDownload(toDelete[i])
582+ }
583+ downloadsListView.ViewItems.selectedIndices = []
584+ downloadsItem.selectMode = false
585+ }
586+ },
587+ Action {
588+ iconName: "edit"
589+ visible: !selectMode && !pickingMode
590+ enabled: downloadsListView.count > 0
591+ onTriggered: {
592+ selectMode = true
593+ multiSelect = true
594+ }
595+ }
596+ ]
597+
598+ onBack: {
599+ if (selectMode) {
600+ selectMode = false
601+ } else {
602+ if (activeTransfer) {
603+ activeTransfer.state = ContentTransfer.Aborted
604+ }
605+ if (internalFilePicker) {
606+ internalFilePicker.reject()
607+ }
608+ done()
609+ }
610+ }
611+
612 Loader {
613 id: thumbnailLoader
614 source: "Thumbnailer.qml"
615 }
616
617- Rectangle {
618- anchors.fill: parent
619- color: "#fbfbfb"
620- }
621-
622- BrowserPageHeader {
623- id: title
624- text: i18n.tr("Downloads")
625- color: "#f7f7f7"
626- actions: [
627- Action {
628- text: i18n.tr("Confirm selection")
629- iconName: "tick"
630- visible: pickingMode
631- enabled: downloadsListView.ViewItems.selectedIndices.length > 0
632- onTriggered: {
633- var results = []
634- if (internalFilePicker) {
635- for (var i = 0; i < downloadsListView.ViewItems.selectedIndices.length; i++) {
636- var selectedDownload = downloadsListView.model.get(downloadsListView.ViewItems.selectedIndices[i])
637- results.push(selectedDownload.path)
638- }
639- internalFilePicker.accept(results)
640- } else {
641- for (var i = 0; i < downloadsListView.ViewItems.selectedIndices.length; i++) {
642- var selectedDownload = downloadsListView.model.get(downloadsListView.ViewItems.selectedIndices[i])
643- results.push(resultComponent.createObject(downloadsItem, {"url": "file://" + selectedDownload.path}))
644- }
645- activeTransfer.items = results
646- activeTransfer.state = ContentTransfer.Charged
647- }
648- downloadsItem.done()
649- }
650- },
651- Action {
652- text: i18n.tr("Select all")
653- iconName: "select"
654- visible: selectMode
655- onTriggered: {
656- if (downloadsListView.ViewItems.selectedIndices.length === downloadsListView.count) {
657- downloadsListView.ViewItems.selectedIndices = []
658- } else {
659- var indices = []
660- for (var i = 0; i < downloadsListView.count; ++i) {
661- indices.push(i)
662- }
663- downloadsListView.ViewItems.selectedIndices = indices
664- }
665- }
666- },
667- Action {
668- text: i18n.tr("Delete")
669- iconName: "delete"
670- visible: selectMode
671- enabled: downloadsListView.ViewItems.selectedIndices.length > 0
672- onTriggered: {
673- var toDelete = []
674- for (var i = 0; i < downloadsListView.ViewItems.selectedIndices.length; i++) {
675- var selectedDownload = downloadsListView.model.get(downloadsListView.ViewItems.selectedIndices[i])
676- toDelete.push(selectedDownload.path)
677- }
678- for (var i = 0; i < toDelete.length; i++) {
679- DownloadsModel.deleteDownload(toDelete[i])
680- }
681- downloadsListView.ViewItems.selectedIndices = []
682- downloadsItem.selectMode = false
683- }
684- },
685- Action {
686- iconName: "edit"
687- visible: !selectMode && !pickingMode
688- enabled: downloadsListView.count > 0
689- onTriggered: {
690- selectMode = true
691- multiSelect = true
692- }
693- }
694- ]
695- onBack: {
696- if (selectMode) {
697- selectMode = false
698- } else {
699- if (activeTransfer) {
700- activeTransfer.state = ContentTransfer.Aborted
701- }
702- if (internalFilePicker) {
703- internalFilePicker.reject()
704- }
705- downloadsItem.done()
706- }
707- }
708- }
709-
710 Component {
711 id: resultComponent
712- ContentItem { }
713+ ContentItem {}
714 }
715
716 ListView {
717 id: downloadsListView
718- clip: true
719+ anchors.fill: parent
720 focus: !exportPeerPicker.focus
721
722- anchors {
723- fill: parent
724- topMargin: title.height
725- }
726-
727 model: SortFilterModel {
728 model: DownloadsModel
729 filter {
730
731=== modified file 'src/app/webbrowser/HistoryView.qml'
732--- src/app/webbrowser/HistoryView.qml 2016-04-15 11:27:13 +0000
733+++ src/app/webbrowser/HistoryView.qml 2016-05-05 15:15:01 +0000
734@@ -18,21 +18,20 @@
735
736 import QtQuick 2.4
737 import Ubuntu.Components 1.3
738-import Ubuntu.Components.ListItems 1.3 as ListItems
739 import webbrowserapp.private 0.1
740 import "." as Local
741
742-FocusScope {
743+BrowserPage {
744 id: historyView
745
746 signal seeMoreEntriesClicked(var model)
747 signal newTabRequested()
748- signal done()
749-
750- Rectangle {
751- anchors.fill: parent
752- color: "#f6f6f6"
753- }
754+
755+ title: domainsListView.ViewItems.selectMode ? "" : i18n.tr("History")
756+
757+ showBackAction: !domainsListView.ViewItems.selectMode
758+ leadingActions: [closeAction]
759+ trailingActions: domainsListView.ViewItems.selectMode ? [selectAllAction, deleteAction] : []
760
761 Timer {
762 // Set the model asynchronously to ensure
763@@ -52,7 +51,7 @@
764 currentIndex: 0
765
766 anchors {
767- top: topBar.bottom
768+ top: parent.top
769 left: parent.left
770 right: parent.right
771 bottom: toolbar.top
772@@ -128,7 +127,7 @@
773
774 text: i18n.tr("Done")
775
776- onClicked: historyView.done()
777+ onClicked: historyView.back()
778 }
779
780 ToolbarAction {
781@@ -145,101 +144,49 @@
782
783 onClicked: {
784 historyView.newTabRequested()
785- historyView.done()
786- }
787- }
788- }
789-
790- Local.Toolbar {
791- id: topBar
792-
793- visible: domainsListView.ViewItems.selectMode
794- height: visible ? units.gu(7) : 0
795- color: "#f7f7f7"
796-
797- Behavior on height {
798- UbuntuNumberAnimation {}
799- }
800-
801- anchors {
802- left: parent.left
803- right: parent.right
804- top: parent.top
805- }
806-
807- ToolbarAction {
808- iconName: "close"
809- objectName: "closeButton"
810- text: i18n.tr("Cancel")
811-
812- onClicked: domainsListView.ViewItems.selectMode = false
813-
814- anchors {
815- left: parent.left
816- leftMargin: units.gu(2)
817- }
818-
819- height: parent.height - units.gu(2)
820- }
821-
822- ToolbarAction {
823- iconName: "select"
824- objectName: "selectAllButton"
825- text: i18n.tr("Select all")
826-
827- onClicked: {
828- if (domainsListView.ViewItems.selectedIndices.length === domainsListView.count) {
829- domainsListView.ViewItems.selectedIndices = []
830- } else {
831- var indices = []
832- for (var i = 0; i < domainsListView.count; ++i) {
833- indices.push(i)
834- }
835- domainsListView.ViewItems.selectedIndices = indices
836- }
837- }
838-
839- anchors {
840- right: deleteButton.left
841- rightMargin: units.gu(2)
842- }
843-
844- height: parent.height - units.gu(2)
845- }
846-
847- ToolbarAction {
848- id: deleteButton
849- objectName: "deleteButton"
850-
851- iconName: "delete"
852- text: i18n.tr("Delete")
853- enabled: domainsListView.ViewItems.selectedIndices.length > 0
854-
855- onClicked: {
856- var indices = domainsListView.ViewItems.selectedIndices
857- var domains = []
858- for (var i in indices) {
859- domains.push(domainsListView.model.get(indices[i]).domain)
860- }
861- domainsListView.ViewItems.selectMode = false
862- for (var j in domains) {
863- HistoryModel.removeEntriesByDomain(domains[j])
864- }
865- }
866-
867- anchors {
868- right: parent.right
869- rightMargin: units.gu(2)
870- }
871-
872- height: parent.height - units.gu(2)
873- }
874-
875- ListItems.ThinDivider {
876- anchors {
877- left: parent.left
878- right: parent.right
879- bottom: parent.bottom
880+ historyView.back()
881+ }
882+ }
883+ }
884+
885+ Action {
886+ id: closeAction
887+ objectName: "close"
888+ iconName: "close"
889+ onTriggered: domainsListView.ViewItems.selectMode = false
890+ }
891+
892+ Action {
893+ id: selectAllAction
894+ objectName: "selectAll"
895+ iconName: "select"
896+ onTriggered: {
897+ if (domainsListView.ViewItems.selectedIndices.length === domainsListView.count) {
898+ domainsListView.ViewItems.selectedIndices = []
899+ } else {
900+ var indices = []
901+ for (var i = 0; i < domainsListView.count; ++i) {
902+ indices.push(i)
903+ }
904+ domainsListView.ViewItems.selectedIndices = indices
905+ }
906+ }
907+ }
908+
909+ Action {
910+ id: deleteAction
911+ objectName: "delete"
912+ iconName: "delete"
913+ enabled: domainsListView.ViewItems.selectedIndices.length > 0
914+ onTriggered: {
915+ var indices = domainsListView.ViewItems.selectedIndices
916+ var domains = []
917+ for (var i in indices) {
918+ domains.push(domainsListView.model.get(indices[i]).domain)
919+ }
920+ domainsListView.ViewItems.selectMode = false
921+ for (var j in domains) {
922+ HistoryModel.removeEntriesByDomain(domains[j])
923 }
924 }
925 }
926
927=== modified file 'src/app/webbrowser/HistoryViewWide.qml'
928--- src/app/webbrowser/HistoryViewWide.qml 2016-04-15 11:27:13 +0000
929+++ src/app/webbrowser/HistoryViewWide.qml 2016-05-05 15:15:01 +0000
930@@ -18,34 +18,80 @@
931
932 import QtQuick 2.4
933 import Ubuntu.Components 1.3
934-import Ubuntu.Components.ListItems 1.3 as ListItems
935 import webbrowserapp.private 0.1
936 import "Highlight.js" as Highlight
937 import "." as Local
938
939-FocusScope {
940+BrowserPage {
941 id: historyViewWide
942
943 property bool searchMode: false
944 readonly property bool selectMode: urlsListView.ViewItems.selectMode
945- onSearchModeChanged: {
946- if (searchMode) searchQuery.focus = true
947- else {
948- searchQuery.text = ""
949- urlsListView.focus = true
950- }
951- }
952
953 signal done()
954 signal historyEntryClicked(url url)
955 signal newTabRequested()
956
957+ title: (selectMode || searchMode) ? "" : i18n.tr("History")
958+ headerContents: searchMode ? searchQuery : null
959+
960+ showBackAction: !searchMode && !selectMode
961+
962+ onBack: {
963+ if (searchMode) {
964+ searchMode = false
965+ lastVisitDateListView.forceActiveFocus()
966+ } else if (selectMode) {
967+ urlsListView.ViewItems.selectMode = false
968+ lastVisitDateListView.forceActiveFocus()
969+ } else {
970+ done()
971+ }
972+ }
973+
974+ leadingActions: [
975+ Action {
976+ objectName: "close"
977+ iconName: "close"
978+ onTriggered: {
979+ if (historyViewWide.searchMode) {
980+ historyViewWide.searchMode = false
981+ } else if (historyViewWide.selectMode) {
982+ urlsListView.ViewItems.selectMode = false
983+ }
984+ lastVisitDateListView.forceActiveFocus()
985+ }
986+ }
987+ ]
988+
989+ trailingActions: [
990+ Action {
991+ objectName: "selectAll"
992+ iconName: "select"
993+ visible: historyViewWide.selectMode
994+ onTriggered: internal.toggleSelectAll()
995+ },
996+ Action {
997+ objectName: "delete"
998+ iconName: "delete"
999+ visible: historyViewWide.selectMode
1000+ enabled: urlsListView.ViewItems.selectedIndices.length > 0
1001+ onTriggered: internal.removeSelected()
1002+ },
1003+ Action {
1004+ objectName: "search"
1005+ iconName: "search"
1006+ visible: !historyViewWide.searchMode && !historyViewWide.selectMode
1007+ onTriggered: historyViewWide.searchMode = true
1008+ }
1009+ ]
1010+
1011 Keys.onLeftPressed: lastVisitDateListView.forceActiveFocus()
1012 Keys.onRightPressed: urlsListView.forceActiveFocus()
1013- Keys.onUpPressed: if (searchMode) searchQuery.focus = true
1014+ Keys.onUpPressed: if (searchMode) searchQuery.forceActiveFocus()
1015 Keys.onPressed: {
1016 if (event.modifiers === Qt.ControlModifier && event.key === Qt.Key_F) {
1017- if (searchMode) searchQuery.focus = true
1018+ if (searchMode) searchQuery.forceActiveFocus()
1019 else if (!selectMode) searchMode = true
1020 event.accepted = true
1021 }
1022@@ -77,10 +123,6 @@
1023 }
1024 }
1025
1026- Rectangle {
1027- anchors.fill: parent
1028- }
1029-
1030 Timer {
1031 // Set the model asynchronously to ensure
1032 // the view is displayed as early as possible.
1033@@ -97,10 +139,44 @@
1034 terms: searchQuery.terms
1035 }
1036
1037+ TextField {
1038+ id: searchQuery
1039+ objectName: "searchQuery"
1040+ parent: null
1041+ anchors {
1042+ verticalCenter: parent ? parent.verticalCenter : undefined
1043+ right: parent ? parent.right : undefined
1044+ rightMargin: units.gu(2)
1045+ }
1046+ width: urlsListView.width
1047+
1048+ inputMethodHints: Qt.ImhNoPredictiveText
1049+ primaryItem: Icon {
1050+ height: parent.height - units.gu(2)
1051+ width: height
1052+ name: "search"
1053+ }
1054+ hasClearButton: true
1055+ placeholderText: i18n.tr("search history")
1056+ readonly property var terms: text.split(/\s+/g).filter(function(term) { return term.length > 0 })
1057+
1058+ Keys.onDownPressed: urlsListView.forceActiveFocus()
1059+ Keys.onEscapePressed: historyViewWide.searchMode = false
1060+
1061+ onParentChanged: {
1062+ if (historyViewWide.searchMode) {
1063+ forceActiveFocus()
1064+ } else if (urlsListView) {
1065+ text = ""
1066+ urlsListView.forceActiveFocus()
1067+ }
1068+ }
1069+ }
1070+
1071 Row {
1072 id: historyViewWideRow
1073 anchors {
1074- top: topBar.bottom
1075+ top: parent.top
1076 left: parent.left
1077 bottom: bottomToolbar.top
1078 leftMargin: units.gu(2)
1079@@ -203,7 +279,7 @@
1080
1081 Keys.onUpPressed: {
1082 if (searchMode) {
1083- searchQuery.focus = true
1084+ searchQuery.forceActiveFocus()
1085 } else {
1086 event.accepted = false
1087 }
1088@@ -320,152 +396,6 @@
1089 }
1090
1091 Local.Toolbar {
1092- id: topBar
1093-
1094- height: units.gu(7)
1095- color: "#f7f7f7"
1096-
1097- anchors {
1098- left: parent.left
1099- right: parent.right
1100- top: parent.top
1101- }
1102-
1103- Keys.onEscapePressed: {
1104- if (searchQuery.activeFocus) {
1105- historyViewWide.searchMode = false
1106- } else {
1107- event.accepted = false
1108- }
1109- }
1110-
1111- Label {
1112- visible: !urlsListView.ViewItems.selectMode &&
1113- !historyViewWide.searchMode
1114-
1115- anchors {
1116- top: parent.top
1117- left: parent.left
1118- topMargin: units.gu(2)
1119- leftMargin: units.gu(2)
1120- }
1121-
1122- text: i18n.tr("History")
1123- }
1124-
1125- ToolbarAction {
1126- objectName: "backButton"
1127-
1128- visible: historyViewWide.selectMode || historyViewWide.searchMode
1129-
1130- anchors {
1131- top: parent.top
1132- left: parent.left
1133- leftMargin: units.gu(2)
1134- }
1135- height: parent.height - units.gu(2)
1136-
1137- iconName: "back"
1138- text: i18n.tr("Cancel")
1139-
1140- onClicked: {
1141- if (historyViewWide.searchMode) {
1142- historyViewWide.searchMode = false
1143- } else {
1144- urlsListView.ViewItems.selectMode = false
1145- }
1146- lastVisitDateListView.forceActiveFocus()
1147- }
1148- }
1149-
1150- ToolbarAction {
1151- objectName: "selectButton"
1152-
1153- visible: urlsListView.ViewItems.selectMode
1154-
1155- anchors {
1156- top: parent.top
1157- right: deleteButton.left
1158- rightMargin: units.gu(2)
1159- }
1160- height: parent.height - units.gu(2)
1161-
1162- iconName: "select"
1163- text: i18n.tr("Select all")
1164-
1165- onClicked: internal.toggleSelectAll()
1166- }
1167-
1168- ToolbarAction {
1169- id: deleteButton
1170- objectName: "deleteButton"
1171-
1172- visible: urlsListView.ViewItems.selectMode
1173-
1174- anchors {
1175- top: parent.top
1176- right: parent.right
1177- rightMargin: units.gu(2)
1178- }
1179- height: parent.height - units.gu(2)
1180-
1181- iconName: "delete"
1182- text: i18n.tr("Delete")
1183- enabled: urlsListView.ViewItems.selectedIndices.length > 0
1184- onClicked: internal.removeSelected()
1185- }
1186-
1187- TextField {
1188- id: searchQuery
1189- objectName: "searchQuery"
1190- anchors {
1191- verticalCenter: parent.verticalCenter
1192- right: parent.right
1193- rightMargin: units.gu(2)
1194- }
1195- width: urlsListView.width
1196- inputMethodHints: Qt.ImhNoPredictiveText
1197- primaryItem: Icon {
1198- height: parent.height - units.gu(2)
1199- width: height
1200- name: "search"
1201- }
1202- hasClearButton: true
1203- placeholderText: i18n.tr("search history")
1204- visible: historyViewWide.searchMode
1205- readonly property var terms: text.split(/\s+/g).filter(function(term) { return term.length > 0 })
1206-
1207- Keys.onDownPressed: urlsListView.focus = true
1208- }
1209-
1210- ToolbarAction {
1211- id: searchButton
1212- iconName: "search"
1213- objectName: "searchButton"
1214- visible: !urlsListView.ViewItems.selectMode &&
1215- !historyViewWide.searchMode
1216- anchors {
1217- verticalCenter: parent.verticalCenter
1218- right: parent.right
1219- rightMargin: units.gu(3.5)
1220- }
1221- height: parent.height - units.gu(2)
1222- onClicked: {
1223- historyViewWide.searchMode = true
1224- searchQuery.forceActiveFocus()
1225- }
1226- }
1227-
1228- ListItems.ThinDivider {
1229- anchors {
1230- left: parent.left
1231- right: parent.right
1232- bottom: parent.bottom
1233- }
1234- }
1235- }
1236-
1237- Local.Toolbar {
1238 id: bottomToolbar
1239 height: units.gu(7)
1240
1241@@ -502,10 +432,7 @@
1242 text: i18n.tr("New tab")
1243 iconName: "tab-new"
1244
1245- onClicked: {
1246- historyViewWide.newTabRequested()
1247- historyViewWide.done()
1248- }
1249+ onClicked: historyViewWide.newTabRequested()
1250 }
1251 }
1252
1253
1254=== modified file 'src/app/webbrowser/SettingsPage.qml'
1255--- src/app/webbrowser/SettingsPage.qml 2016-04-04 11:44:02 +0000
1256+++ src/app/webbrowser/SettingsPage.qml 2016-05-05 15:15:01 +0000
1257@@ -25,120 +25,109 @@
1258
1259 import "../UrlUtils.js" as UrlUtils
1260
1261-Item {
1262+FocusScope {
1263 id: settingsItem
1264
1265 property QtObject settingsObject
1266
1267 signal done()
1268
1269- Rectangle {
1270- anchors.fill: parent
1271- color: "#f6f6f6"
1272- }
1273-
1274 SearchEngines {
1275 id: searchEngines
1276 searchPaths: searchEnginesSearchPaths
1277 }
1278
1279- BrowserPageHeader {
1280- id: title
1281+ BrowserPage {
1282+ title: i18n.tr("Settings")
1283+
1284+ anchors.fill: parent
1285+ visible: !subpageContainer.visible
1286+ focus: true
1287
1288 onBack: settingsItem.done()
1289- text: i18n.tr("Settings")
1290- visible: !subpageContainer.visible
1291- }
1292-
1293- Flickable {
1294- anchors {
1295- top: title.bottom
1296- left: parent.left
1297- right: parent.right
1298- bottom: parent.bottom
1299- }
1300-
1301- visible: !subpageContainer.visible
1302- clip: true
1303- contentHeight: settingsCol.height
1304-
1305- Column {
1306- id: settingsCol
1307-
1308- width: parent.width
1309-
1310- ListItem {
1311- id: searchEngineListItem
1312- objectName: "searchengine"
1313- readonly property string currentSearchEngineDisplayName: currentSearchEngine.name
1314-
1315- SearchEngine {
1316- id: currentSearchEngine
1317- searchPaths: searchEngines.searchPaths
1318- filename: settingsObject.searchEngine
1319- }
1320-
1321- ListItemLayout {
1322- title.text: i18n.tr("Search engine")
1323- subtitle.text: searchEngineListItem.currentSearchEngineDisplayName
1324- ProgressionSlot {}
1325- }
1326-
1327- visible: searchEngines.engines.count > 1
1328- onClicked: searchEngineComponent.createObject(subpageContainer)
1329- }
1330-
1331- ListItem {
1332- id: homepageListItem
1333- objectName: "homepage"
1334- readonly property url currentHomepage: settingsObject.homepage
1335-
1336- ListItemLayout {
1337- title.text: i18n.tr("Homepage")
1338- subtitle.text: homepageListItem.currentHomepage
1339- }
1340-
1341- onClicked: PopupUtils.open(homepageDialog)
1342- }
1343-
1344- ListItem {
1345- objectName: "restoreSession"
1346-
1347- ListItemLayout {
1348- title.text: i18n.tr("Restore previous session at startup")
1349- CheckBox {
1350- id: restoreSessionCheckbox
1351- SlotsLayout.position: SlotsLayout.Trailing
1352- onTriggered: settingsObject.restoreSession = checked
1353- }
1354- }
1355-
1356- Binding {
1357- target: restoreSessionCheckbox
1358- property: "checked"
1359- value: settingsObject.restoreSession
1360- }
1361- }
1362-
1363- ListItem {
1364- objectName: "privacy"
1365-
1366- ListItemLayout {
1367- title.text: i18n.tr("Privacy & permissions")
1368- ProgressionSlot {}
1369- }
1370-
1371- onClicked: privacyComponent.createObject(subpageContainer)
1372- }
1373-
1374- ListItem {
1375- objectName: "reset"
1376-
1377- ListItemLayout {
1378- title.text: i18n.tr("Reset browser settings")
1379- }
1380-
1381- onClicked: settingsObject.restoreDefaults()
1382+
1383+ Flickable {
1384+ anchors.fill: parent
1385+ contentHeight: settingsCol.height
1386+
1387+ Column {
1388+ id: settingsCol
1389+
1390+ width: parent.width
1391+
1392+ ListItem {
1393+ id: searchEngineListItem
1394+ objectName: "searchengine"
1395+ readonly property string currentSearchEngineDisplayName: currentSearchEngine.name
1396+
1397+ SearchEngine {
1398+ id: currentSearchEngine
1399+ searchPaths: searchEngines.searchPaths
1400+ filename: settingsObject.searchEngine
1401+ }
1402+
1403+ ListItemLayout {
1404+ title.text: i18n.tr("Search engine")
1405+ subtitle.text: searchEngineListItem.currentSearchEngineDisplayName
1406+ ProgressionSlot {}
1407+ }
1408+
1409+ visible: searchEngines.engines.count > 1
1410+ onClicked: searchEngineComponent.createObject(subpageContainer)
1411+ }
1412+
1413+ ListItem {
1414+ id: homepageListItem
1415+ objectName: "homepage"
1416+ readonly property url currentHomepage: settingsObject.homepage
1417+
1418+ ListItemLayout {
1419+ title.text: i18n.tr("Homepage")
1420+ subtitle.text: homepageListItem.currentHomepage
1421+ }
1422+
1423+ onClicked: PopupUtils.open(homepageDialog)
1424+ }
1425+
1426+ ListItem {
1427+ objectName: "restoreSession"
1428+
1429+ ListItemLayout {
1430+ title.text: i18n.tr("Restore previous session at startup")
1431+ CheckBox {
1432+ id: restoreSessionCheckbox
1433+ SlotsLayout.position: SlotsLayout.Trailing
1434+ onTriggered: settingsObject.restoreSession = checked
1435+ }
1436+ }
1437+
1438+ Binding {
1439+ target: restoreSessionCheckbox
1440+ property: "checked"
1441+ value: settingsObject.restoreSession
1442+ }
1443+ }
1444+
1445+ ListItem {
1446+ objectName: "privacy"
1447+
1448+ ListItemLayout {
1449+ title.text: i18n.tr("Privacy & permissions")
1450+ ProgressionSlot {}
1451+ }
1452+
1453+ onClicked: privacyComponent.createObject(subpageContainer)
1454+ }
1455+
1456+ ListItem {
1457+ objectName: "reset"
1458+
1459+ ListItemLayout {
1460+ title.text: i18n.tr("Reset browser settings")
1461+ }
1462+
1463+ onClicked: settingsObject.restoreDefaults()
1464+ }
1465 }
1466 }
1467 }
1468@@ -152,31 +141,16 @@
1469 Component {
1470 id: searchEngineComponent
1471
1472- Item {
1473+ BrowserPage {
1474 id: searchEngineItem
1475 objectName: "searchEnginePage"
1476 anchors.fill: parent
1477
1478- Rectangle {
1479- anchors.fill: parent
1480- color: "#f6f6f6"
1481- }
1482-
1483- BrowserPageHeader {
1484- id: searchEngineTitle
1485-
1486- onBack: searchEngineItem.destroy()
1487- text: i18n.tr("Search engine")
1488- }
1489+ onBack: searchEngineItem.destroy()
1490+ title: i18n.tr("Search engine")
1491
1492 ListView {
1493- anchors {
1494- top: searchEngineTitle.bottom
1495- left: parent.left
1496- right: parent.right
1497- bottom: parent.bottom
1498- }
1499- clip: true
1500+ anchors.fill: parent
1501
1502 model: searchEngines.engines
1503
1504@@ -209,33 +183,17 @@
1505 Component {
1506 id: privacyComponent
1507
1508- Item {
1509+ BrowserPage {
1510 id: privacyItem
1511 objectName: "privacySettings"
1512
1513 anchors.fill: parent
1514
1515- Rectangle {
1516- anchors.fill: parent
1517- color: "#f6f6f6"
1518- }
1519-
1520- BrowserPageHeader {
1521- id: privacyTitle
1522- onBack: privacyItem.destroy()
1523- text: i18n.tr("Privacy & permissions")
1524- }
1525+ onBack: privacyItem.destroy()
1526+ title: i18n.tr("Privacy & permissions")
1527
1528 Flickable {
1529- anchors {
1530- top: privacyTitle.bottom
1531- left: parent.left
1532- right: parent.right
1533- bottom: parent.bottom
1534- }
1535-
1536- clip: true
1537-
1538+ anchors.fill: parent
1539 contentHeight: privacyCol.height
1540
1541 Column {
1542@@ -375,33 +333,16 @@
1543 Component {
1544 id: mediaAccessComponent
1545
1546- Item {
1547+ BrowserPage {
1548 id: mediaAccessItem
1549 objectName: "mediaAccessSettings"
1550 anchors.fill: parent
1551
1552- Rectangle {
1553- anchors.fill: parent
1554- color: "#f6f6f6"
1555- }
1556-
1557- BrowserPageHeader {
1558- id: mediaAccessTitle
1559-
1560- onBack: mediaAccessItem.destroy()
1561- text: i18n.tr("Camera & microphone")
1562- }
1563+ onBack: mediaAccessItem.destroy()
1564+ title: i18n.tr("Camera & microphone")
1565
1566 Flickable {
1567- anchors {
1568- top: mediaAccessTitle.bottom
1569- left: parent.left
1570- right: parent.right
1571- bottom: parent.bottom
1572- }
1573-
1574- clip: true
1575-
1576+ anchors.fill: parent
1577 contentHeight: mediaAccessCol.height
1578
1579 Column {
1580@@ -454,4 +395,3 @@
1581 }
1582 }
1583 }
1584-
1585
1586=== modified file 'tests/autopilot/webbrowser_app/emulators/browser.py'
1587--- tests/autopilot/webbrowser_app/emulators/browser.py 2016-03-21 16:13:49 +0000
1588+++ tests/autopilot/webbrowser_app/emulators/browser.py 2016-05-05 15:15:01 +0000
1589@@ -502,10 +502,21 @@
1590 self.pointing_device.click_object(action)
1591
1592
1593-class SettingsPage(uitk.UbuntuUIToolkitCustomProxyObjectBase):
1594+class PageHeader(uitk.UbuntuUIToolkitCustomProxyObjectBase):
1595+
1596+ @autopilot.logging.log_action(logger.info)
1597+ def click_back_button(self):
1598+ button = self.select_single(objectName="back_button")
1599+ self.pointing_device.click_object(button)
1600+
1601+
1602+class BrowserPage(uitk.UbuntuUIToolkitCustomProxyObjectBase):
1603
1604 def get_header(self):
1605- return self.select_single(BrowserPageHeader)
1606+ return self.select_single(PageHeader)
1607+
1608+
1609+class SettingsPage(BrowserPage):
1610
1611 def get_searchengine_entry(self):
1612 return self.select_single(objectName="searchengine")
1613@@ -529,18 +540,9 @@
1614 return self.select_single(objectName="reset")
1615
1616
1617-class DownloadsPage(uitk.UbuntuUIToolkitCustomProxyObjectBase):
1618-
1619- def get_header(self):
1620- return self.select_single(BrowserPageHeader)
1621-
1622-
1623-class BrowserPageHeader(uitk.UbuntuUIToolkitCustomProxyObjectBase):
1624-
1625- @autopilot.logging.log_action(logger.info)
1626- def click_back_button(self):
1627- button = self.select_single(objectName="backButton")
1628- self.pointing_device.click_object(button)
1629+class DownloadsPage(BrowserPage):
1630+
1631+ pass
1632
1633
1634 class HistoryView(uitk.UbuntuUIToolkitCustomProxyObjectBase):
1635
1636=== modified file 'tests/autopilot/webbrowser_app/tests/test_keyboard.py'
1637--- tests/autopilot/webbrowser_app/tests/test_keyboard.py 2016-04-13 15:12:05 +0000
1638+++ tests/autopilot/webbrowser_app/tests/test_keyboard.py 2016-05-05 15:15:01 +0000
1639@@ -370,7 +370,7 @@
1640
1641 self.main_window.press_key('Escape')
1642 self.assertThat(history_view.searchMode, Eventually(Equals(False)))
1643- self.assertThat(search_field.visible, Equals(False))
1644+ search_field.wait_until_destroyed()
1645
1646 self.main_window.press_key('Escape')
1647 history_view.wait_until_destroyed()
1648
1649=== modified file 'tests/autopilot/webbrowser_app/tests/test_settings.py'
1650--- tests/autopilot/webbrowser_app/tests/test_settings.py 2016-02-26 08:36:49 +0000
1651+++ tests/autopilot/webbrowser_app/tests/test_settings.py 2016-05-05 15:15:01 +0000
1652@@ -49,7 +49,7 @@
1653 self.pointing_device.click_object(searchengine)
1654 searchengine_page = settings.get_searchengine_page()
1655 searchengine_header = searchengine_page.select_single(
1656- browser.BrowserPageHeader)
1657+ browser.PageHeader)
1658 searchengine_header.click_back_button()
1659 searchengine_page.wait_until_destroyed()
1660 self.assertThat(searchengine.currentSearchEngineDisplayName,
1661@@ -123,7 +123,7 @@
1662 privacy = settings.get_privacy_entry()
1663 self.pointing_device.click_object(privacy)
1664 privacy_page = settings.get_privacy_page()
1665- privacy_header = privacy_page.select_single(browser.BrowserPageHeader)
1666+ privacy_header = privacy_page.select_single(browser.PageHeader)
1667 privacy_header.click_back_button()
1668 privacy_page.wait_until_destroyed()
1669
1670
1671=== modified file 'tests/unittests/qml/tst_BookmarksView.qml'
1672--- tests/unittests/qml/tst_BookmarksView.qml 2016-02-04 16:39:47 +0000
1673+++ tests/unittests/qml/tst_BookmarksView.qml 2016-05-05 15:15:01 +0000
1674@@ -43,9 +43,9 @@
1675 }
1676
1677 SignalSpy {
1678- id: doneSpy
1679+ id: backSpy
1680 target: view
1681- signalName: "done"
1682+ signalName: "back"
1683 }
1684
1685 SignalSpy {
1686@@ -63,7 +63,7 @@
1687 populate()
1688 verify(view.activeFocus)
1689 compare(bookmarkEntryClickedSpy.count, 0)
1690- compare(doneSpy.count, 0)
1691+ compare(backSpy.count, 0)
1692 compare(newTabClickedSpy.count, 0)
1693 }
1694
1695@@ -77,14 +77,14 @@
1696 function cleanup() {
1697 BookmarksModel.databasePath = ""
1698 bookmarkEntryClickedSpy.clear()
1699- doneSpy.clear()
1700+ backSpy.clear()
1701 newTabClickedSpy.clear()
1702 }
1703
1704- function test_done() {
1705+ function test_back() {
1706 var button = findChild(view, "doneButton")
1707 clickItem(button)
1708- compare(doneSpy.count, 1)
1709+ compare(backSpy.count, 1)
1710 }
1711
1712 function test_new_tab() {
1713
1714=== modified file 'tests/unittests/qml/tst_BookmarksViewWide.qml'
1715--- tests/unittests/qml/tst_BookmarksViewWide.qml 2015-11-17 17:19:13 +0000
1716+++ tests/unittests/qml/tst_BookmarksViewWide.qml 2016-05-05 15:15:01 +0000
1717@@ -1,5 +1,5 @@
1718 /*
1719- * Copyright 2015 Canonical Ltd.
1720+ * Copyright 2015-2016 Canonical Ltd.
1721 *
1722 * This file is part of webbrowser-app.
1723 *
1724@@ -40,9 +40,9 @@
1725 }
1726
1727 SignalSpy {
1728- id: doneSpy
1729+ id: backSpy
1730 target: view
1731- signalName: "done"
1732+ signalName: "back"
1733 }
1734
1735 SignalSpy {
1736@@ -60,7 +60,7 @@
1737 populate()
1738 view.forceActiveFocus()
1739 compare(bookmarkEntryClickedSpy.count, 0)
1740- compare(doneSpy.count, 0)
1741+ compare(backSpy.count, 0)
1742 compare(newTabClickedSpy.count, 0)
1743 }
1744
1745@@ -74,14 +74,14 @@
1746 function cleanup() {
1747 BookmarksModel.databasePath = ""
1748 bookmarkEntryClickedSpy.clear()
1749- doneSpy.clear()
1750+ backSpy.clear()
1751 newTabClickedSpy.clear()
1752 }
1753
1754- function test_done() {
1755+ function test_back() {
1756 var button = findChild(view, "doneButton")
1757 clickItem(button)
1758- compare(doneSpy.count, 1)
1759+ compare(backSpy.count, 1)
1760 }
1761
1762 function test_new_tab() {
1763
1764=== added file 'tests/unittests/qml/tst_BrowserPage.qml'
1765--- tests/unittests/qml/tst_BrowserPage.qml 1970-01-01 00:00:00 +0000
1766+++ tests/unittests/qml/tst_BrowserPage.qml 2016-05-05 15:15:01 +0000
1767@@ -0,0 +1,151 @@
1768+/*
1769+ * Copyright 2016 Canonical Ltd.
1770+ *
1771+ * This file is part of webbrowser-app.
1772+ *
1773+ * webbrowser-app is free software; you can redistribute it and/or modify
1774+ * it under the terms of the GNU General Public License as published by
1775+ * the Free Software Foundation; version 3.
1776+ *
1777+ * webbrowser-app is distributed in the hope that it will be useful,
1778+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1779+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1780+ * GNU General Public License for more details.
1781+ *
1782+ * You should have received a copy of the GNU General Public License
1783+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1784+ */
1785+
1786+import QtQuick 2.4
1787+import QtTest 1.0
1788+import Ubuntu.Components 1.3
1789+import "../../../src/app/webbrowser"
1790+
1791+FocusScope {
1792+ id: root
1793+
1794+ focus: true
1795+
1796+ width: 200
1797+ height: 200
1798+
1799+ MouseArea {
1800+ id: mouseArea
1801+ anchors.fill: parent
1802+ acceptedButtons: Qt.AllButtons
1803+
1804+ property int clicked: 0
1805+ onClicked: ++clicked
1806+ }
1807+
1808+ Loader {
1809+ id: pageLoader
1810+ anchors.fill: parent
1811+ active: false
1812+ focus: true
1813+ sourceComponent: BrowserPage {
1814+ anchors.fill: parent
1815+ focus: true
1816+ readonly property var theContents: theContents
1817+ Item {
1818+ id: theContents
1819+ anchors.fill: parent
1820+ focus: true
1821+ }
1822+ }
1823+ }
1824+
1825+ readonly property alias page: pageLoader.item
1826+
1827+ SignalSpy {
1828+ id: backSpy
1829+ target: root.page
1830+ signalName: "back"
1831+ }
1832+
1833+ Action {
1834+ id: anAction
1835+ objectName: "anAction"
1836+ iconName: "like"
1837+ property int triggered: 0
1838+ onTriggered: ++triggered
1839+ }
1840+
1841+ WebbrowserTestCase {
1842+ name: "BrowserPage"
1843+ when: windowShown
1844+
1845+ function longPressItem(item) {
1846+ var center = centerOf(item)
1847+ mousePress(item, center.x, center.y)
1848+ mouseRelease(item, center.x, center.y, Qt.LeftButton, Qt.NoModifier, 2000)
1849+ }
1850+
1851+ function init() {
1852+ pageLoader.active = true
1853+ mouseArea.clicked = 0
1854+ anAction.triggered = 0
1855+ backSpy.clear()
1856+ }
1857+
1858+ function cleanup() {
1859+ pageLoader.active = false
1860+ compare(mouseArea.clicked, 0)
1861+ }
1862+
1863+ function test_focus_transfer() {
1864+ verify(root.page.theContents.activeFocus)
1865+ }
1866+
1867+ function test_clicks_do_not_go_through() {
1868+ clickItem(root.page, Qt.LeftButton)
1869+ clickItem(root.page, Qt.RightButton)
1870+ clickItem(root.page, Qt.MiddleButton)
1871+ }
1872+
1873+ function test_press_back_button() {
1874+ var backButton = findChild(root.page, "back_button")
1875+ tryCompare(backButton, "visible", true)
1876+ clickItem(backButton)
1877+ compare(backSpy.count, 1)
1878+ }
1879+
1880+ function test_esc_is_back() {
1881+ keyClick(Qt.Key_Escape)
1882+ compare(backSpy.count, 1)
1883+ }
1884+
1885+ function test_leading_actions() {
1886+ compare(page.leadingActions.length, 0)
1887+
1888+ page.showBackAction = false
1889+ compare(findChild(root.page, "back_button"), null)
1890+ compare(findChild(root.page, "anAction_button"), null)
1891+
1892+ page.leadingActions = [anAction]
1893+ var actionButton = findChild(root.page, "anAction_button")
1894+ tryCompare(actionButton, "visible", true)
1895+ clickItem(actionButton)
1896+ compare(anAction.triggered, 1)
1897+
1898+ page.showBackAction = true
1899+ compare(findChild(root.page, "anAction_button"), null)
1900+ var backButton = findChild(root.page, "back_button")
1901+ tryCompare(backButton, "visible", true)
1902+ }
1903+
1904+ function test_trailing_actions() {
1905+ compare(page.trailingActions.length, 0)
1906+
1907+ page.trailingActions = [anAction]
1908+ var actionButton = findChild(root.page, "anAction_button")
1909+ tryCompare(actionButton, "visible", true)
1910+ clickItem(actionButton)
1911+ compare(anAction.triggered, 1)
1912+ verify(findChild(root.page, "back_button").visible)
1913+
1914+ page.trailingActions = []
1915+ compare(findChild(root.page, "anAction_button"), null)
1916+ }
1917+ }
1918+}
1919
1920=== modified file 'tests/unittests/qml/tst_HistoryView.qml'
1921--- tests/unittests/qml/tst_HistoryView.qml 2016-02-04 16:39:47 +0000
1922+++ tests/unittests/qml/tst_HistoryView.qml 2016-05-05 15:15:01 +0000
1923@@ -54,9 +54,9 @@
1924 }
1925
1926 SignalSpy {
1927- id: doneSpy
1928+ id: backSpy
1929 target: historyView
1930- signalName: "done"
1931+ signalName: "back"
1932 }
1933
1934 WebbrowserTestCase {
1935@@ -74,7 +74,7 @@
1936 waitForRendering(domainsList)
1937 tryCompare(domainsList, "count", 3)
1938 compare(seeMoreEntriesClickedSpy.count, 0)
1939- compare(doneSpy.count, 0)
1940+ compare(backSpy.count, 0)
1941 }
1942
1943 function populate() {
1944@@ -88,20 +88,20 @@
1945 historyViewLoader.active = false
1946 HistoryModel.databasePath = ""
1947 seeMoreEntriesClickedSpy.clear()
1948- doneSpy.clear()
1949+ backSpy.clear()
1950 }
1951
1952- function test_done() {
1953+ function test_back() {
1954 var button = findChild(historyView, "doneButton")
1955 clickItem(button)
1956- compare(doneSpy.count, 1)
1957+ compare(backSpy.count, 1)
1958 }
1959
1960 function test_new_tab() {
1961 var action = findChild(historyView, "newTabAction")
1962 clickItem(action)
1963 compare(newTabRequestedSpy.count, 1)
1964- compare(doneSpy.count, 1)
1965+ compare(backSpy.count, 1)
1966 }
1967
1968 function test_see_more_entries() {
1969@@ -128,7 +128,7 @@
1970 longPressItem(first)
1971 tryCompare(first, "selectMode", true)
1972
1973- var closeButton = findChild(historyView, "closeButton")
1974+ var closeButton = findChild(historyView, "close_button")
1975 clickItem(closeButton)
1976 tryCompare(first, "selectMode", false)
1977 }
1978@@ -148,7 +148,7 @@
1979 clickItem(third)
1980 tryCompare(third, "selected", true)
1981
1982- var deleteButton = findChild(historyView, "deleteButton")
1983+ var deleteButton = findChild(historyView, "delete_button")
1984 clickItem(deleteButton)
1985 tryCompare(first, "selectMode", false)
1986 tryCompare(HistoryModel, "count", 1)
1987@@ -165,10 +165,10 @@
1988 tryCompare(first, "selected", true)
1989 verify(!second.selected)
1990 verify(!third.selected)
1991- var deleteButton = findChild(historyView, "deleteButton")
1992+ var deleteButton = findChild(historyView, "delete_button")
1993 verify(deleteButton.enabled)
1994
1995- var selectAllButton = findChild(historyView, "selectAllButton")
1996+ var selectAllButton = findChild(historyView, "selectAll_button")
1997 clickItem(selectAllButton)
1998 verify(first.selected)
1999 tryCompare(second, "selected", true)
2000
2001=== modified file 'tests/unittests/qml/tst_HistoryViewWide.qml'
2002--- tests/unittests/qml/tst_HistoryViewWide.qml 2015-12-03 09:00:24 +0000
2003+++ tests/unittests/qml/tst_HistoryViewWide.qml 2016-05-05 15:15:01 +0000
2004@@ -1,5 +1,5 @@
2005 /*
2006- * Copyright 2015 Canonical Ltd.
2007+ * Copyright 2015-2016 Canonical Ltd.
2008 *
2009 * This file is part of webbrowser-app.
2010 *
2011@@ -113,7 +113,6 @@
2012 newTabRequestedSpy.clear()
2013 clickItem(newTabButton)
2014 compare(newTabRequestedSpy.count, 1)
2015- compare(doneSpy.count, 1)
2016 }
2017
2018 function test_history_entry_clicked() {
2019@@ -130,18 +129,23 @@
2020 function test_selection_mode() {
2021 var urlsList = findChild(historyViewWide, "urlsListView")
2022 compare(urlsList.count, 3)
2023- var backButton = findChild(historyViewWide, "backButton")
2024- var selectButton = findChild(historyViewWide, "selectButton")
2025- var deleteButton = findChild(historyViewWide, "deleteButton")
2026- verify(!backButton.visible)
2027- verify(!selectButton.visible)
2028- verify(!deleteButton.visible)
2029+ var backButton = findChild(historyViewWide, "back_button")
2030+ var selectButton = findChild(historyViewWide, "selectAll_button")
2031+ var deleteButton = findChild(historyViewWide, "delete_button")
2032+ verify(backButton.visible)
2033+ compare(selectButton, null)
2034+ compare(deleteButton, null)
2035 longPressItem(urlsList.children[0])
2036- verify(backButton.visible)
2037+ backButton = findChild(historyViewWide, "back_button")
2038+ compare(backButton, null)
2039+ selectButton = findChild(historyViewWide, "selectAll_button")
2040 verify(selectButton.visible)
2041+ deleteButton = findChild(historyViewWide, "delete_button")
2042 verify(deleteButton.visible)
2043- clickItem(backButton)
2044- verify(!backButton.visible)
2045+ var closeButton = findChild(historyViewWide, "close_button")
2046+ clickItem(closeButton)
2047+ backButton = findChild(historyViewWide, "back_button")
2048+ verify(backButton.visible)
2049 verify(!selectButton.visible)
2050 verify(!deleteButton.visible)
2051 }
2052@@ -152,12 +156,12 @@
2053 longPressItem(urlsList.children[0])
2054 var selectedIndices = urlsList.ViewItems.selectedIndices
2055 compare(selectedIndices.length, 1)
2056- var selectButton = findChild(historyViewWide, "selectButton")
2057+ var selectButton = findChild(historyViewWide, "selectAll_button")
2058 clickItem(selectButton)
2059 compare(selectedIndices.length, urlsList.count)
2060 clickItem(selectButton)
2061- var backButton = findChild(historyViewWide, "backButton")
2062- clickItem(backButton)
2063+ var closeButton = findChild(historyViewWide, "close_button")
2064+ clickItem(closeButton)
2065 }
2066
2067 function test_delete_button() {
2068@@ -165,7 +169,7 @@
2069 compare(urlsList.count, 3)
2070 var deletedUrl = urlsList.model.get(0).url
2071 longPressItem(urlsList.children[0])
2072- var deleteButton = findChild(historyViewWide, "deleteButton")
2073+ var deleteButton = findChild(historyViewWide, "delete_button")
2074 clickItem(deleteButton)
2075 compare(urlsList.count, 2)
2076 for (var i = 0; i < urlsList.count; ++i) {
2077@@ -188,13 +192,14 @@
2078
2079 function test_search_button() {
2080 var searchQuery = findChild(historyViewWide, "searchQuery")
2081- verify(!searchQuery.visible)
2082+ compare(searchQuery, null)
2083
2084- var searchButton = findChild(historyViewWide, "searchButton")
2085+ var searchButton = findChild(historyViewWide, "search_button")
2086 verify(searchButton.visible)
2087 clickItem(searchButton)
2088 verify(!searchButton.visible)
2089
2090+ searchQuery = findChild(historyViewWide, "searchQuery")
2091 verify(searchQuery.visible)
2092 verify(searchQuery.activeFocus)
2093 compare(searchQuery.text, "")
2094@@ -204,12 +209,12 @@
2095 typeString("2")
2096 compare(urlsList.count, 1)
2097
2098- var backButton = findChild(historyViewWide, "backButton")
2099- verify(backButton.visible)
2100- clickItem(backButton)
2101- verify(!backButton.visible)
2102- verify(!searchQuery.visible)
2103- verify(searchButton.visible)
2104+ var closeButton = findChild(historyViewWide, "close_button")
2105+ verify(closeButton.visible)
2106+ clickItem(closeButton)
2107+ verify(closeButton.visible)
2108+ searchButton = findChild(historyViewWide, "search_button")
2109+ tryCompare(searchButton, "visible", true)
2110 compare(urlsList.count, 3)
2111
2112 clickItem(searchButton)
2113@@ -242,11 +247,11 @@
2114 function test_ctrl_f_during_search_returns_to_query() {
2115 var urlsList = findChild(historyViewWide, "urlsListView")
2116 var datesList = findChild(historyViewWide, "lastVisitDateListView")
2117- var searchQuery = findChild(historyViewWide, "searchQuery")
2118
2119 verify(urlsList.activeFocus)
2120 verify(!historyViewWide.searchMode)
2121 keyClick(Qt.Key_F, Qt.ControlModifier)
2122+ var searchQuery = findChild(historyViewWide, "searchQuery")
2123 verify(searchQuery.activeFocus)
2124 verify(historyViewWide.searchMode)
2125
2126@@ -303,10 +308,10 @@
2127 return "<font color=\"%1\">%2</font>".arg("#752571").arg(term)
2128 }
2129
2130- var searchButton = findChild(historyViewWide, "searchButton")
2131- var searchQuery = findChild(historyViewWide, "searchQuery")
2132+ var searchButton = findChild(historyViewWide, "search_button")
2133 var urlsList = findChild(historyViewWide, "urlsListView")
2134 clickItem(searchButton)
2135+ verify(!searchButton.visible)
2136
2137 var term = "2"
2138 typeString(term)
2139@@ -314,12 +319,19 @@
2140 compare(items.length, 1)
2141 compare(items[0].title, wraphtml("Example Domain " + highlight(term)))
2142
2143- var backButton = findChild(historyViewWide, "backButton")
2144- clickItem(backButton)
2145+ var closeButton = findChild(historyViewWide, "close_button")
2146+ clickItem(closeButton)
2147+ verify(!historyViewWide.searchMode)
2148+ searchButton = findChild(historyViewWide, "search_button")
2149+ tryCompare(searchButton, "visible", true)
2150 clickItem(searchButton)
2151+ tryCompare(historyViewWide, "searchMode", true)
2152+ var searchQuery = findChild(historyViewWide, "searchQuery")
2153+ verify(searchQuery.activeFocus)
2154
2155 var terms = ["1", "Example"]
2156 typeString(terms.join(" "))
2157+ tryCompare(searchQuery, "text", "1 Example")
2158 items = getListItems(urlsList, "historyDelegate")
2159 compare(items.length, 1)
2160 compare(items[0].title, wraphtml("%1 Domain %0"
2161@@ -342,7 +354,6 @@
2162 keyClick(Qt.Key_Left)
2163 }
2164
2165- var searchQuery = findChild(historyViewWide, "searchQuery")
2166 var today = new Date()
2167 today = new Date(today.getFullYear(), today.getMonth(), today.getDate())
2168 var youngest = new Date(1912, 6, 23)
2169@@ -363,6 +374,7 @@
2170 clickItem(testItem)
2171 verify(testItem.activeFocus)
2172 keyClick(Qt.Key_F, Qt.ControlModifier)
2173+ var searchQuery = findChild(historyViewWide, "searchQuery")
2174 typeString("Alan")
2175 urls = getListItems(urlsListView, "historyDelegate")
2176 compare(urls.length, 1)
2177@@ -372,9 +384,10 @@
2178 // change the search terms so that it will display more items, but
2179 // since we have a selected date, we will see only one
2180 keyClick(Qt.Key_F, Qt.ControlModifier)
2181- keyClick(Qt.Key_Backspace)
2182- keyClick(Qt.Key_Backspace)
2183- compare(searchQuery.text, "Al")
2184+ tryCompare(searchQuery, "activeFocus", true)
2185+ keyClick(Qt.Key_Backspace)
2186+ keyClick(Qt.Key_Backspace)
2187+ tryCompare(searchQuery, "text", "Al")
2188 returnToDatesList()
2189 verify(testItem.activeFocus)
2190 urls = getListItems(urlsListView, "historyDelegate")

Subscribers

People subscribed via source and target branches

to status/vote changes: