From: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com> Date: Sat, 11 Jan 2020 16:06:42 +0000 (+0100) Subject: Added confirmation dialog for account removal X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~413^2~66 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6485ef480b7ab2080790ac9650f20f6880fdbc3c;p=nextcloud-desktop.git Added confirmation dialog for account removal Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com> --- diff --git a/src/gui/generalsettings.cpp b/src/gui/generalsettings.cpp index 632ae43f8..d803299fa 100644 --- a/src/gui/generalsettings.cpp +++ b/src/gui/generalsettings.cpp @@ -116,7 +116,8 @@ GeneralSettings::GeneralSettings(QWidget *parent) connect(_ui->ignoredFilesButton, &QAbstractButton::clicked, this, &GeneralSettings::slotIgnoreFilesEditor); // accountAdded means the wizard was finished and the wizard might change some options. - connect(AccountManager::instance(), &AccountManager::accountAdded, this, &GeneralSettings::loadMiscSettings); + // Update 01/2020: Show new tray window instead + // connect(AccountManager::instance(), &AccountManager::accountAdded, this, &GeneralSettings::loadMiscSettings); customizeStyle(); } diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index c7bbe2fe3..2157c7579 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -57,6 +57,9 @@ Systray::Systray() // TODO: make singleton, provide ::instance() connect(UserModel::instance(), &UserModel::newUserSelected, this, &Systray::slotChangeActivityModel); + + connect(AccountManager::instance(), &AccountManager::accountAdded, + this, &Systray::showWindow); } Systray::~Systray() diff --git a/src/gui/tray/UserModel.cpp b/src/gui/tray/UserModel.cpp index 8a14fc1b2..33506f62d 100644 --- a/src/gui/tray/UserModel.cpp +++ b/src/gui/tray/UserModel.cpp @@ -4,8 +4,10 @@ #include #include +#include #include #include +#include namespace OCC { @@ -281,6 +283,21 @@ Q_INVOKABLE void UserModel::logout(const int &id) Q_INVOKABLE void UserModel::removeAccount(const int &id) { + QMessageBox messageBox(QMessageBox::Question, + tr("Confirm Account Removal"), + tr("

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

" + "

Note: This will not delete any files.

") + .arg(_users[id].name()), + QMessageBox::NoButton); + QPushButton *yesButton = + messageBox.addButton(tr("Remove connection"), QMessageBox::YesRole); + messageBox.addButton(tr("Cancel"), QMessageBox::NoRole); + + messageBox.exec(); + if (messageBox.clickedButton() != yesButton) { + return; + } + _users[id].logout(); _users[id].removeAccount(); if (_users.count() > 1) {