From: Christian Kamm Date: Fri, 21 Aug 2015 09:01:01 +0000 (+0200) Subject: Adjust buttons on remove folder/account questions #3654 X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~1408^2~172 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a0f9b834b6f64a581d094d12e8b7b3f8057bdd5b;p=nextcloud-desktop.git Adjust buttons on remove folder/account questions #3654 --- diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index d70548350..206db2dcb 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("

Do you really want to stop syncing the folder %1?

" - "

Note: This will not delete any files.

").arg(alias), - QMessageBox::Yes|QMessageBox::No ); - - if( ret == QMessageBox::No ) { + QMessageBox messageBox(QMessageBox::Question, + tr("Confirm Folder Remove"), + tr("

Do you really want to stop syncing the folder %1?

" + "

Note: This will not delete any files.

").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("

Do you really want to remove the connection to the account %1?

" - "

Note: This will not delete any files.

") - .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("

Do you really want to remove the connection to the account %1?

" + "

Note: This will not delete any files.

") + .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();