ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #01324
[Merge] lp:~vthompson/music-app/refactor-improve-playlist-delete into lp:music-app/refactor
Victor Thompson has proposed merging lp:~vthompson/music-app/refactor-improve-playlist-delete into lp:music-app/refactor.
Commit message:
Improve multiselect delete for playlist items
Requested reviews:
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/refactor-improve-playlist-delete/+merge/255241
Improve multiselect delete for playlist items
--
Your team Music App Developers is requested to review the proposed merge of lp:~vthompson/music-app/refactor-improve-playlist-delete into lp:music-app/refactor.
=== modified file 'app/logic/playlists.js'
--- app/logic/playlists.js 2015-02-03 23:00:14 +0000
+++ app/logic/playlists.js 2015-04-05 16:40:38 +0000
@@ -367,18 +367,17 @@
return res
}
-function removeFromPlaylist(playlist, index) {
+function removeFromPlaylist(playlist, indexes) {
var db = getPlaylistDatabase()
- var res = false
db.transaction(function (tx) {
- res = tx.executeSql('DELETE FROM track WHERE playlist=? AND i=?;',
- [playlist, index]).rowsAffected > 0
+ for (var i = 0; i < indexes.length; i++) {
+ tx.executeSql('DELETE FROM track WHERE playlist=? AND i=?;',
+ [playlist, indexes[i]]).rowsAffected > 0
+ }
reorder(playlist, "remove", tx)
})
-
- return res
}
function reorder(playlist, type, tx) {
=== modified file 'app/ui/SongsView.qml'
--- app/ui/SongsView.qml 2015-03-29 23:59:41 +0000
+++ app/ui/SongsView.qml 2015-04-05 16:40:38 +0000
@@ -151,17 +151,7 @@
thisPage: songStackPage
onRemoved: {
- for (var i=0; i < selectedItems.length; i++) {
- Playlists.removeFromPlaylist(songStackPage.line2, selectedItems[i])
-
- // Update indexes as an index has been removed
- for (var j=i + 1; j < selectedItems.length; j++) {
- if (selectedItems[j] > selectedItems[i]) {
- selectedItems[j]--;
- }
- }
- }
-
+ Playlists.removeFromPlaylist(songStackPage.line2, selectedItems)
playlistChangedHelper() // update recent/playlist models
albumTracksModel.filterPlaylistTracks(songStackPage.line2)
@@ -354,7 +344,7 @@
id: playlistRemoveAction
sourceComponent: Remove {
onTriggered: {
- Playlists.removeFromPlaylist(songStackPage.line2, model.i)
+ Playlists.removeFromPlaylist(songStackPage.line2, [model.i])
playlistChangedHelper() // update recent/playlist models
Follow ups