← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~ahayzen/music-app/refactor-fix-1435658-close-dialog-before-pop into lp:music-app/refactor

 

Andrew Hayzen has proposed merging lp:~ahayzen/music-app/refactor-fix-1435658-close-dialog-before-pop into lp:music-app/refactor.

Commit message:
* Ensure dialogs are closed before popping a page

Requested reviews:
  Music App Developers (music-app-dev)
Related bugs:
  Bug #1435658 in Ubuntu Music App: "[refactor] While in the "Rename playlist" dialog, hitting escape puts the user in an inescapable situation"
  https://bugs.launchpad.net/music-app/+bug/1435658

For more details, see:
https://code.launchpad.net/~ahayzen/music-app/refactor-fix-1435658-close-dialog-before-pop/+merge/254016

* Ensure dialogs are closed before popping a page
-- 
Your team Music App Developers is requested to review the proposed merge of lp:~ahayzen/music-app/refactor-fix-1435658-close-dialog-before-pop into lp:music-app/refactor.
=== modified file 'app/components/HeadState/PlaylistsHeadState.qml'
--- app/components/HeadState/PlaylistsHeadState.qml	2015-02-05 04:01:08 +0000
+++ app/components/HeadState/PlaylistsHeadState.qml	2015-03-24 23:59:48 +0000
@@ -31,7 +31,7 @@
             iconName: "add"
             onTriggered: {
                 customdebug("New playlist.")
-                PopupUtils.open(Qt.resolvedUrl("../Dialog/NewPlaylistDialog.qml"), mainView)
+                thisPage.currentDialog = PopupUtils.open(Qt.resolvedUrl("../Dialog/NewPlaylistDialog.qml"), mainView)
             }
         },
         Action {

=== modified file 'app/components/MusicPage.qml'
--- app/components/MusicPage.qml	2015-01-21 19:04:07 +0000
+++ app/components/MusicPage.qml	2015-03-24 23:59:48 +0000
@@ -19,6 +19,7 @@
 
 import QtQuick 2.3
 import Ubuntu.Components 1.1
+import Ubuntu.Components.Popups 1.0
 
 
 // generic page for music, could be useful for bottomedge implementation
@@ -29,6 +30,7 @@
         fill: parent
     }
 
+    property Dialog currentDialog
     property bool searchable: false
     property int searchResultsCount
 

=== modified file 'app/music-app.qml'
--- app/music-app.qml	2015-03-09 00:13:22 +0000
+++ app/music-app.qml	2015-03-24 23:59:48 +0000
@@ -19,6 +19,7 @@
 
 import QtQuick 2.3
 import Ubuntu.Components 1.1
+import Ubuntu.Components.Popups 1.0
 import Ubuntu.MediaScanner 0.1
 import Qt.labs.settings 1.0
 import QtMultimedia 5.0
@@ -53,7 +54,9 @@
     focus: true
     Keys.onPressed: {
         if(event.key === Qt.Key_Escape) {
-            if (mainPageStack.currentMusicPage.searchable && mainPageStack.currentMusicPage.state === "search") {
+            if (mainPageStack.currentMusicPage.currentDialog !== null) {
+                PopupUtils.close(mainPageStack.currentMusicPage.currentDialog)
+            } else if (mainPageStack.currentMusicPage.searchable && mainPageStack.currentMusicPage.state === "search") {
                 mainPageStack.currentMusicPage.state = "default"
             } else {
                 mainPageStack.goBack();  // Esc      Go back
@@ -692,6 +695,11 @@
 
         // Go back up the stack if possible
         function goBack() {
+            // Ensure in the case that goBack is called programmatically that any dialogs are closed
+            if (mainPageStack.currentMusicPage.currentDialog !== null) {
+                PopupUtils.close(mainPageStack.currentMusicPage.currentDialog)
+            }
+
             if (depth > 1) {
                 pop()
             }
@@ -701,6 +709,11 @@
         function popPage(page) {
             var tmpPages = []
 
+            // Ensure in the case that popPage is called programmatically that any dialogs are closed
+            if (page.currentDialog !== undefined && page.currentDialog !== null) {
+                PopupUtils.close(page.currentDialog)
+            }
+
             popping = true
 
             while (currentPage !== page && depth > 0) {

=== modified file 'app/ui/SongsView.qml'
--- app/ui/SongsView.qml	2015-02-16 20:27:40 +0000
+++ app/ui/SongsView.qml	2015-03-24 23:59:48 +0000
@@ -126,16 +126,16 @@
                     objectName: "editPlaylist"
                     iconName: "edit"
                     onTriggered: {
-                        var dialog = PopupUtils.open(Qt.resolvedUrl("../components/Dialog/EditPlaylistDialog.qml"), mainView)
-                        dialog.oldPlaylistName = line2
+                        currentDialog = PopupUtils.open(Qt.resolvedUrl("../components/Dialog/EditPlaylistDialog.qml"), mainView)
+                        currentDialog.oldPlaylistName = line2
                     }
                 },
                 Action {
                     objectName: "deletePlaylist"
                     iconName: "delete"
                     onTriggered: {
-                        var dialog = PopupUtils.open(Qt.resolvedUrl("../components/Dialog/RemovePlaylistDialog.qml"), mainView)
-                        dialog.oldPlaylistName = line2
+                        currentDialog = PopupUtils.open(Qt.resolvedUrl("../components/Dialog/RemovePlaylistDialog.qml"), mainView)
+                        currentDialog.oldPlaylistName = line2
                     }
                 }
             ]


Follow ups