[Pkg-owncloud-commits] [qtkeychain] 06/17: add kwallet5 support

Sandro Knauß hefee-guest at moszumanska.debian.org
Mon Jun 1 18:02:01 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository qtkeychain.

commit ca08e8861281c34e2320f50518b9d1388653efcc
Author: Karol Herbst <git at karolherbst.de>
Date:   Sat Feb 21 21:31:20 2015 +0100

    add kwallet5 support
---
 keychain_unix.cpp | 62 ++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 36 insertions(+), 26 deletions(-)

diff --git a/keychain_unix.cpp b/keychain_unix.cpp
index 42baa77..be2d275 100644
--- a/keychain_unix.cpp
+++ b/keychain_unix.cpp
@@ -115,6 +115,22 @@ static KeyringBackend getKeyringBackend()
     return backend;
 }
 
+static void kwalletReadPasswordScheduledStartImpl(const char * service, const char * path, ReadPasswordJobPrivate * priv) {
+    if ( QDBusConnection::sessionBus().isConnected() )
+    {
+        priv->iface = new org::kde::KWallet( QLatin1String(service), QLatin1String(path), QDBusConnection::sessionBus(), priv );
+        const QDBusPendingReply<QString> reply = priv->iface->networkWallet();
+        QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher( reply, priv );
+        priv->connect( watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), priv, SLOT(kwalletWalletFound(QDBusPendingCallWatcher*)) );
+    }
+    else
+    {
+    // D-Bus is not reachable so none can tell us something about KWalletd
+        QDBusError err( QDBusError::NoServer, priv->tr("D-Bus is not running") );
+        priv->fallbackOnError( err );
+    }
+}
+
 void ReadPasswordJobPrivate::scheduledStart() {
     switch ( getKeyringBackend() ) {
     case Backend_GnomeKeyring:
@@ -125,21 +141,10 @@ void ReadPasswordJobPrivate::scheduledStart() {
         break;
 
     case Backend_Kwallet4:
-        if ( QDBusConnection::sessionBus().isConnected() )
-        {
-            iface = new org::kde::KWallet( QLatin1String("org.kde.kwalletd"), QLatin1String("/modules/kwalletd"), QDBusConnection::sessionBus(), this );
-            const QDBusPendingReply<QString> reply = iface->networkWallet();
-            QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher( reply, this );
-            connect( watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(kwalletWalletFound(QDBusPendingCallWatcher*)) );
-        }
-        else
-        {
-        // D-Bus is not reachable so none can tell us something about KWalletd
-            QDBusError err( QDBusError::NoServer, tr("D-Bus is not running") );
-            fallbackOnError( err );
-        }
+        kwalletReadPasswordScheduledStartImpl("org.kde.kwalletd", "/modules/kwalletd", this);
         break;
     case Backend_Kwallet5:
+        kwalletReadPasswordScheduledStartImpl("org.kde.kwalletd5", "/modules/kwalletd5", this);
         break;
     }
 }
@@ -333,6 +338,22 @@ void ReadPasswordJobPrivate::kwalletReadFinished( QDBusPendingCallWatcher* watch
     q->emitFinished();
 }
 
+static void kwalletWritePasswordScheduledStart( const char * service, const char * path, WritePasswordJobPrivate * priv ) {
+    if ( QDBusConnection::sessionBus().isConnected() )
+    {
+        priv->iface = new org::kde::KWallet( QLatin1String(service), QLatin1String(path), QDBusConnection::sessionBus(), priv );
+        const QDBusPendingReply<QString> reply = priv->iface->networkWallet();
+        QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher( reply, priv );
+        priv->connect( watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), priv, SLOT(kwalletWalletFound(QDBusPendingCallWatcher*)) );
+    }
+    else
+    {
+        // D-Bus is not reachable so none can tell us something about KWalletd
+        QDBusError err( QDBusError::NoServer, priv->tr("D-Bus is not running") );
+        priv->fallbackOnError( err );
+    }
+}
+
 void WritePasswordJobPrivate::scheduledStart() {
     switch ( getKeyringBackend() ) {
     case Backend_GnomeKeyring:
@@ -353,21 +374,10 @@ void WritePasswordJobPrivate::scheduledStart() {
         break;
 
     case Backend_Kwallet4:
-        if ( QDBusConnection::sessionBus().isConnected() )
-        {
-            iface = new org::kde::KWallet( QLatin1String("org.kde.kwalletd"), QLatin1String("/modules/kwalletd"), QDBusConnection::sessionBus(), this );
-            const QDBusPendingReply<QString> reply = iface->networkWallet();
-            QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher( reply, this );
-            connect( watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(kwalletWalletFound(QDBusPendingCallWatcher*)) );
-        }
-        else
-        {
-            // D-Bus is not reachable so none can tell us something about KWalletd
-            QDBusError err( QDBusError::NoServer, tr("D-Bus is not running") );
-            fallbackOnError( err );
-        }
+        kwalletWritePasswordScheduledStart("org.kde.kwalletd", "/modules/kwalletd", this);
         break;
     case Backend_Kwallet5:
+        kwalletWritePasswordScheduledStart("org.kde.kwalletd5", "/modules/kwalletd5", this);
         break;
     }
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/qtkeychain.git



More information about the Pkg-owncloud-commits mailing list