diff --git a/src/OutlookGoogleCalendarSync/Forms/MainForm.Designer.cs b/src/OutlookGoogleCalendarSync/Forms/MainForm.Designer.cs index b739cdee..d6824e97 100644 --- a/src/OutlookGoogleCalendarSync/Forms/MainForm.Designer.cs +++ b/src/OutlookGoogleCalendarSync/Forms/MainForm.Designer.cs @@ -258,6 +258,7 @@ private void InitializeComponent() { this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.AboutColumnLabel = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.AboutColumnValue = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.cbSingleCategoryOnly = new System.Windows.Forms.CheckBox(); this.tabApp.SuspendLayout(); this.tabPage_Sync.SuspendLayout(); this.consolePanel.SuspendLayout(); @@ -1671,6 +1672,7 @@ private void InitializeComponent() { // this.gbSyncOptions_What.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.gbSyncOptions_What.Controls.Add(this.cbSingleCategoryOnly); this.gbSyncOptions_What.Controls.Add(this.btColourMap); this.gbSyncOptions_What.Controls.Add(this.cbCloakEmail); this.gbSyncOptions_What.Controls.Add(this.lDNDand); @@ -3127,6 +3129,18 @@ private void InitializeComponent() { this.AboutColumnValue.Name = "AboutColumnValue"; this.AboutColumnValue.ReadOnly = true; // + // cbSingleCategoryOnly + // + this.cbSingleCategoryOnly.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.cbSingleCategoryOnly.ForeColor = System.Drawing.SystemColors.ControlText; + this.cbSingleCategoryOnly.Location = new System.Drawing.Point(226, 96); + this.cbSingleCategoryOnly.Name = "cbSingleCategoryOnly"; + this.cbSingleCategoryOnly.Size = new System.Drawing.Size(121, 18); + this.cbSingleCategoryOnly.TabIndex = 47; + this.cbSingleCategoryOnly.Text = "Single category only"; + this.cbSingleCategoryOnly.UseVisualStyleBackColor = true; + this.cbSingleCategoryOnly.CheckedChanged += new System.EventHandler(this.cbSingleCategoryOnly_CheckedChanged); + // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -3417,5 +3431,6 @@ private void InitializeComponent() { private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3; private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4; private System.Windows.Forms.ComboBox ddAvailabilty; + private System.Windows.Forms.CheckBox cbSingleCategoryOnly; } } diff --git a/src/OutlookGoogleCalendarSync/Forms/MainForm.cs b/src/OutlookGoogleCalendarSync/Forms/MainForm.cs index bdc1b304..ccc2490a 100644 --- a/src/OutlookGoogleCalendarSync/Forms/MainForm.cs +++ b/src/OutlookGoogleCalendarSync/Forms/MainForm.cs @@ -113,6 +113,9 @@ private void updateGUIsettings() { ToolTips.SetToolTip(cbCloakEmail, "Google has been known to send meeting updates to attendees without your consent.\n" + "This option safeguards against that by appending '"+ GoogleOgcs.EventAttendee.EmailCloak +"' to their email address."); + ToolTips.SetToolTip(cbSingleCategoryOnly, + "Only allow a single Outlook category - ie 1:1 sync with Google.\n" + + "Otherwise, for multiple categories and only one synced with OGCS, manually prefix the category name(s) with \"OGCS \"."); ToolTips.SetToolTip(cbReminderDND, "Do Not Disturb: Don't sync reminders to Google if they will trigger between these times."); @@ -398,6 +401,8 @@ private void updateGUIsettings() { dtDNDend.Value = Settings.Instance.ReminderDNDend; cbAddColours.Checked = Settings.Instance.AddColours; btColourMap.Enabled = Settings.Instance.AddColours; + cbSingleCategoryOnly.Checked = Settings.Instance.SingleCategoryOnly; + cbSingleCategoryOnly.Enabled = Settings.Instance.AddColours && Settings.Instance.SyncDirection.Id != Sync.Direction.OutlookToGoogle.Id; this.gbSyncOptions_What.ResumeLayout(); #endregion #endregion @@ -1261,6 +1266,7 @@ private void syncDirection_SelectedIndexChanged(object sender, EventArgs e) { tbTargetCalendar.Items.Remove("target calendar"); tbTargetCalendar.SelectedIndex = 0; tbTargetCalendar.Enabled = true; + cbSingleCategoryOnly.Visible = true; } else { cbObfuscateDirection.Enabled = false; cbObfuscateDirection.SelectedIndex = Settings.Instance.SyncDirection.Id - 1; @@ -1284,6 +1290,7 @@ private void syncDirection_SelectedIndexChanged(object sender, EventArgs e) { this.lDNDand.Visible = false; this.ddGoogleColour.Visible = false; this.ddOutlookColour.Visible = true; + this.cbSingleCategoryOnly.Visible = true; } if (Settings.Instance.SyncDirection == Sync.Direction.OutlookToGoogle) { Sync.Engine.Instance.RegisterForPushSync(); @@ -1294,6 +1301,7 @@ private void syncDirection_SelectedIndexChanged(object sender, EventArgs e) { this.lDNDand.Visible = true; this.ddGoogleColour.Visible = true; this.ddOutlookColour.Visible = false; + this.cbSingleCategoryOnly.Visible = false; } cbAddAttendees_CheckedChanged(null, null); cbAddReminders_CheckedChanged(null, null); @@ -1620,6 +1628,7 @@ private void cbCloakEmail_CheckedChanged(object sender, EventArgs e) { private void cbAddColours_CheckedChanged(object sender, EventArgs e) { Settings.Instance.AddColours = cbAddColours.Checked; btColourMap.Enabled = Settings.Instance.AddColours; + cbSingleCategoryOnly.Enabled = Settings.Instance.AddColours; } private void btColourMap_Click(object sender, EventArgs e) { if (Settings.Instance.UseGoogleCalendar == null || string.IsNullOrEmpty(Settings.Instance.UseGoogleCalendar.Id)) { @@ -1628,6 +1637,9 @@ private void btColourMap_Click(object sender, EventArgs e) { } new Forms.ColourMap().ShowDialog(this); } + private void cbSingleCategoryOnly_CheckedChanged(object sender, EventArgs e) { + Settings.Instance.SingleCategoryOnly = cbSingleCategoryOnly.Checked; + } #endregion #endregion #region Application settings diff --git a/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCalendar.cs b/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCalendar.cs index 5ee29bc1..84fb8eba 100644 --- a/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCalendar.cs +++ b/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCalendar.cs @@ -540,8 +540,12 @@ public Boolean UpdateCalendarEntry(ref AppointmentItem ai, Event ev, ref int ite } String gCategoryName = getColour(ev.ColorId, oCategoryName ?? ""); if (Sync.Engine.CompareAttribute("Category/Colour", Sync.Direction.GoogleToOutlook, gCategoryName, oCategoryName, sb, ref itemModified)) { - //Only allow one OGCS category at a time (Google Events can only have one colour) - aiCategories.RemoveAll(x => x.StartsWith("OGCS ") || x == gCategoryName); + if (Settings.Instance.SingleCategoryOnly) + aiCategories = new List(); + else { + //Only allow one OGCS category at a time (Google Events can only have one colour) + aiCategories.RemoveAll(x => x.StartsWith("OGCS ") || x == gCategoryName); + } aiCategories.Insert(0, gCategoryName); ai.Categories = String.Join(Categories.Delimiter, aiCategories.ToArray()); } diff --git a/src/OutlookGoogleCalendarSync/Settings.cs b/src/OutlookGoogleCalendarSync/Settings.cs index 7eac0813..dd1c4120 100644 --- a/src/OutlookGoogleCalendarSync/Settings.cs +++ b/src/OutlookGoogleCalendarSync/Settings.cs @@ -300,6 +300,8 @@ public String GaccountEmail_masked() { Namespace = "http://schemas.datacontract.org/2004/07/OutlookGoogleCalendarSync" )] public class ColourMappingDictionary : Dictionary { } + /// Only allow Outlook to have one category assigned + [DataMember] public Boolean SingleCategoryOnly { get; set; } //Obfuscation [DataMember] public Obfuscate Obfuscation { get; set; } @@ -516,6 +518,7 @@ public void LogSettings() { ColourMaps.ToList().ForEach(c => log.Info(" " + OutlookOgcs.Calendar.Categories.OutlookColour(c.Key) + ":" + c.Key + " <=> " + c.Value + ":" + GoogleOgcs.EventColour.Palette.GetColourName(c.Value))); } + log.Info(" SingleCategoryOnly: " + SingleCategoryOnly); log.Info(" Obfuscate Words: " + Obfuscation.Enabled); if (Obfuscation.Enabled) { if (Settings.Instance.Obfuscation.FindReplace.Count == 0) log.Info(" No regex defined.");