From 71e55c3c648d94dae60152f39e14819439a8cd0d Mon Sep 17 00:00:00 2001
From: Paul Woolcock <11843015+phw198@users.noreply.github.com>
Date: Sat, 8 Aug 2020 11:34:20 +0100
Subject: [PATCH] Sync Outlook deletion on first 2-way sync. Resolves #1050
---
.../GoogleOgcs/GoogleCalendar.cs | 2 +-
.../OutlookOgcs/OutlookCalendar.cs | 2 +-
src/OutlookGoogleCalendarSync/Sync/Engine.cs | 23 ++++++++++---------
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/src/OutlookGoogleCalendarSync/GoogleOgcs/GoogleCalendar.cs b/src/OutlookGoogleCalendarSync/GoogleOgcs/GoogleCalendar.cs
index b71ab96c..0635ea33 100644
--- a/src/OutlookGoogleCalendarSync/GoogleOgcs/GoogleCalendar.cs
+++ b/src/OutlookGoogleCalendarSync/GoogleOgcs/GoogleCalendar.cs
@@ -1093,7 +1093,7 @@ public void IdentifyEventDifferences(
//Don't delete any items that aren't yet in Outlook or just created in Outlook during this sync
for (int g = google.Count - 1; g >= 0; g--) {
if (!CustomProperty.Exists(google[g], CustomProperty.MetadataId.oEntryId) ||
- google[g].Updated > Settings.Instance.LastSyncDate)
+ google[g].Updated > Sync.Engine.Instance.SyncStarted)
google.Remove(google[g]);
}
}
diff --git a/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCalendar.cs b/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCalendar.cs
index 972d2720..5c17a121 100644
--- a/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCalendar.cs
+++ b/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCalendar.cs
@@ -1322,7 +1322,7 @@ public static void IdentifyEventDifferences(
//Don't delete any items that aren't yet in Google or just created in Google during this sync
for (int o = outlook.Count - 1; o >= 0; o--) {
if (!CustomProperty.Exists(outlook[o], CustomProperty.MetadataId.gEventID) ||
- outlook[o].LastModificationTime > Settings.Instance.LastSyncDate)
+ outlook[o].LastModificationTime > Sync.Engine.Instance.SyncStarted)
outlook.Remove(outlook[o]);
}
}
diff --git a/src/OutlookGoogleCalendarSync/Sync/Engine.cs b/src/OutlookGoogleCalendarSync/Sync/Engine.cs
index 2d37a0bd..671e7f17 100644
--- a/src/OutlookGoogleCalendarSync/Sync/Engine.cs
+++ b/src/OutlookGoogleCalendarSync/Sync/Engine.cs
@@ -25,6 +25,8 @@ public static Engine Instance {
public Engine() { }
+ ///
You have selected to sync attendees but Outlook is currently offline.
" + "Either put Outlook online or do not sync attendees.
", Console.Markup.error, notifyBubble: true); - setNextSync(syncStarted, false, updateSyncSchedule, cacheNextSync); + setNextSync(false, updateSyncSchedule, cacheNextSync); return; } } catch (System.Exception ex) { @@ -174,7 +176,7 @@ public void Start(Boolean updateSyncSchedule = true) { StringBuilder sb = new StringBuilder(); mainFrm.Console.BuildOutput("Sync version: " + System.Windows.Forms.Application.ProductVersion, ref sb); - mainFrm.Console.BuildOutput((ManualForceCompare ? "Full s" : "S") + "ync started at " + syncStarted.ToString(), ref sb); + mainFrm.Console.BuildOutput((ManualForceCompare ? "Full s" : "S") + "ync started at " + this.SyncStarted.ToString(), ref sb); mainFrm.Console.BuildOutput("Syncing from " + Settings.Instance.SyncStart.ToShortDateString() + " to " + Settings.Instance.SyncEnd.ToShortDateString(), ref sb); mainFrm.Console.BuildOutput(Settings.Instance.SyncDirection.Name, ref sb); @@ -302,7 +304,7 @@ public void Start(Boolean updateSyncSchedule = true) { mainFrm.Console.Update("Sync aborted after " + failedAttempts + " failed attempts!", syncResult == SyncResult.UserCancelled ? Console.Markup.fail : Console.Markup.error); } - setNextSync(syncStarted, syncResult == SyncResult.OK, updateSyncSchedule, cacheNextSync); + setNextSync(syncResult == SyncResult.OK, updateSyncSchedule, cacheNextSync); mainFrm.CheckSyncMilestone(); } finally { @@ -317,25 +319,24 @@ public void Start(Boolean updateSyncSchedule = true) { OutlookOgcs.Calendar.Disconnect(onlyWhenNoGUI: true); } } - + ///