Commit 89ecae72 authored by Méven Car's avatar Méven Car

Warn user when changing selected user about potential data loss

Summary: CCBUG: 411736

Reviewers: ngraham, #plasma

Reviewed By: ngraham

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26844
parent 0f161b03
......@@ -38,6 +38,7 @@
#include <KIO/CopyJob>
#include <KUser>
#include <KI18n/klocalizedstring.h>
#include <KMessageBox>
AccountInfo::AccountInfo(AccountModel* model, QWidget* parent, Qt::WindowFlags f)
: QWidget(parent, f)
......@@ -103,6 +104,18 @@ void AccountInfo::setModelIndex(const QModelIndex& index)
return;
}
if (!m_infoToSave.isEmpty()) {
const QString message = i18n("Save changes to this user?");
bool wantToSave = KMessageBox::questionYesNo(this,
message,
QString(),
KStandardGuiItem::save(),
KStandardGuiItem::discard()) == KMessageBox::Yes;
if (wantToSave) {
save();
}
}
m_index = index;
m_infoToSave.clear();
loadFromModel();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment