Changeset View
Changeset View
Standalone View
Standalone View
src/accountinfo.cpp
Show All 32 Lines | |||||
33 | #include <QFontDatabase> | 33 | #include <QFontDatabase> | ||
34 | #include <QFileDialog> | 34 | #include <QFileDialog> | ||
35 | 35 | | |||
36 | #include "user_manager_debug.h" | 36 | #include "user_manager_debug.h" | ||
37 | #include <KJob> | 37 | #include <KJob> | ||
38 | #include <KIO/CopyJob> | 38 | #include <KIO/CopyJob> | ||
39 | #include <KUser> | 39 | #include <KUser> | ||
40 | #include <KI18n/klocalizedstring.h> | 40 | #include <KI18n/klocalizedstring.h> | ||
41 | #include <KMessageBox> | ||||
41 | 42 | | |||
42 | AccountInfo::AccountInfo(AccountModel* model, QWidget* parent, Qt::WindowFlags f) | 43 | AccountInfo::AccountInfo(AccountModel* model, QWidget* parent, Qt::WindowFlags f) | ||
43 | : QWidget(parent, f) | 44 | : QWidget(parent, f) | ||
44 | , m_info(new Ui::AccountInfo()) | 45 | , m_info(new Ui::AccountInfo()) | ||
45 | , m_model(model) | 46 | , m_model(model) | ||
46 | { | 47 | { | ||
47 | m_info->setupUi(this); | 48 | m_info->setupUi(this); | ||
48 | 49 | | |||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | |||||
98 | } | 99 | } | ||
99 | 100 | | |||
100 | void AccountInfo::setModelIndex(const QModelIndex& index) | 101 | void AccountInfo::setModelIndex(const QModelIndex& index) | ||
101 | { | 102 | { | ||
102 | if (!index.isValid() || m_index == index) { | 103 | if (!index.isValid() || m_index == index) { | ||
103 | return; | 104 | return; | ||
104 | } | 105 | } | ||
105 | 106 | | |||
107 | if (!m_infoToSave.isEmpty()) { | ||||
108 | const QString message = i18n("Save changes to this user?"); | ||||
ngrahamUnsubmitted Done
ngraham: 1. Needs more whitespace around things
2. Change string to "Save changes to this user?"
3. | |||||
meven: 1. done
2. done
3. no idea was from copy/paste | |||||
109 | bool wantToSave = KMessageBox::questionYesNo(this, | ||||
110 | message, | ||||
111 | QString(), | ||||
112 | KStandardGuiItem::save(), | ||||
113 | KStandardGuiItem::discard()) == KMessageBox::Yes; | ||||
114 | if (wantToSave) { | ||||
115 | save(); | ||||
116 | } | ||||
117 | } | ||||
118 | | ||||
106 | m_index = index; | 119 | m_index = index; | ||
107 | m_infoToSave.clear(); | 120 | m_infoToSave.clear(); | ||
108 | loadFromModel(); | 121 | loadFromModel(); | ||
109 | } | 122 | } | ||
110 | 123 | | |||
111 | QModelIndex AccountInfo::modelIndex() const | 124 | QModelIndex AccountInfo::modelIndex() const | ||
112 | { | 125 | { | ||
113 | return m_index; | 126 | return m_index; | ||
▲ Show 20 Lines • Show All 363 Lines • Show Last 20 Lines |