Merge lp:~osomon/webbrowser-app/newTabRefactoring-autopilot-tests into lp:webbrowser-app

Proposed by Olivier Tilloy
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 914
Merged at revision: 1039
Proposed branch: lp:~osomon/webbrowser-app/newTabRefactoring-autopilot-tests
Merge into: lp:webbrowser-app
Prerequisite: lp:~rpadovani/webbrowser-app/newTabRefactoring
Diff against target: 2015 lines (+461/-1018)
23 files modified
src/app/webbrowser/Browser.qml (+7/-2)
src/app/webbrowser/CMakeLists.txt (+0/-4)
src/app/webbrowser/ExpandedHistoryView.qml (+12/-88)
src/app/webbrowser/HistoryView.qml (+46/-147)
src/app/webbrowser/NewTabView.qml (+32/-16)
src/app/webbrowser/UrlDelegate.qml (+21/-5)
src/app/webbrowser/UrlsList.qml (+13/-92)
src/app/webbrowser/history-domainlist-chronological-model.cpp (+6/-1)
src/app/webbrowser/history-domainlist-chronological-model.h (+4/-1)
src/app/webbrowser/top-sites-model.cpp (+4/-0)
src/app/webbrowser/top-sites-model.h (+2/-0)
src/app/webbrowser/upstreamcomponents/ListItemWithActions.qml (+0/-372)
src/app/webbrowser/upstreamcomponents/ListItemWithActionsCheckBox.qml (+0/-25)
src/app/webbrowser/upstreamcomponents/MultipleSelectionListView.qml (+0/-199)
src/app/webbrowser/upstreamcomponents/MultipleSelectionVisualModel.qml (+0/-31)
src/app/webbrowser/upstreamcomponents/README (+0/-20)
tests/autopilot/webbrowser_app/emulators/browser.py (+25/-7)
tests/autopilot/webbrowser_app/tests/__init__.py (+1/-1)
tests/autopilot/webbrowser_app/tests/test_new_tab_view.py (+274/-0)
tests/autopilot/webbrowser_app/tests/test_private.py (+1/-1)
tests/autopilot/webbrowser_app/tests/test_tabs.py (+3/-6)
tests/unittests/history-domainlist-chronological-model/tst_HistoryDomainListChronologicalModelTests.cpp (+5/-0)
tests/unittests/top-sites-model/tst_TopSitesModelTests.cpp (+5/-0)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/newTabRefactoring-autopilot-tests
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Riccardo Padovani (community) Approve
Review via email: mp+260488@code.launchpad.net

Commit message

Remove the upstreamcomponents folder, and use components from the UITK instead.
Add autopilot tests for the new tab view.

To post a comment you must log in.
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Since LP Web UI doesn't work for MR I'm doing this review by mail,
and I'll take more time to check the diff later.

It seems to work well, autopilot tests work good, there aren't flake8 issues
and the code seems ok.

Great work Olivier :-)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Some things:

- onHistoryDomainRemoved: browser.historyModel.removeEntriesByDomain(domain)

Why do you remove the possibilty to delete an entire domain? Anyway, if you are sure about this, you should also remove the swype - atm you can swype the domain, but then when you click on the trash icon nothing happens.

In the ExpandedHistoryView there isn't anymore the multiple selection - I think we should be consistent and have it (or don't have it) both in ExpandedHistoryView and HistoryView

review: Needs Fixing
911. By Olivier Tilloy

Fix embarassing regression…

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

> Some things:
>
> - onHistoryDomainRemoved:
> browser.historyModel.removeEntriesByDomain(domain)
>
> Why do you remove the possibilty to delete an entire domain? Anyway, if you
> are sure about this, you should also remove the swype - atm you can swype the
> domain, but then when you click on the trash icon nothing happens.

Good catch! This is something I overlooked, I just pushed a new revision that fixes it.

> In the ExpandedHistoryView there isn't anymore the multiple selection - I
> think we should be consistent and have it (or don't have it) both in
> ExpandedHistoryView and HistoryView

We never had multiple selection in the expanded history view, so this is not a regression. If you think we should have it, feel free to file a bug against webbrowser-app and ubuntu-ux to have design comment on the idea.

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Looks good now then, thanks :-)

I opened bug #1459982 about multiple selection in history view

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
912. By Olivier Tilloy

Also emit countChanged() when the model has been reset.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
913. By Olivier Tilloy

Fix invalid indices in for loop.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
914. By Olivier Tilloy

When in multiple selection mode, clicking a domain (de)selects it instead of expanding it.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/webbrowser/Browser.qml'
2--- src/app/webbrowser/Browser.qml 2015-06-02 14:24:15 +0000
3+++ src/app/webbrowser/Browser.qml 2015-06-02 14:24:15 +0000
4@@ -221,6 +221,7 @@
5 NewTabView {
6 historyModel: browser.historyModel
7 bookmarksModel: browser.bookmarksModel
8+ settingsObject: settings
9 onBookmarkClicked: {
10 chrome.requestedUrl = url
11 currentWebview.url = url
12@@ -624,7 +625,6 @@
13 var view = expandedHistoryViewComponent.createObject(historyViewContainer, {model: model})
14 view.onHistoryEntryClicked.connect(destroy)
15 }
16- onHistoryDomainRemoved: browser.historyModel.removeEntriesByDomain(domain)
17 onDone: destroy()
18 }
19 }
20@@ -639,7 +639,12 @@
21 browser.openUrlInNewTab(url, true)
22 done()
23 }
24- onHistoryEntryRemoved: browser.historyModel.removeEntryByUrl(url)
25+ onHistoryEntryRemoved: {
26+ if (count == 1) {
27+ done()
28+ }
29+ browser.historyModel.removeEntryByUrl(url)
30+ }
31 onDone: destroy()
32 }
33 }
34
35=== modified file 'src/app/webbrowser/CMakeLists.txt'
36--- src/app/webbrowser/CMakeLists.txt 2015-04-28 23:22:57 +0000
37+++ src/app/webbrowser/CMakeLists.txt 2015-06-02 14:24:15 +0000
38@@ -50,10 +50,6 @@
39 DESTINATION ${CMAKE_INSTALL_DATADIR}/webbrowser-app/webbrowser
40 FILES_MATCHING PATTERN *.png)
41
42-install(DIRECTORY upstreamcomponents
43- DESTINATION ${CMAKE_INSTALL_DATADIR}/webbrowser-app/webbrowser
44- FILES_MATCHING PATTERN *.qml)
45-
46 install(DIRECTORY searchengines
47 DESTINATION ${CMAKE_INSTALL_DATADIR}/webbrowser-app/webbrowser
48 FILES_MATCHING PATTERN *.xml)
49
50=== modified file 'src/app/webbrowser/ExpandedHistoryView.qml'
51--- src/app/webbrowser/ExpandedHistoryView.qml 2015-03-20 12:19:51 +0000
52+++ src/app/webbrowser/ExpandedHistoryView.qml 2015-06-02 14:24:15 +0000
53@@ -24,6 +24,7 @@
54 id: expandedHistoryView
55
56 property alias model: entriesListView.model
57+ property alias count: entriesListView.count
58
59 signal historyEntryClicked(url url)
60 signal historyEntryRemoved(url url)
61@@ -37,19 +38,22 @@
62 ListView {
63 id: entriesListView
64
65- property var _currentSwipedItem: null
66-
67 anchors {
68 top: header.bottom
69 bottom: parent.bottom
70 left: parent.left
71 right: parent.right
72- margins: units.gu(2)
73+ margins: units.gu(1.5)
74+ leftMargin: 0
75 }
76
77 section.property: "lastVisitDate"
78 section.delegate: HistorySectionDelegate {
79- width: parent.width
80+ anchors {
81+ left: parent.left
82+ leftMargin: units.gu(1.5)
83+ right: parent.right
84+ }
85 }
86
87 delegate: UrlDelegate {
88@@ -61,91 +65,12 @@
89 title: model.title
90 icon: model.icon
91
92- property var removalAnimation
93- function remove() {
94- removalAnimation.start()
95- }
96-
97- onSwippingChanged: {
98- entriesListView._updateSwipeState(entriesDelegate)
99- }
100-
101- onSwipeStateChanged: {
102- entriesListView._updateSwipeState(entriesDelegate)
103- }
104-
105- leftSideAction: Action {
106- iconName: "delete"
107- text: i18n.tr("Delete")
108- onTriggered: {
109- entriesDelegate.remove()
110- }
111- }
112-
113- ListView.onRemove: ScriptAction {
114- script: {
115- if (entriesListView._currentSwipedItem === entriesDelegate) {
116- entriesListView._currentSwipedItem = null
117- }
118- }
119- }
120-
121- removalAnimation: SequentialAnimation {
122- alwaysRunToEnd: true
123-
124- PropertyAction {
125- target: entriesDelegate
126- property: "ListView.delayRemove"
127- value: true
128- }
129-
130- UbuntuNumberAnimation {
131- target: entriesDelegate
132- property: "height"
133- to: 0
134- }
135-
136- PropertyAction {
137- target: entriesDelegate
138- property: "ListView.delayRemove"
139- value: false
140- }
141-
142- ScriptAction {
143- script: {
144- if(entriesListView.count === 1) {
145- expandedHistoryView.done()
146- }
147- historyEntryRemoved(model.url)
148- }
149- }
150- }
151-
152- onItemClicked: {
153- historyEntryClicked(model.url)
154- }
155- }
156-
157- function _updateSwipeState(item) {
158- if (item.swipping) {
159- return
160- }
161-
162- if (item.swipeState !== "Normal") {
163- if (entriesListView._currentSwipedItem !== item) {
164- if (entriesListView._currentSwipedItem) {
165- entriesListView._currentSwipedItem.resetSwipe()
166- }
167- entriesListView._currentSwipedItem = item
168- }
169- } else if (item.swipeState !== "Normal"
170- && entriesListView._currentSwipedItem === item) {
171- entriesListView._currentSwipedItem = null
172- }
173+ onClicked: expandedHistoryView.historyEntryClicked(model.url)
174+ onRemoved: expandedHistoryView.historyEntryRemoved(model.url)
175 }
176 }
177
178- Rectangle {
179+ Item {
180 id: header
181
182 anchors {
183@@ -155,8 +80,6 @@
184 }
185 height: units.gu(8)
186
187- color: "#f6f6f6"
188-
189 Rectangle {
190 anchors {
191 left: parent.left
192@@ -178,6 +101,7 @@
193 icon: expandedHistoryView.model.lastVisitedIcon
194 title: expandedHistoryView.model.domain
195 url: i18n.tr("%1 page", "%1 pages", entriesListView.count).arg(entriesListView.count)
196+ enabled: false
197 }
198
199 Button {
200
201=== modified file 'src/app/webbrowser/HistoryView.qml'
202--- src/app/webbrowser/HistoryView.qml 2015-03-20 12:19:51 +0000
203+++ src/app/webbrowser/HistoryView.qml 2015-06-02 14:24:15 +0000
204@@ -17,9 +17,8 @@
205 */
206
207 import QtQuick 2.0
208-import Ubuntu.Components 1.1
209+import Ubuntu.Components 1.2
210 import webbrowserapp.private 0.1
211-import "upstreamcomponents"
212
213 Item {
214 id: historyView
215@@ -27,7 +26,6 @@
216 property alias historyModel: historyTimeframeModel.sourceModel
217
218 signal seeMoreEntriesClicked(var model)
219- signal historyDomainRemoved(var domain)
220 signal done()
221
222 Rectangle {
223@@ -35,37 +33,18 @@
224 color: "#f6f6f6"
225 }
226
227- UbuntuNumberAnimation {
228- id: topBarOpenAnimation
229- target: topBar
230- property: "height"
231- to: units.gu(5)
232- alwaysRunToEnd: true
233- }
234-
235- UbuntuNumberAnimation {
236- id: topBarCloseAnimation
237- target: topBar
238- property: "height"
239- to: 0
240- alwaysRunToEnd: true
241- }
242-
243- MultipleSelectionListView {
244+ ListView {
245 id: domainsListView
246
247- property var _currentSwipedItem: null
248-
249 anchors {
250 top: topBar.bottom
251 left: parent.left
252 right: parent.right
253 bottom: toolbar.top
254- topMargin: units.gu(-0.5) // topMargin 2 - firstSection.topMargin 2.5
255 rightMargin: units.gu(2)
256 }
257
258- listModel: HistoryDomainListChronologicalModel {
259+ model: HistoryDomainListChronologicalModel {
260 sourceModel: HistoryDomainListModel {
261 sourceModel: HistoryTimeframeModel {
262 id: historyTimeframeModel
263@@ -80,17 +59,7 @@
264 anchors.leftMargin: units.gu(2)
265 }
266
267- onSelectionDone: {
268- var domains = new Array();
269- for (var i=0; i < items.count; i++) {
270- domains[i] = items.get(i).model.domain
271- }
272- for (var i=0; i < domains.length; i++) {
273- historyView.historyDomainRemoved(domains[i])
274- }
275- }
276-
277- listDelegate: UrlDelegate {
278+ delegate: UrlDelegate {
279 id: urlDelegate
280 width: parent.width
281 height: units.gu(5)
282@@ -99,111 +68,19 @@
283 url: lastVisitedTitle
284 icon: model.lastVisitedIcon
285
286- property var removalAnimation
287- function remove() {
288- removalAnimation.start()
289- }
290-
291- anchors {
292- left: parent.left
293- // we need to move left the favicon to align the favicon to
294- // other elements. Favicon has a container bigger than it.
295- // units.gu(3) it's the size of the favicon container
296- // units.dp(16) it's the size of the favicon
297- // the favicon is hCentered in the container
298- leftMargin: selectionMode ? - (units.gu(3) - units.dp(16)) / 2 : 0
299- }
300-
301- selectionMode: domainsListView.isInSelectionMode
302- selected: domainsListView.isSelected(urlDelegate)
303-
304- onSwippingChanged: {
305- domainsListView._updateSwipeState(urlDelegate)
306- }
307-
308- onSwipeStateChanged: {
309- domainsListView._updateSwipeState(urlDelegate)
310- }
311-
312- leftSideAction: Action {
313- iconName: "delete"
314- text: i18n.tr("Delete")
315- onTriggered: {
316- urlDelegate.remove()
317- }
318- }
319-
320- ListView.onRemove: ScriptAction {
321- script: {
322- if (domainsListView._currentSwipedItem === urlDelegate) {
323- domainsListView._currentSwipedItem = null
324- }
325- }
326- }
327-
328- removalAnimation: SequentialAnimation {
329- alwaysRunToEnd: true
330-
331- PropertyAction {
332- target: urlDelegate
333- property: "ListView.delayRemove"
334- value: true
335- }
336-
337- UbuntuNumberAnimation {
338- target: urlDelegate
339- property: "height"
340- to: 0
341- }
342-
343- PropertyAction {
344- target: urlDelegate
345- property: "ListView.delayRemove"
346- value: false
347- }
348-
349- ScriptAction {
350- script: {
351- historyView.historyDomainRemoved(model.domain)
352- }
353- }
354- }
355-
356- onItemClicked: {
357- if (domainsListView.isInSelectionMode) {
358- if (!domainsListView.selectItem(urlDelegate)) {
359- domainsListView.deselectItem(urlDelegate)
360- }
361- }
362- else {
363+ onClicked: {
364+ if (selectMode) {
365+ selected = !selected
366+ } else {
367 historyView.seeMoreEntriesClicked(model.entries)
368 }
369 }
370- onItemPressAndHold: {
371- domainsListView.startSelection()
372- domainsListView.selectItem(urlDelegate)
373- }
374- }
375-
376- /*
377- * Functions for manage swype and multiple selection together
378- * Developed upstream
379- */
380- function _updateSwipeState(item) {
381- if (item.swipping) {
382- return
383- }
384-
385- if (item.swipeState !== "Normal") {
386- if (domainsListView._currentSwipedItem !== item) {
387- if (domainsListView._currentSwipedItem) {
388- domainsListView._currentSwipedItem.resetSwipe()
389- }
390- domainsListView._currentSwipedItem = item
391+ onRemoved: historyView.historyModel.removeEntriesByDomain(model.domain)
392+ onPressAndHold: {
393+ selectMode = !selectMode
394+ if (selectMode) {
395+ domainsListView.ViewItems.selectedIndices = [index]
396 }
397- } else if (item.swipeState !== "Normal"
398- && domainsListView._currentSwipedItem === item) {
399- domainsListView._currentSwipedItem = null
400 }
401 }
402 }
403@@ -253,11 +130,19 @@
404
405 Item {
406 id: topBar
407- visible: domainsListView.isInSelectionMode
408-
409- onVisibleChanged: visible ? topBarOpenAnimation.start() : topBarCloseAnimation.start()
410-
411- anchors { left: parent.left; right: parent.right; top: parent.top }
412+
413+ visible: domainsListView.ViewItems.selectMode
414+ height: visible ? units.gu(5) : 0
415+
416+ Behavior on height {
417+ UbuntuNumberAnimation {}
418+ }
419+
420+ anchors {
421+ left: parent.left
422+ right: parent.right
423+ top: parent.top
424+ }
425
426 Rectangle {
427 width: parent.width
428@@ -281,7 +166,7 @@
429
430 MouseArea {
431 anchors.fill: parent
432- onClicked: domainsListView.cancelSelection()
433+ onClicked: domainsListView.ViewItems.selectMode = false
434 }
435
436 anchors.left: parent.left
437@@ -297,10 +182,14 @@
438 MouseArea {
439 anchors.fill: parent
440 onClicked: {
441- if (domainsListView.selectedItems.count === domainsListView.count) {
442- domainsListView.clearSelection()
443+ if (domainsListView.ViewItems.selectedIndices.length === domainsListView.count) {
444+ domainsListView.ViewItems.selectedIndices = []
445 } else {
446- domainsListView.selectAll()
447+ var indices = []
448+ for (var i = 0; i < domainsListView.count; ++i) {
449+ indices.push(i)
450+ }
451+ domainsListView.ViewItems.selectedIndices = indices
452 }
453 }
454 }
455@@ -319,11 +208,21 @@
456
457 iconName: "delete"
458 text: i18n.tr("Delete")
459- enabled: domainsListView.selectedItems.count > 0
460+ enabled: domainsListView.ViewItems.selectedIndices.length > 0
461
462 MouseArea {
463 anchors.fill: parent
464- onClicked: domainsListView.endSelection()
465+ onClicked: {
466+ var indices = domainsListView.ViewItems.selectedIndices
467+ var domains = []
468+ for (var i in indices) {
469+ domains.push(domainsListView.model.get(indices[i]))
470+ }
471+ domainsListView.ViewItems.selectMode = false
472+ for (var j in domains) {
473+ historyModel.removeEntriesByDomain(domains[j])
474+ }
475+ }
476 }
477
478 anchors.right: parent.right
479
480=== modified file 'src/app/webbrowser/NewTabView.qml'
481--- src/app/webbrowser/NewTabView.qml 2015-06-02 14:24:15 +0000
482+++ src/app/webbrowser/NewTabView.qml 2015-06-02 14:24:15 +0000
483@@ -17,8 +17,8 @@
484 */
485
486 import QtQuick 2.0
487-import Ubuntu.Components 1.1
488-import Ubuntu.Components.ListItems 1.0 as ListItem
489+import Qt.labs.settings 1.0
490+import Ubuntu.Components 1.2
491 import webbrowserapp.private 0.1
492 import ".."
493
494@@ -27,6 +27,7 @@
495
496 property QtObject bookmarksModel
497 property alias historyModel: historyTimeframeModel.sourceModel
498+ property Settings settingsObject
499
500 signal bookmarkClicked(url url)
501 signal bookmarkRemoved(url url)
502@@ -45,7 +46,6 @@
503 property bool seeMoreBookmarksView: bookmarksCountLimit > 4
504 property int bookmarksCountLimit: Math.min(4, numberOfBookmarks)
505 property int numberOfBookmarks: bookmarksModel ? bookmarksModel.count : 0
506- property int numberOfTopSites: historyModel ? historyModel.count : 0
507
508 // Force the topsites section to reappear when remove a bookmark while
509 // the bookmarks list is expanded and there aren't anymore > 5
510@@ -72,7 +72,6 @@
511 id: contentColumn
512 anchors {
513 left: parent.left
514- leftMargin: units.gu(1.5)
515 right: parent.right
516 rightMargin: units.gu(1.5)
517 }
518@@ -80,7 +79,11 @@
519
520 Row {
521 height: units.gu(6)
522- anchors { left: parent.left; right: parent.right }
523+ anchors {
524+ left: parent.left
525+ leftMargin: units.gu(1.5)
526+ right: parent.right
527+ }
528 spacing: units.gu(1.5)
529
530 Icon {
531@@ -108,6 +111,7 @@
532
533 Button {
534 id: moreButton
535+ objectName: "bookmarks.moreButton"
536 height: parent.height - units.gu(2)
537
538 anchors { top: parent.top; topMargin: units.gu(1) }
539@@ -129,7 +133,11 @@
540
541 Rectangle {
542 height: units.gu(0.1)
543- anchors { left: parent.left; right: parent.right }
544+ anchors {
545+ left: parent.left
546+ leftMargin: units.gu(1.5)
547+ right: parent.right
548+ }
549 color: "#d3d3d3"
550 }
551
552@@ -137,7 +145,6 @@
553 id: bookmarksColumn
554 anchors {
555 left: parent.left
556- leftMargin: units.gu(-1.5)
557 right: parent.right
558 }
559
560@@ -147,7 +154,7 @@
561 spacing: 0
562
563 UrlDelegate {
564- id: homepageBookmark
565+ objectName: "homepageBookmark"
566 anchors {
567 left: parent.left
568 right: parent.right
569@@ -156,12 +163,14 @@
570
571 title: i18n.tr('Homepage')
572
573- url: settings.homepage
574- onItemClicked: newTabView.bookmarkClicked(url)
575+ leadingActions: null
576+
577+ url: newTabView.settingsObject.homepage
578+ onClicked: newTabView.bookmarkClicked(url)
579 }
580
581 UrlsList {
582- id: bookmarksList
583+ objectName: "bookmarksList"
584 anchors {
585 left: parent.left
586 right: parent.right
587@@ -177,13 +186,13 @@
588 }
589 }
590
591- Rectangle {
592+ Item {
593 height: units.gu(6)
594 anchors {
595 left: parent.left
596+ leftMargin: units.gu(1.5)
597 right: parent.right
598 }
599- color: "#f6f6f6"
600
601 Label {
602 anchors {
603@@ -203,7 +212,11 @@
604
605 Rectangle {
606 height: units.gu(0.1)
607- anchors { left: parent.left; right: parent.right }
608+ anchors {
609+ left: parent.left
610+ leftMargin: units.gu(1.5)
611+ right: parent.right
612+ }
613 color: "#d3d3d3"
614
615 opacity: internal.seeMoreBookmarksView ? 0.0 : 1.0
616@@ -211,12 +224,14 @@
617 }
618
619 Label {
620+ objectName: "notopsites"
621+
622 height: units.gu(11)
623 anchors {
624 left: parent.left
625 right: parent.right
626 }
627- visible: internal.numberOfTopSites === 0
628+ visible: topSitesModel.count == 0
629
630 horizontalAlignment: Text.AlignHCenter
631 verticalAlignment: Text.AlignVCenter
632@@ -226,14 +241,15 @@
633 }
634
635 UrlsList {
636+ objectName: "topSitesList"
637 anchors {
638 left: parent.left
639- leftMargin: units.gu(-1.5)
640 right: parent.right
641 }
642
643 opacity: internal.seeMoreBookmarksView ? 0.0 : 1.0
644 Behavior on opacity { UbuntuNumberAnimation {} }
645+ visible: opacity > 0
646
647 limit: 10
648 spacing: 0
649
650=== modified file 'src/app/webbrowser/UrlDelegate.qml'
651--- src/app/webbrowser/UrlDelegate.qml 2015-03-20 12:19:51 +0000
652+++ src/app/webbrowser/UrlDelegate.qml 2015-06-02 14:24:15 +0000
653@@ -17,20 +17,26 @@
654 */
655
656 import QtQuick 2.0
657-import Ubuntu.Components 1.1
658+import Ubuntu.Components 1.2
659 import ".."
660-import "upstreamcomponents"
661
662-ListItemWithActions {
663+ListItem {
664 id: urlDelegate
665
666 property alias icon: icon.source
667 property alias title: title.text
668 property alias url: url.text
669- color: "#f6f6f6"
670+
671+ divider.visible: false
672+
673+ signal removed()
674
675 Row {
676- anchors.verticalCenter: parent.verticalCenter
677+ anchors {
678+ verticalCenter: parent.verticalCenter
679+ left: parent.left
680+ leftMargin: units.gu(1.5)
681+ }
682 spacing: units.gu(1)
683
684 UbuntuShape {
685@@ -69,4 +75,14 @@
686 }
687 }
688 }
689+
690+ leadingActions: ListItemActions {
691+ actions: [
692+ Action {
693+ objectName: "leadingAction.delete"
694+ iconName: "delete"
695+ onTriggered: urlDelegate.removed()
696+ }
697+ ]
698+ }
699 }
700
701=== modified file 'src/app/webbrowser/UrlsList.qml'
702--- src/app/webbrowser/UrlsList.qml 2015-06-02 14:24:15 +0000
703+++ src/app/webbrowser/UrlsList.qml 2015-06-02 14:24:15 +0000
704@@ -21,6 +21,7 @@
705
706 Column {
707 id: urlsList
708+
709 property alias model: urlsListRepeater.model
710 property int limit
711
712@@ -29,102 +30,22 @@
713
714 spacing: units.gu(1)
715
716- move: Transition { UbuntuNumberAnimation { properties: "x, y" } }
717-
718 Repeater {
719 id: urlsListRepeater
720- property var _currentSwipedItem: null
721
722 delegate: Loader {
723- sourceComponent: (index < limit) ? realDelegate : undefined
724- Component {
725- id: realDelegate
726- UrlDelegate{
727- id: urlDelegate
728- width: urlsList.width
729- height: units.gu(5)
730-
731- icon: model.icon
732- title: model.title ? model.title : model.url
733- url: model.url
734-
735- onItemClicked: urlClicked(model.url)
736-
737- property var removalAnimation
738- function remove() {
739- removalAnimation.start()
740- }
741-
742- onSwippingChanged: {
743- urlsListRepeater._updateSwipeState(urlDelegate)
744- }
745-
746- onSwipeStateChanged: {
747- urlsListRepeater._updateSwipeState(urlDelegate)
748- }
749-
750- leftSideAction: Action {
751- iconName: "delete"
752- text: i18n.tr("Delete")
753- onTriggered: {
754- urlDelegate.remove()
755- }
756- }
757-
758- ListView.onRemove: ScriptAction {
759- script: {
760- if (urlsListRepeater._currentSwipedItem === urlDelegate) {
761- urlsListRepeater._currentSwipedItem = null
762- }
763- }
764- }
765-
766- removalAnimation: SequentialAnimation {
767- alwaysRunToEnd: true
768-
769- PropertyAction {
770- target: urlDelegate
771- property: "ListView.delayRemove"
772- value: true
773- }
774-
775- UbuntuNumberAnimation {
776- target: urlDelegate
777- property: "height"
778- to: 0
779- }
780-
781- PropertyAction {
782- target: urlDelegate
783- property: "ListView.delayRemove"
784- value: false
785- }
786-
787- ScriptAction {
788- script: {
789- urlRemoved(model.url)
790- }
791- }
792- }
793- }
794- }
795- }
796-
797- function _updateSwipeState(item) {
798- if (item.swipping) {
799- return
800- }
801-
802- if (item.swipeState !== "Normal") {
803- if (urlsListRepeater._currentSwipedItem !== item) {
804- if (urlsListRepeater._currentSwipedItem) {
805- urlsListRepeater._currentSwipedItem.resetSwipe()
806- }
807- urlsListRepeater._currentSwipedItem = item
808- }
809- } else if (item.swipeState !== "Normal"
810- && urlsListRepeater._currentSwipedItem === item) {
811- urlsListRepeater._currentSwipedItem = null
812+ active: index < limit
813+ sourceComponent: UrlDelegate{
814+ id: urlDelegate
815+ width: urlsList.width
816+ height: units.gu(5)
817+
818+ icon: model.icon
819+ title: model.title ? model.title : model.url
820+ url: model.url
821+
822+ onClicked: urlsList.urlClicked(model.url)
823+ onRemoved: urlsList.urlRemoved(model.url)
824 }
825 }
826 }
827
828=== modified file 'src/app/webbrowser/history-domainlist-chronological-model.cpp'
829--- src/app/webbrowser/history-domainlist-chronological-model.cpp 2014-03-12 10:59:54 +0000
830+++ src/app/webbrowser/history-domainlist-chronological-model.cpp 2015-06-02 14:24:15 +0000
831@@ -1,5 +1,5 @@
832 /*
833- * Copyright 2013 Canonical Ltd.
834+ * Copyright 2013-2015 Canonical Ltd.
835 *
836 * This file is part of webbrowser-app.
837 *
838@@ -48,3 +48,8 @@
839 Q_EMIT sourceModelChanged();
840 }
841 }
842+
843+QString HistoryDomainListChronologicalModel::get(int index) const
844+{
845+ return data(this->index(index, 0), HistoryDomainListModel::Domain).toString();
846+}
847
848=== modified file 'src/app/webbrowser/history-domainlist-chronological-model.h'
849--- src/app/webbrowser/history-domainlist-chronological-model.h 2014-03-12 10:59:54 +0000
850+++ src/app/webbrowser/history-domainlist-chronological-model.h 2015-06-02 14:24:15 +0000
851@@ -1,5 +1,5 @@
852 /*
853- * Copyright 2013 Canonical Ltd.
854+ * Copyright 2013-2015 Canonical Ltd.
855 *
856 * This file is part of webbrowser-app.
857 *
858@@ -21,6 +21,7 @@
859
860 // Qt
861 #include <QtCore/QSortFilterProxyModel>
862+#include <QtCore/QString>
863
864 class HistoryDomainListModel;
865
866@@ -36,6 +37,8 @@
867 HistoryDomainListModel* sourceModel() const;
868 void setSourceModel(HistoryDomainListModel* sourceModel);
869
870+ Q_INVOKABLE QString get(int index) const;
871+
872 Q_SIGNALS:
873 void sourceModelChanged() const;
874 };
875
876=== modified file 'src/app/webbrowser/top-sites-model.cpp'
877--- src/app/webbrowser/top-sites-model.cpp 2015-04-09 14:55:14 +0000
878+++ src/app/webbrowser/top-sites-model.cpp 2015-06-02 14:24:15 +0000
879@@ -34,6 +34,9 @@
880 setDynamicSortFilter(true);
881 setSortRole(HistoryModel::Visits);
882 sort(0, Qt::DescendingOrder);
883+ connect(this, SIGNAL(rowsInserted(const QModelIndex&, int, int)), SIGNAL(countChanged()));
884+ connect(this, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), SIGNAL(countChanged()));
885+ connect(this, SIGNAL(modelReset()), SIGNAL(countChanged()));
886 }
887
888 HistoryTimeframeModel* TopSitesModel::sourceModel() const
889@@ -46,6 +49,7 @@
890 if (sourceModel != this->sourceModel()) {
891 QSortFilterProxyModel::setSourceModel(sourceModel);
892 Q_EMIT sourceModelChanged();
893+ Q_EMIT countChanged();
894 }
895 }
896
897
898=== modified file 'src/app/webbrowser/top-sites-model.h'
899--- src/app/webbrowser/top-sites-model.h 2015-04-08 22:17:08 +0000
900+++ src/app/webbrowser/top-sites-model.h 2015-06-02 14:24:15 +0000
901@@ -29,6 +29,7 @@
902 Q_OBJECT
903
904 Q_PROPERTY(HistoryTimeframeModel* sourceModel READ sourceModel WRITE setSourceModel NOTIFY sourceModelChanged)
905+ Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
906
907 public:
908 TopSitesModel(QObject* parent=0);
909@@ -38,6 +39,7 @@
910
911 Q_SIGNALS:
912 void sourceModelChanged() const;
913+ void countChanged() const;
914
915 protected:
916 // reimplemented from QSortFilterProxyModel
917
918=== removed directory 'src/app/webbrowser/upstreamcomponents'
919=== removed file 'src/app/webbrowser/upstreamcomponents/ListItemWithActions.qml'
920--- src/app/webbrowser/upstreamcomponents/ListItemWithActions.qml 2015-02-03 18:32:52 +0000
921+++ src/app/webbrowser/upstreamcomponents/ListItemWithActions.qml 1970-01-01 00:00:00 +0000
922@@ -1,372 +0,0 @@
923-/*
924- * Copyright (C) 2012-2014 Canonical, Ltd.
925- *
926- * This program is free software; you can redistribute it and/or modify
927- * it under the terms of the GNU General Public License as published by
928- * the Free Software Foundation; version 3.
929- *
930- * This program is distributed in the hope that it will be useful,
931- * but WITHOUT ANY WARRANTY; without even the implied warranty of
932- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
933- * GNU General Public License for more details.
934- *
935- * You should have received a copy of the GNU General Public License
936- * along with this program. If not, see <http://www.gnu.org/licenses/>.
937- */
938-
939-import QtQuick 2.0
940-import Ubuntu.Components 1.1
941-
942-Item {
943- id: root
944-
945- property Action leftSideAction: null
946- property list<Action> rightSideActions
947- property double defaultHeight: units.gu(8)
948- property bool locked: false
949- property Action activeAction: null
950- property var activeItem: null
951- property bool triggerActionOnMouseRelease: false
952- property color color: Theme.palette.normal.background
953- property color selectedColor: "#E6E6E6"
954- property bool selected: false
955- property bool selectionMode: false
956- property alias internalAnchors: mainContents.anchors
957- default property alias contents: mainContents.children
958-
959- readonly property double actionWidth: units.gu(5)
960- readonly property double leftActionWidth: units.gu(10)
961- readonly property double actionThreshold: actionWidth * 0.4
962- readonly property double threshold: 0.4
963- readonly property string swipeState: main.x == 0 ? "Normal" : main.x > 0 ? "LeftToRight" : "RightToLeft"
964- readonly property alias swipping: mainItemMoving.running
965-
966- signal itemClicked(var mouse)
967- signal itemPressAndHold(var mouse)
968-
969- function returnToBoundsRTL()
970- {
971- var actionFullWidth = actionWidth + units.gu(2)
972- var xOffset = Math.abs(main.x)
973- var index = Math.min(Math.floor(xOffset / actionFullWidth), rightSideActions.length)
974-
975- if (index < 1) {
976- main.x = 0
977- } else if (index === rightSideActions.length) {
978- main.x = -rightActionsView.width
979- } else {
980- main.x = -(actionFullWidth * index)
981- }
982- }
983-
984- function returnToBoundsLTR()
985- {
986- var finalX = leftActionWidth
987- if (main.x > (finalX * root.threshold))
988- main.x = finalX
989- else
990- main.x = 0
991- }
992-
993- function returnToBounds()
994- {
995- if (main.x < 0) {
996- returnToBoundsRTL()
997- } else if (main.x > 0) {
998- returnToBoundsLTR()
999- }
1000- }
1001-
1002- function contains(item, point)
1003- {
1004- return (point.x >= item.x) && (point.x <= (item.x + item.width)) && (point.y >= item.y) && (point.y <= (item.y + item.height));
1005- }
1006-
1007- function getActionAt(point)
1008- {
1009- if (contains(leftActionView, point)) {
1010- return leftSideAction
1011- } else if (contains(rightActionsView, point)) {
1012- var newPoint = root.mapToItem(rightActionsView, point.x, point.y)
1013- for (var i = 0; i < rightActionsRepeater.count; i++) {
1014- var child = rightActionsRepeater.itemAt(i)
1015- if (contains(child, newPoint)) {
1016- return i
1017- }
1018- }
1019- }
1020- return -1
1021- }
1022-
1023- function updateActiveAction()
1024- {
1025- if ((main.x <= -root.actionWidth) &&
1026- (main.x > -rightActionsView.width)) {
1027- var actionFullWidth = actionWidth + units.gu(2)
1028- var xOffset = Math.abs(main.x)
1029- var index = Math.min(Math.floor(xOffset / actionFullWidth), rightSideActions.length)
1030- index = index - 1
1031- if (index > -1) {
1032- root.activeItem = rightActionsRepeater.itemAt(index)
1033- root.activeAction = root.rightSideActions[index]
1034- }
1035- } else {
1036- root.activeAction = null
1037- }
1038- }
1039-
1040- function resetSwipe()
1041- {
1042- main.x = 0
1043- }
1044-
1045- states: [
1046- State {
1047- name: "select"
1048- when: selectionMode || selected
1049- PropertyChanges {
1050- target: selectionIcon
1051- source: Qt.resolvedUrl("ListItemWithActionsCheckBox.qml")
1052- anchors.leftMargin: units.gu(2)
1053- }
1054- PropertyChanges {
1055- target: root
1056- locked: true
1057- }
1058- PropertyChanges {
1059- target: main
1060- x: 0
1061- }
1062- }
1063- ]
1064-
1065- height: defaultHeight
1066- clip: height !== defaultHeight
1067-
1068- Rectangle {
1069- id: leftActionView
1070-
1071- anchors {
1072- top: parent.top
1073- bottom: parent.bottom
1074- right: main.left
1075- }
1076- width: root.leftActionWidth + actionThreshold
1077- visible: leftSideAction
1078- color: "red"
1079-
1080- Icon {
1081- anchors {
1082- centerIn: parent
1083- horizontalCenterOffset: actionThreshold / 2
1084- }
1085- name: leftSideAction ? leftSideAction.iconName : ""
1086- color: Theme.palette.selected.field
1087- height: units.gu(3)
1088- width: units.gu(3)
1089- }
1090- }
1091-
1092- Item {
1093- id: rightActionsView
1094-
1095- anchors {
1096- top: main.top
1097- left: main.right
1098- leftMargin: units.gu(1)
1099- bottom: main.bottom
1100- }
1101- visible: rightSideActions.length > 0
1102- width: rightActionsRepeater.count > 0 ? rightActionsRepeater.count * (root.actionWidth + units.gu(2)) + actionThreshold : 0
1103- Row {
1104- anchors.fill: parent
1105- spacing: units.gu(2)
1106- Repeater {
1107- id: rightActionsRepeater
1108-
1109- model: rightSideActions
1110- Item {
1111- property alias image: img
1112-
1113- anchors {
1114- top: parent.top
1115- bottom: parent.bottom
1116- }
1117- width: root.actionWidth
1118-
1119- Icon {
1120- id: img
1121-
1122- anchors.centerIn: parent
1123- width: units.gu(3)
1124- height: units.gu(3)
1125- name: iconName
1126- color: root.activeAction === modelData || !root.triggerActionOnMouseRelease ? UbuntuColors.lightAubergine : Theme.palette.selected.background
1127- }
1128- }
1129- }
1130- }
1131- }
1132-
1133-
1134- Rectangle {
1135- id: main
1136- objectName: "mainItem"
1137-
1138- anchors {
1139- top: parent.top
1140- bottom: parent.bottom
1141- }
1142-
1143- width: parent.width
1144- color: mouseArea.pressed && swipeState === "Normal" ? root.selectedColor : root.color
1145-
1146- Loader {
1147- id: selectionIcon
1148-
1149- anchors {
1150- left: main.left
1151- verticalCenter: main.verticalCenter
1152- }
1153- width: (status === Loader.Ready) ? item.implicitWidth : 0
1154- visible: (status === Loader.Ready) && (item.width === item.implicitWidth)
1155- Behavior on width {
1156- NumberAnimation {
1157- duration: UbuntuAnimation.SnapDuration
1158- }
1159- }
1160- }
1161-
1162-
1163- Item {
1164- id: mainContents
1165-
1166- anchors {
1167- left: selectionIcon.right
1168- leftMargin: units.gu(2)
1169- top: parent.top
1170- topMargin: units.gu(1)
1171- right: parent.right
1172- rightMargin: units.gu(2)
1173- bottom: parent.bottom
1174- bottomMargin: units.gu(1)
1175- }
1176- }
1177-
1178- Behavior on x {
1179- UbuntuNumberAnimation {
1180- id: mainItemMoving
1181-
1182- easing.type: Easing.OutElastic
1183- duration: UbuntuAnimation.SlowDuration
1184- }
1185- }
1186- Behavior on color {
1187- enabled: (root.color != root.selectedColor)
1188- ColorAnimation {}
1189- }
1190- }
1191-
1192- SequentialAnimation {
1193- id: triggerAction
1194-
1195- property var currentItem: root.activeItem ? root.activeItem.image : null
1196-
1197- running: false
1198- ParallelAnimation {
1199- UbuntuNumberAnimation {
1200- target: triggerAction.currentItem
1201- property: "opacity"
1202- from: 1.0
1203- to: 0.0
1204- duration: UbuntuAnimation.SlowDuration
1205- easing {type: Easing.InOutBack; }
1206- }
1207- UbuntuNumberAnimation {
1208- target: triggerAction.currentItem
1209- properties: "width, height"
1210- from: units.gu(3)
1211- to: root.actionWidth
1212- duration: UbuntuAnimation.SlowDuration
1213- easing {type: Easing.InOutBack; }
1214- }
1215- }
1216- PropertyAction {
1217- target: triggerAction.currentItem
1218- properties: "width, height"
1219- value: units.gu(3)
1220- }
1221- PropertyAction {
1222- target: triggerAction.currentItem
1223- properties: "opacity"
1224- value: 1.0
1225- }
1226- ScriptAction {
1227- script: root.activeAction.triggered(root)
1228- }
1229- PauseAnimation {
1230- duration: 500
1231- }
1232- UbuntuNumberAnimation {
1233- target: main
1234- property: "x"
1235- to: 0
1236-
1237- }
1238- }
1239-
1240- MouseArea {
1241- id: mouseArea
1242-
1243- property bool locked: root.locked || ((root.leftSideAction === null) && (root.rightSideActions.count === 0))
1244- property bool manual: false
1245-
1246- anchors.fill: parent
1247- drag {
1248- target: locked ? null : main
1249- axis: Drag.XAxis
1250- minimumX: rightActionsView.visible ? -(rightActionsView.width + root.actionThreshold) : 0
1251- maximumX: leftActionView.visible ? leftActionView.width : 0
1252- }
1253-
1254- onReleased: {
1255- if (root.triggerActionOnMouseRelease && root.activeAction) {
1256- triggerAction.start()
1257- } else {
1258- root.returnToBounds()
1259- root.activeAction = null
1260- }
1261- }
1262- onClicked: {
1263- if (main.x === 0) {
1264- root.itemClicked(mouse)
1265- } else if (main.x > 0) {
1266- var action = getActionAt(Qt.point(mouse.x, mouse.y))
1267- if (action && action !== -1) {
1268- action.triggered(root)
1269- }
1270- } else {
1271- var actionIndex = getActionAt(Qt.point(mouse.x, mouse.y))
1272- if (actionIndex !== -1) {
1273- root.activeItem = rightActionsRepeater.itemAt(actionIndex)
1274- root.activeAction = root.rightSideActions[actionIndex]
1275- triggerAction.start()
1276- return
1277- }
1278- }
1279- root.resetSwipe()
1280- }
1281-
1282- onPositionChanged: {
1283- if (mouseArea.pressed) {
1284- updateActiveAction()
1285- }
1286- }
1287- onPressAndHold: {
1288- if (main.x === 0) {
1289- root.itemPressAndHold(mouse)
1290- }
1291- }
1292- z: -1
1293- }
1294-}
1295
1296=== removed file 'src/app/webbrowser/upstreamcomponents/ListItemWithActionsCheckBox.qml'
1297--- src/app/webbrowser/upstreamcomponents/ListItemWithActionsCheckBox.qml 2014-10-15 09:38:37 +0000
1298+++ src/app/webbrowser/upstreamcomponents/ListItemWithActionsCheckBox.qml 1970-01-01 00:00:00 +0000
1299@@ -1,25 +0,0 @@
1300-/*
1301- * Copyright (C) 2012-2014 Canonical, Ltd.
1302- *
1303- * This program is free software; you can redistribute it and/or modify
1304- * it under the terms of the GNU General Public License as published by
1305- * the Free Software Foundation; version 3.
1306- *
1307- * This program is distributed in the hope that it will be useful,
1308- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1309- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1310- * GNU General Public License for more details.
1311- *
1312- * You should have received a copy of the GNU General Public License
1313- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1314- */
1315-
1316-import QtQuick 2.0
1317-import Ubuntu.Components 1.1
1318-
1319-CheckBox {
1320- checked: root.selected
1321- width: implicitWidth
1322- // disable item mouse area to avoid conflicts with parent mouse area
1323- __mouseArea.enabled: false
1324-}
1325
1326=== removed file 'src/app/webbrowser/upstreamcomponents/MultipleSelectionListView.qml'
1327--- src/app/webbrowser/upstreamcomponents/MultipleSelectionListView.qml 2014-10-15 09:38:37 +0000
1328+++ src/app/webbrowser/upstreamcomponents/MultipleSelectionListView.qml 1970-01-01 00:00:00 +0000
1329@@ -1,199 +0,0 @@
1330-/*
1331- * Copyright (C) 2013 Canonical, Ltd.
1332- *
1333- * This program is free software; you can redistribute it and/or modify
1334- * it under the terms of the GNU General Public License as published by
1335- * the Free Software Foundation; version 3.
1336- *
1337- * This program is distributed in the hope that it will be useful,
1338- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1339- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1340- * GNU General Public License for more details.
1341- *
1342- * You should have received a copy of the GNU General Public License
1343- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1344- */
1345-
1346-import QtQuick 2.0
1347-import Ubuntu.Components 1.1
1348-import Ubuntu.Components.Popups 1.0 as Popups
1349-
1350-/*!
1351- \qmltype ContactSimpleListView
1352- \inqmlmodule Ubuntu.Contacts 0.1
1353- \ingroup ubuntu
1354- \brief The MultipleSelectionListView provides a ListView with support to multiple selection
1355-
1356- The MultipleSelectionListViewprovides a ListView with support to multiple selection which can be used by any
1357- application.
1358-
1359- Example:
1360- \qml
1361- import Ubuntu.Contacts 0.1
1362-
1363- MultipleSelectionListView {
1364- id: view
1365- anchors.fill: paret
1366- model: 100
1367- delegate: Rectangle {
1368- width: parent.width
1369- height: 100
1370- color: view.selectedItems.indexOf(index) == -1 ? "white" : "blue"
1371-
1372- MouseArea {
1373- anchors.fill: parent
1374- onClicked: {
1375- if (view.isInSelectionModel) {
1376- view.selectItem(index)
1377- }
1378- }
1379- onPressAndHold: view.startSelection()
1380- }
1381- }
1382- onSelectionDone: console.debug("Selected items:" + view.selectedItems)
1383- }
1384- \endqml
1385-*/
1386-
1387-ListView {
1388- id: listView
1389-
1390- /*!
1391- \qmlproperty model selectedItems
1392-
1393- This property holds the list of selected items
1394- */
1395- readonly property alias selectedItems: visualModel.selectedItems
1396- /*!
1397- \qmlproperty bool multipleSelection
1398-
1399- This property holds if the selection will accept multiple items or single items
1400- */
1401- property bool multipleSelection: true
1402-
1403- /*!
1404- \qmlproperty model listModel
1405-
1406- This property holds the model providing data for the list.
1407- */
1408- property alias listModel: visualModel.model
1409- /*!
1410- \qmlproperty Component listDelegate
1411-
1412- The delegate provides a template defining each item instantiated by the view.
1413- */
1414- property alias listDelegate: visualModel.delegate
1415-
1416- /*!
1417- \qmlproperty bool isInSelectionMode
1418-
1419- This property holds a list with the index of selected items
1420- */
1421- readonly property bool isInSelectionMode: state === "selection"
1422- /*!
1423- This handler is called when the selection mode is finished without be canceled
1424- */
1425- signal selectionDone(var items)
1426- /*!
1427- This handler is called when the selection mode is canceled
1428- */
1429- signal selectionCanceled()
1430-
1431- /*!
1432- Start the selection mode on the list view.
1433- */
1434- function startSelection()
1435- {
1436- state = "selection"
1437- }
1438- /*!
1439- Check if the item is selected
1440- Returns true if the item was marked as selected or false if the item is unselected
1441- */
1442- function isSelected(item)
1443- {
1444- if (item && item.VisualDataModel) {
1445- return (item.VisualDataModel.inSelected === true)
1446- } else {
1447- return false
1448- }
1449- }
1450- /*!
1451- Mark the item as selected
1452- Returns true if the item was marked as selected or false if the item is already selected
1453- */
1454- function selectItem(item)
1455- {
1456- if (item.VisualDataModel.inSelected) {
1457- return false
1458- } else {
1459- if (!multipleSelection) {
1460- clearSelection()
1461- }
1462- item.VisualDataModel.inSelected = true
1463- return true
1464- }
1465- }
1466- /*!
1467- Remove the index from the selected list
1468- */
1469- function deselectItem(item)
1470- {
1471- var result = false
1472- if (item.VisualDataModel.inSelected) {
1473- item.VisualDataModel.inSelected = false
1474- result = true
1475- }
1476- return result
1477- }
1478- /*!
1479- Finish the selection mode with sucess
1480- */
1481- function endSelection()
1482- {
1483- selectionDone(listView.selectedItems)
1484- clearSelection()
1485- state = ""
1486- }
1487- /*!
1488- Cancel the selection
1489- */
1490- function cancelSelection()
1491- {
1492- selectionCanceled()
1493- clearSelection()
1494- state = ""
1495- }
1496- /*!
1497- Remove any selected item from the selection list
1498- */
1499- function clearSelection()
1500- {
1501- if (selectedItems.count > 0) {
1502- selectedItems.remove(0, selectedItems.count)
1503- }
1504- }
1505- /*!
1506- Select all items in the list
1507- */
1508- function selectAll()
1509- {
1510- if (multipleSelection) {
1511- visualModel.items.addGroups(0, visualModel.items.count, ["selected"] )
1512- }
1513- }
1514-
1515- model: visualModel
1516-
1517- MultipleSelectionVisualModel {
1518- id: visualModel
1519- }
1520-
1521- Component.onCompleted: {
1522- // FIXME: workaround for qtubuntu not returning values depending on the grid unit definition
1523- // for Flickable.maximumFlickVelocity and Flickable.flickDeceleration
1524- var scaleFactor = units.gridUnit / 8;
1525- maximumFlickVelocity = maximumFlickVelocity * scaleFactor;
1526- flickDeceleration = flickDeceleration * scaleFactor;
1527- }
1528-}
1529
1530=== removed file 'src/app/webbrowser/upstreamcomponents/MultipleSelectionVisualModel.qml'
1531--- src/app/webbrowser/upstreamcomponents/MultipleSelectionVisualModel.qml 2014-10-15 09:38:37 +0000
1532+++ src/app/webbrowser/upstreamcomponents/MultipleSelectionVisualModel.qml 1970-01-01 00:00:00 +0000
1533@@ -1,31 +0,0 @@
1534-/*
1535- * Copyright (C) 2012-2013 Canonical, Ltd.
1536- *
1537- * This program is free software; you can redistribute it and/or modify
1538- * it under the terms of the GNU General Public License as published by
1539- * the Free Software Foundation; version 3.
1540- *
1541- * This program is distributed in the hope that it will be useful,
1542- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1543- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1544- * GNU General Public License for more details.
1545- *
1546- * You should have received a copy of the GNU General Public License
1547- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1548- */
1549-
1550-import QtQuick 2.0
1551-
1552-VisualDataModel {
1553- id: contactVisualModel
1554-
1555- property alias selectedItems: selectedGroup
1556-
1557- groups: [
1558- VisualDataGroup {
1559- id: selectedGroup
1560-
1561- name: "selected"
1562- }
1563- ]
1564-}
1565
1566=== removed file 'src/app/webbrowser/upstreamcomponents/README'
1567--- src/app/webbrowser/upstreamcomponents/README 2014-10-09 17:41:02 +0000
1568+++ src/app/webbrowser/upstreamcomponents/README 1970-01-01 00:00:00 +0000
1569@@ -1,20 +0,0 @@
1570-# Upstream components
1571-
1572-This folder houses components that were taken from upstream applications like
1573-the Contacts App, Address Book etc. It is important to keep these files synced
1574-with upstream regularly. These components will be used app until they are made
1575-available in the Ubuntu SDK.
1576-
1577-# Links
1578-
1579-ListItemWithActions.qml
1580-https://bazaar.launchpad.net/~phablet-team/address-book-app/trunk/view/head:/src/imports/Ubuntu/Contacts/ListItemWithActions.qml
1581-
1582-ListItemWithActionsCheckBox.qml
1583-https://bazaar.launchpad.net/~phablet-team/address-book-app/trunk/view/head:/src/imports/Ubuntu/Contacts/ListItemWithActionsCheckBox.qml
1584-
1585-MultipleSelectionListView.qml
1586-https://bazaar.launchpad.net/~phablet-team/address-book-app/trunk/view/head:/src/imports/Ubuntu/Contacts/MultipleSelectionListView.qml
1587-
1588-MultipleSelectionVisualModel.qml
1589-https://bazaar.launchpad.net/~phablet-team/address-book-app/trunk/view/head:/src/imports/Ubuntu/Contacts/MultipleSelectionVisualModel.qml
1590
1591=== modified file 'tests/autopilot/webbrowser_app/emulators/browser.py'
1592--- tests/autopilot/webbrowser_app/emulators/browser.py 2015-05-20 11:31:33 +0000
1593+++ tests/autopilot/webbrowser_app/emulators/browser.py 2015-06-02 14:24:15 +0000
1594@@ -361,14 +361,32 @@
1595
1596 class NewTabView(uitk.UbuntuUIToolkitCustomProxyObjectBase):
1597
1598- def get_top_sites(self):
1599- """Return a list of the top sites URLs."""
1600- top_sites_list = self.wait_select_single(
1601- UrlsList, objectName="topSitesList", visible=True)
1602- return top_sites_list.get_url_list()
1603+ def get_bookmarks_more_button(self):
1604+ return self.select_single("Button", objectName="bookmarks.moreButton")
1605+
1606+ def get_homepage_bookmark(self):
1607+ return self.select_single(UrlDelegate, objectName="homepageBookmark")
1608+
1609+ def get_bookmarks_list(self):
1610+ return self.select_single(UrlsList, objectName="bookmarksList")
1611+
1612+ def get_top_sites_list(self):
1613+ return self.select_single(UrlsList, objectName="topSitesList")
1614+
1615+ def get_notopsites_label(self):
1616+ return self.select_single("Label", objectName="notopsites")
1617
1618
1619 class UrlsList(uitk.UbuntuUIToolkitCustomProxyObjectBase):
1620
1621- def get_url_list(self):
1622- return [delegate.url for delegate in self.select_many("UrlDelegate")]
1623+ def get_delegates(self):
1624+ return sorted(self.select_many(UrlDelegate),
1625+ key=lambda delegate: delegate.globalRect.y)
1626+
1627+ def get_urls(self):
1628+ return [delegate.url for delegate in self.get_delegates()]
1629+
1630+
1631+class UrlDelegate(uitk.UCListItem):
1632+
1633+ pass
1634
1635=== modified file 'tests/autopilot/webbrowser_app/tests/__init__.py'
1636--- tests/autopilot/webbrowser_app/tests/__init__.py 2015-05-20 11:37:18 +0000
1637+++ tests/autopilot/webbrowser_app/tests/__init__.py 2015-06-02 14:24:15 +0000
1638@@ -134,7 +134,7 @@
1639 self.pointing_device.click_object(tabs_action)
1640 else:
1641 self.drag_bottom_edge_upwards(0.75)
1642- self.main_window.get_tabs_view()
1643+ return self.main_window.get_tabs_view()
1644
1645 def open_new_tab(self):
1646 if (self.main_window.incognito):
1647
1648=== added file 'tests/autopilot/webbrowser_app/tests/test_new_tab_view.py'
1649--- tests/autopilot/webbrowser_app/tests/test_new_tab_view.py 1970-01-01 00:00:00 +0000
1650+++ tests/autopilot/webbrowser_app/tests/test_new_tab_view.py 2015-06-02 14:24:15 +0000
1651@@ -0,0 +1,274 @@
1652+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1653+#
1654+# Copyright 2015 Canonical
1655+#
1656+# This program is free software: you can redistribute it and/or modify it
1657+# under the terms of the GNU General Public License version 3, as published
1658+# by the Free Software Foundation.
1659+#
1660+# This program is distributed in the hope that it will be useful,
1661+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1662+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1663+# GNU General Public License for more details.
1664+#
1665+# You should have received a copy of the GNU General Public License
1666+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1667+
1668+import os.path
1669+import sqlite3
1670+import time
1671+
1672+from autopilot.matchers import Eventually
1673+from testtools.matchers import Equals, NotEquals
1674+
1675+from webbrowser_app.tests import StartOpenRemotePageTestCaseBase
1676+
1677+
1678+class TestNewTabViewLifetime(StartOpenRemotePageTestCaseBase):
1679+
1680+ def test_new_tab_view_destroyed_when_browsing(self):
1681+ self.open_tabs_view()
1682+ new_tab_view = self.open_new_tab()
1683+ self.main_window.go_to_url(self.base_url + "/test2")
1684+ new_tab_view.wait_until_destroyed()
1685+
1686+ def test_new_tab_view_destroyed_when_closing_tab(self):
1687+ self.open_tabs_view()
1688+ new_tab_view = self.open_new_tab()
1689+ tabs_view = self.open_tabs_view()
1690+ tabs_view.get_previews()[0].close()
1691+ self.main_window.get_recent_view_toolbar().click_button("doneButton")
1692+ new_tab_view.wait_until_destroyed()
1693+
1694+ def test_new_tab_view_is_shared_between_tabs(self):
1695+ # Open one new tab
1696+ self.open_tabs_view()
1697+ new_tab_view = self.open_new_tab()
1698+ # Open a second new tab
1699+ self.open_tabs_view()
1700+ new_tab_view_2 = self.open_new_tab()
1701+ # Verify that they share the same NewTabView instance
1702+ self.assertThat(new_tab_view_2.id, Equals(new_tab_view.id))
1703+ # Close the second new tab, and verify that the NewTabView instance
1704+ # is still there
1705+ tabs_view = self.open_tabs_view()
1706+ tabs_view.get_previews()[0].close()
1707+ self.main_window.get_recent_view_toolbar().click_button("doneButton")
1708+ tabs_view.visible.wait_for(False)
1709+ self.assertThat(new_tab_view.visible, Equals(True))
1710+ # Close the first new tab, and verify that the NewTabView instance
1711+ # is destroyed
1712+ tabs_view = self.open_tabs_view()
1713+ tabs_view.get_previews()[0].close()
1714+ self.main_window.get_recent_view_toolbar().click_button("doneButton")
1715+ new_tab_view.wait_until_destroyed()
1716+
1717+ def test_new_tab_view_not_destroyed_when_closing_last_open_tab(self):
1718+ tabs_view = self.open_tabs_view()
1719+ tabs_view.get_previews()[0].close()
1720+ tabs_view.visible.wait_for(False)
1721+ new_tab_view = self.main_window.get_new_tab_view()
1722+ # Verify that the new tab view is not destroyed and then re-created
1723+ # when closing the last open tab if it was a blank one
1724+ tabs_view = self.open_tabs_view()
1725+ tabs_view.get_previews()[0].close()
1726+ tabs_view.visible.wait_for(False)
1727+ self.assertThat(new_tab_view.visible, Equals(True))
1728+
1729+
1730+class TestNewPrivateTabViewLifetime(StartOpenRemotePageTestCaseBase):
1731+
1732+ def test_new_private_tab_view_destroyed_when_browsing(self):
1733+ self.main_window.enter_private_mode()
1734+ new_private_tab_view = self.main_window.get_new_private_tab_view()
1735+ self.main_window.go_to_url(self.base_url + "/test2")
1736+ new_private_tab_view.wait_until_destroyed()
1737+
1738+ def test_new_private_tab_view_destroyed_when_leaving_private_mode(self):
1739+ self.main_window.enter_private_mode()
1740+ new_private_tab_view = self.main_window.get_new_private_tab_view()
1741+ self.main_window.leave_private_mode()
1742+ new_private_tab_view.wait_until_destroyed()
1743+
1744+ def test_new_private_tab_view_is_shared_between_tabs(self):
1745+ self.main_window.enter_private_mode()
1746+ new_private_tab_view = self.main_window.get_new_private_tab_view()
1747+ self.main_window.go_to_url(self.base_url + "/test2")
1748+ new_private_tab_view.wait_until_destroyed()
1749+ # Open one new private tab
1750+ self.open_tabs_view()
1751+ new_private_tab_view = self.open_new_tab()
1752+ # Open a second new private tab
1753+ self.open_tabs_view()
1754+ new_private_tab_view_2 = self.open_new_tab()
1755+ # Verify that they share the same NewPrivateTabView instance
1756+ self.assertThat(new_private_tab_view_2.id,
1757+ Equals(new_private_tab_view.id))
1758+ # Close the second new private tab, and verify that the
1759+ # NewPrivateTabView instance is still there
1760+ tabs_view = self.open_tabs_view()
1761+ tabs_view.get_previews()[0].close()
1762+ self.main_window.get_recent_view_toolbar().click_button("doneButton")
1763+ tabs_view.visible.wait_for(False)
1764+ self.assertThat(new_private_tab_view.visible, Equals(True))
1765+ # Close the first new private tab, and verify that the
1766+ # NewPrivateTabView instance is destroyed
1767+ tabs_view = self.open_tabs_view()
1768+ tabs_view.get_previews()[0].close()
1769+ self.main_window.get_recent_view_toolbar().click_button("doneButton")
1770+ new_private_tab_view.wait_until_destroyed()
1771+
1772+
1773+class TestNewTabViewContents(StartOpenRemotePageTestCaseBase):
1774+
1775+ def setUp(self):
1776+ self.create_temporary_profile()
1777+ self.populate_config()
1778+ self.populate_bookmarks()
1779+ super(TestNewTabViewContents, self).setUp()
1780+
1781+ def populate_config(self):
1782+ self.homepage = "http://test/test2"
1783+ config_file = os.path.join(self.config_location, "webbrowser-app.conf")
1784+ with open(config_file, "w") as f:
1785+ f.write("[General]\n")
1786+ f.write("homepage={}".format(self.homepage))
1787+
1788+ def populate_bookmarks(self):
1789+ db_path = os.path.join(self.data_location, "bookmarks.sqlite")
1790+ connection = sqlite3.connect(db_path)
1791+ connection.execute("""CREATE TABLE IF NOT EXISTS bookmarks
1792+ (url VARCHAR, title VARCHAR, icon VARCHAR,
1793+ created INTEGER);""")
1794+ rows = [
1795+ ("http://test/periodic-table/element/24/chromium",
1796+ "Chromium - Element Information"),
1797+ ("http://test/periodic-table/element/77/iridium",
1798+ "Iridium - Element Information"),
1799+ ("http://test/periodic-table/element/31/gallium",
1800+ "Gallium - Element Information"),
1801+ ("http://test/periodic-table/element/116/livermorium",
1802+ "Livermorium - Element Information"),
1803+ ("http://test/periodic-table/element/62/samarium",
1804+ "Samarium - Element Information"),
1805+ ("http://test/periodic-table/element/63/europium",
1806+ "Europium - Element Information"),
1807+ ]
1808+ for i, row in enumerate(rows):
1809+ timestamp = int(time.time()) - i * 10
1810+ query = "INSERT INTO bookmarks \
1811+ VALUES ('{}', '{}', '', {});"
1812+ query = query.format(row[0], row[1], timestamp)
1813+ connection.execute(query)
1814+ connection.commit()
1815+ connection.close()
1816+
1817+ def test_default_home_bookmark(self):
1818+ self.open_tabs_view()
1819+ new_tab_view = self.open_new_tab()
1820+ homepage_bookmark = new_tab_view.get_homepage_bookmark()
1821+ self.assertThat(homepage_bookmark.url, Equals(self.homepage))
1822+ self.pointing_device.click_object(homepage_bookmark)
1823+ new_tab_view.wait_until_destroyed()
1824+ self.main_window.wait_until_page_loaded(self.homepage)
1825+
1826+ def test_open_bookmark(self):
1827+ self.open_tabs_view()
1828+ new_tab_view = self.open_new_tab()
1829+ bookmarks = new_tab_view.get_bookmarks_list()
1830+ self.assertThat(lambda: len(bookmarks.get_delegates()),
1831+ Eventually(Equals(4)))
1832+ bookmark = bookmarks.get_delegates()[1]
1833+ url = bookmark.url
1834+ self.pointing_device.click_object(bookmark)
1835+ new_tab_view.wait_until_destroyed()
1836+ self.main_window.wait_until_page_loaded(url)
1837+
1838+ def test_bookmarks_section_expands_and_collapses(self):
1839+ self.open_tabs_view()
1840+ new_tab_view = self.open_new_tab()
1841+ bookmarks = new_tab_view.get_bookmarks_list()
1842+ top_sites = new_tab_view.get_top_sites_list()
1843+ self.assertThat(top_sites.visible, Equals(True))
1844+ # When the bookmarks list is collapsed, it shows a maximum of 4 entries
1845+ self.assertThat(lambda: len(bookmarks.get_delegates()),
1846+ Eventually(Equals(4)))
1847+ # When expanded, it shows all entries
1848+ more_button = new_tab_view.get_bookmarks_more_button()
1849+ self.assertThat(more_button.visible, Equals(True))
1850+ self.pointing_device.click_object(more_button)
1851+ self.assertThat(lambda: len(bookmarks.get_delegates()),
1852+ Eventually(Equals(6)))
1853+ self.assertThat(top_sites.visible, Eventually(Equals(False)))
1854+ # Collapse again
1855+ self.assertThat(more_button.visible, Equals(True))
1856+ self.pointing_device.click_object(more_button)
1857+ self.assertThat(lambda: len(bookmarks.get_delegates()),
1858+ Eventually(Equals(4)))
1859+ self.assertThat(top_sites.visible, Eventually(Equals(True)))
1860+
1861+ def _remove_first_bookmark(self):
1862+ bookmarks = self.main_window.get_new_tab_view().get_bookmarks_list()
1863+ delegate = bookmarks.get_delegates()[0]
1864+ url = delegate.url
1865+ delegate.trigger_leading_action("leadingAction.delete",
1866+ delegate.wait_until_destroyed)
1867+ self.assertThat(lambda: bookmarks.get_urls()[0],
1868+ Eventually(NotEquals(url)))
1869+
1870+ def test_remove_bookmarks_when_collapsed(self):
1871+ self.open_tabs_view()
1872+ new_tab_view = self.open_new_tab()
1873+ bookmarks = new_tab_view.get_bookmarks_list()
1874+ self.assertThat(lambda: len(bookmarks.get_delegates()),
1875+ Eventually(Equals(4)))
1876+ more_button = new_tab_view.get_bookmarks_more_button()
1877+ for i in range(3):
1878+ self._remove_first_bookmark()
1879+ self.assertThat(more_button.visible, Eventually(Equals(i < 1)))
1880+ self.assertThat(len(bookmarks.get_delegates()),
1881+ Equals(4 if (i < 2) else 3))
1882+
1883+ def test_remove_bookmarks_when_expanded(self):
1884+ self.open_tabs_view()
1885+ new_tab_view = self.open_new_tab()
1886+ bookmarks = new_tab_view.get_bookmarks_list()
1887+ more_button = new_tab_view.get_bookmarks_more_button()
1888+ self.assertThat(more_button.visible, Equals(True))
1889+ self.pointing_device.click_object(more_button)
1890+ self.assertThat(lambda: len(bookmarks.get_delegates()),
1891+ Eventually(Equals(6)))
1892+ more_button = new_tab_view.get_bookmarks_more_button()
1893+ top_sites = new_tab_view.get_top_sites_list()
1894+ for i in range(3):
1895+ self._remove_first_bookmark()
1896+ self.assertThat(len(bookmarks.get_delegates()), Equals(5 - i))
1897+ self.assertThat(more_button.visible, Eventually(Equals(i < 1)))
1898+ self.assertThat(top_sites.visible, Eventually(Equals(i > 0)))
1899+
1900+ def test_open_top_site(self):
1901+ self.open_tabs_view()
1902+ new_tab_view = self.open_new_tab()
1903+ top_sites = new_tab_view.get_top_sites_list()
1904+ self.assertThat(lambda: len(top_sites.get_delegates()),
1905+ Eventually(Equals(1)))
1906+ top_site = top_sites.get_delegates()[0]
1907+ url = top_site.url
1908+ self.pointing_device.click_object(top_site)
1909+ new_tab_view.wait_until_destroyed()
1910+ self.main_window.wait_until_page_loaded(url)
1911+
1912+ def test_remove_top_sites(self):
1913+ self.open_tabs_view()
1914+ new_tab_view = self.open_new_tab()
1915+ top_sites = new_tab_view.get_top_sites_list()
1916+ self.assertThat(lambda: len(top_sites.get_delegates()),
1917+ Eventually(Equals(1)))
1918+ notopsites_label = new_tab_view.get_notopsites_label()
1919+ self.assertThat(notopsites_label.visible, Eventually(Equals(False)))
1920+ delegate = top_sites.get_delegates()[0]
1921+ delegate.trigger_leading_action("leadingAction.delete",
1922+ delegate.wait_until_destroyed)
1923+ self.assertThat(lambda: len(top_sites.get_delegates()),
1924+ Eventually(Equals(0)))
1925+ self.assertThat(notopsites_label.visible, Eventually(Equals(True)))
1926
1927=== modified file 'tests/autopilot/webbrowser_app/tests/test_private.py'
1928--- tests/autopilot/webbrowser_app/tests/test_private.py 2015-05-22 19:13:31 +0000
1929+++ tests/autopilot/webbrowser_app/tests/test_private.py 2015-06-02 14:24:15 +0000
1930@@ -25,7 +25,7 @@
1931 def get_url_list_from_top_sites(self):
1932 self.open_tabs_view()
1933 new_tab_view = self.open_new_tab()
1934- return new_tab_view.get_top_sites()
1935+ return new_tab_view.get_top_sites_list().get_urls()
1936
1937 def test_going_in_and_out_private_mode(self):
1938 address_bar = self.main_window.address_bar
1939
1940=== modified file 'tests/autopilot/webbrowser_app/tests/test_tabs.py'
1941--- tests/autopilot/webbrowser_app/tests/test_tabs.py 2015-03-20 15:28:33 +0000
1942+++ tests/autopilot/webbrowser_app/tests/test_tabs.py 2015-06-02 14:24:15 +0000
1943@@ -71,8 +71,7 @@
1944 self.main_window.go_to_url(url)
1945 new_tab_view.wait_until_destroyed()
1946 self.assert_number_webviews_eventually(2)
1947- self.open_tabs_view()
1948- tabs_view = self.main_window.get_tabs_view()
1949+ tabs_view = self.open_tabs_view()
1950 previews = tabs_view.get_previews()
1951 self.assertThat(len(previews), Equals(2))
1952 previews[0].close()
1953@@ -150,8 +149,7 @@
1954 self.assert_number_webviews_eventually(2)
1955
1956 def test_selecting_tab_focuses_webview(self):
1957- self.open_tabs_view()
1958- tabs_view = self.main_window.get_tabs_view()
1959+ tabs_view = self.open_tabs_view()
1960 tabs_view.get_previews()[0].select()
1961 tabs_view.visible.wait_for(False)
1962 webview = self.main_window.get_current_webview()
1963@@ -170,8 +168,7 @@
1964 self.assert_number_webviews_eventually(1)
1965
1966 def test_last_webview_requests_close(self):
1967- self.open_tabs_view()
1968- tabs_view = self.main_window.get_tabs_view()
1969+ tabs_view = self.open_tabs_view()
1970 tabs_view.get_previews()[0].close()
1971 tabs_view.visible.wait_for(False)
1972 url = self.base_url + "/closeself"
1973
1974=== modified file 'tests/unittests/history-domainlist-chronological-model/tst_HistoryDomainListChronologicalModelTests.cpp'
1975--- tests/unittests/history-domainlist-chronological-model/tst_HistoryDomainListChronologicalModelTests.cpp 2014-08-12 19:57:28 +0000
1976+++ tests/unittests/history-domainlist-chronological-model/tst_HistoryDomainListChronologicalModelTests.cpp 2015-06-02 14:24:15 +0000
1977@@ -99,6 +99,11 @@
1978 QCOMPARE(args.at(1).toInt(), 0);
1979 QCOMPARE(args.at(2).toInt(), 0);
1980 }
1981+
1982+ void shouldReturnDomain() {
1983+ history->add(QUrl("http://example.org/"), "Example Domain", QUrl());
1984+ QCOMPARE(model->get(0), QString("example.org"));
1985+ }
1986 };
1987
1988 QTEST_MAIN(HistoryDomainListChronologicalModelTests)
1989
1990=== modified file 'tests/unittests/top-sites-model/tst_TopSitesModelTests.cpp'
1991--- tests/unittests/top-sites-model/tst_TopSitesModelTests.cpp 2015-04-09 15:03:27 +0000
1992+++ tests/unittests/top-sites-model/tst_TopSitesModelTests.cpp 2015-06-02 14:24:15 +0000
1993@@ -74,17 +74,22 @@
1994
1995 void shouldMatchAllWhenNothingIsHidden()
1996 {
1997+ QSignalSpy spy(topsites, SIGNAL(countChanged()));
1998 model->add(QUrl("http://example.org"), "Example Domain", QUrl());
1999 model->add(QUrl("http://example.com"), "Example Domain", QUrl());
2000+ QCOMPARE(spy.count(), 2);
2001 QCOMPARE(topsites->rowCount(), 2);
2002 }
2003
2004 void shouldFilterOutHiddenUrls()
2005 {
2006+ QSignalSpy spy(topsites, SIGNAL(countChanged()));
2007 model->add(QUrl("http://example.org"), "Example Domain", QUrl());
2008 model->add(QUrl("http://example.com"), "Example Domain", QUrl());
2009+ QCOMPARE(spy.count(), 2);
2010 QCOMPARE(topsites->rowCount(), 2);
2011 model->hide(QUrl("http://example.org"));
2012+ QCOMPARE(spy.count(), 3);
2013 QCOMPARE(topsites->rowCount(), 1);
2014 QCOMPARE(topsites->data(topsites->index(0, 0), HistoryModel::Url).toUrl(), QUrl("http://example.com"));
2015 }

Subscribers

People subscribed via source and target branches

to status/vote changes: