mirror of
https://github.com/Kopano-dev/kopano-ol-extension.git
synced 2023-10-10 13:37:40 +02:00
[KOE-12] Added debug option to disable COM code, which is the one bit that might cause a crash.
This commit is contained in:
parent
7a885acb71
commit
08c771d762
@ -26,6 +26,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static Acacia.DebugOptions;
|
||||
|
||||
namespace Acacia.Features.SharedFolders
|
||||
{
|
||||
@ -34,6 +35,19 @@ namespace Acacia.Features.SharedFolders
|
||||
:
|
||||
Feature, FeatureWithRibbon, FeatureWithContextMenu
|
||||
{
|
||||
#region Debug options
|
||||
|
||||
[AcaciaOption("Disables the update of the reminders query. If this is disabled, the reminders flag on " +
|
||||
"shared folders will be ignored.")]
|
||||
public bool Reminders
|
||||
{
|
||||
get { return GetOption(OPTION_REMINDERS); }
|
||||
set { SetOption(OPTION_REMINDERS, value); }
|
||||
}
|
||||
private static readonly BoolOption OPTION_REMINDERS = new BoolOption("Reminders", true);
|
||||
|
||||
#endregion
|
||||
|
||||
public override void Startup()
|
||||
{
|
||||
RegisterButton(this, "SharedFolders", true, ManageFolders, ZPushBehaviour.Disable);
|
||||
|
@ -62,15 +62,18 @@ namespace Acacia.Features.SharedFolders
|
||||
// Fetch the shares
|
||||
ICollection<SharedFolder> shares = _api.GetCurrentShares(cancel);
|
||||
|
||||
// Make sure reminders are disabled as soon as possible
|
||||
UpdateReminders(shares);
|
||||
if (_feature.Reminders)
|
||||
{
|
||||
// Make sure reminders are disabled as soon as possible
|
||||
UpdateReminders(shares);
|
||||
|
||||
// Remove any reminders from the shares that are not wanted, they are stale
|
||||
OpenQuery()?.RemoveStaleReminders(
|
||||
shares
|
||||
.Where(x => x.IsSynced && x.SyncType.IsAppointment() && x.FlagCalendarReminders)
|
||||
.Select(x => x.SyncId)
|
||||
);
|
||||
// Remove any reminders from the shares that are not wanted, they are stale
|
||||
OpenQuery()?.RemoveStaleReminders(
|
||||
shares
|
||||
.Where(x => x.IsSynced && x.SyncType.IsAppointment() && x.FlagCalendarReminders)
|
||||
.Select(x => x.SyncId)
|
||||
);
|
||||
}
|
||||
|
||||
// Commit changes
|
||||
if (_query != null)
|
||||
@ -90,12 +93,15 @@ namespace Acacia.Features.SharedFolders
|
||||
|
||||
private void UpdateReminders(ICollection<SharedFolder> shares)
|
||||
{
|
||||
foreach(SharedFolder share in shares)
|
||||
if (_feature.Reminders)
|
||||
{
|
||||
Logger.Instance.Debug(this, "UpdateReminders: {0}", share);
|
||||
if (share.IsSynced && share.SyncType.IsAppointment())
|
||||
foreach (SharedFolder share in shares)
|
||||
{
|
||||
OpenQuery()?.UpdateReminders(share.SyncId, share.FlagCalendarReminders);
|
||||
Logger.Instance.Debug(this, "UpdateReminders: {0}", share);
|
||||
if (share.IsSynced && share.SyncType.IsAppointment())
|
||||
{
|
||||
OpenQuery()?.UpdateReminders(share.SyncId, share.FlagCalendarReminders);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -104,14 +110,17 @@ namespace Acacia.Features.SharedFolders
|
||||
{
|
||||
if (_query == null)
|
||||
{
|
||||
RemindersQuery query = new RemindersQuery(_feature, _account.Account.Store);
|
||||
if (query.Open())
|
||||
if (_feature.Reminders)
|
||||
{
|
||||
_query = query;
|
||||
}
|
||||
else
|
||||
{
|
||||
query.Dispose();
|
||||
RemindersQuery query = new RemindersQuery(_feature, _account.Account.Store);
|
||||
if (query.Open())
|
||||
{
|
||||
_query = query;
|
||||
}
|
||||
else
|
||||
{
|
||||
query.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
return _query;
|
||||
|
Loading…
Reference in New Issue
Block a user