Changeset View
Changeset View
Standalone View
Standalone View
src/runtime/kwalletd/migrationagent.cpp
Show First 20 Lines • Show All 190 Lines • ▼ Show 20 Line(s) | |||||
191 | bool MigrationAgent::performMigration(WId wid, bool withoutWizard) | 191 | bool MigrationAgent::performMigration(WId wid, bool withoutWizard) | ||
192 | { | 192 | { | ||
193 | auto appId = i18n("KDE Wallet Migration Agent"); | 193 | auto appId = i18n("KDE Wallet Migration Agent"); | ||
194 | try { | 194 | try { | ||
195 | QStringList wallets = invokeAndCheck<QStringList>( | 195 | QStringList wallets = invokeAndCheck<QStringList>( | ||
196 | this, [this] { return _kde4_daemon->wallets(); }, | 196 | this, [this] { return _kde4_daemon->wallets(); }, | ||
197 | i18n("Cannot read old wallet list. Aborting.")); | 197 | i18n("Cannot read old wallet list. Aborting.")); | ||
198 | 198 | | |||
199 | foreach (const QString &wallet, wallets) { | 199 | for (const QString &wallet : qAsConst(wallets)) { | ||
200 | emit progressMessage(i18n("Migrating wallet: %1", wallet)); | 200 | emit progressMessage(i18n("Migrating wallet: %1", wallet)); | ||
201 | emit progressMessage(i18n("* Creating KF5 wallet: %1", wallet)); | 201 | emit progressMessage(i18n("* Creating KF5 wallet: %1", wallet)); | ||
202 | 202 | | |||
203 | int handle5 = -1; | 203 | int handle5 = -1; | ||
204 | if (withoutWizard && (_pam_hash != nullptr)) { | 204 | if (withoutWizard && (_pam_hash != nullptr)) { | ||
205 | // see BUG 351056 for why this hacky code | 205 | // see BUG 351056 for why this hacky code | ||
206 | // If the user has several wallets, all the values will be | 206 | // If the user has several wallets, all the values will be | ||
207 | // merged into the single LocalWallet | 207 | // merged into the single LocalWallet | ||
Show All 10 Lines | 217 | int handle4 = invokeAndCheck<int>( | |||
218 | this, [this, wallet, wid, appId] { return _kde4_daemon->open(wallet, wid, appId); }, | 218 | this, [this, wallet, wid, appId] { return _kde4_daemon->open(wallet, wid, appId); }, | ||
219 | i18n("Cannot open KDE4 wallet named: %1", wallet)); | 219 | i18n("Cannot open KDE4 wallet named: %1", wallet)); | ||
220 | emit progressMessage(i18n("* Opened KDE4 wallet: %1", wallet)); | 220 | emit progressMessage(i18n("* Opened KDE4 wallet: %1", wallet)); | ||
221 | 221 | | |||
222 | const QStringList folders = invokeAndCheck<QStringList>( | 222 | const QStringList folders = invokeAndCheck<QStringList>( | ||
223 | this, [this, handle4, appId] { return _kde4_daemon->folderList(handle4, appId); }, | 223 | this, [this, handle4, appId] { return _kde4_daemon->folderList(handle4, appId); }, | ||
224 | i18n("Cannot retrieve folder list. Aborting.")); | 224 | i18n("Cannot retrieve folder list. Aborting.")); | ||
225 | 225 | | |||
226 | foreach (const QString &folder, folders) { | 226 | for (const QString &folder : folders) { | ||
227 | emit progressMessage(i18n("* Migrating folder %1", folder)); | 227 | emit progressMessage(i18n("* Migrating folder %1", folder)); | ||
228 | 228 | | |||
229 | QStringList entries = invokeAndCheck<QStringList>( | 229 | const QStringList entries = invokeAndCheck<QStringList>( | ||
230 | this, [this, handle4, folder, appId] { return _kde4_daemon->entryList(handle4, folder, appId); }, | 230 | this, [this, handle4, folder, appId] { return _kde4_daemon->entryList(handle4, folder, appId); }, | ||
231 | i18n("Cannot retrieve folder %1 entries. Aborting.", folder)); | 231 | i18n("Cannot retrieve folder %1 entries. Aborting.", folder)); | ||
232 | 232 | | |||
233 | foreach (const QString &key, entries) { | 233 | for (const QString &key : entries) { | ||
234 | 234 | | |||
235 | int entryType = invokeAndCheck<int>( | 235 | int entryType = invokeAndCheck<int>( | ||
236 | this, [this, handle4, folder, key, appId] { return _kde4_daemon->entryType(handle4, folder, key, appId); }, | 236 | this, [this, handle4, folder, key, appId] { return _kde4_daemon->entryType(handle4, folder, key, appId); }, | ||
237 | i18n("Cannot retrieve key %1 info. Aborting.", key)); | 237 | i18n("Cannot retrieve key %1 info. Aborting.", key)); | ||
238 | 238 | | |||
239 | // handle the case where the entries are already there | 239 | // handle the case where the entries are already there | ||
240 | if (_kf5_daemon->hasEntry(handle5, folder, key, appId)) { | 240 | if (_kf5_daemon->hasEntry(handle5, folder, key, appId)) { | ||
241 | emit progressMessage(i18n("* SKIPPING entry %1 in folder %2 as it seems already migrated", key, folder)); | 241 | emit progressMessage(i18n("* SKIPPING entry %1 in folder %2 as it seems already migrated", key, folder)); | ||
Show All 24 Lines |