From kde-commits Fri Jul 31 21:17:18 2015 From: Jonathan Riddell Date: Fri, 31 Jul 2015 21:17:18 +0000 To: kde-commits Subject: [user-manager] src: Save settings with m_kEmailSettings as well to replace kcm_useraccounts Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=143837745411771 Git commit f4a899d5e18b2974444f13b6b0dbd33a8d46c211 by Jonathan Riddell. Committed on 31/07/2015 at 21:16. Pushed by jriddell into branch 'master'. Save settings with m_kEmailSettings as well to replace kcm_useraccounts add symlink in ~/.face.icon the file used by some login managers save settings with kemailsettings this allows us to stop shipping kcm_useraccounts which saved using this class to a file in ~/.config/emaildefaults also make an avatar link in ~/.face.icon which is used by some display mana= gers BUG: 342631 REVIEW: 124571 M +5 -0 src/accountinfo.cpp M +5 -0 src/lib/accountmodel.cpp M +2 -0 src/lib/accountmodel.h http://commits.kde.org/user-manager/f4a899d5e18b2974444f13b6b0dbd33a8d46c211 diff --git a/src/accountinfo.cpp b/src/accountinfo.cpp index 78fe969..878f683 100644 --- a/src/accountinfo.cpp +++ b/src/accountinfo.cpp @@ -179,6 +179,11 @@ bool AccountInfo::save() connect(moveJob, SIGNAL(finished(KJob*)), SLOT(avatarModelChanged(= KJob*))); moveJob->setUiDelegate(0); moveJob->start(); + + QString faceFile2 =3D QDesktopServices::storageLocation(QDesktopSe= rvices::HomeLocation); + faceFile2.append(QLatin1String("/.face.icon")); + QFile::remove(faceFile2); + QFile::link(faceFile, faceFile2); } = if (!failed.isEmpty()) { diff --git a/src/lib/accountmodel.cpp b/src/lib/accountmodel.cpp index 558aa6b..267dfa8 100644 --- a/src/lib/accountmodel.cpp +++ b/src/lib/accountmodel.cpp @@ -55,6 +55,9 @@ AccountModel::AccountModel(QObject* parent) //Adding fake "new user" directly into cache addAccountToCache("new-user", 0); = + m_kEmailSettings =3D new KEMailSettings(); + m_kEmailSettings->setProfile(m_kEmailSettings->defaultProfileName()); + connect(m_dbus, SIGNAL(UserAdded(QDBusObjectPath)), SLOT(UserAdded(QDB= usObjectPath))); connect(m_dbus, SIGNAL(UserDeleted(QDBusObjectPath)), SLOT(UserDeleted= (QDBusObjectPath))); = @@ -158,6 +161,7 @@ bool AccountModel::setData(const QModelIndex& index, co= nst QVariant& value, int if (checkForErrors(acc->SetRealName(value.toString()))) { return false; } + m_kEmailSettings->setSetting(KEMailSettings::RealName, value.t= oString()); = m_dbus->UncacheUser(acc->userName()).waitForFinished(); m_dbus->CacheUser(acc->userName()); @@ -181,6 +185,7 @@ bool AccountModel::setData(const QModelIndex& index, co= nst QVariant& value, int if (checkForErrors(acc->SetEmail(value.toString()))) { return false; } + m_kEmailSettings->setSetting(KEMailSettings::EmailAddress, val= ue.toString()); = emit dataChanged(index, index); return true; diff --git a/src/lib/accountmodel.h b/src/lib/accountmodel.h index 331c131..6b7c499 100644 --- a/src/lib/accountmodel.h +++ b/src/lib/accountmodel.h @@ -25,6 +25,7 @@ #include #include #include +#include = class UserSession; class OrgFreedesktopAccountsInterface; @@ -78,6 +79,7 @@ class AccountModel : public QAbstractListModel QHash m_newUserData; QHash m_users; QHash m_loggedAccounts; + KEMailSettings* m_kEmailSettings; }; = QDebug operator<<(QDebug debug, AccountModel::Role role);