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

List:       kde-commits
Subject:    [plasma-workspace/accounts-service] /: ksmserver/screenlocker/greeter: Change to use UserAccount for
From:       Leslie Zhai <xiangzhai83 () gmail ! com>
Date:       2015-08-01 2:27:11
Message-ID: E1ZLMVz-0001N2-Jc () scm ! kde ! org
[Download RAW message or body]

Git commit 5a3c2ad6951caed5703dc631b52f2f84a09d4075 by Leslie Zhai.
Committed on 01/08/2015 at 02:26.
Pushed by lesliezhai into branch 'accounts-service'.

ksmserver/screenlocker/greeter: Change to use UserAccount for current
login user

M  +5    -0    CMakeLists.txt
M  +7    -8    ksmserver/screenlocker/greeter/greeterapp.cpp
M  +3    -0    ksmserver/screenlocker/greeter/greeterapp.h

http://commits.kde.org/plasma-workspace/5a3c2ad6951caed5703dc631b52f2f84a09d4075

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9fe2008..8c54cc9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,11 @@ find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS \
Widgets Quick Quic  find_package(ECM 1.8.0 REQUIRED NO_MODULE)
 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
 
+option(ENABLE_DEBUG "Enable debug" OFF)
+if(ENABLE_DEBUG)
+    add_definitions(-g -DDEBUG)
+endif()
+
 find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
                     Plasma DocTools Runner JsEmbed NotifyConfig Su NewStuff Wallet \
                KCMUtils
                     IdleTime Declarative TextWidgets KDELibs4Support Crash \
                GlobalAccel
diff --git a/ksmserver/screenlocker/greeter/greeterapp.cpp \
b/ksmserver/screenlocker/greeter/greeterapp.cpp index 4903b07..4131782 100644
--- a/ksmserver/screenlocker/greeter/greeterapp.cpp
+++ b/ksmserver/screenlocker/greeter/greeterapp.cpp
@@ -39,8 +39,6 @@ along with this program.  If not, see \
<http://www.gnu.org/licenses/>.  #include <KWayland/Client/connection_thread.h>
 #include <KWayland/Client/event_queue.h>
 #include <KWayland/Client/registry.h>
-// AccountsService
-#include <QtAccountsService/AccountsManager>
 // Qt
 #include <QtCore/QTimer>
 #include <QtGui/QKeyEvent>
@@ -84,6 +82,7 @@ UnlockApp::UnlockApp(int &argc, char **argv)
     connect(m_authenticator, &Authenticator::succeeded, this, \
&QCoreApplication::quit);  initialize();
     connect(this, &UnlockApp::screenAdded, this, &UnlockApp::desktopResized);
+    m_userAccount = new QtAccountsService::UserAccount;
 }
 
 UnlockApp::~UnlockApp()
@@ -101,6 +100,10 @@ UnlockApp::~UnlockApp()
         m_ksldConnectionThread->quit();
         m_ksldConnectionThread->wait();
     }
+    if (m_userAccount) {
+        delete m_userAccount;
+        m_userAccount = nullptr;
+    }
 }
 
 void UnlockApp::initialize()
@@ -194,13 +197,9 @@ void UnlockApp::desktopResized()
         QQmlContext* context = view->engine()->rootContext();
         const KUser user;
         const QString fullName = user.property(KUser::FullName).toString();
-        QtAccountsService::UserAccount* userAccount = new \
QtAccountsService::UserAccount;  QString faceIconPath = "";
-        if (userAccount) {
-            faceIconPath = userAccount->iconFileName();
-            delete userAccount;
-            userAccount = nullptr;
-        }
+        if (m_userAccount)
+            faceIconPath = m_userAccount->iconFileName();
 
         context->setContextProperty(QStringLiteral("kscreenlocker_userName"), \
                fullName.isEmpty() ? user.loginName() : fullName);
         context->setContextProperty(QStringLiteral("kscreenlocker_userImage"), \
                QFile::exists(faceIconPath) ? faceIconPath : user.faceIconPath());
diff --git a/ksmserver/screenlocker/greeter/greeterapp.h \
b/ksmserver/screenlocker/greeter/greeterapp.h index ed278e4..293e44b 100644
--- a/ksmserver/screenlocker/greeter/greeterapp.h
+++ b/ksmserver/screenlocker/greeter/greeterapp.h
@@ -25,6 +25,8 @@ along with this program.  If not, see \
<http://www.gnu.org/licenses/>.  #include <KPackage/PackageStructure>
 #include <QQuickView>
 
+#include <QtAccountsService/UserAccount>
+
 namespace KWayland {
 namespace Client {
     class ConnectionThread;
@@ -92,6 +94,7 @@ private:
     KWayland::Client::Registry *m_ksldRegistry = nullptr;
     QThread *m_ksldConnectionThread = nullptr;
     org_kde_ksld *m_ksldInterface = nullptr;
+    QtAccountsService::UserAccount *m_userAccount = nullptr;
 };
 } // namespace
 


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

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