From e9d8932d04a7882471f722800b7b4603074d560d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Sun, 31 May 2015 07:03:31 +0200 Subject: [PATCH 5/5] Replace kwalletd4 after migration has finished MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit kwalletd5 can service both org.kde.kwalletd5 and org.kde.kwalletd Signed-off-by: Stefan BrĂ¼ns --- src/runtime/kwalletd/kwalletd.cpp | 13 +++++++++++++ src/runtime/kwalletd/kwalletd.h | 1 + src/runtime/kwalletd/migrationagent.cpp | 1 + 3 files changed, 15 insertions(+) diff --git a/src/runtime/kwalletd/kwalletd.cpp b/src/runtime/kwalletd/kwalletd.cpp index 18ef9fa..da851da 100644 --- a/src/runtime/kwalletd/kwalletd.cpp +++ b/src/runtime/kwalletd/kwalletd.cpp @@ -151,6 +151,19 @@ KWalletD::KWalletD() SLOT(slotServiceOwnerChanged(QString, QString, QString))); } +void KWalletD::registerKWalletd4Service() +{ + auto bus = QDBusConnection::sessionBus().interface(); + auto reply = bus->registerService(QLatin1String("org.kde.kwalletd"), QDBusConnectionInterface::QueueService); + if (reply.isValid() && (reply.value() == QDBusConnectionInterface::ServiceQueued)) { + QDBusInterface _kde_kwalletd4("org.kde.kwalletd", "/MainApplication", "org.kde.KApplication"); + if (_kde_kwalletd4.isValid()) { + auto qreply = _kde_kwalletd4.call("quit"); + } + } + QDBusConnection::sessionBus().registerObject(QLatin1String("/modules/kwalletd"), this); +} + KWalletD::~KWalletD() { #ifdef Q_WS_X11 diff --git a/src/runtime/kwalletd/kwalletd.h b/src/runtime/kwalletd/kwalletd.h index 3571535..a862faf 100644 --- a/src/runtime/kwalletd/kwalletd.h +++ b/src/runtime/kwalletd/kwalletd.h @@ -182,6 +182,7 @@ private Q_SLOTS: void notifyFailures(); void processTransactions(); void activatePasswordDialog(); + void registerKWalletd4Service(); #ifdef Q_WS_X11 void connectToScreenSaver(); #endif diff --git a/src/runtime/kwalletd/migrationagent.cpp b/src/runtime/kwalletd/migrationagent.cpp index 6eb6013..639ee8d 100644 --- a/src/runtime/kwalletd/migrationagent.cpp +++ b/src/runtime/kwalletd/migrationagent.cpp @@ -41,6 +41,7 @@ MigrationAgent::MigrationAgent(KWalletD* kd, const char *hash) : , _kde4_daemon(nullptr) , _pam_hash(hash) { + connect(this, &MigrationAgent::migrationFinished, _kf5_daemon, &KWalletD::registerKWalletd4Service); if (isAlreadyMigrated()) { qDebug() << "old wallets were already migrated"; emit migrationFinished(); -- 2.12.0