Merge lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/ubuntu-rssreader-app-new-header-temp into lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk

Proposed by Nicholas Skaggs
Status: Merged
Approved by: Joey Chan
Approved revision: 277
Merged at revision: 311
Proposed branch: lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/ubuntu-rssreader-app-new-header-temp
Merge into: lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk
Diff against target: 1613 lines (+553/-617)
15 files modified
ArticleViewItem.qml (+107/-64)
ListModePage.qml (+2/-85)
RssFeedPage.qml (+0/-47)
SavedTab.qml (+1/-1)
ShortsTab.qml (+1/-1)
TopicTab.qml (+1/-1)
feeds/AppendFeedPage.qml (+88/-74)
feeds/ChooseTopicPage.qml (+71/-96)
feeds/CreateTopicPage.qml (+77/-65)
feeds/TopicComponent.qml (+1/-1)
feeds/TopicManagement.qml (+85/-72)
icons_tmp/back.svg (+21/-0)
shorts-app.qml (+15/-8)
tests/autopilot/shorts_app/__init__.py (+72/-48)
tests/autopilot/shorts_app/tests/test_rssreader.py (+11/-54)
To merge this branch: bzr merge lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/ubuntu-rssreader-app-new-header-temp
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Joey Chan Approve
Review via email: mp+235046@code.launchpad.net

Commit message

Meet Shorts with new header!

--

This is a resubmit under a common branch so everyone can edit. The tests have been corrected by Carla.

Description of the change

Meet Shorts with new header!

--

This is a resubmit under a common branch so everyone can edit. The tests have been corrected by Carla.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Joey Chan (qqworini) wrote :

looks great ! ( ´∀`)σ)Д`) (◕‿◕✿)

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ArticleViewItem.qml'
2--- ArticleViewItem.qml 2014-09-02 06:34:00 +0000
3+++ ArticleViewItem.qml 2014-09-17 20:27:28 +0000
4@@ -69,9 +69,9 @@
5 width: parent.width
6 anchors {
7 bottom: parent.bottom
8- bottomMargin: units.gu(2)
9+ bottomMargin: units.gu(1)
10 top: parent.top
11- topMargin: units.gu(2)
12+ topMargin: units.gu(1)
13 }
14
15 snapMode: ListView.SnapOneItem
16@@ -185,7 +185,7 @@
17 }
18
19 Label {
20-// fontSize: "large"
21+ // fontSize: "large"
22 color: "grey"
23 text: model.author ? model.author : ""
24 anchors.horizontalCenter: parent.horizontalCenter
25@@ -225,69 +225,112 @@
26 width: parent.width - units.gu(4)
27 wrapMode: Text.WrapAtWordBoundaryOrAnywhere
28 }
29-
30- Button {
31- id: showMediaButton
32-
33- text: i18n.tr("Show media")
34- anchors.horizontalCenter: parent.horizontalCenter
35- // Everyone can test my "Show media". I want it in v 1.0 too.
36- visible: false // model.media_groups ? true : false
37-
38- onClicked: {
39- visible = false
40-
41- var medias = JSON.parse(rssModel.get(index).media_groups)
42- var len = medias.length
43-
44- for (var i = 0; i < len; i++) {
45- var media = medias[i]
46-
47- for (var j = 0; j < media.contents.length; j++) {
48- var cont = media.contents[j]
49-
50- if (cont.type === "image/jpeg" || cont.type === "image/png" ||
51- cont.type === "image/jpeg" || cont.type === "image/pjpeg" ||
52- cont.type === "image/svg+xml" || cont.medium === "image") {
53- var mediaImg = mediaGroupImageComponent.createObject(innerAreaColumn)
54-
55- innerAreaColumn.mediaDownloadInProgress++
56- mediaImg.mediaLoadFinished.connect(innerAreaColumn.mediaDownloaded)
57-
58- mediaImg.anchors.horizontalCenter = showMediaButton.horizontalCenter
59- mediaImg.source = cont.url
60- }
61- }
62- }
63- }
64- }
65-
66- ActivityIndicator {
67- id: mediaDownloadIndicator
68-
69- running: innerAreaColumn.mediaDownloadInProgress > 0
70- visible: running
71- anchors.horizontalCenter: parent.horizontalCenter
72- }
73- }
74+ } // Column
75+
76 } // Flickable
77 } // Component
78
79+ property bool isEmbeddedMode: false
80+
81+ Panel {
82+ id: operationsPanel
83+
84+ visible: rssItem != null
85+ Rectangle { color: "#fafafa"; anchors.fill: parent }
86+
87+ anchors {
88+ left: parent.left
89+ right: parent.right
90+ bottom: parent.bottom
91+ }
92+ height: units.gu(6)
93+ Item {
94+ anchors.fill: parent
95+
96+ ToolbarButton {
97+ id: backBtn
98+
99+ visible: !isEmbeddedMode
100+ anchors {
101+ verticalCenter: parent.verticalCenter
102+ left: parent.left
103+ leftMargin: units.gu(1)
104+ }
105+ action: Action {
106+ iconSource: "./icons_tmp/back.svg"
107+ text: i18n.tr("Back")
108+ onTriggered: {
109+ pageStack.pop()
110+ }
111+ }
112+ }
113+
114+ ToolbarButton {
115+ id: optionsBtn
116+
117+ anchors {
118+ verticalCenter: parent.verticalCenter
119+ right: saveButton.left
120+ rightMargin: units.gu(1)
121+ }
122+
123+ action: Action {
124+ text: i18n.tr("Options")
125+ iconSource: "./icons_tmp/settings.svg"
126+ onTriggered: {
127+ PopupUtils.open(readingOptionsPopoverComponent, optionsBtn)
128+ }
129+ }
130+ }
131+
132+ ToolbarButton {
133+ id: saveButton
134+
135+ anchors {
136+ verticalCenter: parent.verticalCenter
137+ right: openSiteBtn.left
138+ rightMargin: units.gu(1)
139+ }
140+ visible: rssItem != null
141+ action: Action {
142+ text: rssItem == null ? "" : (rssItem.favourite == "0" ? i18n.tr("Save") : i18n.tr("Remove"))
143+ iconSource: {
144+ if (rssItem == null || rssItem.favourite == "0")
145+ return Qt.resolvedUrl("./icons_tmp/favorite-unselected.svg")
146+ else return Qt.resolvedUrl("./icons_tmp/favorite-selected.svg")
147+ }
148+ onTriggered: {
149+ var fav = (rssItem.favourite == "0" ? "1" : "0")
150+ var dbResult = DB.updateArticleFavourite(rssItem.id, fav)
151+ if (dbResult.rowsAffected === 1) {
152+ articleFavouriteChanged(rssItem, fav)
153+ }
154+ }
155+ }
156+ } // Button
157+
158+ ToolbarButton {
159+ id: openSiteBtn
160+
161+ anchors {
162+ verticalCenter: parent.verticalCenter
163+ right: parent.right
164+ rightMargin: units.gu(1)
165+ }
166+ visible: rssItem != null
167+ action: Action {
168+ text: i18n.tr("Open site")
169+ iconSource: Qt.resolvedUrl("./icons_tmp/go-to.svg")
170+ onTriggered: {
171+ Qt.openUrlExternally(rssItem.link)
172+ }
173+ }
174+ } // Button
175+ }
176+ } // Panel
177+
178 Component {
179- id: mediaGroupImageComponent
180-
181- Image {
182- id: mediaGroupImage
183-
184- signal mediaLoadFinished
185-
186- fillMode: Image.PreserveAspectFit
187- width: Math.min(sourceSize.width, articleViewRoot.width - units.gu(4))
188-
189- onStatusChanged: {
190- if (status == Image.Ready)
191- mediaLoadFinished()
192- }
193- }
194- }
195+ id: readingOptionsPopoverComponent
196+ ReadingOptions { }
197+ } // Comp
198 }
199
200=== modified file 'ListModePage.qml'
201--- ListModePage.qml 2014-09-02 06:34:00 +0000
202+++ ListModePage.qml 2014-09-17 20:27:28 +0000
203@@ -15,7 +15,7 @@
204 property var listViewModel: null
205 property bool isShorts: topicId == 0
206
207- property var listTools: listModeTools
208+ // property var listTools: listModeTools
209
210 function getListToots() {
211 return listModeTools
212@@ -234,6 +234,7 @@
213 ArticleViewItem {
214 id: listArticleView
215
216+ isEmbeddedMode: mainView.isTabletMode
217 height: parent.height
218 anchors {
219 left: articleList.right
220@@ -245,90 +246,6 @@
221 // onVisibleChanged: if (visible) showArticle(0)
222 }
223
224- ToolbarItems {
225- id: listModeTools
226-
227- visible: mainView.isTabletMode
228-
229- back: ToolbarButton {
230- objectName: "rsspagerefreshbutton"
231- action: refreshAction
232- }
233-
234- ToolbarButton {
235- objectName: "changemodebutton"
236- action: changeModeAction
237- }
238-
239- ToolbarButton {
240- id: addReadsBtn
241- objectName: "addreadsbutton"
242- action: Action {
243- text: i18n.tr("Add reads")
244- iconSource: Qt.resolvedUrl("icons_tmp/add.svg")
245- onTriggered: {
246- PopupUtils.open(addReadsPopoverComp, addReadsBtn)
247- }
248- }
249- }
250-
251- ToolbarButton {
252- objectName: "edittopicsbutton"
253- action: editTopicsAction
254- }
255-
256- ToolbarButton {
257- id: readingOptionsButton
258-
259- visible: true
260- action: Action {
261- text: i18n.tr("Options")
262- iconSource: Qt.resolvedUrl("./icons_tmp/settings.svg")
263- onTriggered: {
264- PopupUtils.open(readingOptionsPopoverComponent, readingOptionsButton)
265- }
266- }
267- }
268-
269- ToolbarButton {
270- //visible: mainView.isTabletMode
271- objectName: "addRemoveFavor"
272-
273- visible: listArticleView.rssItem != null
274- action: Action {
275- id: addRemoveFavor
276-
277- text: listArticleView.rssItem == null ? "" : (listArticleView.rssItem.favourite == "0" ? i18n.tr("Save") : i18n.tr("Remove"))
278- iconSource: {
279- if (listArticleView.rssItem == null || listArticleView.rssItem.favourite == "0")
280- return Qt.resolvedUrl("icons_tmp/favorite-unselected.svg")
281- else return Qt.resolvedUrl("icons_tmp/favorite-selected.svg")
282- }
283- onTriggered: {
284- var fav = (listArticleView.rssItem.favourite == "0" ? "1" : "0")
285- var dbResult = DB.updateArticleFavourite(listArticleView.rssItem.id, fav)
286- if (dbResult.rowsAffected == 1) {
287- listArticleView.articleFavouriteChanged(listArticleView.rssItem, fav)
288- }
289- }
290- }
291- }
292-
293- ToolbarButton {
294- //visible: mainView.isTabletMode
295- objectName: "openSiteAction"
296- action: Action {
297- id: openSiteAction
298-
299- text: i18n.tr("Open site")
300- iconSource: Qt.resolvedUrl("icons_tmp/go-to.svg")
301- onTriggered: {
302- Qt.openUrlExternally(listArticleView.rssItem.link)
303- }
304- }
305- }
306- } // ToolBarItems
307-
308 Component {
309 id: readingOptionsPopoverComponent
310
311
312=== modified file 'RssFeedPage.qml'
313--- RssFeedPage.qml 2014-09-02 06:34:00 +0000
314+++ RssFeedPage.qml 2014-09-17 20:27:28 +0000
315@@ -30,55 +30,8 @@
316 anchors.fill: parent
317 }
318
319- tools: ToolbarItems {
320- objectName: "pageBackBtn"
321- id: toolbar
322-
323- ToolbarButton {
324- id: readingOptionsButton
325-
326- visible: true
327- action: Action {
328- text: i18n.tr("Options")
329- iconSource: Qt.resolvedUrl("./icons_tmp/settings.svg")
330- onTriggered: {
331- PopupUtils.open(readingOptionsPopoverComponent, readingOptionsButton)
332- }
333- }
334- }
335-
336- ToolbarButton {
337- action: Action {
338- text: innerArticleView.rssItem == null ? "" : (innerArticleView.rssItem.favourite == "0" ? i18n.tr("Save") : i18n.tr("Remove"))
339- iconSource: {
340- if (innerArticleView.rssItem == null || innerArticleView.rssItem.favourite == "0")
341- return Qt.resolvedUrl("./icons_tmp/favorite-unselected.svg")
342- else return Qt.resolvedUrl("./icons_tmp/favorite-selected.svg")
343- }
344- onTriggered: {
345- var fav = (innerArticleView.rssItem.favourite == "0" ? "1" : "0")
346- var dbResult = DB.updateArticleFavourite(innerArticleView.rssItem.id, fav)
347- if (dbResult.rowsAffected === 1) {
348- innerArticleView.articleFavouriteChanged(innerArticleView.rssItem, fav)
349- }
350- }
351- }
352- }
353-
354- ToolbarButton {
355- action: Action {
356- text: i18n.tr("Open site")
357- iconSource: Qt.resolvedUrl("./icons_tmp/go-to.svg")
358- onTriggered: {
359- Qt.openUrlExternally(innerArticleView.rssItem.link)
360- }
361- }
362- }
363- }
364-
365 Component {
366 id: readingOptionsPopoverComponent
367-
368 ReadingOptions { }
369 } // Comp
370
371
372=== modified file 'SavedTab.qml'
373--- SavedTab.qml 2014-09-02 06:34:00 +0000
374+++ SavedTab.qml 2014-09-17 20:27:28 +0000
375@@ -15,7 +15,7 @@
376 page: Page {
377 id: contentPage
378
379- tools: (isListMode && mainView.isTabletMode) ? listPage.listTools : mainCommonToolbar
380+ tools: /*(isListMode && mainView.isTabletMode) ? listPage.listTools :*/ mainCommonToolbar
381
382 ListModePage {
383 id: listPage
384
385=== modified file 'ShortsTab.qml'
386--- ShortsTab.qml 2014-09-02 06:34:00 +0000
387+++ ShortsTab.qml 2014-09-17 20:27:28 +0000
388@@ -16,7 +16,7 @@
389 page: Page {
390 id: contentPage
391
392- tools: (isListMode && mainView.isTabletMode) ? listPage.listTools : mainCommonToolbar
393+ tools: /*(isListMode && mainView.isTabletMode) ? listPage.listTools :*/ mainCommonToolbar
394
395 ListModePage {
396 id: listPage
397
398=== modified file 'TopicTab.qml'
399--- TopicTab.qml 2014-09-02 06:34:00 +0000
400+++ TopicTab.qml 2014-09-17 20:27:28 +0000
401@@ -16,7 +16,7 @@
402 page: Page {
403 id: contentPage
404
405- tools: (isListMode && mainView.isTabletMode) ? listPage.listTools : mainCommonToolbar
406+ tools: /*(isListMode && mainView.isTabletMode) ? listPage.listTools :*/ mainCommonToolbar
407
408 ListModePage {
409 id: listPage
410
411=== removed file 'avatar@8.png'
412Binary files avatar@8.png 2013-02-12 16:18:48 +0000 and avatar@8.png 1970-01-01 00:00:00 +0000 differ
413=== modified file 'feeds/AppendFeedPage.qml'
414--- feeds/AppendFeedPage.qml 2014-09-02 06:34:00 +0000
415+++ feeds/AppendFeedPage.qml 2014-09-17 20:27:28 +0000
416@@ -33,73 +33,10 @@
417
418 property bool isDirty: false // Need to clear all page content.
419 property int selectedCount: 0
420- //.property var selectedFeeds: null // Become local.
421 property bool resultsReceived: false // Indicates that at least once results were received.
422
423- // Workaround for bug #1231137
424- // set the tools to null, then add the toolbar manually when enter this page
425-
426- tools: null
427-
428- ToolbarItems {
429- id: appendFeedTools
430-
431- opened: true
432- locked: true
433-
434- back: Button {
435- anchors.verticalCenter: parent.verticalCenter
436- action: Action {
437- text: i18n.tr("Cancel")
438-
439- onTriggered:
440- {
441- googleFeedApi.abort()
442- pageStack.pop()
443- }
444- }
445- }
446-
447- ActivityIndicator {
448- id: checkRunning
449-
450- visible: googleFeedApi.inProgress
451- running: googleFeedApi.inProgress
452-
453- anchors.verticalCenter: parent.verticalCenter
454- }
455-
456- Button {
457- objectName: "nextButton"
458- id: nextBtn
459- anchors.verticalCenter: parent.verticalCenter
460-
461- enabled: !googleFeedApi.inProgress && selectedCount > 0
462- action: Action {
463- text: i18n.tr("Next")
464-
465- onTriggered:
466- {
467- if (!nextBtn.enabled)
468- return
469-
470- var selectedFeeds = []
471- for (var i = 0; i < searchResultsModel.count; i++) {
472- var curItem = searchResultsModel.get(i)
473-
474- if (curItem.isSelected) {
475- selectedFeeds.push(curItem)
476- }
477- }
478-
479- pageStack.push(chooseTopicPage, {"feedsToAdd" : selectedFeeds})
480- }
481- }
482- }
483- }
484-
485 function reloadPageContent() {
486- appendFeedPage.tools = appendFeedTools
487+ // appendFeedPage.tools = appendFeedTools
488 if (isDirty) {
489 tfFeedUrl.text = ""
490 resultsReceived = false
491@@ -141,10 +78,10 @@
492
493 for (var i = 0; i < entries.length; i++) {
494 searchResultsModel.append({"url" : entries[i].url,
495- "title" : entries[i].title,
496- "description" : entries[i].contentSnippet,
497- "link" : entries[i].link,
498- "isSelected" : false})
499+ "title" : entries[i].title,
500+ "description" : entries[i].contentSnippet,
501+ "link" : entries[i].link,
502+ "isSelected" : false})
503 }
504 }
505
506@@ -167,10 +104,10 @@
507 var feed = result.responseData.feed
508
509 searchResultsModel.append({"url" : feed.feedUrl,
510- "title" : feed.title,
511- "description" : feed.description,
512- "link" : feed.link,
513- "isSelected" : false})
514+ "title" : feed.title,
515+ "description" : feed.description,
516+ "link" : feed.link,
517+ "isSelected" : false})
518 }
519 }
520
521@@ -195,6 +132,7 @@
522 placeholderText: i18n.tr("Type a keyword or URL")
523
524 width: parent.width - units.gu(4)
525+ // height:units.gu(5)
526 anchors {
527 horizontalCenter: parent.horizontalCenter
528 }
529@@ -202,7 +140,7 @@
530 height: parent.height*0.5
531 width: height
532 anchors.verticalCenter: parent.verticalCenter
533-// anchors.verticalCenterOffset: -units.gu(0.2)
534+ // anchors.verticalCenterOffset: -units.gu(0.2)
535 source: Qt.resolvedUrl("../icons_tmp/find.svg")
536 smooth: true
537
538@@ -255,7 +193,7 @@
539 width: parent.width
540 clip: true
541 anchors {
542- bottom: parent.bottom
543+ bottom: fakePanel.top
544 // bottomMargin: appendFeedTools.height
545 top: appendFeedColumn.bottom
546 }
547@@ -280,6 +218,82 @@
548 }
549 }
550
551+ Rectangle {
552+ id: fakePanel
553+
554+ color: "#fafafa"
555+ anchors {
556+ left: parent.left
557+ right: parent.right
558+ bottom: parent.bottom
559+ }
560+ height: units.gu(6)
561+ Item {
562+ anchors.fill: parent
563+
564+ Button {
565+ anchors {
566+ verticalCenter: parent.verticalCenter
567+ left: parent.left
568+ leftMargin: units.gu(1)
569+ }
570+ gradient: UbuntuColors.greyGradient
571+ action: Action {
572+ text: i18n.tr("Cancel")
573+
574+ onTriggered: {
575+ googleFeedApi.abort()
576+ pageStack.pop()
577+ }
578+ }
579+ }
580+
581+ ActivityIndicator {
582+ id: checkRunning
583+
584+ visible: googleFeedApi.inProgress
585+ running: googleFeedApi.inProgress
586+
587+ anchors {
588+ verticalCenter: parent.verticalCenter
589+ right: nextBtn.left
590+ rightMargin: units.gu(1)
591+ }
592+ }
593+
594+ Button {
595+ id: nextBtn
596+ objectName: "nextButton"
597+ anchors {
598+ verticalCenter: parent.verticalCenter
599+ right: parent.right
600+ rightMargin: units.gu(1)
601+ }
602+
603+ enabled: !googleFeedApi.inProgress && selectedCount > 0
604+ action: Action {
605+ text: i18n.tr("Next")
606+
607+ onTriggered: {
608+ if (!nextBtn.enabled)
609+ return
610+
611+ var selectedFeeds = []
612+ for (var i = 0; i < searchResultsModel.count; i++) {
613+ var curItem = searchResultsModel.get(i)
614+
615+ if (curItem.isSelected) {
616+ selectedFeeds.push(curItem)
617+ }
618+ }
619+
620+ pageStack.push(chooseTopicPage, {"feedsToAdd" : selectedFeeds})
621+ }
622+ }
623+ } // Button
624+ }
625+ } // Rectangle fakePanel
626+
627 ListModel {
628 id: searchResultsModel
629 }
630
631=== modified file 'feeds/ChooseTopicPage.qml'
632--- feeds/ChooseTopicPage.qml 2014-09-02 06:34:00 +0000
633+++ feeds/ChooseTopicPage.qml 2014-09-17 20:27:28 +0000
634@@ -14,35 +14,10 @@
635 flickable: null
636
637 property var feedsToAdd: null
638-
639 signal topicChoosen(int topicId, var addedFeeds)
640
641- // Workaround for bug #1231137
642- // set the tools to null, then add the toolbar manually when enter this page
643-
644- tools: null
645-
646- ToolbarItems {
647- id: appendFeedTools
648-
649- opened: true
650- locked: true
651-
652- back: Button {
653- anchors.verticalCenter: parent.verticalCenter
654- action: Action {
655- text: i18n.tr("Previous")
656-
657- onTriggered:
658- {
659- pageStack.pop()
660- }
661- }
662- }
663- }
664-
665 function reloadPageContent() {
666- chooseTopicPage.tools = appendFeedTools
667+ // chooseTopicPage.tools = appendFeedTools
668 suggestionTopicsModel.clear()
669
670 var tags = DB.loadTags()
671@@ -105,76 +80,76 @@
672 }
673
674 footer: Item {
675- width: parent.width
676- height: tfNewTopicName.height + units.gu(2)
677-
678- TextField {
679- objectName: "newTopic"
680- id: tfNewTopicName
681-
682- placeholderText: i18n.tr(" + New topic")
683-
684- width: parent.width - units.gu(4)
685- anchors {
686- horizontalCenter: parent.horizontalCenter
687- verticalCenter: parent.verticalCenter
688- }
689-
690- Connections {
691- id: connKeyBroad
692- target: Qt.inputMethod
693-
694- onVisibleChanged: {
695- if (Qt.inputMethod.visible && pageStack && (pageStack.currentPage == chooseTopicPage)) {
696-// console.log("kb show up", Qt.inputMethod.keyboardRectangle.height)
697-// suggestionTopics.positionViewAtEnd()
698- timerKeyboard.start()
699- }
700- }
701- }
702-
703- /* a bad workaround for forcing TextField to show on the top of keyboard
704- flick the listview doesn't work because the keyboard needs about 400ms to show from bottom to top
705- if better workarounds come out, pls use it to replace the current one
706- */
707- Timer {
708- id: timerKeyboard
709- interval: 400; running: false; repeat: false; triggeredOnStart: false
710- onTriggered: suggestionTopics.positionViewAtEnd()
711- }
712-
713- onAccepted: {
714- // Qt.inputMethod.hide()
715- var tagName = text.replace(/^\s+|\s+$/g, '') // Trimming whitespaces.
716- if (tagName != "") { // Check that tagName contains only spaces.
717-
718- /* Make first letter capital.
719- */
720- tagName = tagName.charAt(0).toUpperCase() + tagName.slice(1)
721-
722- var dbResult = DB.addTag(tagName)
723-
724- if (dbResult.error) {
725- PopupUtils.open(errorDialogComponent, chooseTopicPage,
726- {"text" : i18n.tr("A topic with this name already exists"),
727- "title" : i18n.tr("Warning")})
728- return
729- }
730-
731- suggestionTopicsModel.append({"tagName" : tagName,
732- "tagId" : dbResult.tagId})
733-
734- text = ""
735-
736- appendFeedsToTopic(dbResult.tagId)
737- } else {
738- PopupUtils.open(errorDialogComponent, chooseTopicPage,
739- {"text" : i18n.tr("Topic name can't contain only whitespaces"),
740- "title" : i18n.tr("Warning")})
741- }
742- }
743- }
744- }
745+ width: parent.width
746+ height: tfNewTopicName.height + units.gu(2)
747+
748+ TextField {
749+ objectName: "newTopic"
750+ id: tfNewTopicName
751+
752+ placeholderText: i18n.tr(" + New topic")
753+
754+ width: parent.width - units.gu(4)
755+ anchors {
756+ horizontalCenter: parent.horizontalCenter
757+ verticalCenter: parent.verticalCenter
758+ }
759+
760+ Connections {
761+ id: connKeyBroad
762+ target: Qt.inputMethod
763+
764+ onVisibleChanged: {
765+ if (Qt.inputMethod.visible && pageStack && (pageStack.currentPage == chooseTopicPage)) {
766+ // console.log("kb show up", Qt.inputMethod.keyboardRectangle.height)
767+ // suggestionTopics.positionViewAtEnd()
768+ timerKeyboard.start()
769+ }
770+ }
771+ }
772+
773+ /* a bad workaround for forcing TextField to show on the top of keyboard
774+ flick the listview doesn't work because the keyboard needs about 400ms to show from bottom to top
775+ if better workarounds come out, pls use it to replace the current one
776+ */
777+ Timer {
778+ id: timerKeyboard
779+ interval: 400; running: false; repeat: false; triggeredOnStart: false
780+ onTriggered: suggestionTopics.positionViewAtEnd()
781+ }
782+
783+ onAccepted: {
784+ // Qt.inputMethod.hide()
785+ var tagName = text.replace(/^\s+|\s+$/g, '') // Trimming whitespaces.
786+ if (tagName != "") { // Check that tagName contains only spaces.
787+
788+ /* Make first letter capital.
789+ */
790+ tagName = tagName.charAt(0).toUpperCase() + tagName.slice(1)
791+
792+ var dbResult = DB.addTag(tagName)
793+
794+ if (dbResult.error) {
795+ PopupUtils.open(errorDialogComponent, chooseTopicPage,
796+ {"text" : i18n.tr("A topic with this name already exists"),
797+ "title" : i18n.tr("Warning")})
798+ return
799+ }
800+
801+ suggestionTopicsModel.append({"tagName" : tagName,
802+ "tagId" : dbResult.tagId})
803+
804+ text = ""
805+
806+ appendFeedsToTopic(dbResult.tagId)
807+ } else {
808+ PopupUtils.open(errorDialogComponent, chooseTopicPage,
809+ {"text" : i18n.tr("Topic name can't contain only whitespaces"),
810+ "title" : i18n.tr("Warning")})
811+ }
812+ }
813+ }
814+ }
815
816 delegate: ListItem.Standard {
817 objectName: "topicItem"
818
819=== modified file 'feeds/CreateTopicPage.qml'
820--- feeds/CreateTopicPage.qml 2014-09-02 06:34:00 +0000
821+++ feeds/CreateTopicPage.qml 2014-09-17 20:27:28 +0000
822@@ -15,76 +15,88 @@
823
824 signal topicAdded()
825
826-
827-
828- tools: null
829-
830- ToolbarItems {
831- id: createTopicTools
832-
833- opened: true
834- locked: true
835-
836- back: Button {
837- anchors.verticalCenter: parent.verticalCenter
838- action: Action {
839- text: i18n.tr("Cancel")
840-
841- onTriggered: {
842- pageStack.pop()
843- }
844- }
845+ Rectangle {
846+ id: fakePanel
847+
848+ color: "#fafafa"
849+ anchors {
850+ left: parent.left
851+ right: parent.right
852+ bottom: parent.bottom
853 }
854-
855- Button {
856- id: addTopicBtn
857-
858- enabled: tfTopicName.length > 0
859- anchors.verticalCenter: parent.verticalCenter
860- action: Action {
861- text: i18n.tr("Add topic")
862-
863- onTriggered:
864- {
865- if (!addTopicBtn.enabled)
866- return
867-
868- var topicName = tfTopicName.text.replace(/^\s+|\s+$/g, '') // Trimming whitespaces.
869- if (topicName == "") {
870- PopupUtils.open(errorDialogComponent, createTopicPage,
871- {"text" : i18n.tr("Topic name can't contain only whitespaces"),
872- "title" : i18n.tr("Warning")})
873- return
874+ height: units.gu(6)
875+ Item {
876+ anchors.fill: parent
877+
878+ Button {
879+ anchors {
880+ verticalCenter: parent.verticalCenter
881+ left: parent.left
882+ leftMargin: units.gu(1)
883+ }
884+ action: Action {
885+ text: i18n.tr("Cancel")
886+
887+ onTriggered: {
888+ pageStack.pop()
889 }
890-
891- /* Make first letter capital.
892- */
893- topicName = topicName.charAt(0).toUpperCase() + topicName.slice(1)
894-
895- var dbResult = DB.addTag(topicName)
896- if (dbResult.error) {
897- PopupUtils.open(errorDialogComponent, createTopicPage,
898- {"text" : i18n.tr("A topic with this name already exists"),
899- "title" : i18n.tr("Warning")})
900- return
901- } else {
902- tfTopicName.text = ""
903-
904- for( var i = 0; i < suggestionFeedsModel.count; i++) {
905- var curItem = suggestionFeedsModel.get(i)
906-
907- if (curItem.feedSelected) {
908- DB.addFeedTag(curItem.feedId, dbResult.tagId)
909+ }
910+ }
911+
912+ Button {
913+ id: addTopicBtn
914+
915+ enabled: tfTopicName.length > 0
916+ anchors {
917+ verticalCenter: parent.verticalCenter
918+ right: parent.right
919+ rightMargin: units.gu(1)
920+ }
921+ action: Action {
922+ text: i18n.tr("Add topic")
923+
924+ onTriggered:
925+ {
926+ if (!addTopicBtn.enabled)
927+ return
928+
929+ var topicName = tfTopicName.text.replace(/^\s+|\s+$/g, '') // Trimming whitespaces.
930+ if (topicName == "") {
931+ PopupUtils.open(errorDialogComponent, createTopicPage,
932+ {"text" : i18n.tr("Topic name can't contain only whitespaces"),
933+ "title" : i18n.tr("Warning")})
934+ return
935+ }
936+
937+ /* Make first letter capital.
938+ */
939+ topicName = topicName.charAt(0).toUpperCase() + topicName.slice(1)
940+
941+ var dbResult = DB.addTag(topicName)
942+ if (dbResult.error) {
943+ PopupUtils.open(errorDialogComponent, createTopicPage,
944+ {"text" : i18n.tr("A topic with this name already exists"),
945+ "title" : i18n.tr("Warning")})
946+ return
947+ } else {
948+ tfTopicName.text = ""
949+
950+ for( var i = 0; i < suggestionFeedsModel.count; i++) {
951+ var curItem = suggestionFeedsModel.get(i)
952+
953+ if (curItem.feedSelected) {
954+ DB.addFeedTag(curItem.feedId, dbResult.tagId)
955+ }
956 }
957 }
958+
959+ topicAdded()
960+ pageStack.pop()
961 }
962-
963- topicAdded()
964- pageStack.pop()
965 }
966- }
967+ } // Button
968 }
969- }
970+ } // Rectangle fakePanel
971
972 function reloadPageContent() {
973 suggestionFeedsModel.clear()
974@@ -140,8 +152,8 @@
975 width: parent.width
976 clip: true
977 anchors {
978- bottom: parent.bottom
979- bottomMargin: createTopicTools.height
980+ bottom: fakePanel.top
981+ // bottomMargin: createTopicTools.height
982 top: someColumn.bottom
983 }
984
985
986=== modified file 'feeds/TopicComponent.qml'
987--- feeds/TopicComponent.qml 2014-09-02 06:34:00 +0000
988+++ feeds/TopicComponent.qml 2014-09-17 20:27:28 +0000
989@@ -182,7 +182,7 @@
990 id: inputTopicName
991 anchors.verticalCenter: parent.verticalCenter
992 text: topicName
993- width: rowTopicContent.isEditing ? headerTopic.width - units.gu(15) : 0
994+ width: rowTopicContent.isEditing ? headerTopic.width - units.gu(11) : 0
995 opacity: rowTopicContent.isEditing ? 1 : 0
996 hasClearButton: true
997 activeFocusOnPress: true
998
999=== modified file 'feeds/TopicManagement.qml'
1000--- feeds/TopicManagement.qml 2014-09-02 06:34:00 +0000
1001+++ feeds/TopicManagement.qml 2014-09-17 20:27:28 +0000
1002@@ -7,8 +7,8 @@
1003 import "../databasemodule_v2.js" as DB
1004
1005 Page {
1006+ id: topicManagement
1007 objectName: "topicmanagement"
1008- id: topicManagement
1009
1010 title: i18n.tr("Edit topics")
1011 flickable: content
1012@@ -17,8 +17,9 @@
1013 signal feedEdit(int topicId)
1014 signal topicDeleted()
1015
1016- Component.onCompleted:
1017- {
1018+ property int editIndex
1019+
1020+ Component.onCompleted: {
1021 reloadTopics ()
1022 }
1023
1024@@ -45,60 +46,69 @@
1025 topicManagement.flickable = content
1026 }
1027
1028- /*
1029- toolbar for normal state
1030- */
1031- ToolbarItems {
1032- id: toolbar
1033-
1034- ToolbarButton {
1035- id: actionsButton
1036- text: i18n.tr("Add Feed")
1037- iconSource: Qt.resolvedUrl("../icons_tmp/add.svg")
1038- onTriggered: pageStack.push(appendFeedPage/*, {"isDirty" : true}*/) ;
1039- visible: true
1040- }
1041- }
1042-
1043- /*
1044- toolbar for editing state
1045- */
1046- ToolbarItems {
1047- id: editConfirm
1048- opened: true
1049- locked: true
1050- visible: false
1051-// anchors.bottom: content.bottom
1052-
1053- property int editIndex
1054-
1055- back: Button {
1056- id: cancelButton
1057- text: i18n.tr("Cancel")
1058- gradient: UbuntuColors.greyGradient
1059- anchors.verticalCenter: parent.verticalCenter
1060- onClicked: {
1061- Qt.inputMethod.hide()
1062- topicList.currentItem.cancelEdit()
1063- topicManagement.state = ""
1064- editConfirm.visible = false
1065- topicList.currentIndex = -1
1066- timerHeader.start()
1067- }
1068- }
1069-
1070- Button {
1071- id: confirmButton
1072- text: i18n.tr("Confirm")
1073- anchors.verticalCenter: parent.verticalCenter
1074- onClicked: {
1075- topicList.currentItem.confirmEdit()
1076- topicManagement.state = ""
1077- editConfirm.visible = false
1078- topicList.currentIndex = -1
1079- }
1080- }
1081- }
1082+ Rectangle {
1083+ id: fakePanel
1084+
1085+ color: "#fafafa"
1086+ anchors {
1087+ left: parent.left
1088+ right: parent.right
1089+ bottom: parent.bottom
1090+ }
1091+ height: units.gu(6)
1092+ Item {
1093+ anchors.fill: parent
1094+
1095+ Button {
1096+ id: cancelButton
1097+ text: i18n.tr("Cancel")
1098+ gradient: UbuntuColors.greyGradient
1099+ anchors {
1100+ verticalCenter: parent.verticalCenter
1101+ left: parent.left
1102+ leftMargin: units.gu(1)
1103+ }
1104+ visible: topicManagement.state == "editMode"
1105+ onClicked: {
1106+ Qt.inputMethod.hide()
1107+ topicList.currentItem.cancelEdit()
1108+ topicManagement.state = "default"
1109+ // editConfirm.visible = false
1110+ topicList.currentIndex = -1
1111+ timerHeader.start()
1112+ }
1113+ }
1114+
1115+ Button {
1116+ id: confirmButton
1117+ text: i18n.tr("Confirm")
1118+ anchors {
1119+ verticalCenter: parent.verticalCenter
1120+ right: parent.right
1121+ rightMargin: units.gu(1)
1122+ }
1123+ visible: topicManagement.state == "editMode"
1124+ onClicked: {
1125+ topicList.currentItem.confirmEdit()
1126+ topicManagement.state = "default"
1127+ // editConfirm.visible = false
1128+ topicList.currentIndex = -1
1129+ }
1130+ }
1131+
1132+ Button {
1133+ id: actionsButton
1134+ text: i18n.tr("Add Feed")
1135+ anchors {
1136+ verticalCenter: parent.verticalCenter
1137+ right: parent.right
1138+ rightMargin: units.gu(1)
1139+ }
1140+ visible: topicManagement.state != "editMode"
1141+ onClicked: pageStack.push(appendFeedPage/*, {"isDirty" : true}*/)
1142+ }
1143+ }
1144+ } // Rectangle fakePanel
1145
1146 /*
1147 main content
1148@@ -106,7 +116,10 @@
1149 Flickable {
1150 id: content
1151 anchors {
1152- fill: parent
1153+ left: parent.left
1154+ right: parent.right
1155+ top: parent.top
1156+ bottom: fakePanel.top
1157 }
1158 contentHeight: contentItem.childrenRect.height
1159 // boundsBehavior: (contentHeight > topicManagement.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
1160@@ -235,17 +248,17 @@
1161 onEdit: {
1162 if (topicList.currentItem)
1163 topicList.currentItem.cancelEdit()
1164- editConfirm.editIndex = index
1165+ topicManagement.editIndex = index
1166 topicManagement.state = "editMode"
1167- editConfirm.visible = true
1168+ // editConfirm.visible = true
1169 topicList.currentIndex = index
1170 }
1171
1172 onEditCanceled: {
1173 if (topicList.currentItem)
1174 topicList.currentItem.cancelEdit()
1175- topicManagement.state = ""
1176- editConfirm.visible = false
1177+ topicManagement.state = "default"
1178+ // editConfirm.visible = false
1179 topicList.currentIndex = -1
1180 }
1181
1182@@ -365,7 +378,7 @@
1183
1184 function anchorToKeyboard() {
1185 if (topicList.currentItem.isEditing && Qt.inputMethod.visible) {
1186- var kbTemp = mainView.height - mainView.header.height - Qt.inputMethod.keyboardRectangle.height - editConfirm.height
1187+ var kbTemp = mainView.height - mainView.header.height - Qt.inputMethod.keyboardRectangle.height - /*editConfirm.height*/ fakePanel.height
1188 var yChange = topicList.delegateRootY + topicList.y - kbTemp + topicList.currentItem.height
1189 if (yChange > 0) {
1190 content.contentY += yChange
1191@@ -406,18 +419,18 @@
1192
1193 states: [
1194 State {
1195- name: ""
1196- PropertyChanges {
1197- target: topicManagement
1198- tools: toolbar
1199- }
1200+ name: "default"
1201+// PropertyChanges {
1202+// target: topicManagement
1203+// tools: toolbar
1204+// }
1205 },
1206 State {
1207 name: "editMode"
1208- PropertyChanges {
1209- target: topicManagement
1210- tools: editConfirm
1211- }
1212+// PropertyChanges {
1213+// target: topicManagement
1214+// tools: editConfirm
1215+// }
1216 }
1217 ]
1218
1219
1220=== added file 'icons_tmp/back.svg'
1221--- icons_tmp/back.svg 1970-01-01 00:00:00 +0000
1222+++ icons_tmp/back.svg 2014-09-17 20:27:28 +0000
1223@@ -0,0 +1,21 @@
1224+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
1225+<!-- Created with Inkscape (http://www.inkscape.org/) -->
1226+<svg id="svg3140" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="90" width="90" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
1227+ <metadata id="metadata3145">
1228+ <rdf:RDF>
1229+ <cc:Work rdf:about="">
1230+ <dc:format>image/svg+xml</dc:format>
1231+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
1232+ <dc:title/>
1233+ </cc:Work>
1234+ </rdf:RDF>
1235+ </metadata>
1236+ <g id="layer1" transform="translate(0 -962.36)">
1237+ <rect id="rect4198" style="color:#000000;fill:none" height="90" width="90" y="962.36" x="0"/>
1238+ <g id="g4978" transform="translate(-60 548)">
1239+ <path id="path4984" style="color:#000000;fill:#808080" transform="matrix(3.5011 0 0 3.5548 -307.21 -174.5)" d="m113.92 179.14c-0.52479 0.30299-8.7464-4.4438-8.7464-5.0498 0-0.60597 8.2216-5.3527 8.7464-5.0498 0.52478 0.30299 0.52478 9.7965 0 10.1z"/>
1240+ <path id="path4988" style="block-progression:tb;text-indent:0;color:#000000;text-transform:none;fill:#808080" d="m87 438.36v12l39 0.002c12-0.0002 12-0.0002 12 8.9998v9c0 9 0 9-12 9.0002l-15-0.002v12l9 0.002c27 0 30 0 30-18v-15.002c0-17.998-3-17.998-30-17.998z"/>
1241+ <rect id="rect3038" style="color:#000000;fill:none" transform="translate(60 414.36)" height="90" width="90" y=".000017383" x="0"/>
1242+ </g>
1243+ </g>
1244+</svg>
1245
1246=== modified file 'shorts-app.qml'
1247--- shorts-app.qml 2014-09-02 06:34:00 +0000
1248+++ shorts-app.qml 2014-09-17 20:27:28 +0000
1249@@ -29,6 +29,8 @@
1250 width: units.gu(100)
1251 height: units.gu(80)
1252
1253+ useDeprecatedToolbar: false
1254+
1255 headerColor: "#3a2c32"
1256 backgroundColor: "#875864"
1257 footerColor: "#9b616c"
1258@@ -233,16 +235,25 @@
1259 repeater.itemAt(tabstabs.selectedTabIndex - 2).showContent()
1260 }
1261
1262- mainCommonToolbar.opened = false
1263+ // mainCommonToolbar.opened = false
1264 } // onTriggered
1265 }
1266
1267 Action {
1268 id: addReadsAction
1269- text: i18n.tr("Add reads")
1270 iconSource: Qt.resolvedUrl("./icons_tmp/add.svg")
1271+// text: i18n.tr("Add reads")
1272+// onTriggered: {
1273+// PopupUtils.open(addReadsPopoverComp, addReadsBtn)
1274+// }
1275+ text: i18n.tr("Add feeds")
1276 onTriggered: {
1277- PopupUtils.open(addReadsPopoverComp, addReadsBtn)
1278+ /* When we want to show "Append feed" page from
1279+ * any page except of "Choose topic",
1280+ * we should clear it (mark as dirty).
1281+ * ATTENTION: similar call can be found in hotkeys section.
1282+ */
1283+ pageStack.push(appendFeedPage, {"isDirty" : true})
1284 }
1285 }
1286
1287@@ -255,17 +266,13 @@
1288 }
1289 }
1290
1291-
1292-
1293-
1294-
1295 /* -------------------------- Toolbars ---------------------------- */
1296
1297
1298 ToolbarItems {
1299 id: mainCommonToolbar
1300
1301- back: ToolbarButton {
1302+ /*back: */ToolbarButton {
1303 objectName: "rsspagerefreshbutton"
1304 action: refreshAction
1305 }
1306
1307=== modified file 'tests/autopilot/shorts_app/__init__.py'
1308--- tests/autopilot/shorts_app/__init__.py 2014-08-05 12:37:10 +0000
1309+++ tests/autopilot/shorts_app/__init__.py 2014-09-17 20:27:28 +0000
1310@@ -13,7 +13,6 @@
1311
1312 from autopilot import logging as autopilot_logging
1313 from testtools.matchers import NotEquals
1314-from autopilot.introspection import dbus
1315
1316 from ubuntuuitoolkit import (
1317 base,
1318@@ -94,28 +93,47 @@
1319
1320 @autopilot_logging.log_action(logger.info)
1321 def go_to_add_feeds(self):
1322- popover = self._click_add_reads()
1323- try:
1324- popover.click_button_by_text('+ Add feeds')
1325- except dbus.StateNotFoundError:
1326- pass
1327- return self.select_single(
1328- AppendFeedPage, objectName='appendfeedpage')
1329+ self._click_add_reads()
1330+ return self.wait_select_single(AppendFeedPage)
1331
1332 @autopilot_logging.log_action(logger.info)
1333 def go_to_edit_feeds(self):
1334 """Go to the edit feeds page."""
1335- toolbar = self.open_toolbar()
1336- action_item = toolbar.select_single(
1337- 'ActionItem', objectName='edittopicsbutton')
1338- self.pointing_device.click_object(action_item)
1339+ # does not work using workaround
1340+ # header = self.get_header()
1341+ # header.click_action_button('Edit topics')
1342+
1343+ # -------------------------------------------------------------------
1344+ # this will have to bee removed after fixing above header issue
1345+ actionsButton = self.wait_select_single(
1346+ "PageHeadButton", objectName='actions_overflow_button')
1347+ self.pointing_device.click_object(actionsButton)
1348+ popover = self.wait_select_single(
1349+ "StyledItem", objectName="popover_foreground")
1350+ addReadsAction = popover.wait_select_single(
1351+ "AbstractButton", text="Edit topics")
1352+ self.pointing_device.click_object(addReadsAction)
1353+ # -----------------------------------------------------------------
1354+
1355 return self.wait_select_single(
1356 TopicManagement, objectName='topicmanagement')
1357
1358 def _click_add_reads(self):
1359- toolbar = self.open_toolbar()
1360- toolbar.click_button('addreadsbutton')
1361- return self.get_action_selection_popover('addreadspopover')
1362+ # does not work using workaround
1363+ # header = self.get_header()
1364+ # header.click_action_button('Add feeds')
1365+
1366+ # -------------------------------------------------------------------
1367+ # this will have to bee removed after fixing above header issue
1368+ actionsButton = self.wait_select_single(
1369+ "PageHeadButton", objectName='actions_overflow_button')
1370+ self.pointing_device.click_object(actionsButton)
1371+ popover = self.wait_select_single(
1372+ "StyledItem", objectName="popover_foreground")
1373+ addReadsAction = popover.wait_select_single(
1374+ "AbstractButton", text="Add feeds")
1375+ self.pointing_device.click_object(addReadsAction)
1376+ # -----------------------------------------------------------------
1377
1378 def get_selected_tab_title(self):
1379 tabs = self.get_tabs()
1380@@ -125,17 +143,6 @@
1381 tab = tabs.select_single('TopicTab', index=selected_tab_index)
1382 return tab.title
1383
1384- # ideally this should be converted to the sdk
1385- # and use object name not text names
1386- # see https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1205144
1387- def run_action(self, popover, name):
1388- actions = popover.select_many("Empty")
1389- requested = None
1390- for action in actions:
1391- if action.text == name:
1392- requested = action
1393- self.pointing_device.click_object(requested)
1394-
1395 def select_many_retry(self, object_type, **kwargs):
1396 """Returns the item that is searched for with app.select_many
1397 In case of no item was not found (not created yet) a second attempt is
1398@@ -148,10 +155,6 @@
1399 tries = tries - 1
1400 return items
1401
1402- def get_action_popover(self):
1403- # Returns all instances, but with current one as first index
1404- return self.select_many_retry("ActionSelectionPopover")[0]
1405-
1406 def get_network_activity(self):
1407 try:
1408 activity = self.select_single("ActivityIndicator", running="True")
1409@@ -204,14 +207,6 @@
1410 return self.select_single("Button", objectName="deleteButton")
1411
1412 # Page Calls
1413- def get_append_page(self):
1414- return self.select_single("AppendFeedPage",
1415- objectName="appendfeedpage")
1416-
1417- def get_topics_page(self):
1418- return self.select_single("ChooseTopicPage",
1419- objectName="choosetopicpage")
1420-
1421 def get_feedlist_page(self):
1422 return self.wait_select_single("FeedListPage",
1423 objectName="feedlistpage")
1424@@ -322,9 +317,38 @@
1425 return valueselector.select_single("LabelVisual", text=name)
1426
1427 @autopilot_logging.log_action(logger.info)
1428- def change_view_mode(self):
1429- toolbar = self.open_toolbar()
1430- toolbar.click_button("changemodebutton")
1431+ def change_view_mode(self, mode):
1432+ """Change view mode.
1433+
1434+ :parameter mode: if you are in list mode it equals "isListMode"
1435+ if you are not in list mode it equals "isNotListMode"
1436+
1437+ """
1438+
1439+ # does not work using workaround
1440+ """
1441+ header = self.get_header()
1442+ if mode == "isListMode":
1443+ header.click_action_button("Grid View")
1444+ else:
1445+ header.click_action_button("List view")
1446+ """
1447+ # -------------------------------------------------------------------
1448+ # this will have to bee removed after fixing above header issue
1449+ actionsButton = self.wait_select_single(
1450+ "PageHeadButton", objectName='actions_overflow_button')
1451+ self.pointing_device.click_object(actionsButton)
1452+ popover = self.wait_select_single(
1453+ "StyledItem", objectName="popover_foreground")
1454+ if mode == "isListMode":
1455+ addReadsAction = popover.wait_select_single(
1456+ "AbstractButton", text="Grid View")
1457+ else:
1458+ addReadsAction = popover.wait_select_single(
1459+ "AbstractButton", text="List view")
1460+
1461+ self.pointing_device.click_object(addReadsAction)
1462+ # -----------------------------------------------------------------
1463
1464
1465 class Page(toolkit_emulators.MainView):
1466@@ -337,12 +361,6 @@
1467 # --elopio - 2014-02-26
1468 self.main_view = self.get_root_instance().select_single(MainView)
1469
1470- @autopilot_logging.log_action(logger.info)
1471- def click_next(self):
1472- toolbar = self.main_view.get_toolbar()
1473- next_button = toolbar.select_single('Button', objectName='nextButton')
1474- self.pointing_device.click_object(next_button)
1475-
1476
1477 class AppendFeedPage(Page):
1478
1479@@ -356,6 +374,12 @@
1480 search_text_field.write(keyword_or_url + '\n')
1481 self._wait_for_results_to_appear()
1482
1483+ @autopilot_logging.log_action(logger.info)
1484+ def click_next_button(self):
1485+ next_button = self.wait_select_single(
1486+ 'Button', objectName='nextButton')
1487+ self.pointing_device.click_object(next_button)
1488+
1489 def _wait_for_results_to_appear(self):
1490 results_list = self._get_results_list()
1491 results_list.count.wait_for(NotEquals(0))
1492@@ -375,7 +399,7 @@
1493 self._check_result(result)
1494
1495 def click_next(self):
1496- super(AppendFeedPage, self).click_next()
1497+ self.click_next_button()
1498 return self.main_view.select_single(
1499 ChooseTopicPage, objectName='choosetopicpage')
1500
1501
1502=== modified file 'tests/autopilot/shorts_app/tests/test_rssreader.py'
1503--- tests/autopilot/shorts_app/tests/test_rssreader.py 2014-06-27 15:12:42 +0000
1504+++ tests/autopilot/shorts_app/tests/test_rssreader.py 2014-09-17 20:27:28 +0000
1505@@ -19,10 +19,9 @@
1506 from __future__ import absolute_import
1507
1508 from autopilot.matchers import Eventually
1509-from testtools.matchers import Equals, NotEquals, Is, Not
1510+from testtools.matchers import Equals, NotEquals
1511
1512 from shorts_app.tests import ShortsAppTestCase
1513-from time import sleep
1514 import unittest
1515 import logging
1516
1517@@ -37,11 +36,8 @@
1518
1519 def setUp(self):
1520 super(BaseShortsAppTestCase, self).setUp()
1521+ self.shorts_app.main_view.visible.wait_for(True)
1522
1523- self.assertThat(
1524- self.shorts_app.main_view.visible,
1525- Eventually(Equals(True))
1526- )
1527 # wait for any updates to finish before beginning tests
1528 self._wait_for_refresh()
1529
1530@@ -84,66 +80,27 @@
1531 selected_tab_title = self.shorts_app.main_view.get_selected_tab_title()
1532 self.assertEqual('Test topic', selected_tab_title)
1533
1534- def _input_new_feed(self, rssFeed):
1535- inputField = self.shorts_app.main_view.get_append_feed_input_box()
1536- return self._safe_enter_text(inputField, rssFeed)
1537-
1538- def _input_new_topic(self, topic):
1539- inputField = self.shorts_app.main_view.get_new_topic_input_box()
1540- return self._safe_enter_text(inputField, topic)
1541-
1542- def _safe_enter_text(self, inputField, text, timeout=10):
1543- # poll clicking for focus for lack of better method,
1544- # due to screen switching animation
1545- # is there a property we can use instead?
1546- poll = 0
1547- while not inputField.focus and poll < timeout:
1548- self.pointing_device.click_object(inputField)
1549- sleep(1)
1550- poll += 1
1551- self.keyboard.type(text)
1552- self.assertThat(inputField.text, Eventually(Equals(text)))
1553- self.keyboard.press_and_release("Enter")
1554- return inputField
1555-
1556- def _get_topic(self, topicName, timeout=10):
1557- logger.debug("_get_topic: assert topics")
1558- self.assertThat(
1559- lambda: self.shorts_app.main_view.get_feedlist_topic(topicName),
1560- Eventually(Not(Is([]))))
1561- logger.debug("_get_topic: grab topic")
1562- topic = self.shorts_app.main_view.get_feedlist_topic(topicName)
1563- logger.debug("_get_topic: click topic")
1564-
1565- poll = 0
1566- while not topic.isExpanded and poll < timeout:
1567- logger.debug("_get_topic: loop click topic")
1568- self.pointing_device.click_object(topic)
1569- sleep(1)
1570- poll += 1
1571- return topic
1572-
1573 def test_switch_to_list_view_mode(self):
1574 """ test switching to list view mode"""
1575 shorts_tab = self.shorts_app.main_view.get_shorts_tab()
1576- self.ensure_grid_view_mode(shorts_tab)
1577- self.shorts_app.main_view.change_view_mode()
1578+ self._ensure_grid_view_mode(shorts_tab)
1579+ self.shorts_app.main_view.change_view_mode("isNotListMode")
1580 self.assertThat(shorts_tab.isListMode, Eventually(Equals(True)))
1581
1582 def test_switch_to_grid_view_mode(self):
1583 """ test switching to grid view mode"""
1584 shorts_tab = self.shorts_app.main_view.get_shorts_tab()
1585- self.ensure_list_view_mode(shorts_tab)
1586- self.shorts_app.main_view.change_view_mode()
1587+ self._ensure_list_view_mode(shorts_tab)
1588+ self.shorts_app.main_view.change_view_mode("isListMode")
1589 self.assertThat(shorts_tab.isListMode, Eventually(Equals(False)))
1590
1591- def ensure_grid_view_mode(self, current_tab):
1592+ def _ensure_grid_view_mode(self, current_tab):
1593 if current_tab.isListMode:
1594- self.shorts_app.main_view.change_view_mode()
1595+ self.shorts_app.main_view.change_view_mode("isListMode")
1596
1597- def ensure_list_view_mode(self, current_tab):
1598+ def _ensure_list_view_mode(self, current_tab):
1599 if not current_tab.isListMode:
1600- self.shorts_app.main_view.change_view_mode()
1601+ self.shorts_app.main_view.change_view_mode("isNotListMode")
1602
1603 def test_open_listmode_feed_item(self):
1604 """"test to ensure list mode feed items can be opened"""
1605@@ -154,7 +111,7 @@
1606
1607 self.add_feed_to_new_topic(test_feed_url, test_feed_title, test_topic)
1608 new_topic_tab = self.shorts_app.main_view.get_topic_tab(test_topic)
1609- self.ensure_list_view_mode(new_topic_tab)
1610+ self._ensure_list_view_mode(new_topic_tab)
1611
1612 self.shorts_app.main_view.open_feed_item(test_topic, test_feed_title)
1613 self.assertEqual(

Subscribers

People subscribed via source and target branches

to all changes: