ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #01304
[Merge] lp:~vthompson/music-app/improve-playlist-delete into lp:music-app
Victor Thompson has proposed merging lp:~vthompson/music-app/improve-playlist-delete into lp:music-app.
Commit message:
Improve multiselect delete for playlist items
Requested reviews:
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot): continuous-integration
Music App Developers (music-app-dev)
Related bugs:
Bug #1439185 in Ubuntu Music App: "Delete action takes long, no activity feedback"
https://bugs.launchpad.net/music-app/+bug/1439185
For more details, see:
https://code.launchpad.net/~vthompson/music-app/improve-playlist-delete/+merge/255237
Improve multiselect delete for playlist items
--
Your team Music App Developers is requested to review the proposed merge of lp:~vthompson/music-app/improve-playlist-delete into lp:music-app.
=== modified file 'common/SongsPage.qml'
--- common/SongsPage.qml 2015-03-29 22:11:54 +0000
+++ common/SongsPage.qml 2015-04-05 06:41:24 +0000
@@ -208,16 +208,7 @@
text: i18n.tr("Delete")
visible: songStackPage.line1 === i18n.tr("Playlist")
onTriggered: {
- for (var i=0; i < albumtrackslist.selectedItems.length; i++) {
- Playlists.removeFromPlaylist(songStackPage.line2, albumtrackslist.selectedItems[i])
-
- // Update indexes as an index has been removed
- for (var j=i + 1; j < albumtrackslist.selectedItems.length; j++) {
- if (albumtrackslist.selectedItems[j] > albumtrackslist.selectedItems[i]) {
- albumtrackslist.selectedItems[j]--;
- }
- }
- }
+ Playlists.removeListFromPlaylist(songStackPage.line2, albumtrackslist.selectedItems)
albumtrackslist.closeSelection()
=== modified file 'playlists.js'
--- playlists.js 2015-01-25 16:44:49 +0000
+++ playlists.js 2015-04-05 06:41:24 +0000
@@ -367,18 +367,28 @@
return res
}
+function removeListFromPlaylist(playlist, indexes) {
+ var db = getPlaylistDatabase()
+
+ for (var i = 0; i < indexes.length; i++) {
+ db.transaction(function (tx) {
+ tx.executeSql('DELETE FROM track WHERE playlist=? AND i=?;',
+ [playlist, indexes[i]]).rowsAffected > 0
+ })
+ }
+
+ reorder(playlist, "remove")
+}
+
function removeFromPlaylist(playlist, index) {
var db = getPlaylistDatabase()
- var res = false
db.transaction(function (tx) {
- res = tx.executeSql('DELETE FROM track WHERE playlist=? AND i=?;',
- [playlist, index]).rowsAffected > 0
+ tx.executeSql('DELETE FROM track WHERE playlist=? AND i=?;',
+ [playlist, index]).rowsAffected > 0
reorder(playlist, "remove", tx)
})
-
- return res
}
function reorder(playlist, type, tx) {