[Pkg-owncloud-commits] [owncloud-client] 01/218: Adjust buttons on remove folder/account questions #3654

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 17 14:30:30 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit a0f9b834b6f64a581d094d12e8b7b3f8057bdd5b
Author: Christian Kamm <mail at ckamm.de>
Date:   Fri Aug 21 11:01:01 2015 +0200

    Adjust buttons on remove folder/account questions #3654
---
 src/gui/accountsettings.cpp | 46 +++++++++++++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 16 deletions(-)

diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp
index d705483..206db2d 100644
--- a/src/gui/accountsettings.cpp
+++ b/src/gui/accountsettings.cpp
@@ -258,14 +258,18 @@ void AccountSettings::slotRemoveCurrentFolder()
         QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString();
         qDebug() << "Remove Folder alias " << alias;
         if( !alias.isEmpty() ) {
-            // remove from file system through folder man
-            // _model->removeRow( selected.row() );
-            int ret = QMessageBox::question( this, tr("Confirm Folder Remove"),
-                                             tr("<p>Do you really want to stop syncing the folder <i>%1</i>?</p>"
-                                                "<p><b>Note:</b> This will <b>not</b> delete any files.</p>").arg(alias),
-                                             QMessageBox::Yes|QMessageBox::No );
-
-            if( ret == QMessageBox::No ) {
+            QMessageBox messageBox(QMessageBox::Question,
+                                   tr("Confirm Folder Remove"),
+                                   tr("<p>Do you really want to stop syncing the folder <i>%1</i>?</p>"
+                                      "<p><b>Note:</b> This will <b>not</b> delete any files.</p>").arg(alias),
+                                   QMessageBox::NoButton,
+                                   this);
+            QPushButton* yesButton =
+                    messageBox.addButton(tr("Stop syncing"), QMessageBox::YesRole);
+            messageBox.addButton(tr("Cancel"), QMessageBox::NoRole);
+
+            messageBox.exec();
+            if (messageBox.clickedButton() != yesButton) {
                 return;
             }
 
@@ -522,14 +526,24 @@ void AccountSettings::refreshSelectiveSyncStatus()
 
 void AccountSettings::slotDeleteAccount()
 {
-    int ret = QMessageBox::question( this, tr("Confirm Account Delete"),
-                                     tr("<p>Do you really want to remove the connection to the account <i>%1</i>?</p>"
-                                     "<p><b>Note:</b> This will <b>not</b> delete any files.</p>")
-                                        .arg(_accountState->account()->displayName()),
-                                     QMessageBox::Yes|QMessageBox::No );
-
-    if( ret == QMessageBox::No ) {
-        return;
+    // Deleting the account potentially deletes 'this', so
+    // the QMessageBox should be destroyed before that happens.
+    {
+        QMessageBox messageBox(QMessageBox::Question,
+                               tr("Confirm Account Delete"),
+                               tr("<p>Do you really want to remove the connection to the account <i>%1</i>?</p>"
+                                  "<p><b>Note:</b> This will <b>not</b> delete any files.</p>")
+                                 .arg(_accountState->account()->displayName()),
+                               QMessageBox::NoButton,
+                               this);
+        QPushButton* yesButton =
+                messageBox.addButton(tr("Remove connection"), QMessageBox::YesRole);
+        messageBox.addButton(tr("Cancel"), QMessageBox::NoRole);
+
+        messageBox.exec();
+        if (messageBox.clickedButton() != yesButton) {
+            return;
+        }
     }
 
     auto manager = AccountManager::instance();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list