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
=== modified file 'ArticleViewItem.qml'
--- ArticleViewItem.qml 2014-09-02 06:34:00 +0000
+++ ArticleViewItem.qml 2014-09-17 20:27:28 +0000
@@ -69,9 +69,9 @@
69 width: parent.width69 width: parent.width
70 anchors {70 anchors {
71 bottom: parent.bottom71 bottom: parent.bottom
72 bottomMargin: units.gu(2)72 bottomMargin: units.gu(1)
73 top: parent.top73 top: parent.top
74 topMargin: units.gu(2)74 topMargin: units.gu(1)
75 }75 }
7676
77 snapMode: ListView.SnapOneItem77 snapMode: ListView.SnapOneItem
@@ -185,7 +185,7 @@
185 }185 }
186186
187 Label {187 Label {
188// fontSize: "large"188 // fontSize: "large"
189 color: "grey"189 color: "grey"
190 text: model.author ? model.author : ""190 text: model.author ? model.author : ""
191 anchors.horizontalCenter: parent.horizontalCenter191 anchors.horizontalCenter: parent.horizontalCenter
@@ -225,69 +225,112 @@
225 width: parent.width - units.gu(4)225 width: parent.width - units.gu(4)
226 wrapMode: Text.WrapAtWordBoundaryOrAnywhere226 wrapMode: Text.WrapAtWordBoundaryOrAnywhere
227 }227 }
228228 } // Column
229 Button {229
230 id: showMediaButton
231
232 text: i18n.tr("Show media")
233 anchors.horizontalCenter: parent.horizontalCenter
234 // Everyone can test my "Show media". I want it in v 1.0 too.
235 visible: false // model.media_groups ? true : false
236
237 onClicked: {
238 visible = false
239
240 var medias = JSON.parse(rssModel.get(index).media_groups)
241 var len = medias.length
242
243 for (var i = 0; i < len; i++) {
244 var media = medias[i]
245
246 for (var j = 0; j < media.contents.length; j++) {
247 var cont = media.contents[j]
248
249 if (cont.type === "image/jpeg" || cont.type === "image/png" ||
250 cont.type === "image/jpeg" || cont.type === "image/pjpeg" ||
251 cont.type === "image/svg+xml" || cont.medium === "image") {
252 var mediaImg = mediaGroupImageComponent.createObject(innerAreaColumn)
253
254 innerAreaColumn.mediaDownloadInProgress++
255 mediaImg.mediaLoadFinished.connect(innerAreaColumn.mediaDownloaded)
256
257 mediaImg.anchors.horizontalCenter = showMediaButton.horizontalCenter
258 mediaImg.source = cont.url
259 }
260 }
261 }
262 }
263 }
264
265 ActivityIndicator {
266 id: mediaDownloadIndicator
267
268 running: innerAreaColumn.mediaDownloadInProgress > 0
269 visible: running
270 anchors.horizontalCenter: parent.horizontalCenter
271 }
272 }
273 } // Flickable230 } // Flickable
274 } // Component231 } // Component
275232
233 property bool isEmbeddedMode: false
234
235 Panel {
236 id: operationsPanel
237
238 visible: rssItem != null
239 Rectangle { color: "#fafafa"; anchors.fill: parent }
240
241 anchors {
242 left: parent.left
243 right: parent.right
244 bottom: parent.bottom
245 }
246 height: units.gu(6)
247 Item {
248 anchors.fill: parent
249
250 ToolbarButton {
251 id: backBtn
252
253 visible: !isEmbeddedMode
254 anchors {
255 verticalCenter: parent.verticalCenter
256 left: parent.left
257 leftMargin: units.gu(1)
258 }
259 action: Action {
260 iconSource: "./icons_tmp/back.svg"
261 text: i18n.tr("Back")
262 onTriggered: {
263 pageStack.pop()
264 }
265 }
266 }
267
268 ToolbarButton {
269 id: optionsBtn
270
271 anchors {
272 verticalCenter: parent.verticalCenter
273 right: saveButton.left
274 rightMargin: units.gu(1)
275 }
276
277 action: Action {
278 text: i18n.tr("Options")
279 iconSource: "./icons_tmp/settings.svg"
280 onTriggered: {
281 PopupUtils.open(readingOptionsPopoverComponent, optionsBtn)
282 }
283 }
284 }
285
286 ToolbarButton {
287 id: saveButton
288
289 anchors {
290 verticalCenter: parent.verticalCenter
291 right: openSiteBtn.left
292 rightMargin: units.gu(1)
293 }
294 visible: rssItem != null
295 action: Action {
296 text: rssItem == null ? "" : (rssItem.favourite == "0" ? i18n.tr("Save") : i18n.tr("Remove"))
297 iconSource: {
298 if (rssItem == null || rssItem.favourite == "0")
299 return Qt.resolvedUrl("./icons_tmp/favorite-unselected.svg")
300 else return Qt.resolvedUrl("./icons_tmp/favorite-selected.svg")
301 }
302 onTriggered: {
303 var fav = (rssItem.favourite == "0" ? "1" : "0")
304 var dbResult = DB.updateArticleFavourite(rssItem.id, fav)
305 if (dbResult.rowsAffected === 1) {
306 articleFavouriteChanged(rssItem, fav)
307 }
308 }
309 }
310 } // Button
311
312 ToolbarButton {
313 id: openSiteBtn
314
315 anchors {
316 verticalCenter: parent.verticalCenter
317 right: parent.right
318 rightMargin: units.gu(1)
319 }
320 visible: rssItem != null
321 action: Action {
322 text: i18n.tr("Open site")
323 iconSource: Qt.resolvedUrl("./icons_tmp/go-to.svg")
324 onTriggered: {
325 Qt.openUrlExternally(rssItem.link)
326 }
327 }
328 } // Button
329 }
330 } // Panel
331
276 Component {332 Component {
277 id: mediaGroupImageComponent333 id: readingOptionsPopoverComponent
278334 ReadingOptions { }
279 Image {335 } // Comp
280 id: mediaGroupImage
281
282 signal mediaLoadFinished
283
284 fillMode: Image.PreserveAspectFit
285 width: Math.min(sourceSize.width, articleViewRoot.width - units.gu(4))
286
287 onStatusChanged: {
288 if (status == Image.Ready)
289 mediaLoadFinished()
290 }
291 }
292 }
293}336}
294337
=== modified file 'ListModePage.qml'
--- ListModePage.qml 2014-09-02 06:34:00 +0000
+++ ListModePage.qml 2014-09-17 20:27:28 +0000
@@ -15,7 +15,7 @@
15 property var listViewModel: null15 property var listViewModel: null
16 property bool isShorts: topicId == 016 property bool isShorts: topicId == 0
1717
18 property var listTools: listModeTools18 // property var listTools: listModeTools
1919
20 function getListToots() {20 function getListToots() {
21 return listModeTools21 return listModeTools
@@ -234,6 +234,7 @@
234 ArticleViewItem {234 ArticleViewItem {
235 id: listArticleView235 id: listArticleView
236236
237 isEmbeddedMode: mainView.isTabletMode
237 height: parent.height238 height: parent.height
238 anchors {239 anchors {
239 left: articleList.right240 left: articleList.right
@@ -245,90 +246,6 @@
245 // onVisibleChanged: if (visible) showArticle(0)246 // onVisibleChanged: if (visible) showArticle(0)
246 }247 }
247248
248 ToolbarItems {
249 id: listModeTools
250
251 visible: mainView.isTabletMode
252
253 back: ToolbarButton {
254 objectName: "rsspagerefreshbutton"
255 action: refreshAction
256 }
257
258 ToolbarButton {
259 objectName: "changemodebutton"
260 action: changeModeAction
261 }
262
263 ToolbarButton {
264 id: addReadsBtn
265 objectName: "addreadsbutton"
266 action: Action {
267 text: i18n.tr("Add reads")
268 iconSource: Qt.resolvedUrl("icons_tmp/add.svg")
269 onTriggered: {
270 PopupUtils.open(addReadsPopoverComp, addReadsBtn)
271 }
272 }
273 }
274
275 ToolbarButton {
276 objectName: "edittopicsbutton"
277 action: editTopicsAction
278 }
279
280 ToolbarButton {
281 id: readingOptionsButton
282
283 visible: true
284 action: Action {
285 text: i18n.tr("Options")
286 iconSource: Qt.resolvedUrl("./icons_tmp/settings.svg")
287 onTriggered: {
288 PopupUtils.open(readingOptionsPopoverComponent, readingOptionsButton)
289 }
290 }
291 }
292
293 ToolbarButton {
294 //visible: mainView.isTabletMode
295 objectName: "addRemoveFavor"
296
297 visible: listArticleView.rssItem != null
298 action: Action {
299 id: addRemoveFavor
300
301 text: listArticleView.rssItem == null ? "" : (listArticleView.rssItem.favourite == "0" ? i18n.tr("Save") : i18n.tr("Remove"))
302 iconSource: {
303 if (listArticleView.rssItem == null || listArticleView.rssItem.favourite == "0")
304 return Qt.resolvedUrl("icons_tmp/favorite-unselected.svg")
305 else return Qt.resolvedUrl("icons_tmp/favorite-selected.svg")
306 }
307 onTriggered: {
308 var fav = (listArticleView.rssItem.favourite == "0" ? "1" : "0")
309 var dbResult = DB.updateArticleFavourite(listArticleView.rssItem.id, fav)
310 if (dbResult.rowsAffected == 1) {
311 listArticleView.articleFavouriteChanged(listArticleView.rssItem, fav)
312 }
313 }
314 }
315 }
316
317 ToolbarButton {
318 //visible: mainView.isTabletMode
319 objectName: "openSiteAction"
320 action: Action {
321 id: openSiteAction
322
323 text: i18n.tr("Open site")
324 iconSource: Qt.resolvedUrl("icons_tmp/go-to.svg")
325 onTriggered: {
326 Qt.openUrlExternally(listArticleView.rssItem.link)
327 }
328 }
329 }
330 } // ToolBarItems
331
332 Component {249 Component {
333 id: readingOptionsPopoverComponent250 id: readingOptionsPopoverComponent
334251
335252
=== modified file 'RssFeedPage.qml'
--- RssFeedPage.qml 2014-09-02 06:34:00 +0000
+++ RssFeedPage.qml 2014-09-17 20:27:28 +0000
@@ -30,55 +30,8 @@
30 anchors.fill: parent30 anchors.fill: parent
31 }31 }
3232
33 tools: ToolbarItems {
34 objectName: "pageBackBtn"
35 id: toolbar
36
37 ToolbarButton {
38 id: readingOptionsButton
39
40 visible: true
41 action: Action {
42 text: i18n.tr("Options")
43 iconSource: Qt.resolvedUrl("./icons_tmp/settings.svg")
44 onTriggered: {
45 PopupUtils.open(readingOptionsPopoverComponent, readingOptionsButton)
46 }
47 }
48 }
49
50 ToolbarButton {
51 action: Action {
52 text: innerArticleView.rssItem == null ? "" : (innerArticleView.rssItem.favourite == "0" ? i18n.tr("Save") : i18n.tr("Remove"))
53 iconSource: {
54 if (innerArticleView.rssItem == null || innerArticleView.rssItem.favourite == "0")
55 return Qt.resolvedUrl("./icons_tmp/favorite-unselected.svg")
56 else return Qt.resolvedUrl("./icons_tmp/favorite-selected.svg")
57 }
58 onTriggered: {
59 var fav = (innerArticleView.rssItem.favourite == "0" ? "1" : "0")
60 var dbResult = DB.updateArticleFavourite(innerArticleView.rssItem.id, fav)
61 if (dbResult.rowsAffected === 1) {
62 innerArticleView.articleFavouriteChanged(innerArticleView.rssItem, fav)
63 }
64 }
65 }
66 }
67
68 ToolbarButton {
69 action: Action {
70 text: i18n.tr("Open site")
71 iconSource: Qt.resolvedUrl("./icons_tmp/go-to.svg")
72 onTriggered: {
73 Qt.openUrlExternally(innerArticleView.rssItem.link)
74 }
75 }
76 }
77 }
78
79 Component {33 Component {
80 id: readingOptionsPopoverComponent34 id: readingOptionsPopoverComponent
81
82 ReadingOptions { }35 ReadingOptions { }
83 } // Comp36 } // Comp
8437
8538
=== modified file 'SavedTab.qml'
--- SavedTab.qml 2014-09-02 06:34:00 +0000
+++ SavedTab.qml 2014-09-17 20:27:28 +0000
@@ -15,7 +15,7 @@
15 page: Page {15 page: Page {
16 id: contentPage16 id: contentPage
1717
18 tools: (isListMode && mainView.isTabletMode) ? listPage.listTools : mainCommonToolbar18 tools: /*(isListMode && mainView.isTabletMode) ? listPage.listTools :*/ mainCommonToolbar
1919
20 ListModePage {20 ListModePage {
21 id: listPage21 id: listPage
2222
=== modified file 'ShortsTab.qml'
--- ShortsTab.qml 2014-09-02 06:34:00 +0000
+++ ShortsTab.qml 2014-09-17 20:27:28 +0000
@@ -16,7 +16,7 @@
16 page: Page {16 page: Page {
17 id: contentPage17 id: contentPage
1818
19 tools: (isListMode && mainView.isTabletMode) ? listPage.listTools : mainCommonToolbar19 tools: /*(isListMode && mainView.isTabletMode) ? listPage.listTools :*/ mainCommonToolbar
2020
21 ListModePage {21 ListModePage {
22 id: listPage22 id: listPage
2323
=== modified file 'TopicTab.qml'
--- TopicTab.qml 2014-09-02 06:34:00 +0000
+++ TopicTab.qml 2014-09-17 20:27:28 +0000
@@ -16,7 +16,7 @@
16 page: Page {16 page: Page {
17 id: contentPage17 id: contentPage
1818
19 tools: (isListMode && mainView.isTabletMode) ? listPage.listTools : mainCommonToolbar19 tools: /*(isListMode && mainView.isTabletMode) ? listPage.listTools :*/ mainCommonToolbar
2020
21 ListModePage {21 ListModePage {
22 id: listPage22 id: listPage
2323
=== removed file 'avatar@8.png'
24Binary files avatar@8.png 2013-02-12 16:18:48 +0000 and avatar@8.png 1970-01-01 00:00:00 +0000 differ24Binary files avatar@8.png 2013-02-12 16:18:48 +0000 and avatar@8.png 1970-01-01 00:00:00 +0000 differ
=== modified file 'feeds/AppendFeedPage.qml'
--- feeds/AppendFeedPage.qml 2014-09-02 06:34:00 +0000
+++ feeds/AppendFeedPage.qml 2014-09-17 20:27:28 +0000
@@ -33,73 +33,10 @@
3333
34 property bool isDirty: false // Need to clear all page content.34 property bool isDirty: false // Need to clear all page content.
35 property int selectedCount: 035 property int selectedCount: 0
36 //.property var selectedFeeds: null // Become local.
37 property bool resultsReceived: false // Indicates that at least once results were received.36 property bool resultsReceived: false // Indicates that at least once results were received.
3837
39 // Workaround for bug #1231137
40 // set the tools to null, then add the toolbar manually when enter this page
41
42 tools: null
43
44 ToolbarItems {
45 id: appendFeedTools
46
47 opened: true
48 locked: true
49
50 back: Button {
51 anchors.verticalCenter: parent.verticalCenter
52 action: Action {
53 text: i18n.tr("Cancel")
54
55 onTriggered:
56 {
57 googleFeedApi.abort()
58 pageStack.pop()
59 }
60 }
61 }
62
63 ActivityIndicator {
64 id: checkRunning
65
66 visible: googleFeedApi.inProgress
67 running: googleFeedApi.inProgress
68
69 anchors.verticalCenter: parent.verticalCenter
70 }
71
72 Button {
73 objectName: "nextButton"
74 id: nextBtn
75 anchors.verticalCenter: parent.verticalCenter
76
77 enabled: !googleFeedApi.inProgress && selectedCount > 0
78 action: Action {
79 text: i18n.tr("Next")
80
81 onTriggered:
82 {
83 if (!nextBtn.enabled)
84 return
85
86 var selectedFeeds = []
87 for (var i = 0; i < searchResultsModel.count; i++) {
88 var curItem = searchResultsModel.get(i)
89
90 if (curItem.isSelected) {
91 selectedFeeds.push(curItem)
92 }
93 }
94
95 pageStack.push(chooseTopicPage, {"feedsToAdd" : selectedFeeds})
96 }
97 }
98 }
99 }
100
101 function reloadPageContent() {38 function reloadPageContent() {
102 appendFeedPage.tools = appendFeedTools39 // appendFeedPage.tools = appendFeedTools
103 if (isDirty) {40 if (isDirty) {
104 tfFeedUrl.text = ""41 tfFeedUrl.text = ""
105 resultsReceived = false42 resultsReceived = false
@@ -141,10 +78,10 @@
14178
142 for (var i = 0; i < entries.length; i++) {79 for (var i = 0; i < entries.length; i++) {
143 searchResultsModel.append({"url" : entries[i].url,80 searchResultsModel.append({"url" : entries[i].url,
144 "title" : entries[i].title,81 "title" : entries[i].title,
145 "description" : entries[i].contentSnippet,82 "description" : entries[i].contentSnippet,
146 "link" : entries[i].link,83 "link" : entries[i].link,
147 "isSelected" : false})84 "isSelected" : false})
148 }85 }
149 }86 }
15087
@@ -167,10 +104,10 @@
167 var feed = result.responseData.feed104 var feed = result.responseData.feed
168105
169 searchResultsModel.append({"url" : feed.feedUrl,106 searchResultsModel.append({"url" : feed.feedUrl,
170 "title" : feed.title,107 "title" : feed.title,
171 "description" : feed.description,108 "description" : feed.description,
172 "link" : feed.link,109 "link" : feed.link,
173 "isSelected" : false})110 "isSelected" : false})
174 }111 }
175 }112 }
176113
@@ -195,6 +132,7 @@
195 placeholderText: i18n.tr("Type a keyword or URL")132 placeholderText: i18n.tr("Type a keyword or URL")
196133
197 width: parent.width - units.gu(4)134 width: parent.width - units.gu(4)
135 // height:units.gu(5)
198 anchors {136 anchors {
199 horizontalCenter: parent.horizontalCenter137 horizontalCenter: parent.horizontalCenter
200 }138 }
@@ -202,7 +140,7 @@
202 height: parent.height*0.5140 height: parent.height*0.5
203 width: height141 width: height
204 anchors.verticalCenter: parent.verticalCenter142 anchors.verticalCenter: parent.verticalCenter
205// anchors.verticalCenterOffset: -units.gu(0.2)143 // anchors.verticalCenterOffset: -units.gu(0.2)
206 source: Qt.resolvedUrl("../icons_tmp/find.svg")144 source: Qt.resolvedUrl("../icons_tmp/find.svg")
207 smooth: true145 smooth: true
208146
@@ -255,7 +193,7 @@
255 width: parent.width193 width: parent.width
256 clip: true194 clip: true
257 anchors {195 anchors {
258 bottom: parent.bottom196 bottom: fakePanel.top
259 // bottomMargin: appendFeedTools.height197 // bottomMargin: appendFeedTools.height
260 top: appendFeedColumn.bottom198 top: appendFeedColumn.bottom
261 }199 }
@@ -280,6 +218,82 @@
280 }218 }
281 }219 }
282220
221 Rectangle {
222 id: fakePanel
223
224 color: "#fafafa"
225 anchors {
226 left: parent.left
227 right: parent.right
228 bottom: parent.bottom
229 }
230 height: units.gu(6)
231 Item {
232 anchors.fill: parent
233
234 Button {
235 anchors {
236 verticalCenter: parent.verticalCenter
237 left: parent.left
238 leftMargin: units.gu(1)
239 }
240 gradient: UbuntuColors.greyGradient
241 action: Action {
242 text: i18n.tr("Cancel")
243
244 onTriggered: {
245 googleFeedApi.abort()
246 pageStack.pop()
247 }
248 }
249 }
250
251 ActivityIndicator {
252 id: checkRunning
253
254 visible: googleFeedApi.inProgress
255 running: googleFeedApi.inProgress
256
257 anchors {
258 verticalCenter: parent.verticalCenter
259 right: nextBtn.left
260 rightMargin: units.gu(1)
261 }
262 }
263
264 Button {
265 id: nextBtn
266 objectName: "nextButton"
267 anchors {
268 verticalCenter: parent.verticalCenter
269 right: parent.right
270 rightMargin: units.gu(1)
271 }
272
273 enabled: !googleFeedApi.inProgress && selectedCount > 0
274 action: Action {
275 text: i18n.tr("Next")
276
277 onTriggered: {
278 if (!nextBtn.enabled)
279 return
280
281 var selectedFeeds = []
282 for (var i = 0; i < searchResultsModel.count; i++) {
283 var curItem = searchResultsModel.get(i)
284
285 if (curItem.isSelected) {
286 selectedFeeds.push(curItem)
287 }
288 }
289
290 pageStack.push(chooseTopicPage, {"feedsToAdd" : selectedFeeds})
291 }
292 }
293 } // Button
294 }
295 } // Rectangle fakePanel
296
283 ListModel {297 ListModel {
284 id: searchResultsModel298 id: searchResultsModel
285 }299 }
286300
=== modified file 'feeds/ChooseTopicPage.qml'
--- feeds/ChooseTopicPage.qml 2014-09-02 06:34:00 +0000
+++ feeds/ChooseTopicPage.qml 2014-09-17 20:27:28 +0000
@@ -14,35 +14,10 @@
14 flickable: null14 flickable: null
1515
16 property var feedsToAdd: null16 property var feedsToAdd: null
17
18 signal topicChoosen(int topicId, var addedFeeds)17 signal topicChoosen(int topicId, var addedFeeds)
1918
20 // Workaround for bug #1231137
21 // set the tools to null, then add the toolbar manually when enter this page
22
23 tools: null
24
25 ToolbarItems {
26 id: appendFeedTools
27
28 opened: true
29 locked: true
30
31 back: Button {
32 anchors.verticalCenter: parent.verticalCenter
33 action: Action {
34 text: i18n.tr("Previous")
35
36 onTriggered:
37 {
38 pageStack.pop()
39 }
40 }
41 }
42 }
43
44 function reloadPageContent() {19 function reloadPageContent() {
45 chooseTopicPage.tools = appendFeedTools20 // chooseTopicPage.tools = appendFeedTools
46 suggestionTopicsModel.clear()21 suggestionTopicsModel.clear()
4722
48 var tags = DB.loadTags()23 var tags = DB.loadTags()
@@ -105,76 +80,76 @@
105 }80 }
10681
107 footer: Item {82 footer: Item {
108 width: parent.width83 width: parent.width
109 height: tfNewTopicName.height + units.gu(2)84 height: tfNewTopicName.height + units.gu(2)
11085
111 TextField {86 TextField {
112 objectName: "newTopic"87 objectName: "newTopic"
113 id: tfNewTopicName88 id: tfNewTopicName
11489
115 placeholderText: i18n.tr(" + New topic")90 placeholderText: i18n.tr(" + New topic")
11691
117 width: parent.width - units.gu(4)92 width: parent.width - units.gu(4)
118 anchors {93 anchors {
119 horizontalCenter: parent.horizontalCenter94 horizontalCenter: parent.horizontalCenter
120 verticalCenter: parent.verticalCenter95 verticalCenter: parent.verticalCenter
121 }96 }
12297
123 Connections {98 Connections {
124 id: connKeyBroad99 id: connKeyBroad
125 target: Qt.inputMethod100 target: Qt.inputMethod
126101
127 onVisibleChanged: {102 onVisibleChanged: {
128 if (Qt.inputMethod.visible && pageStack && (pageStack.currentPage == chooseTopicPage)) {103 if (Qt.inputMethod.visible && pageStack && (pageStack.currentPage == chooseTopicPage)) {
129// console.log("kb show up", Qt.inputMethod.keyboardRectangle.height)104 // console.log("kb show up", Qt.inputMethod.keyboardRectangle.height)
130// suggestionTopics.positionViewAtEnd()105 // suggestionTopics.positionViewAtEnd()
131 timerKeyboard.start()106 timerKeyboard.start()
132 }107 }
133 }108 }
134 }109 }
135110
136 /* a bad workaround for forcing TextField to show on the top of keyboard111 /* a bad workaround for forcing TextField to show on the top of keyboard
137 flick the listview doesn't work because the keyboard needs about 400ms to show from bottom to top112 flick the listview doesn't work because the keyboard needs about 400ms to show from bottom to top
138 if better workarounds come out, pls use it to replace the current one113 if better workarounds come out, pls use it to replace the current one
139 */114 */
140 Timer {115 Timer {
141 id: timerKeyboard116 id: timerKeyboard
142 interval: 400; running: false; repeat: false; triggeredOnStart: false117 interval: 400; running: false; repeat: false; triggeredOnStart: false
143 onTriggered: suggestionTopics.positionViewAtEnd()118 onTriggered: suggestionTopics.positionViewAtEnd()
144 }119 }
145120
146 onAccepted: {121 onAccepted: {
147 // Qt.inputMethod.hide()122 // Qt.inputMethod.hide()
148 var tagName = text.replace(/^\s+|\s+$/g, '') // Trimming whitespaces.123 var tagName = text.replace(/^\s+|\s+$/g, '') // Trimming whitespaces.
149 if (tagName != "") { // Check that tagName contains only spaces.124 if (tagName != "") { // Check that tagName contains only spaces.
150125
151 /* Make first letter capital.126 /* Make first letter capital.
152 */127 */
153 tagName = tagName.charAt(0).toUpperCase() + tagName.slice(1)128 tagName = tagName.charAt(0).toUpperCase() + tagName.slice(1)
154129
155 var dbResult = DB.addTag(tagName)130 var dbResult = DB.addTag(tagName)
156131
157 if (dbResult.error) {132 if (dbResult.error) {
158 PopupUtils.open(errorDialogComponent, chooseTopicPage,133 PopupUtils.open(errorDialogComponent, chooseTopicPage,
159 {"text" : i18n.tr("A topic with this name already exists"),134 {"text" : i18n.tr("A topic with this name already exists"),
160 "title" : i18n.tr("Warning")})135 "title" : i18n.tr("Warning")})
161 return136 return
162 }137 }
163138
164 suggestionTopicsModel.append({"tagName" : tagName,139 suggestionTopicsModel.append({"tagName" : tagName,
165 "tagId" : dbResult.tagId})140 "tagId" : dbResult.tagId})
166141
167 text = ""142 text = ""
168143
169 appendFeedsToTopic(dbResult.tagId)144 appendFeedsToTopic(dbResult.tagId)
170 } else {145 } else {
171 PopupUtils.open(errorDialogComponent, chooseTopicPage,146 PopupUtils.open(errorDialogComponent, chooseTopicPage,
172 {"text" : i18n.tr("Topic name can't contain only whitespaces"),147 {"text" : i18n.tr("Topic name can't contain only whitespaces"),
173 "title" : i18n.tr("Warning")})148 "title" : i18n.tr("Warning")})
174 }149 }
175 }150 }
176 }151 }
177 }152 }
178153
179 delegate: ListItem.Standard {154 delegate: ListItem.Standard {
180 objectName: "topicItem"155 objectName: "topicItem"
181156
=== modified file 'feeds/CreateTopicPage.qml'
--- feeds/CreateTopicPage.qml 2014-09-02 06:34:00 +0000
+++ feeds/CreateTopicPage.qml 2014-09-17 20:27:28 +0000
@@ -15,76 +15,88 @@
1515
16 signal topicAdded()16 signal topicAdded()
1717
1818 Rectangle {
1919 id: fakePanel
20 tools: null20
2121 color: "#fafafa"
22 ToolbarItems {22 anchors {
23 id: createTopicTools23 left: parent.left
2424 right: parent.right
25 opened: true25 bottom: parent.bottom
26 locked: true
27
28 back: Button {
29 anchors.verticalCenter: parent.verticalCenter
30 action: Action {
31 text: i18n.tr("Cancel")
32
33 onTriggered: {
34 pageStack.pop()
35 }
36 }
37 }26 }
3827 height: units.gu(6)
39 Button {28 Item {
40 id: addTopicBtn29 anchors.fill: parent
4130
42 enabled: tfTopicName.length > 031 Button {
43 anchors.verticalCenter: parent.verticalCenter32 anchors {
44 action: Action {33 verticalCenter: parent.verticalCenter
45 text: i18n.tr("Add topic")34 left: parent.left
4635 leftMargin: units.gu(1)
47 onTriggered:36 }
48 {37 action: Action {
49 if (!addTopicBtn.enabled)38 text: i18n.tr("Cancel")
50 return39
5140 onTriggered: {
52 var topicName = tfTopicName.text.replace(/^\s+|\s+$/g, '') // Trimming whitespaces.41 pageStack.pop()
53 if (topicName == "") {
54 PopupUtils.open(errorDialogComponent, createTopicPage,
55 {"text" : i18n.tr("Topic name can't contain only whitespaces"),
56 "title" : i18n.tr("Warning")})
57 return
58 }42 }
5943 }
60 /* Make first letter capital.44 }
61 */45
62 topicName = topicName.charAt(0).toUpperCase() + topicName.slice(1)46 Button {
6347 id: addTopicBtn
64 var dbResult = DB.addTag(topicName)48
65 if (dbResult.error) {49 enabled: tfTopicName.length > 0
66 PopupUtils.open(errorDialogComponent, createTopicPage,50 anchors {
67 {"text" : i18n.tr("A topic with this name already exists"),51 verticalCenter: parent.verticalCenter
68 "title" : i18n.tr("Warning")})52 right: parent.right
69 return53 rightMargin: units.gu(1)
70 } else {54 }
71 tfTopicName.text = ""55 action: Action {
7256 text: i18n.tr("Add topic")
73 for( var i = 0; i < suggestionFeedsModel.count; i++) {57
74 var curItem = suggestionFeedsModel.get(i)58 onTriggered:
7559 {
76 if (curItem.feedSelected) {60 if (!addTopicBtn.enabled)
77 DB.addFeedTag(curItem.feedId, dbResult.tagId)61 return
62
63 var topicName = tfTopicName.text.replace(/^\s+|\s+$/g, '') // Trimming whitespaces.
64 if (topicName == "") {
65 PopupUtils.open(errorDialogComponent, createTopicPage,
66 {"text" : i18n.tr("Topic name can't contain only whitespaces"),
67 "title" : i18n.tr("Warning")})
68 return
69 }
70
71 /* Make first letter capital.
72 */
73 topicName = topicName.charAt(0).toUpperCase() + topicName.slice(1)
74
75 var dbResult = DB.addTag(topicName)
76 if (dbResult.error) {
77 PopupUtils.open(errorDialogComponent, createTopicPage,
78 {"text" : i18n.tr("A topic with this name already exists"),
79 "title" : i18n.tr("Warning")})
80 return
81 } else {
82 tfTopicName.text = ""
83
84 for( var i = 0; i < suggestionFeedsModel.count; i++) {
85 var curItem = suggestionFeedsModel.get(i)
86
87 if (curItem.feedSelected) {
88 DB.addFeedTag(curItem.feedId, dbResult.tagId)
89 }
78 }90 }
79 }91 }
92
93 topicAdded()
94 pageStack.pop()
80 }95 }
81
82 topicAdded()
83 pageStack.pop()
84 }96 }
85 }97 } // Button
86 }98 }
87 }99 } // Rectangle fakePanel
88100
89 function reloadPageContent() {101 function reloadPageContent() {
90 suggestionFeedsModel.clear()102 suggestionFeedsModel.clear()
@@ -140,8 +152,8 @@
140 width: parent.width152 width: parent.width
141 clip: true153 clip: true
142 anchors {154 anchors {
143 bottom: parent.bottom155 bottom: fakePanel.top
144 bottomMargin: createTopicTools.height156 // bottomMargin: createTopicTools.height
145 top: someColumn.bottom157 top: someColumn.bottom
146 }158 }
147159
148160
=== modified file 'feeds/TopicComponent.qml'
--- feeds/TopicComponent.qml 2014-09-02 06:34:00 +0000
+++ feeds/TopicComponent.qml 2014-09-17 20:27:28 +0000
@@ -182,7 +182,7 @@
182 id: inputTopicName182 id: inputTopicName
183 anchors.verticalCenter: parent.verticalCenter183 anchors.verticalCenter: parent.verticalCenter
184 text: topicName184 text: topicName
185 width: rowTopicContent.isEditing ? headerTopic.width - units.gu(15) : 0185 width: rowTopicContent.isEditing ? headerTopic.width - units.gu(11) : 0
186 opacity: rowTopicContent.isEditing ? 1 : 0186 opacity: rowTopicContent.isEditing ? 1 : 0
187 hasClearButton: true187 hasClearButton: true
188 activeFocusOnPress: true188 activeFocusOnPress: true
189189
=== modified file 'feeds/TopicManagement.qml'
--- feeds/TopicManagement.qml 2014-09-02 06:34:00 +0000
+++ feeds/TopicManagement.qml 2014-09-17 20:27:28 +0000
@@ -7,8 +7,8 @@
7import "../databasemodule_v2.js" as DB7import "../databasemodule_v2.js" as DB
88
9Page {9Page {
10 id: topicManagement
10 objectName: "topicmanagement"11 objectName: "topicmanagement"
11 id: topicManagement
1212
13 title: i18n.tr("Edit topics")13 title: i18n.tr("Edit topics")
14 flickable: content14 flickable: content
@@ -17,8 +17,9 @@
17 signal feedEdit(int topicId)17 signal feedEdit(int topicId)
18 signal topicDeleted()18 signal topicDeleted()
1919
20 Component.onCompleted:20 property int editIndex
21 {21
22 Component.onCompleted: {
22 reloadTopics ()23 reloadTopics ()
23 }24 }
2425
@@ -45,60 +46,69 @@
45 topicManagement.flickable = content46 topicManagement.flickable = content
46 }47 }
4748
48 /*49 Rectangle {
49 toolbar for normal state50 id: fakePanel
50 */51
51 ToolbarItems {52 color: "#fafafa"
52 id: toolbar53 anchors {
5354 left: parent.left
54 ToolbarButton {55 right: parent.right
55 id: actionsButton56 bottom: parent.bottom
56 text: i18n.tr("Add Feed")57 }
57 iconSource: Qt.resolvedUrl("../icons_tmp/add.svg")58 height: units.gu(6)
58 onTriggered: pageStack.push(appendFeedPage/*, {"isDirty" : true}*/) ;59 Item {
59 visible: true60 anchors.fill: parent
60 }61
61 }62 Button {
6263 id: cancelButton
63 /*64 text: i18n.tr("Cancel")
64 toolbar for editing state65 gradient: UbuntuColors.greyGradient
65 */66 anchors {
66 ToolbarItems {67 verticalCenter: parent.verticalCenter
67 id: editConfirm68 left: parent.left
68 opened: true69 leftMargin: units.gu(1)
69 locked: true70 }
70 visible: false71 visible: topicManagement.state == "editMode"
71// anchors.bottom: content.bottom72 onClicked: {
7273 Qt.inputMethod.hide()
73 property int editIndex74 topicList.currentItem.cancelEdit()
7475 topicManagement.state = "default"
75 back: Button {76 // editConfirm.visible = false
76 id: cancelButton77 topicList.currentIndex = -1
77 text: i18n.tr("Cancel")78 timerHeader.start()
78 gradient: UbuntuColors.greyGradient79 }
79 anchors.verticalCenter: parent.verticalCenter80 }
80 onClicked: {81
81 Qt.inputMethod.hide()82 Button {
82 topicList.currentItem.cancelEdit()83 id: confirmButton
83 topicManagement.state = ""84 text: i18n.tr("Confirm")
84 editConfirm.visible = false85 anchors {
85 topicList.currentIndex = -186 verticalCenter: parent.verticalCenter
86 timerHeader.start()87 right: parent.right
87 }88 rightMargin: units.gu(1)
88 }89 }
8990 visible: topicManagement.state == "editMode"
90 Button {91 onClicked: {
91 id: confirmButton92 topicList.currentItem.confirmEdit()
92 text: i18n.tr("Confirm")93 topicManagement.state = "default"
93 anchors.verticalCenter: parent.verticalCenter94 // editConfirm.visible = false
94 onClicked: {95 topicList.currentIndex = -1
95 topicList.currentItem.confirmEdit()96 }
96 topicManagement.state = ""97 }
97 editConfirm.visible = false98
98 topicList.currentIndex = -199 Button {
99 }100 id: actionsButton
100 }101 text: i18n.tr("Add Feed")
101 }102 anchors {
103 verticalCenter: parent.verticalCenter
104 right: parent.right
105 rightMargin: units.gu(1)
106 }
107 visible: topicManagement.state != "editMode"
108 onClicked: pageStack.push(appendFeedPage/*, {"isDirty" : true}*/)
109 }
110 }
111 } // Rectangle fakePanel
102112
103 /*113 /*
104 main content114 main content
@@ -106,7 +116,10 @@
106 Flickable {116 Flickable {
107 id: content117 id: content
108 anchors {118 anchors {
109 fill: parent119 left: parent.left
120 right: parent.right
121 top: parent.top
122 bottom: fakePanel.top
110 }123 }
111 contentHeight: contentItem.childrenRect.height124 contentHeight: contentItem.childrenRect.height
112// boundsBehavior: (contentHeight > topicManagement.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds125// boundsBehavior: (contentHeight > topicManagement.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
@@ -235,17 +248,17 @@
235 onEdit: {248 onEdit: {
236 if (topicList.currentItem)249 if (topicList.currentItem)
237 topicList.currentItem.cancelEdit()250 topicList.currentItem.cancelEdit()
238 editConfirm.editIndex = index251 topicManagement.editIndex = index
239 topicManagement.state = "editMode"252 topicManagement.state = "editMode"
240 editConfirm.visible = true253 // editConfirm.visible = true
241 topicList.currentIndex = index254 topicList.currentIndex = index
242 }255 }
243256
244 onEditCanceled: {257 onEditCanceled: {
245 if (topicList.currentItem)258 if (topicList.currentItem)
246 topicList.currentItem.cancelEdit()259 topicList.currentItem.cancelEdit()
247 topicManagement.state = ""260 topicManagement.state = "default"
248 editConfirm.visible = false261 // editConfirm.visible = false
249 topicList.currentIndex = -1262 topicList.currentIndex = -1
250 }263 }
251264
@@ -365,7 +378,7 @@
365378
366 function anchorToKeyboard() {379 function anchorToKeyboard() {
367 if (topicList.currentItem.isEditing && Qt.inputMethod.visible) {380 if (topicList.currentItem.isEditing && Qt.inputMethod.visible) {
368 var kbTemp = mainView.height - mainView.header.height - Qt.inputMethod.keyboardRectangle.height - editConfirm.height381 var kbTemp = mainView.height - mainView.header.height - Qt.inputMethod.keyboardRectangle.height - /*editConfirm.height*/ fakePanel.height
369 var yChange = topicList.delegateRootY + topicList.y - kbTemp + topicList.currentItem.height382 var yChange = topicList.delegateRootY + topicList.y - kbTemp + topicList.currentItem.height
370 if (yChange > 0) {383 if (yChange > 0) {
371 content.contentY += yChange384 content.contentY += yChange
@@ -406,18 +419,18 @@
406419
407 states: [420 states: [
408 State {421 State {
409 name: ""422 name: "default"
410 PropertyChanges {423// PropertyChanges {
411 target: topicManagement424// target: topicManagement
412 tools: toolbar425// tools: toolbar
413 }426// }
414 },427 },
415 State {428 State {
416 name: "editMode"429 name: "editMode"
417 PropertyChanges {430// PropertyChanges {
418 target: topicManagement431// target: topicManagement
419 tools: editConfirm432// tools: editConfirm
420 }433// }
421 }434 }
422 ]435 ]
423436
424437
=== added file 'icons_tmp/back.svg'
--- icons_tmp/back.svg 1970-01-01 00:00:00 +0000
+++ icons_tmp/back.svg 2014-09-17 20:27:28 +0000
@@ -0,0 +1,21 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!-- Created with Inkscape (http://www.inkscape.org/) -->
3<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/">
4 <metadata id="metadata3145">
5 <rdf:RDF>
6 <cc:Work rdf:about="">
7 <dc:format>image/svg+xml</dc:format>
8 <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
9 <dc:title/>
10 </cc:Work>
11 </rdf:RDF>
12 </metadata>
13 <g id="layer1" transform="translate(0 -962.36)">
14 <rect id="rect4198" style="color:#000000;fill:none" height="90" width="90" y="962.36" x="0"/>
15 <g id="g4978" transform="translate(-60 548)">
16 <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"/>
17 <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"/>
18 <rect id="rect3038" style="color:#000000;fill:none" transform="translate(60 414.36)" height="90" width="90" y=".000017383" x="0"/>
19 </g>
20 </g>
21</svg>
022
=== modified file 'shorts-app.qml'
--- shorts-app.qml 2014-09-02 06:34:00 +0000
+++ shorts-app.qml 2014-09-17 20:27:28 +0000
@@ -29,6 +29,8 @@
29 width: units.gu(100)29 width: units.gu(100)
30 height: units.gu(80)30 height: units.gu(80)
3131
32 useDeprecatedToolbar: false
33
32 headerColor: "#3a2c32"34 headerColor: "#3a2c32"
33 backgroundColor: "#875864"35 backgroundColor: "#875864"
34 footerColor: "#9b616c"36 footerColor: "#9b616c"
@@ -233,16 +235,25 @@
233 repeater.itemAt(tabstabs.selectedTabIndex - 2).showContent()235 repeater.itemAt(tabstabs.selectedTabIndex - 2).showContent()
234 }236 }
235237
236 mainCommonToolbar.opened = false238 // mainCommonToolbar.opened = false
237 } // onTriggered239 } // onTriggered
238 }240 }
239241
240 Action {242 Action {
241 id: addReadsAction243 id: addReadsAction
242 text: i18n.tr("Add reads")
243 iconSource: Qt.resolvedUrl("./icons_tmp/add.svg")244 iconSource: Qt.resolvedUrl("./icons_tmp/add.svg")
245// text: i18n.tr("Add reads")
246// onTriggered: {
247// PopupUtils.open(addReadsPopoverComp, addReadsBtn)
248// }
249 text: i18n.tr("Add feeds")
244 onTriggered: {250 onTriggered: {
245 PopupUtils.open(addReadsPopoverComp, addReadsBtn)251 /* When we want to show "Append feed" page from
252 * any page except of "Choose topic",
253 * we should clear it (mark as dirty).
254 * ATTENTION: similar call can be found in hotkeys section.
255 */
256 pageStack.push(appendFeedPage, {"isDirty" : true})
246 }257 }
247 }258 }
248259
@@ -255,17 +266,13 @@
255 }266 }
256 }267 }
257268
258
259
260
261
262 /* -------------------------- Toolbars ---------------------------- */269 /* -------------------------- Toolbars ---------------------------- */
263270
264271
265 ToolbarItems {272 ToolbarItems {
266 id: mainCommonToolbar273 id: mainCommonToolbar
267274
268 back: ToolbarButton {275 /*back: */ToolbarButton {
269 objectName: "rsspagerefreshbutton"276 objectName: "rsspagerefreshbutton"
270 action: refreshAction277 action: refreshAction
271 }278 }
272279
=== modified file 'tests/autopilot/shorts_app/__init__.py'
--- tests/autopilot/shorts_app/__init__.py 2014-08-05 12:37:10 +0000
+++ tests/autopilot/shorts_app/__init__.py 2014-09-17 20:27:28 +0000
@@ -13,7 +13,6 @@
1313
14from autopilot import logging as autopilot_logging14from autopilot import logging as autopilot_logging
15from testtools.matchers import NotEquals15from testtools.matchers import NotEquals
16from autopilot.introspection import dbus
1716
18from ubuntuuitoolkit import (17from ubuntuuitoolkit import (
19 base,18 base,
@@ -94,28 +93,47 @@
9493
95 @autopilot_logging.log_action(logger.info)94 @autopilot_logging.log_action(logger.info)
96 def go_to_add_feeds(self):95 def go_to_add_feeds(self):
97 popover = self._click_add_reads()96 self._click_add_reads()
98 try:97 return self.wait_select_single(AppendFeedPage)
99 popover.click_button_by_text('+ Add feeds')
100 except dbus.StateNotFoundError:
101 pass
102 return self.select_single(
103 AppendFeedPage, objectName='appendfeedpage')
10498
105 @autopilot_logging.log_action(logger.info)99 @autopilot_logging.log_action(logger.info)
106 def go_to_edit_feeds(self):100 def go_to_edit_feeds(self):
107 """Go to the edit feeds page."""101 """Go to the edit feeds page."""
108 toolbar = self.open_toolbar()102 # does not work using workaround
109 action_item = toolbar.select_single(103 # header = self.get_header()
110 'ActionItem', objectName='edittopicsbutton')104 # header.click_action_button('Edit topics')
111 self.pointing_device.click_object(action_item)105
106 # -------------------------------------------------------------------
107 # this will have to bee removed after fixing above header issue
108 actionsButton = self.wait_select_single(
109 "PageHeadButton", objectName='actions_overflow_button')
110 self.pointing_device.click_object(actionsButton)
111 popover = self.wait_select_single(
112 "StyledItem", objectName="popover_foreground")
113 addReadsAction = popover.wait_select_single(
114 "AbstractButton", text="Edit topics")
115 self.pointing_device.click_object(addReadsAction)
116 # -----------------------------------------------------------------
117
112 return self.wait_select_single(118 return self.wait_select_single(
113 TopicManagement, objectName='topicmanagement')119 TopicManagement, objectName='topicmanagement')
114120
115 def _click_add_reads(self):121 def _click_add_reads(self):
116 toolbar = self.open_toolbar()122 # does not work using workaround
117 toolbar.click_button('addreadsbutton')123 # header = self.get_header()
118 return self.get_action_selection_popover('addreadspopover')124 # header.click_action_button('Add feeds')
125
126 # -------------------------------------------------------------------
127 # this will have to bee removed after fixing above header issue
128 actionsButton = self.wait_select_single(
129 "PageHeadButton", objectName='actions_overflow_button')
130 self.pointing_device.click_object(actionsButton)
131 popover = self.wait_select_single(
132 "StyledItem", objectName="popover_foreground")
133 addReadsAction = popover.wait_select_single(
134 "AbstractButton", text="Add feeds")
135 self.pointing_device.click_object(addReadsAction)
136 # -----------------------------------------------------------------
119137
120 def get_selected_tab_title(self):138 def get_selected_tab_title(self):
121 tabs = self.get_tabs()139 tabs = self.get_tabs()
@@ -125,17 +143,6 @@
125 tab = tabs.select_single('TopicTab', index=selected_tab_index)143 tab = tabs.select_single('TopicTab', index=selected_tab_index)
126 return tab.title144 return tab.title
127145
128 # ideally this should be converted to the sdk
129 # and use object name not text names
130 # see https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1205144
131 def run_action(self, popover, name):
132 actions = popover.select_many("Empty")
133 requested = None
134 for action in actions:
135 if action.text == name:
136 requested = action
137 self.pointing_device.click_object(requested)
138
139 def select_many_retry(self, object_type, **kwargs):146 def select_many_retry(self, object_type, **kwargs):
140 """Returns the item that is searched for with app.select_many147 """Returns the item that is searched for with app.select_many
141 In case of no item was not found (not created yet) a second attempt is148 In case of no item was not found (not created yet) a second attempt is
@@ -148,10 +155,6 @@
148 tries = tries - 1155 tries = tries - 1
149 return items156 return items
150157
151 def get_action_popover(self):
152 # Returns all instances, but with current one as first index
153 return self.select_many_retry("ActionSelectionPopover")[0]
154
155 def get_network_activity(self):158 def get_network_activity(self):
156 try:159 try:
157 activity = self.select_single("ActivityIndicator", running="True")160 activity = self.select_single("ActivityIndicator", running="True")
@@ -204,14 +207,6 @@
204 return self.select_single("Button", objectName="deleteButton")207 return self.select_single("Button", objectName="deleteButton")
205208
206 # Page Calls209 # Page Calls
207 def get_append_page(self):
208 return self.select_single("AppendFeedPage",
209 objectName="appendfeedpage")
210
211 def get_topics_page(self):
212 return self.select_single("ChooseTopicPage",
213 objectName="choosetopicpage")
214
215 def get_feedlist_page(self):210 def get_feedlist_page(self):
216 return self.wait_select_single("FeedListPage",211 return self.wait_select_single("FeedListPage",
217 objectName="feedlistpage")212 objectName="feedlistpage")
@@ -322,9 +317,38 @@
322 return valueselector.select_single("LabelVisual", text=name)317 return valueselector.select_single("LabelVisual", text=name)
323318
324 @autopilot_logging.log_action(logger.info)319 @autopilot_logging.log_action(logger.info)
325 def change_view_mode(self):320 def change_view_mode(self, mode):
326 toolbar = self.open_toolbar()321 """Change view mode.
327 toolbar.click_button("changemodebutton")322
323 :parameter mode: if you are in list mode it equals "isListMode"
324 if you are not in list mode it equals "isNotListMode"
325
326 """
327
328 # does not work using workaround
329 """
330 header = self.get_header()
331 if mode == "isListMode":
332 header.click_action_button("Grid View")
333 else:
334 header.click_action_button("List view")
335 """
336 # -------------------------------------------------------------------
337 # this will have to bee removed after fixing above header issue
338 actionsButton = self.wait_select_single(
339 "PageHeadButton", objectName='actions_overflow_button')
340 self.pointing_device.click_object(actionsButton)
341 popover = self.wait_select_single(
342 "StyledItem", objectName="popover_foreground")
343 if mode == "isListMode":
344 addReadsAction = popover.wait_select_single(
345 "AbstractButton", text="Grid View")
346 else:
347 addReadsAction = popover.wait_select_single(
348 "AbstractButton", text="List view")
349
350 self.pointing_device.click_object(addReadsAction)
351 # -----------------------------------------------------------------
328352
329353
330class Page(toolkit_emulators.MainView):354class Page(toolkit_emulators.MainView):
@@ -337,12 +361,6 @@
337 # --elopio - 2014-02-26361 # --elopio - 2014-02-26
338 self.main_view = self.get_root_instance().select_single(MainView)362 self.main_view = self.get_root_instance().select_single(MainView)
339363
340 @autopilot_logging.log_action(logger.info)
341 def click_next(self):
342 toolbar = self.main_view.get_toolbar()
343 next_button = toolbar.select_single('Button', objectName='nextButton')
344 self.pointing_device.click_object(next_button)
345
346364
347class AppendFeedPage(Page):365class AppendFeedPage(Page):
348366
@@ -356,6 +374,12 @@
356 search_text_field.write(keyword_or_url + '\n')374 search_text_field.write(keyword_or_url + '\n')
357 self._wait_for_results_to_appear()375 self._wait_for_results_to_appear()
358376
377 @autopilot_logging.log_action(logger.info)
378 def click_next_button(self):
379 next_button = self.wait_select_single(
380 'Button', objectName='nextButton')
381 self.pointing_device.click_object(next_button)
382
359 def _wait_for_results_to_appear(self):383 def _wait_for_results_to_appear(self):
360 results_list = self._get_results_list()384 results_list = self._get_results_list()
361 results_list.count.wait_for(NotEquals(0))385 results_list.count.wait_for(NotEquals(0))
@@ -375,7 +399,7 @@
375 self._check_result(result)399 self._check_result(result)
376400
377 def click_next(self):401 def click_next(self):
378 super(AppendFeedPage, self).click_next()402 self.click_next_button()
379 return self.main_view.select_single(403 return self.main_view.select_single(
380 ChooseTopicPage, objectName='choosetopicpage')404 ChooseTopicPage, objectName='choosetopicpage')
381405
382406
=== modified file 'tests/autopilot/shorts_app/tests/test_rssreader.py'
--- tests/autopilot/shorts_app/tests/test_rssreader.py 2014-06-27 15:12:42 +0000
+++ tests/autopilot/shorts_app/tests/test_rssreader.py 2014-09-17 20:27:28 +0000
@@ -19,10 +19,9 @@
19from __future__ import absolute_import19from __future__ import absolute_import
2020
21from autopilot.matchers import Eventually21from autopilot.matchers import Eventually
22from testtools.matchers import Equals, NotEquals, Is, Not22from testtools.matchers import Equals, NotEquals
2323
24from shorts_app.tests import ShortsAppTestCase24from shorts_app.tests import ShortsAppTestCase
25from time import sleep
26import unittest25import unittest
27import logging26import logging
2827
@@ -37,11 +36,8 @@
3736
38 def setUp(self):37 def setUp(self):
39 super(BaseShortsAppTestCase, self).setUp()38 super(BaseShortsAppTestCase, self).setUp()
39 self.shorts_app.main_view.visible.wait_for(True)
4040
41 self.assertThat(
42 self.shorts_app.main_view.visible,
43 Eventually(Equals(True))
44 )
45 # wait for any updates to finish before beginning tests41 # wait for any updates to finish before beginning tests
46 self._wait_for_refresh()42 self._wait_for_refresh()
4743
@@ -84,66 +80,27 @@
84 selected_tab_title = self.shorts_app.main_view.get_selected_tab_title()80 selected_tab_title = self.shorts_app.main_view.get_selected_tab_title()
85 self.assertEqual('Test topic', selected_tab_title)81 self.assertEqual('Test topic', selected_tab_title)
8682
87 def _input_new_feed(self, rssFeed):
88 inputField = self.shorts_app.main_view.get_append_feed_input_box()
89 return self._safe_enter_text(inputField, rssFeed)
90
91 def _input_new_topic(self, topic):
92 inputField = self.shorts_app.main_view.get_new_topic_input_box()
93 return self._safe_enter_text(inputField, topic)
94
95 def _safe_enter_text(self, inputField, text, timeout=10):
96 # poll clicking for focus for lack of better method,
97 # due to screen switching animation
98 # is there a property we can use instead?
99 poll = 0
100 while not inputField.focus and poll < timeout:
101 self.pointing_device.click_object(inputField)
102 sleep(1)
103 poll += 1
104 self.keyboard.type(text)
105 self.assertThat(inputField.text, Eventually(Equals(text)))
106 self.keyboard.press_and_release("Enter")
107 return inputField
108
109 def _get_topic(self, topicName, timeout=10):
110 logger.debug("_get_topic: assert topics")
111 self.assertThat(
112 lambda: self.shorts_app.main_view.get_feedlist_topic(topicName),
113 Eventually(Not(Is([]))))
114 logger.debug("_get_topic: grab topic")
115 topic = self.shorts_app.main_view.get_feedlist_topic(topicName)
116 logger.debug("_get_topic: click topic")
117
118 poll = 0
119 while not topic.isExpanded and poll < timeout:
120 logger.debug("_get_topic: loop click topic")
121 self.pointing_device.click_object(topic)
122 sleep(1)
123 poll += 1
124 return topic
125
126 def test_switch_to_list_view_mode(self):83 def test_switch_to_list_view_mode(self):
127 """ test switching to list view mode"""84 """ test switching to list view mode"""
128 shorts_tab = self.shorts_app.main_view.get_shorts_tab()85 shorts_tab = self.shorts_app.main_view.get_shorts_tab()
129 self.ensure_grid_view_mode(shorts_tab)86 self._ensure_grid_view_mode(shorts_tab)
130 self.shorts_app.main_view.change_view_mode()87 self.shorts_app.main_view.change_view_mode("isNotListMode")
131 self.assertThat(shorts_tab.isListMode, Eventually(Equals(True)))88 self.assertThat(shorts_tab.isListMode, Eventually(Equals(True)))
13289
133 def test_switch_to_grid_view_mode(self):90 def test_switch_to_grid_view_mode(self):
134 """ test switching to grid view mode"""91 """ test switching to grid view mode"""
135 shorts_tab = self.shorts_app.main_view.get_shorts_tab()92 shorts_tab = self.shorts_app.main_view.get_shorts_tab()
136 self.ensure_list_view_mode(shorts_tab)93 self._ensure_list_view_mode(shorts_tab)
137 self.shorts_app.main_view.change_view_mode()94 self.shorts_app.main_view.change_view_mode("isListMode")
138 self.assertThat(shorts_tab.isListMode, Eventually(Equals(False)))95 self.assertThat(shorts_tab.isListMode, Eventually(Equals(False)))
13996
140 def ensure_grid_view_mode(self, current_tab):97 def _ensure_grid_view_mode(self, current_tab):
141 if current_tab.isListMode:98 if current_tab.isListMode:
142 self.shorts_app.main_view.change_view_mode()99 self.shorts_app.main_view.change_view_mode("isListMode")
143100
144 def ensure_list_view_mode(self, current_tab):101 def _ensure_list_view_mode(self, current_tab):
145 if not current_tab.isListMode:102 if not current_tab.isListMode:
146 self.shorts_app.main_view.change_view_mode()103 self.shorts_app.main_view.change_view_mode("isNotListMode")
147104
148 def test_open_listmode_feed_item(self):105 def test_open_listmode_feed_item(self):
149 """"test to ensure list mode feed items can be opened"""106 """"test to ensure list mode feed items can be opened"""
@@ -154,7 +111,7 @@
154111
155 self.add_feed_to_new_topic(test_feed_url, test_feed_title, test_topic)112 self.add_feed_to_new_topic(test_feed_url, test_feed_title, test_topic)
156 new_topic_tab = self.shorts_app.main_view.get_topic_tab(test_topic)113 new_topic_tab = self.shorts_app.main_view.get_topic_tab(test_topic)
157 self.ensure_list_view_mode(new_topic_tab)114 self._ensure_list_view_mode(new_topic_tab)
158115
159 self.shorts_app.main_view.open_feed_item(test_topic, test_feed_title)116 self.shorts_app.main_view.open_feed_item(test_topic, test_feed_title)
160 self.assertEqual(117 self.assertEqual(

Subscribers

People subscribed via source and target branches

to all changes: