Codebase list kwallet-kf5 / e70ea5a
add patch Jonathan Riddell 9 years ago
1 changed file(s) with 69 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 From: Valentin Rusu <kde@rusu.info>
1 Date: Thu, 23 Apr 2015 06:59:46 +0000
2 Subject: Migration agent now also check old wallet is empty before starting
3 X-Git-Url: http://quickgit.kde.org/?p=kwallet.git&a=commitdiff&h=abb22c194f3b5650f51dce97f2e7ad64c2c33861
4 ---
5 Migration agent now also check old wallet is empty before starting
6
7 BUG: 346498
8
9 Some distributions provide old kwalletd along with the new kwalletd5.
10 In this case, the old kwalletd do not have any data to migrate.
11 ---
12
13
14 Index: kwallet-kf5-5.9.0/src/runtime/kwalletd/migrationagent.cpp
15 ===================================================================
16 --- kwallet-kf5-5.9.0.orig/src/runtime/kwalletd/migrationagent.cpp
17 +++ kwallet-kf5-5.9.0/src/runtime/kwalletd/migrationagent.cpp
18 @@ -55,10 +55,15 @@ void MigrationAgent::migrateWallets()
19 qDebug() << "Migration agent starting...";
20 if (!isAlreadyMigrated()) {
21 if (connectOldDaemon()) {
22 - if (isMigrationWizardOk()) {
23 - setAlreadyMigrated();
24 + if (!isEmptyOldWallet()) {
25 + if (isMigrationWizardOk()) {
26 + setAlreadyMigrated();
27 + } else {
28 + qDebug() << "Migration wizard returned an error or has been canceled. The migration agent will resume upon next daemon start";
29 + }
30 } else {
31 - qDebug() << "Migration wizard returned an error or has been canceled. The migration agent will resume upon next daemon start";
32 + qDebug() << "Old wallet is empty. No need to migrate.";
33 + setAlreadyMigrated();
34 }
35 } else {
36 qDebug() << "KDE4 kwalletd not present, stopping migration agent";
37 @@ -145,6 +150,19 @@ template <typename R, typename F> R invo
38 }
39 return reply.value();
40 }
41 +
42 +bool MigrationAgent::isEmptyOldWallet() const {
43 + QStringList wallets;
44 + try {
45 + wallets = invokeAndCheck<QStringList>(
46 + [this] { return _kde4_daemon->wallets(); },
47 + i18n("Cannot read old wallet list. Aborting."));
48 + } catch (MigrationException ex) {
49 + return true;
50 + }
51 +
52 + return wallets.length() == 0;
53 +}
54
55 bool MigrationAgent::performMigration(WId wid)
56 {
57 Index: kwallet-kf5-5.9.0/src/runtime/kwalletd/migrationagent.h
58 ===================================================================
59 --- kwallet-kf5-5.9.0.orig/src/runtime/kwalletd/migrationagent.h
60 +++ kwallet-kf5-5.9.0/src/runtime/kwalletd/migrationagent.h
61 @@ -34,6 +34,7 @@ class MigrationAgent : public QObject {
62 public:
63 MigrationAgent(KWalletD* kd);
64
65 + bool isEmptyOldWallet() const;
66 bool performMigration(WId wid);
67
68 private Q_SLOTS: