Merge lp:~nik90/podbird/dev-multidelete-podcast into lp:podbird/devel

Proposed by Nekhelesh Ramananthan
Status: Merged
Merged at revision: 114
Proposed branch: lp:~nik90/podbird/dev-multidelete-podcast
Merge into: lp:podbird/devel
Diff against target: 542 lines (+436/-16)
4 files modified
app/graphics/select-none.svg (+153/-0)
app/graphics/select.svg (+158/-0)
app/ui/PodcastsTab.qml (+103/-6)
po/podbird.nik90.pot (+22/-10)
To merge this branch: bzr merge lp:~nik90/podbird/dev-multidelete-podcast
Reviewer Review Type Date Requested Status
Podbird Developers Pending
Review via email: mp+262528@code.launchpad.net

Commit message

Add multiselect delete support for the podcast tab (list view)

Description of the change

Add multiselect delete support for the podcast tab (list view)

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'app/graphics/select-none.svg'
2--- app/graphics/select-none.svg 1970-01-01 00:00:00 +0000
3+++ app/graphics/select-none.svg 2015-06-20 23:30:28 +0000
4@@ -0,0 +1,153 @@
5+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
6+<!-- Created with Inkscape (http://www.inkscape.org/) -->
7+
8+<svg
9+ xmlns:dc="http://purl.org/dc/elements/1.1/"
10+ xmlns:cc="http://creativecommons.org/ns#"
11+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
12+ xmlns:svg="http://www.w3.org/2000/svg"
13+ xmlns="http://www.w3.org/2000/svg"
14+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
15+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
16+ width="90"
17+ height="90"
18+ id="svg4874"
19+ version="1.1"
20+ inkscape:version="0.48+devel r"
21+ viewBox="0 0 90 90.000001"
22+ sodipodi:docname="select-none.svg">
23+ <defs
24+ id="defs4876" />
25+ <sodipodi:namedview
26+ id="base"
27+ pagecolor="#ffffff"
28+ bordercolor="#666666"
29+ borderopacity="1.0"
30+ inkscape:pageopacity="0.0"
31+ inkscape:pageshadow="2"
32+ inkscape:zoom="12.434498"
33+ inkscape:cx="10.237647"
34+ inkscape:cy="53.078139"
35+ inkscape:document-units="px"
36+ inkscape:current-layer="g1311"
37+ showgrid="true"
38+ showborder="true"
39+ fit-margin-top="0"
40+ fit-margin-left="0"
41+ fit-margin-right="0"
42+ fit-margin-bottom="0"
43+ inkscape:snap-bbox="true"
44+ inkscape:bbox-paths="true"
45+ inkscape:bbox-nodes="true"
46+ inkscape:snap-bbox-edge-midpoints="true"
47+ inkscape:snap-bbox-midpoints="true"
48+ inkscape:object-paths="true"
49+ inkscape:snap-intersection-paths="true"
50+ inkscape:object-nodes="true"
51+ inkscape:snap-smooth-nodes="true"
52+ inkscape:snap-midpoints="true"
53+ inkscape:snap-object-midpoints="true"
54+ inkscape:snap-center="true"
55+ showguides="true"
56+ inkscape:guide-bbox="true">
57+ <inkscape:grid
58+ type="xygrid"
59+ id="grid5451"
60+ empspacing="6" />
61+ <sodipodi:guide
62+ orientation="1,0"
63+ position="6,77"
64+ id="guide4063" />
65+ <sodipodi:guide
66+ orientation="1,0"
67+ position="3,78"
68+ id="guide4065" />
69+ <sodipodi:guide
70+ orientation="0,1"
71+ position="55,84"
72+ id="guide4067" />
73+ <sodipodi:guide
74+ orientation="0,1"
75+ position="53,87"
76+ id="guide4069" />
77+ <sodipodi:guide
78+ orientation="0,1"
79+ position="20,3"
80+ id="guide4071" />
81+ <sodipodi:guide
82+ orientation="0,1"
83+ position="20,6"
84+ id="guide4073" />
85+ <sodipodi:guide
86+ orientation="1,0"
87+ position="87,7"
88+ id="guide4075" />
89+ <sodipodi:guide
90+ orientation="1,0"
91+ position="84,7"
92+ id="guide4077" />
93+ <sodipodi:guide
94+ orientation="0,1"
95+ position="58,81"
96+ id="guide4074" />
97+ <sodipodi:guide
98+ orientation="1,0"
99+ position="9,74"
100+ id="guide4076" />
101+ <sodipodi:guide
102+ orientation="0,1"
103+ position="21,9"
104+ id="guide4078" />
105+ <sodipodi:guide
106+ orientation="1,0"
107+ position="81,4"
108+ id="guide4080" />
109+ </sodipodi:namedview>
110+ <metadata
111+ id="metadata4879">
112+ <rdf:RDF>
113+ <cc:Work
114+ rdf:about="">
115+ <dc:format>image/svg+xml</dc:format>
116+ <dc:type
117+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
118+ <dc:title></dc:title>
119+ </cc:Work>
120+ </rdf:RDF>
121+ </metadata>
122+ <g
123+ inkscape:label="Layer 1"
124+ inkscape:groupmode="layer"
125+ id="layer1"
126+ transform="translate(67.857146,-84.50504)">
127+ <g
128+ transform="matrix(0,-1,-1,0,373.50506,516.50504)"
129+ id="g4845"
130+ style="display:inline">
131+ <g
132+ transform="matrix(0,-1,-1,0,567.36222,615.36221)"
133+ id="g1311"
134+ inkscape:export-filename="envelope02.png"
135+ inkscape:export-xdpi="90"
136+ inkscape:export-ydpi="90">
137+ <g
138+ id="g1313"
139+ transform="matrix(1.875,0,0,1.875,-366,-1657.8169)">
140+ <rect
141+ transform="translate(0,804.3622)"
142+ y="152"
143+ x="288"
144+ height="48"
145+ width="48"
146+ id="rect1315"
147+ style="opacity:0.21171169;fill:none;stroke:none" />
148+ </g>
149+ <path
150+ style="font-size:15px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#808080;fill-opacity:1;stroke:none;display:inline;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
151+ d="M 21 6 C 11 6 6 5.9998033 6 17.626953 L 6 72.373047 C 6 84.000207 11 84 21 84 L 69 84 C 79 84 84 84.000207 84 72.373047 L 84 17.626953 C 84 5.9998033 79 6 69 6 L 21 6 z M 22.867188 12 L 67.132812 12 C 75.065512 12 78 11.999356 78 20.191406 L 78 69.808594 C 78 78.000644 75.065512 78 67.132812 78 L 22.867188 78 C 14.934488 78 12 78.000644 12 69.808594 L 12 20.191406 C 12 11.999356 14.934488 12 22.867188 12 z "
152+ transform="translate(174,135.36222)"
153+ id="path4098" />
154+ </g>
155+ </g>
156+ </g>
157+</svg>
158
159=== added file 'app/graphics/select.svg'
160--- app/graphics/select.svg 1970-01-01 00:00:00 +0000
161+++ app/graphics/select.svg 2015-06-20 23:30:28 +0000
162@@ -0,0 +1,158 @@
163+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
164+<!-- Created with Inkscape (http://www.inkscape.org/) -->
165+
166+<svg
167+ xmlns:dc="http://purl.org/dc/elements/1.1/"
168+ xmlns:cc="http://creativecommons.org/ns#"
169+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
170+ xmlns:svg="http://www.w3.org/2000/svg"
171+ xmlns="http://www.w3.org/2000/svg"
172+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
173+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
174+ width="90"
175+ height="90"
176+ id="svg4874"
177+ version="1.1"
178+ inkscape:version="0.48+devel r12833"
179+ viewBox="0 0 90 90.000001"
180+ sodipodi:docname="select.svg">
181+ <defs
182+ id="defs4876" />
183+ <sodipodi:namedview
184+ id="base"
185+ pagecolor="#ffffff"
186+ bordercolor="#666666"
187+ borderopacity="1.0"
188+ inkscape:pageopacity="0.0"
189+ inkscape:pageshadow="2"
190+ inkscape:zoom="12.434498"
191+ inkscape:cx="30.343002"
192+ inkscape:cy="53.600878"
193+ inkscape:document-units="px"
194+ inkscape:current-layer="g1311"
195+ showgrid="true"
196+ showborder="true"
197+ fit-margin-top="0"
198+ fit-margin-left="0"
199+ fit-margin-right="0"
200+ fit-margin-bottom="0"
201+ inkscape:snap-bbox="true"
202+ inkscape:bbox-paths="true"
203+ inkscape:bbox-nodes="true"
204+ inkscape:snap-bbox-edge-midpoints="true"
205+ inkscape:snap-bbox-midpoints="true"
206+ inkscape:object-paths="true"
207+ inkscape:snap-intersection-paths="true"
208+ inkscape:object-nodes="true"
209+ inkscape:snap-smooth-nodes="true"
210+ inkscape:snap-midpoints="true"
211+ inkscape:snap-object-midpoints="true"
212+ inkscape:snap-center="true"
213+ showguides="true"
214+ inkscape:guide-bbox="true">
215+ <inkscape:grid
216+ type="xygrid"
217+ id="grid5451"
218+ empspacing="6" />
219+ <sodipodi:guide
220+ orientation="1,0"
221+ position="6,77"
222+ id="guide4063" />
223+ <sodipodi:guide
224+ orientation="1,0"
225+ position="3,78"
226+ id="guide4065" />
227+ <sodipodi:guide
228+ orientation="0,1"
229+ position="55,84"
230+ id="guide4067" />
231+ <sodipodi:guide
232+ orientation="0,1"
233+ position="53,87"
234+ id="guide4069" />
235+ <sodipodi:guide
236+ orientation="0,1"
237+ position="20,3"
238+ id="guide4071" />
239+ <sodipodi:guide
240+ orientation="0,1"
241+ position="20,6"
242+ id="guide4073" />
243+ <sodipodi:guide
244+ orientation="1,0"
245+ position="87,7"
246+ id="guide4075" />
247+ <sodipodi:guide
248+ orientation="1,0"
249+ position="84,7"
250+ id="guide4077" />
251+ <sodipodi:guide
252+ orientation="0,1"
253+ position="58,81"
254+ id="guide4074" />
255+ <sodipodi:guide
256+ orientation="1,0"
257+ position="9,74"
258+ id="guide4076" />
259+ <sodipodi:guide
260+ orientation="0,1"
261+ position="21,9"
262+ id="guide4078" />
263+ <sodipodi:guide
264+ orientation="1,0"
265+ position="81,4"
266+ id="guide4080" />
267+ </sodipodi:namedview>
268+ <metadata
269+ id="metadata4879">
270+ <rdf:RDF>
271+ <cc:Work
272+ rdf:about="">
273+ <dc:format>image/svg+xml</dc:format>
274+ <dc:type
275+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
276+ <dc:title></dc:title>
277+ </cc:Work>
278+ </rdf:RDF>
279+ </metadata>
280+ <g
281+ inkscape:label="Layer 1"
282+ inkscape:groupmode="layer"
283+ id="layer1"
284+ transform="translate(67.857146,-84.50504)">
285+ <g
286+ transform="matrix(0,-1,-1,0,373.50506,516.50504)"
287+ id="g4845"
288+ style="display:inline">
289+ <g
290+ transform="matrix(0,-1,-1,0,567.36222,615.36221)"
291+ id="g1311"
292+ inkscape:export-filename="envelope02.png"
293+ inkscape:export-xdpi="90"
294+ inkscape:export-ydpi="90">
295+ <g
296+ id="g1313"
297+ transform="matrix(1.875,0,0,1.875,-366,-1657.8169)">
298+ <rect
299+ transform="translate(0,804.3622)"
300+ y="152"
301+ x="288"
302+ height="48"
303+ width="48"
304+ id="rect1315"
305+ style="opacity:0.21171169;fill:none;stroke:none" />
306+ </g>
307+ <path
308+ style="font-size:15px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#808080;fill-opacity:1;stroke:none;display:inline;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
309+ d="M 21 6 C 11 6 6 5.9998033 6 17.626953 L 6 72.373047 C 6 84.000207 11 84 21 84 L 69 84 C 79 84 84 84.000207 84 72.373047 L 84 17.626953 C 84 5.9998033 79 6 69 6 L 21 6 z M 22.867188 12 L 67.132812 12 C 75.065512 12 78 11.999356 78 20.191406 L 78 69.808594 C 78 78.000644 75.065512 78 67.132812 78 L 22.867188 78 C 14.934488 78 12 78.000644 12 69.808594 L 12 20.191406 C 12 11.999356 14.934488 12 22.867188 12 z "
310+ transform="translate(174,135.36222)"
311+ id="path4098" />
312+ <path
313+ style="font-size:15px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#808080;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
314+ d="m 242.00422,161.6591 -0.375,0.32812 -26.94727,23.60352 -15.79687,-13.55079 -4.77539,5.4004 20.57617,21.64843 31.30078,-32.9375 -3.98242,-4.49218 z"
315+ id="path4041-9"
316+ inkscape:connector-curvature="0" />
317+ </g>
318+ </g>
319+ </g>
320+</svg>
321
322=== modified file 'app/ui/PodcastsTab.qml'
323--- app/ui/PodcastsTab.qml 2015-05-12 22:24:33 +0000
324+++ app/ui/PodcastsTab.qml 2015-06-20 23:30:28 +0000
325@@ -99,6 +99,72 @@
326 anchors.right: parent ? parent.right : undefined
327 anchors.rightMargin: units.gu(2)
328 }
329+ },
330+
331+ PageHeadState {
332+ name: "selection"
333+ head: podcastPage.head
334+ when: podbird.settings.showListView && viewLoader.item.ViewItems.selectMode
335+ backAction: Action {
336+ iconName: "back"
337+ text: i18n.tr("Back")
338+ onTriggered: {
339+ viewLoader.item.ViewItems.selectMode = false
340+ podcastPage.state = "default"
341+ }
342+ }
343+
344+ actions: [
345+ Action {
346+ enabled: viewLoader.item.count !== 0
347+ text: {
348+ if (viewLoader.item.ViewItems.selectedIndices.length === viewLoader.item.count) {
349+ return i18n.tr("Select None")
350+ } else {
351+ return i18n.tr("Select All")
352+ }
353+ }
354+
355+ iconSource: {
356+ if (viewLoader.item.ViewItems.selectedIndices.length === viewLoader.item.count) {
357+ return Qt.resolvedUrl("../graphics/select-none.svg")
358+ } else {
359+ return Qt.resolvedUrl("../graphics/select.svg")
360+ }
361+ }
362+
363+ onTriggered: {
364+ if (viewLoader.item.ViewItems.selectedIndices.length === viewLoader.item.count) {
365+ viewLoader.item.clearSelection()
366+ } else {
367+ viewLoader.item.selectAll()
368+ }
369+ }
370+ },
371+
372+ Action {
373+ iconName: "delete"
374+ text: i18n.tr("Delete")
375+ enabled: viewLoader.item.ViewItems.selectedIndices.length !== 0
376+ onTriggered: {
377+ var items = viewLoader.item.ViewItems.selectedIndices
378+ var db = Podcasts.init();
379+ for (var i=0; i< viewLoader.item.ViewItems.selectedIndices.length; i++) {
380+ var id = podcastModel.get(items[i]).id
381+ db.transaction(function (tx) {
382+ var rs = tx.executeSql("SELECT downloadedfile FROM Episode WHERE downloadedfile NOT NULL AND podcast=?", [id]);
383+ for(var j = 0; j < rs.rows.length; j++) {
384+ fileManager.deleteFile(rs.rows.item(j).downloadedfile);
385+ }
386+ tx.executeSql("DELETE FROM Episode WHERE podcast=?", [id]);
387+ tx.executeSql("DELETE FROM Podcast WHERE rowid=?", [id]);
388+ });
389+ }
390+ viewLoader.item.clearSelection()
391+ podcastPage.refreshModel()
392+ }
393+ }
394+ ]
395 }
396 ]
397
398@@ -186,7 +252,7 @@
399 Component {
400 id: listviewComponent
401
402- ListView {
403+ UbuntuListView {
404 id: listView
405
406 Component.onCompleted: {
407@@ -197,6 +263,10 @@
408 flickDeceleration = flickDeceleration * scaleFactor;
409 }
410
411+ signal clearSelection()
412+ signal closeSelection()
413+ signal selectAll()
414+
415 clip: true
416 model: sortedPodcastModel
417 anchors.fill: parent
418@@ -237,12 +307,39 @@
419 }
420
421 onClicked: {
422- if(podcastPage.state === "search") {
423- listView.forceActiveFocus()
424- podcastPage.state = "default"
425+ if (selectMode) {
426+ selected = !selected
427+ } else {
428+ if(podcastPage.state === "search") {
429+ listView.forceActiveFocus()
430+ podcastPage.state = "default"
431+ }
432+ mainStack.push(Qt.resolvedUrl("EpisodesPage.qml"), {"episodeName": model.name, "episodeId": model.id, "episodeArtist": model.artist, "episodeImage": model.image})
433 }
434- mainStack.push(Qt.resolvedUrl("EpisodesPage.qml"), {"episodeName": model.name, "episodeId": model.id, "episodeArtist": model.artist, "episodeImage": model.image})
435- }
436+ }
437+
438+ onPressAndHold: {
439+ ListView.view.ViewItems.selectMode = !ListView.view.ViewItems.selectMode
440+ }
441+ }
442+
443+ onClearSelection: {
444+ ViewItems.selectedIndices = []
445+ }
446+
447+ onSelectAll: {
448+ var tmp = [];
449+
450+ for (var i=0; i < model.count; i++) {
451+ tmp.push(i)
452+ }
453+
454+ ViewItems.selectedIndices = tmp
455+ }
456+
457+ onCloseSelection: {
458+ clearSelection()
459+ ViewItems.selectMode = false
460 }
461
462 // #FIXME: Use SDK Scrollbar when it is themeable
463
464=== modified file 'po/podbird.nik90.pot'
465--- po/podbird.nik90.pot 2015-06-20 13:58:19 +0000
466+++ po/podbird.nik90.pot 2015-06-20 23:30:28 +0000
467@@ -8,7 +8,7 @@
468 msgstr ""
469 "Project-Id-Version: \n"
470 "Report-Msgid-Bugs-To: \n"
471-"POT-Creation-Date: 2015-06-20 13:57+0000\n"
472+"POT-Creation-Date: 2015-06-20 22:59+0000\n"
473 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
474 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
475 "Language-Team: LANGUAGE <LL@li.org>\n"
476@@ -190,8 +190,8 @@
477 msgstr ""
478
479 #: ../app/ui/EpisodesPage.qml:125 ../app/ui/EpisodesTab.qml:110
480-#: ../app/ui/PodcastsTab.qml:88 ../app/ui/SearchPage.qml:82
481-#: ../app/ui/SearchPage.qml:104
482+#: ../app/ui/PodcastsTab.qml:88 ../app/ui/PodcastsTab.qml:110
483+#: ../app/ui/SearchPage.qml:82 ../app/ui/SearchPage.qml:104
484 msgid "Back"
485 msgstr ""
486
487@@ -327,29 +327,41 @@
488 msgid "Add New Podcasts"
489 msgstr ""
490
491-#: ../app/ui/PodcastsTab.qml:109
492+#: ../app/ui/PodcastsTab.qml:122
493+msgid "Select None"
494+msgstr ""
495+
496+#: ../app/ui/PodcastsTab.qml:124
497+msgid "Select All"
498+msgstr ""
499+
500+#: ../app/ui/PodcastsTab.qml:147
501+msgid "Delete"
502+msgstr ""
503+
504+#: ../app/ui/PodcastsTab.qml:175
505 msgid "Search podcast"
506 msgstr ""
507
508-#: ../app/ui/PodcastsTab.qml:139
509+#: ../app/ui/PodcastsTab.qml:205
510 msgid "No Podcast Subscriptions"
511 msgstr ""
512
513-#: ../app/ui/PodcastsTab.qml:139
514+#: ../app/ui/PodcastsTab.qml:205
515 msgid "No Podcasts Found"
516 msgstr ""
517
518-#: ../app/ui/PodcastsTab.qml:140
519+#: ../app/ui/PodcastsTab.qml:206
520 msgid ""
521 "You haven't subscribed to any podcasts yet, visit the 'Find New Podcasts' "
522 "page to add some."
523 msgstr ""
524
525-#: ../app/ui/PodcastsTab.qml:141 ../app/ui/SearchPage.qml:197
526+#: ../app/ui/PodcastsTab.qml:207 ../app/ui/SearchPage.qml:197
527 msgid "No podcasts found matching the search term."
528 msgstr ""
529
530-#: ../app/ui/PodcastsTab.qml:174 ../app/ui/PodcastsTab.qml:216
531+#: ../app/ui/PodcastsTab.qml:240 ../app/ui/PodcastsTab.qml:286
532 #, qt-format
533 msgid "%1 unheard episode"
534 msgid_plural "%1 unheard episodes"
535@@ -547,6 +559,6 @@
536 msgid "Finish"
537 msgstr ""
538
539-#: /home/krnekhelesh/Documents/Ubuntu-Projects/Podbird-Devel-MPs/builddir/build-devel-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_15_04_vivid-Default/po/Podbird.desktop.in.h:1
540+#: /home/krnekhelesh/Documents/Ubuntu-Projects/Podbird-Devel-MPs/builddir/build-multidelete-podcast-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_15_04_vivid-Default/po/Podbird.desktop.in.h:1
541 msgid "The chirpiest podcast manager for Ubuntu"
542 msgstr ""

Subscribers

People subscribed via source and target branches