From bc9bb279ecc34744270a7674e33bdbd50aab9fa3 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Thu, 22 Aug 2013 10:58:46 +0200 Subject: [PATCH] Use network wallet rather than hardcoded "kdewallet" wallet Fixes #9 --- keychain_dbus.cpp | 13 +++++++++++-- keychain_p.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/keychain_dbus.cpp b/keychain_dbus.cpp index 4b39348..15e0ee1 100644 --- a/keychain_dbus.cpp +++ b/keychain_dbus.cpp @@ -170,9 +170,9 @@ void ReadPasswordJobPrivate::scheduledStart() { if ( QDBusConnection::sessionBus().isConnected() ) { iface = new org::kde::KWallet( QLatin1String("org.kde.kwalletd"), QLatin1String("/modules/kwalletd"), QDBusConnection::sessionBus(), this ); - const QDBusPendingReply reply = iface->open( QLatin1String("kdewallet"), 0, q->service() ); + const QDBusPendingReply reply = iface->networkWallet(); QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher( reply, this ); - connect( watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(kwalletOpenFinished(QDBusPendingCallWatcher*)) ); + connect( watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(kwalletWalletFound(QDBusPendingCallWatcher*)) ); } else { @@ -184,6 +184,15 @@ void ReadPasswordJobPrivate::scheduledStart() { } } +void ReadPasswordJobPrivate::kwalletWalletFound(QDBusPendingCallWatcher *watcher) +{ + watcher->deleteLater(); + const QDBusPendingReply reply = *watcher; + const QDBusPendingReply pendingReply = iface->open( reply.value(), 0, q->service() ); + QDBusPendingCallWatcher* pendingWatcher = new QDBusPendingCallWatcher( pendingReply, this ); + connect( pendingWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(kwalletOpenFinished(QDBusPendingCallWatcher*)) ); +} + static QPair mapGnomeKeyringError( int result ) { Q_ASSERT( result != GnomeKeyring::RESULT_OK ); diff --git a/keychain_p.h b/keychain_p.h index 4facbc6..31fad8a 100644 --- a/keychain_p.h +++ b/keychain_p.h @@ -74,6 +74,7 @@ public: const QString typeKey(); const QString dataKey(); private Q_SLOTS: + void kwalletWalletFound( QDBusPendingCallWatcher* watcher ); void kwalletOpenFinished( QDBusPendingCallWatcher* watcher ); void kwalletEntryTypeFinished( QDBusPendingCallWatcher* watcher ); void kwalletReadFinished( QDBusPendingCallWatcher* watcher );