1
0
mirror of https://github.com/Kopano-dev/kopano-ol-extension.git synced 2023-10-10 13:37:40 +02:00

Changed SyncTimeFrame.YEAR_1 to value 101 to avoid SYNC_FILTERTYPE_INCOMPLETETASKS value of 8

This commit is contained in:
Michele Lunardi 2021-03-17 11:33:57 +01:00
parent 2b00694b50
commit c328404e43
4 changed files with 32 additions and 7 deletions

View File

@ -156,7 +156,7 @@
resources.GetString("comboTimeFrame.Items5"), resources.GetString("comboTimeFrame.Items5"),
resources.GetString("comboTimeFrame.Items6"), resources.GetString("comboTimeFrame.Items6"),
resources.GetString("comboTimeFrame.Items7"), resources.GetString("comboTimeFrame.Items7"),
resources.GetString("comboTimeFrame.Items8")}); resources.GetString("comboTimeFrame.Items101")}); // custom time frame value
this.comboTimeFrame.Name = "comboTimeFrame"; this.comboTimeFrame.Name = "comboTimeFrame";
this.comboTimeFrame.SelectedIndexChanged += new System.EventHandler(this.comboTimeFrame_SelectedIndexChanged); this.comboTimeFrame.SelectedIndexChanged += new System.EventHandler(this.comboTimeFrame_SelectedIndexChanged);
// //

View File

@ -36,6 +36,8 @@ namespace Acacia.Features.SyncState
private readonly Button[] _syncButtons; private readonly Button[] _syncButtons;
private readonly System.ComponentModel.ComponentResourceManager resources;
private ZPushAccount SelectedAccount private ZPushAccount SelectedAccount
{ {
get get
@ -48,6 +50,9 @@ namespace Acacia.Features.SyncState
{ {
InitializeComponent(); InitializeComponent();
// Used for handling custom time frame values.
resources = new System.ComponentModel.ComponentResourceManager(typeof(SyncStateDialog));
// Ensure these are in sync with ResyncOption // Ensure these are in sync with ResyncOption
_syncButtons = new Button[] _syncButtons = new Button[]
{ {
@ -81,6 +86,9 @@ namespace Acacia.Features.SyncState
if (SelectedAccount == null) if (SelectedAccount == null)
comboTimeFrame.SelectedIndex = 0; comboTimeFrame.SelectedIndex = 0;
// Custom values handling. Custom values will be appended into comboTimeFrame after the last standard value (7)
else if (SelectedAccount.SyncTimeFrame == (SyncTimeFrame)(int)SyncTimeFrame.YEAR_1) // 1 year
comboTimeFrame.SelectedIndex = comboTimeFrame.Items.IndexOf(resources.GetString("comboTimeFrame.Items101"));
else else
comboTimeFrame.SelectedIndex = (int)SelectedAccount.SyncTimeFrame; comboTimeFrame.SelectedIndex = (int)SelectedAccount.SyncTimeFrame;
@ -97,8 +105,17 @@ namespace Acacia.Features.SyncState
if (SelectedAccount != null) if (SelectedAccount != null)
{ {
SyncTimeFrame timeFrame = (SyncTimeFrame)comboTimeFrame.SelectedIndex; SyncTimeFrame timeFrame = (SyncTimeFrame)comboTimeFrame.SelectedIndex;
bool isDirty = timeFrame != SelectedAccount.SyncTimeFrame; // Handle custom values
buttonApplyTimeFrame.Enabled = buttonResetTimeFrame.Enabled = isDirty; if ((int)timeFrame == comboTimeFrame.Items.IndexOf(resources.GetString("comboTimeFrame.Items101")))
{
bool isDirty = SelectedAccount.SyncTimeFrame != (SyncTimeFrame)(int)SyncTimeFrame.YEAR_1;
buttonApplyTimeFrame.Enabled = buttonResetTimeFrame.Enabled = isDirty;
}
else
{
bool isDirty = timeFrame != SelectedAccount.SyncTimeFrame;
buttonApplyTimeFrame.Enabled = buttonResetTimeFrame.Enabled = isDirty;
}
} }
else else
{ {
@ -118,8 +135,16 @@ namespace Acacia.Features.SyncState
{ {
Busy = true; Busy = true;
// TODO: do this in the background // Custom values handling. Custom values will be appended into comboTimeFrame after the last standard value (7)
_feature.SetDeviceOptions(SelectedAccount, (SyncTimeFrame)comboTimeFrame.SelectedIndex); if (comboTimeFrame.SelectedItem.Equals(resources.GetString("comboTimeFrame.Items101")))
{
_feature.SetDeviceOptions(SelectedAccount, (SyncTimeFrame)(int)SyncTimeFrame.YEAR_1);
}
else
{
// TODO: do this in the background
_feature.SetDeviceOptions(SelectedAccount, (SyncTimeFrame)comboTimeFrame.SelectedIndex);
}
CheckTimeFrameDirty(); CheckTimeFrameDirty();
} }
} }

View File

@ -444,7 +444,7 @@
<data name="comboTimeFrame.Items7" xml:space="preserve"> <data name="comboTimeFrame.Items7" xml:space="preserve">
<value>6 months</value> <value>6 months</value>
</data> </data>
<data name="comboTimeFrame.Items8" xml:space="preserve"> <data name="comboTimeFrame.Items101" xml:space="preserve">
<value>1 year</value> <value>1 year</value>
</data> </data>
<data name="comboTimeFrame.Location" type="System.Drawing.Point, System.Drawing"> <data name="comboTimeFrame.Location" type="System.Drawing.Point, System.Drawing">

View File

@ -162,7 +162,7 @@ namespace Acacia.ZPush
MONTH_1, MONTH_1,
MONTH_3, MONTH_3,
MONTH_6, MONTH_6,
YEAR_1 YEAR_1 = 101 // Custom value
} }
public static class SyncTimeFrameMethods public static class SyncTimeFrameMethods