Skip to content

Commit

Permalink
Force clean google calendar sync when plugin version increases
Browse files Browse the repository at this point in the history
  • Loading branch information
Antti Seppälä committed Jan 13, 2015
1 parent 5b8155b commit 7cf5fe6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/google/google-calendars/googlecalendarsyncadaptor.cpp
Expand Up @@ -44,6 +44,8 @@

namespace {

static int GOOGLE_CAL_SYNC_PLUGIN_VERSION = 2;

QString gCalEventId(KCalCore::Incidence::Ptr event)
{
return event->customProperty("jolla-sociald", "gcal-id");
Expand Down Expand Up @@ -298,6 +300,12 @@ bool wasLastSyncSuccessful(int accountId)
QSettings settingsFile(settingsFileName, QSettings::IniFormat);
bool retn = settingsFile.value(QString::fromLatin1("%1-success").arg(accountId), QVariant::fromValue<bool>(false)).toBool();
settingsFile.setValue(QString::fromLatin1("%1-success").arg(accountId), QVariant::fromValue<bool>(false));
int pluginVersion = settingsFile.value(QString::fromLatin1("%1-pluginVersion").arg(accountId), QVariant::fromValue<int>(1)).toInt();
if (pluginVersion != GOOGLE_CAL_SYNC_PLUGIN_VERSION) {
settingsFile.setValue(QString::fromLatin1("%1-pluginVersion").arg(accountId), GOOGLE_CAL_SYNC_PLUGIN_VERSION);
SOCIALD_LOG_DEBUG("Google cal sync plugin version mismatch, force clean sync");
retn = false;
}
settingsFile.sync();
return retn;
}
Expand Down

0 comments on commit 7cf5fe6

Please sign in to comment.