Migrator: implement Google Resource migrator
ClosedPublic

Authored by dvratil on Apr 18 2020, 7:09 PM.

Details

Summary

Implement a migrator that migrates the user from the legacy Google Calendar
and Google Contacts resources to the new unified Google Groupware Resource.

Diff Detail

Repository
R44 KDE PIM Runtime
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dvratil created this revision.Apr 18 2020, 7:09 PM
Restricted Application added a project: KDE PIM. · View Herald TranscriptApr 18 2020, 7:09 PM
Restricted Application added a subscriber: kde-pim. · View Herald Transcript
dvratil requested review of this revision.Apr 18 2020, 7:09 PM

+1. Can't comment on the Google-specifics in there, but the general approach looks good to me, and should in a similar fashion also work for Kolab :)

poboiko requested changes to this revision.Apr 19 2020, 10:12 AM

I've tested it a bit too, on couple of Google accounts.
Apart from couple nitpicks, I think it's good to go.

migration/googlegroupware/CMakeLists.txt
28

Is it really needed? It seems like the code is using just the DBus interface

migration/googlegroupware/googleresourcemigrator.cpp
33

Duplicated include

79

What would happen here if only one of the resources was present (e.g. only contacts)? Could instance be invalid here?

203

Although this should not happen, it will probably remove tokens from Wallet (as the result of cleanup procedure for legacy instances). As they store tokens in the same place, it will affect the new instance too.
If so, we would like to have backupKWalletData / restoreKWalletData here too.

283

Interval checking options could in principle also come from contacts resource. We can probably merge somewhat it like that:

const auto contactSettings = settingsForResource(oldInstances.contactResource);
[...]
resourceSettings.setEnableIntervalCheck(calendarSettings->value(QStringLiteral("EnableIntervalCheck"), false) || contactSettings->value(QStringLiteral("EnableIntervalCheck"), false));
resourceSettings.setIntervalCheckTime(qMin(calendarSettings->value(QStringLiteral("IntervalCheckTime"), 60).toInt(), contactSettings->value(QStringLiteral("IntervalCheckTime"), 60).toInt()));
This revision now requires changes to proceed.Apr 19 2020, 10:12 AM
dvratil planned changes to this revision.Apr 20 2020, 10:41 AM
dvratil marked 5 inline comments as done.
dvratil added inline comments.
migration/googlegroupware/googleresourcemigrator.cpp
79

Well spotted, it would have worked if only calendar were configured, but not if only contacts were configured.

dvratil updated this revision to Diff 80632.Apr 20 2020, 10:41 AM
dvratil marked an inline comment as done.
  • Remove unused LibKGAPI dependency
  • Make sure we always backup KWallet data before removing instances
  • Fix race condition between the resource wiping the KWallet data and the migrator restoring them
  • Merge enableIntervalCheck and intervalCheckTime configurations from both resources
  • Fix migration when only Contacts resource is set up for an account
dvratil updated this revision to Diff 80633.Apr 20 2020, 10:42 AM
  • Fix patch
poboiko accepted this revision.Apr 20 2020, 2:08 PM

Codewise it looks good to me, and it works on my setup.

This revision is now accepted and ready to land.Apr 20 2020, 2:08 PM
dvratil planned changes to this revision.Apr 20 2020, 2:45 PM

I just realized a problem: if we remove the old Google resources from git, then the code that waits for the DBus interface to disappear will fail, because the resources won't be running in the first place.

dvratil updated this revision to Diff 80737.Apr 21 2020, 10:10 AM
  • Check if the resource instance is actually running before waiting for it to stop
This revision is now accepted and ready to land.Apr 21 2020, 10:10 AM
This revision was automatically updated to reflect the committed changes.