Codebase list kwallet-kf5 / ec2df56
Add upstream_Stop-showing-the-migration-wizard-by-default.patch to disable the migration wizard dialog. Migration is in fact a non-destructive import, so it can savely be run without any user input. This prevents contextless kwallet dialogs on first login as well as first kwallet5 enabled logins (prequisite for pam unlocking experience) Harald Sitter 8 years ago
3 changed file(s) with 163 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 kwallet-kf5 (5.13.0-0ubuntu2) wily; urgency=medium
1
2 * Add upstream_Stop-showing-the-migration-wizard-by-default.patch to disable
3 the migration wizard dialog. Migration is in fact a non-destructive
4 import, so it can savely be run without any user input. This prevents
5 contextless kwallet dialogs on first login as well as first kwallet5
6 enabled logins (prequisite for pam unlocking experience)
7
8 -- Harald Sitter <sitter@kde.org> Mon, 24 Aug 2015 13:00:08 +0200
9
010 kwallet-kf5 (5.13.0-0ubuntu1) wily; urgency=medium
111
212 * new upstream release
0 upstream_Stop-showing-the-migration-wizard-by-default.patch
0 From 127efedd1668b546d0ac8c83655a2056d0439f29 Mon Sep 17 00:00:00 2001
1 From: Valentin Rusu <kde@rusu.info>
2 Date: Fri, 7 Aug 2015 18:59:04 +0200
3 Subject: [PATCH] Stop showing the migration wizard by default
4
5 BUG:351056
6
7 If the migration wizard is needed, then add this to kwalletrc
8 [Migration]
9 showMigrationWizard=true
10
11 On systems having kwallet-pam the migration agent would also merge all the old
12 wallets into the default LocalWallet, as a side effect. This would avoid
13 wallet creation prompts, though.
14 ---
15 src/runtime/kwalletd/main.cpp | 2 +-
16 src/runtime/kwalletd/migrationagent.cpp | 42 ++++++++++++++++++++++++++------
17 src/runtime/kwalletd/migrationagent.h | 5 ++--
18 src/runtime/kwalletd/migrationwizard.cpp | 2 +-
19 4 files changed, 39 insertions(+), 12 deletions(-)
20
21 diff --git a/src/runtime/kwalletd/main.cpp b/src/runtime/kwalletd/main.cpp
22 index c0fecaa..62fcd3a 100644
23 --- a/src/runtime/kwalletd/main.cpp
24 +++ b/src/runtime/kwalletd/main.cpp
25 @@ -186,7 +186,7 @@ int main(int argc, char **argv)
26 aboutdata.addAuthor(i18n("Thiago Maceira"), i18n("D-Bus Interface"), "thiago@kde.org");
27
28 KWalletD walletd;
29 - MigrationAgent migrationAgent(&walletd);
30 + MigrationAgent migrationAgent(&walletd, hash);
31 KDBusService dbusUniqueInstance(KDBusService::Unique | KDBusService::NoExitOnFailure);
32
33 // NOTE: the command should be parsed only after KDBusService instantiation
34 diff --git a/src/runtime/kwalletd/migrationagent.cpp b/src/runtime/kwalletd/migrationagent.cpp
35 index 6eaeb12..192a871 100644
36 --- a/src/runtime/kwalletd/migrationagent.cpp
37 +++ b/src/runtime/kwalletd/migrationagent.cpp
38 @@ -34,10 +34,12 @@
39
40 #define SERVICE_KWALLETD4 "org.kde.kwalletd"
41 #define ENTRY_ALREADY_MIGRATED "alreadyMigrated"
42 +#define ENTRY_SHOW_MIGRATION_WIZARD "showMigrationWizard"
43
44 -MigrationAgent::MigrationAgent(KWalletD* kd) :
45 +MigrationAgent::MigrationAgent(KWalletD* kd, const char *hash) :
46 _kf5_daemon(kd)
47 , _kde4_daemon(0)
48 + , _pam_hash(hash)
49 {
50 QTimer::singleShot(100, this, SLOT(migrateWallets()));
51 }
52 @@ -118,11 +120,27 @@ bool MigrationAgent::isMigrationWizardOk()
53 {
54 bool ok = false;
55
56 - MigrationWizard *wizard = new MigrationWizard(this);
57 - int result = wizard->exec();
58 - if (QDialog::Accepted == result) {
59 - // the user either migrated the wallets, or choose not to be prompted again
60 - ok = true;
61 + // The migration wizard would no longer been shown by default.
62 + // see BUG 351056
63 + // NOTE if user wants to show the migration wizard, then he should add the
64 + // following setting to the kwalletrc:
65 + // [Migration]
66 + // showMigrationWizard=true
67 + KConfig kwalletrc("kwalletrc");
68 + KConfigGroup cfg(&kwalletrc, "Migration");
69 + bool showMigrationWizard = cfg.readEntry<bool>(ENTRY_SHOW_MIGRATION_WIZARD, false);
70 +
71 + if (showMigrationWizard) {
72 + MigrationWizard *wizard = new MigrationWizard(this);
73 + int result = wizard->exec();
74 + if (QDialog::Accepted == result) {
75 + // the user either migrated the wallets, or choose not to be prompted again
76 + ok = true;
77 + }
78 + } else {
79 + if (performMigration(0, true)) {
80 + qDebug() << "Migration failed.";
81 + }
82 }
83
84 return ok;
85 @@ -162,7 +180,7 @@ bool MigrationAgent::isEmptyOldWallet() const {
86 return wallets.length() == 0;
87 }
88
89 -bool MigrationAgent::performMigration(WId wid)
90 +bool MigrationAgent::performMigration(WId wid, bool withoutWizard)
91 {
92 auto appId = i18n("KDE Wallet Migration Agent");
93 try {
94 @@ -174,7 +192,15 @@ bool MigrationAgent::performMigration(WId wid)
95 emit progressMessage(i18n("Migrating wallet: %1", wallet));
96 emit progressMessage(i18n("* Creating KF5 wallet: %1", wallet));
97
98 - int handle5 = _kf5_daemon->internalOpen(appId, wallet, false, 0, true, QString());
99 + int handle5 = -1;
100 + if (withoutWizard && (_pam_hash != nullptr)) {
101 + // see BUG 351056 for why this hacky code
102 + // If the user has several wallets, all the values will be
103 + // merged into the single LocalWallet
104 + handle5 = _kf5_daemon->pamOpen(KWallet::Wallet::LocalWallet(), _pam_hash, 0);
105 + } else {
106 + handle5 = _kf5_daemon->internalOpen(appId, wallet, false, 0, true, QString());
107 + }
108 if (handle5 <0) {
109 emit progressMessage(i18n("ERROR when attempting new wallet creation. Aborting."));
110 return false;
111 diff --git a/src/runtime/kwalletd/migrationagent.h b/src/runtime/kwalletd/migrationagent.h
112 index 55a251d..c52509e 100644
113 --- a/src/runtime/kwalletd/migrationagent.h
114 +++ b/src/runtime/kwalletd/migrationagent.h
115 @@ -32,10 +32,10 @@ class KWalletD;
116 class MigrationAgent : public QObject {
117 Q_OBJECT
118 public:
119 - MigrationAgent(KWalletD* kd);
120 + MigrationAgent(KWalletD* kd, const char* hash);
121
122 bool isEmptyOldWallet() const;
123 - bool performMigration(WId wid);
124 + bool performMigration(WId wid, bool withoutWizard);
125
126 private Q_SLOTS:
127 void migrateWallets();
128 @@ -52,6 +52,7 @@ Q_SIGNALS:
129 private:
130 KWalletD *_kf5_daemon;
131 org::kde::KWallet *_kde4_daemon;
132 + const char *_pam_hash;
133 };
134
135 #endif // _MIGRATIONAGENT_H_
136 diff --git a/src/runtime/kwalletd/migrationwizard.cpp b/src/runtime/kwalletd/migrationwizard.cpp
137 index b7d3f70..cdd2a92 100644
138 --- a/src/runtime/kwalletd/migrationwizard.cpp
139 +++ b/src/runtime/kwalletd/migrationwizard.cpp
140 @@ -58,7 +58,7 @@ public:
141
142 virtual void initializePage() {
143 connect(_agent, SIGNAL(progressMessage(QString)), _ui._report, SLOT(append(QString)));
144 - _migrationCompleted = _agent->performMigration(winId());
145 + _migrationCompleted = _agent->performMigration(winId(), false);
146 emit completeChanged();
147 }
148
149 --
150 2.1.4
151