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