Blob Blame History Raw
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 00de0f92b56599c68bdb2be54d0f01b04b0dda6c..ea0aa0942d3bb88a8d7334cc198149f13b810be0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
 project(KDEBASE_APPS)
 
 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules )
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH} )
 
 include(CTest)
 include(CTestConfig.cmake)
@@ -55,4 +55,4 @@ macro_optional_add_subdirectory( doc )
 
 if(CMAKE_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
     macro_display_feature_log()
-endif(CMAKE_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+endif(CMAKE_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
\ No newline at end of file
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..a607a2acf051d54687916112676a3e7b824e3c96
--- /dev/null
+++ b/cmake/CMakeLists.txt
@@ -0,0 +1,2 @@
+
+add_subdirectory(modules)
\ No newline at end of file
diff --git a/cmake/modules/PkgConfigGetVar.cmake b/cmake/modules/PkgConfigGetVar.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..a024fdcbfbac46b91687654de0be65e503dea6df
--- /dev/null
+++ b/cmake/modules/PkgConfigGetVar.cmake
@@ -0,0 +1,20 @@
+include(UsePkgConfig)
+
+MACRO(PKGCONFIG_GETVAR _package _var _output_variable)
+  SET(${_output_variable})
+
+  # if pkg-config has been found
+  IF(PKGCONFIG_EXECUTABLE)
+
+    EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --exists RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull )
+
+    # and if the package of interest also exists for pkg-config, then get the information
+    IF(NOT _return_VALUE)
+
+      EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable ${_var} OUTPUT_VARIABLE ${_output_variable} )
+
+    ENDIF(NOT _return_VALUE)
+
+  ENDIF(PKGCONFIG_EXECUTABLE)
+
+ENDMACRO(PKGCONFIG_GETVAR _package _var _output_variable)
\ No newline at end of file
diff --git a/kdepasswd/kcm/CMakeLists.txt b/kdepasswd/kcm/CMakeLists.txt
index b0600aae0aa8ee33d698cc63a4d3270bf24619e1..8da3b14745ef691c3016a992827d696813e6ce65 100644
--- a/kdepasswd/kcm/CMakeLists.txt
+++ b/kdepasswd/kcm/CMakeLists.txt
@@ -5,6 +5,13 @@ set(kcm_useraccount_PART_SRCS
     main.cpp
     chfacedlg.cpp)
 
+include(PkgConfigGetVar)
+PKGCONFIG_GETVAR(dbus-1 interfaces_dir DBUS_INTERFACES)
+set(accountsservice_xml ${DBUS_INTERFACES}/org.freedesktop.Accounts.xml
+	${DBUS_INTERFACES}/org.freedesktop.Accounts.User.xml)
+set_source_files_properties(${accountsservice_xml} PROPERTIES NO_NAMESPACE TRUE)
+qt4_add_dbus_interfaces(kcm_useraccount_PART_SRCS ${accountsservice_xml})
+
 kde4_add_ui_files(kcm_useraccount_PART_SRCS
     main_widget.ui
     faceDlg.ui)
diff --git a/kdepasswd/kcm/main.cpp b/kdepasswd/kcm/main.cpp
index 5a5248e545cc75433024ae0464ac9f3e05b71900..e3290069f204ffae83fd7901479d38b3183d1b3c 100644
--- a/kdepasswd/kcm/main.cpp
+++ b/kdepasswd/kcm/main.cpp
@@ -47,10 +47,13 @@
 
 #include "settings.h"
 #include "pass.h"
+#include "accountsinterface.h"
+#include "userinterface.h"
 #include "chfnprocess.h"
 #include <KPluginFactory>
 #include <KPluginLoader>
 
+
 K_PLUGIN_FACTORY(Factory,
         registerPlugin<KCMUserAccount>();
         )
@@ -219,6 +222,26 @@ void KCMUserAccount::save()
 			KMessageBox::error( this, i18n("There was an error saving the image: %1" ,
 				KCFGUserAccount::faceFile()) );
 		}
+		// save icon file also with accountsservice
+		OrgFreedesktopAccountsInterface ainterface ("org.freedesktop.Accounts",
+			"/org/freedesktop/Accounts",
+			QDBusConnection::systemBus(),
+			this);
+		QDBusPendingReply<QDBusObjectPath> reply = ainterface.FindUserById(_ku->uid());
+		reply.waitForFinished();
+		if (reply.isValid() && reply.count() == 1) {
+			OrgFreedesktopAccountsUserInterface uinterface ("org.freedesktop.Accounts",
+				reply.argumentAt<0>().path(),
+				QDBusConnection::systemBus(),
+				this);
+			QDBusPendingReply<void> ureply = uinterface.SetIconFile(KCFGUserAccount::faceFile());
+			ureply.waitForFinished();
+			if (ureply.isError()) {
+				kDebug() << ureply.error().message();
+				KMessageBox::error( this, i18n("There was an error setting the image: %1" ,
+									KCFGUserAccount::faceFile()) );
+			}
+		}
 	}
 	else { // delete existing image
 		if ( !KIO::NetAccess::del(KCFGUserAccount::faceFile(), this) ) {