[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [user-manager] src: Save settings with m_kEmailSettings as well to replace kcm_useraccounts
From:       Jonathan Riddell <jr () jriddell ! org>
Date:       2015-07-31 21:17:18
Message-ID: E1ZLHg6-0005WP-1p () scm ! kde ! org
[Download RAW message or body]

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 managers

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 = QDesktopServices::storageLocation(QDesktopServices::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 = new KEMailSettings();
+    m_kEmailSettings->setProfile(m_kEmailSettings->defaultProfileName());
+
     connect(m_dbus, SIGNAL(UserAdded(QDBusObjectPath)), SLOT(UserAdded(QDBusObjectPath)));
     connect(m_dbus, SIGNAL(UserDeleted(QDBusObjectPath)), SLOT(UserDeleted(QDBusObjectPath)));
 
@@ -158,6 +161,7 @@ bool AccountModel::setData(const QModelIndex& index, const QVariant& value, int
             if (checkForErrors(acc->SetRealName(value.toString()))) {
                 return false;
             }
+            m_kEmailSettings->setSetting(KEMailSettings::RealName, value.toString());
 
             m_dbus->UncacheUser(acc->userName()).waitForFinished();
             m_dbus->CacheUser(acc->userName());
@@ -181,6 +185,7 @@ bool AccountModel::setData(const QModelIndex& index, const QVariant& value, int
             if (checkForErrors(acc->SetEmail(value.toString()))) {
                 return false;
             }
+            m_kEmailSettings->setSetting(KEMailSettings::EmailAddress, value.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 <QtCore/QAbstractListModel>
 #include <QDBusObjectPath>
 #include <QDBusPendingReply>
+#include <KEMailSettings>
 
 class UserSession;
 class OrgFreedesktopAccountsInterface;
@@ -78,6 +79,7 @@ class AccountModel : public QAbstractListModel
         QHash<AccountModel::Role, QVariant> m_newUserData;
         QHash<QString, OrgFreedesktopAccountsUserInterface*> m_users;
         QHash<QString, bool> m_loggedAccounts;
+        KEMailSettings* m_kEmailSettings;
 };
 
 QDebug operator<<(QDebug debug, AccountModel::Role role);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic