mirror of
https://github.com/Kopano-dev/kopano-ol-extension.git
synced 2023-10-10 13:37:40 +02:00
[KOE-124] Added UI support for opening whole stores
This commit is contained in:
parent
f70e320d85
commit
ae076fe12f
@ -29,7 +29,8 @@ namespace Acacia.Controls
|
|||||||
TwoState,
|
TwoState,
|
||||||
ThreeState,
|
ThreeState,
|
||||||
Recursive,
|
Recursive,
|
||||||
RecursiveThreeState
|
RecursiveThreeState,
|
||||||
|
Custom
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract public class KCheckManager
|
abstract public class KCheckManager
|
||||||
@ -119,7 +120,7 @@ namespace Acacia.Controls
|
|||||||
// Set the check state recursively
|
// Set the check state recursively
|
||||||
node.Owner?.BeginUpdate();
|
node.Owner?.BeginUpdate();
|
||||||
|
|
||||||
SetNodeCheckState(node, NextCheckState(node.CheckState));
|
SetNodeCheckState(node, NextCheckState(node));
|
||||||
|
|
||||||
// Update the parent state
|
// Update the parent state
|
||||||
SetParentCheckState(node.Parent, node.CheckState);
|
SetParentCheckState(node.Parent, node.CheckState);
|
||||||
@ -130,12 +131,12 @@ namespace Acacia.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual CheckState NextCheckState(CheckState checkState)
|
protected virtual CheckState NextCheckState(KTreeNode node)
|
||||||
{
|
{
|
||||||
return (checkState == CheckState.Checked) ? CheckState.Unchecked : CheckState.Checked;
|
return (node.CheckState == CheckState.Checked) ? CheckState.Unchecked : CheckState.Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SetParentCheckState(KTreeNode parent, CheckState childCheckState)
|
protected virtual void SetParentCheckState(KTreeNode parent, CheckState childCheckState)
|
||||||
{
|
{
|
||||||
if (parent == null)
|
if (parent == null)
|
||||||
return;
|
return;
|
||||||
@ -174,11 +175,18 @@ namespace Acacia.Controls
|
|||||||
SetParentCheckState(parent.Parent, parent.CheckState);
|
SetParentCheckState(parent.Parent, parent.CheckState);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetNodeCheckState(KTreeNode node, CheckState checkState)
|
protected virtual void SetChildrenCheckState(KTreeNode parent, CheckState checkState)
|
||||||
|
{
|
||||||
|
foreach (KTreeNode child in parent.Children)
|
||||||
|
SetNodeCheckState(child, checkState != CheckState.Indeterminate ? checkState : CheckState.Unchecked);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void SetNodeCheckState(KTreeNode node, CheckState checkState)
|
||||||
{
|
{
|
||||||
// Apply the children first, otherwise the node's check state will be based on that again
|
// Apply the children first, otherwise the node's check state will be based on that again
|
||||||
foreach (KTreeNode child in node.Children)
|
SetChildrenCheckState(node, checkState);
|
||||||
SetNodeCheckState(child, checkState != CheckState.Indeterminate ? checkState : CheckState.Unchecked);
|
|
||||||
|
// Set the node now
|
||||||
node.CheckState = checkState;
|
node.CheckState = checkState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,9 +260,9 @@ namespace Acacia.Controls
|
|||||||
SetParentCheckState(node.Parent, state);
|
SetParentCheckState(node.Parent, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override CheckState NextCheckState(CheckState checkState)
|
protected override CheckState NextCheckState(KTreeNode node)
|
||||||
{
|
{
|
||||||
switch(checkState)
|
switch(node.CheckState)
|
||||||
{
|
{
|
||||||
case CheckState.Unchecked:
|
case CheckState.Unchecked:
|
||||||
return CheckState.Indeterminate;
|
return CheckState.Indeterminate;
|
||||||
|
@ -197,6 +197,11 @@ namespace Acacia.Controls
|
|||||||
EndLoading(node);
|
EndLoading(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
State = LoadingState.NotLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
public void Reload()
|
public void Reload()
|
||||||
{
|
{
|
||||||
if (State != LoadingState.Loading)
|
if (State != LoadingState.Loading)
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SharedFoldersDialog));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SharedFoldersDialog));
|
||||||
Acacia.Controls.KCheckManager.RecursiveThreeState recursiveThreeState1 = new Acacia.Controls.KCheckManager.RecursiveThreeState();
|
|
||||||
this._layout = new System.Windows.Forms.TableLayoutPanel();
|
this._layout = new System.Windows.Forms.TableLayoutPanel();
|
||||||
this._mainBusyHider = new Acacia.Controls.KBusyHider();
|
this._mainBusyHider = new Acacia.Controls.KBusyHider();
|
||||||
this._layoutMain = new System.Windows.Forms.TableLayoutPanel();
|
this._layoutMain = new System.Windows.Forms.TableLayoutPanel();
|
||||||
@ -39,6 +38,9 @@
|
|||||||
this.buttonOpenUser = new System.Windows.Forms.Button();
|
this.buttonOpenUser = new System.Windows.Forms.Button();
|
||||||
this.kTreeFolders = new Acacia.Controls.KTree();
|
this.kTreeFolders = new Acacia.Controls.KTree();
|
||||||
this._layoutOptions = new System.Windows.Forms.TableLayoutPanel();
|
this._layoutOptions = new System.Windows.Forms.TableLayoutPanel();
|
||||||
|
this._labelWholeStore = new System.Windows.Forms.Label();
|
||||||
|
this.checkWholeStore = new System.Windows.Forms.CheckBox();
|
||||||
|
this.labelPermissionsValue = new System.Windows.Forms.Label();
|
||||||
this._labelName = new System.Windows.Forms.Label();
|
this._labelName = new System.Windows.Forms.Label();
|
||||||
this.textName = new System.Windows.Forms.TextBox();
|
this.textName = new System.Windows.Forms.TextBox();
|
||||||
this._labelSendAs = new System.Windows.Forms.Label();
|
this._labelSendAs = new System.Windows.Forms.Label();
|
||||||
@ -46,7 +48,6 @@
|
|||||||
this._labelReminders = new System.Windows.Forms.Label();
|
this._labelReminders = new System.Windows.Forms.Label();
|
||||||
this.checkReminders = new System.Windows.Forms.CheckBox();
|
this.checkReminders = new System.Windows.Forms.CheckBox();
|
||||||
this._labelPermissions = new System.Windows.Forms.Label();
|
this._labelPermissions = new System.Windows.Forms.Label();
|
||||||
this.labelPermissionsValue = new System.Windows.Forms.Label();
|
|
||||||
this.dialogButtons = new Acacia.Controls.KDialogButtons();
|
this.dialogButtons = new Acacia.Controls.KDialogButtons();
|
||||||
this._layout.SuspendLayout();
|
this._layout.SuspendLayout();
|
||||||
this._mainBusyHider.SuspendLayout();
|
this._mainBusyHider.SuspendLayout();
|
||||||
@ -118,8 +119,8 @@
|
|||||||
//
|
//
|
||||||
this.kTreeFolders.BackColor = System.Drawing.SystemColors.Window;
|
this.kTreeFolders.BackColor = System.Drawing.SystemColors.Window;
|
||||||
this.kTreeFolders.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
this.kTreeFolders.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
this.kTreeFolders.CheckManager = recursiveThreeState1;
|
this.kTreeFolders.CheckManager = null;
|
||||||
this.kTreeFolders.CheckStyle = Acacia.Controls.KCheckStyle.RecursiveThreeState;
|
this.kTreeFolders.CheckStyle = Acacia.Controls.KCheckStyle.None;
|
||||||
resources.ApplyResources(this.kTreeFolders, "kTreeFolders");
|
resources.ApplyResources(this.kTreeFolders, "kTreeFolders");
|
||||||
this.kTreeFolders.FullRowSelect = true;
|
this.kTreeFolders.FullRowSelect = true;
|
||||||
this.kTreeFolders.Images = null;
|
this.kTreeFolders.Images = null;
|
||||||
@ -129,21 +130,39 @@
|
|||||||
this.kTreeFolders.NodePadding = new System.Windows.Forms.Padding(2, 4, 2, 4);
|
this.kTreeFolders.NodePadding = new System.Windows.Forms.Padding(2, 4, 2, 4);
|
||||||
this.kTreeFolders.CheckStateChanged += new Acacia.Controls.KTree.CheckStateChangedHandler(this.kTreeFolders_CheckStateChanged);
|
this.kTreeFolders.CheckStateChanged += new Acacia.Controls.KTree.CheckStateChangedHandler(this.kTreeFolders_CheckStateChanged);
|
||||||
this.kTreeFolders.SelectionChanged += new Acacia.Controls.KTree.SelectionChangedDelegate(this.kTreeFolders_SelectionChanged);
|
this.kTreeFolders.SelectionChanged += new Acacia.Controls.KTree.SelectionChangedDelegate(this.kTreeFolders_SelectionChanged);
|
||||||
this.kTreeFolders.DoubleClick += new System.EventHandler(this.kTreeFolders_DoubleClick);
|
|
||||||
//
|
//
|
||||||
// _layoutOptions
|
// _layoutOptions
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this._layoutOptions, "_layoutOptions");
|
resources.ApplyResources(this._layoutOptions, "_layoutOptions");
|
||||||
this._layoutOptions.Controls.Add(this._labelName, 0, 0);
|
this._layoutOptions.Controls.Add(this._labelWholeStore, 0, 0);
|
||||||
this._layoutOptions.Controls.Add(this.textName, 1, 0);
|
this._layoutOptions.Controls.Add(this.checkWholeStore, 1, 0);
|
||||||
this._layoutOptions.Controls.Add(this._labelSendAs, 0, 1);
|
this._layoutOptions.Controls.Add(this.labelPermissionsValue, 0, 4);
|
||||||
this._layoutOptions.Controls.Add(this.checkSendAs, 1, 1);
|
this._layoutOptions.Controls.Add(this._labelName, 0, 1);
|
||||||
this._layoutOptions.Controls.Add(this._labelReminders, 0, 2);
|
this._layoutOptions.Controls.Add(this.textName, 1, 1);
|
||||||
this._layoutOptions.Controls.Add(this.checkReminders, 1, 2);
|
this._layoutOptions.Controls.Add(this._labelSendAs, 0, 2);
|
||||||
this._layoutOptions.Controls.Add(this._labelPermissions, 0, 3);
|
this._layoutOptions.Controls.Add(this.checkSendAs, 1, 2);
|
||||||
this._layoutOptions.Controls.Add(this.labelPermissionsValue, 1, 3);
|
this._layoutOptions.Controls.Add(this._labelReminders, 0, 3);
|
||||||
|
this._layoutOptions.Controls.Add(this.checkReminders, 1, 3);
|
||||||
|
this._layoutOptions.Controls.Add(this._labelPermissions, 0, 4);
|
||||||
this._layoutOptions.Name = "_layoutOptions";
|
this._layoutOptions.Name = "_layoutOptions";
|
||||||
//
|
//
|
||||||
|
// _labelWholeStore
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this._labelWholeStore, "_labelWholeStore");
|
||||||
|
this._labelWholeStore.Name = "_labelWholeStore";
|
||||||
|
//
|
||||||
|
// checkWholeStore
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.checkWholeStore, "checkWholeStore");
|
||||||
|
this.checkWholeStore.Name = "checkWholeStore";
|
||||||
|
this.checkWholeStore.UseVisualStyleBackColor = true;
|
||||||
|
this.checkWholeStore.CheckedChanged += new System.EventHandler(this.checkWholeStore_CheckedChanged);
|
||||||
|
//
|
||||||
|
// labelPermissionsValue
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.labelPermissionsValue, "labelPermissionsValue");
|
||||||
|
this.labelPermissionsValue.Name = "labelPermissionsValue";
|
||||||
|
//
|
||||||
// _labelName
|
// _labelName
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this._labelName, "_labelName");
|
resources.ApplyResources(this._labelName, "_labelName");
|
||||||
@ -185,11 +204,6 @@
|
|||||||
resources.ApplyResources(this._labelPermissions, "_labelPermissions");
|
resources.ApplyResources(this._labelPermissions, "_labelPermissions");
|
||||||
this._labelPermissions.Name = "_labelPermissions";
|
this._labelPermissions.Name = "_labelPermissions";
|
||||||
//
|
//
|
||||||
// labelPermissionsValue
|
|
||||||
//
|
|
||||||
resources.ApplyResources(this.labelPermissionsValue, "labelPermissionsValue");
|
|
||||||
this.labelPermissionsValue.Name = "labelPermissionsValue";
|
|
||||||
//
|
|
||||||
// dialogButtons
|
// dialogButtons
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.dialogButtons, "dialogButtons");
|
resources.ApplyResources(this.dialogButtons, "dialogButtons");
|
||||||
@ -237,11 +251,13 @@
|
|||||||
private System.Windows.Forms.Label _labelSendAs;
|
private System.Windows.Forms.Label _labelSendAs;
|
||||||
private System.Windows.Forms.CheckBox checkSendAs;
|
private System.Windows.Forms.CheckBox checkSendAs;
|
||||||
private System.Windows.Forms.Label _labelPermissions;
|
private System.Windows.Forms.Label _labelPermissions;
|
||||||
private System.Windows.Forms.Label labelPermissionsValue;
|
private System.Windows.Forms.Label _labelWholeStore;
|
||||||
private Controls.KBusyHider _mainBusyHider;
|
private Controls.KBusyHider _mainBusyHider;
|
||||||
private Controls.KDialogButtons dialogButtons;
|
private Controls.KDialogButtons dialogButtons;
|
||||||
private UI.GABLookupControl gabLookup;
|
private UI.GABLookupControl gabLookup;
|
||||||
private System.Windows.Forms.Label _labelReminders;
|
private System.Windows.Forms.Label _labelReminders;
|
||||||
private System.Windows.Forms.CheckBox checkReminders;
|
private System.Windows.Forms.CheckBox checkReminders;
|
||||||
|
private System.Windows.Forms.CheckBox checkWholeStore;
|
||||||
|
private System.Windows.Forms.Label labelPermissionsValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
using Acacia.Controls;
|
using Acacia.Controls;
|
||||||
using Acacia.Features.GAB;
|
using Acacia.Features.GAB;
|
||||||
|
using Acacia.Stubs;
|
||||||
using Acacia.UI;
|
using Acacia.UI;
|
||||||
using Acacia.UI.Outlook;
|
using Acacia.UI.Outlook;
|
||||||
using Acacia.ZPush;
|
using Acacia.ZPush;
|
||||||
@ -37,6 +38,58 @@ namespace Acacia.Features.SharedFolders
|
|||||||
{
|
{
|
||||||
public partial class SharedFoldersDialog : KDialogNew
|
public partial class SharedFoldersDialog : KDialogNew
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Check manager that makes the store check box independent of the folder checkboxes, which are
|
||||||
|
/// still applied recursively
|
||||||
|
/// </summary>
|
||||||
|
private class ShareCheckManager : KCheckManager.RecursiveThreeState
|
||||||
|
{
|
||||||
|
public override KCheckStyle CheckStyle { get { return KCheckStyle.Custom; } }
|
||||||
|
|
||||||
|
protected override void SetParentCheckState(KTreeNode parent, CheckState childCheckState)
|
||||||
|
{
|
||||||
|
// The store node state is independent of the rest
|
||||||
|
if (parent == null || parent is StoreTreeNode)
|
||||||
|
return;
|
||||||
|
|
||||||
|
base.SetParentCheckState(parent, childCheckState);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void SetNodeCheckState(KTreeNode node, CheckState checkState)
|
||||||
|
{
|
||||||
|
// The store node state is independent of the rest
|
||||||
|
if (node is StoreTreeNode)
|
||||||
|
node.CheckState = checkState;
|
||||||
|
else
|
||||||
|
base.SetNodeCheckState(node, checkState);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override CheckState NextCheckState(KTreeNode node)
|
||||||
|
{
|
||||||
|
if (node is StoreTreeNode)
|
||||||
|
{
|
||||||
|
// The store node has a two-state checkbox
|
||||||
|
return (node.CheckState == CheckState.Checked) ? CheckState.Unchecked : CheckState.Checked;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return base.NextCheckState(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetCheck(KTreeNode node, CheckState state)
|
||||||
|
{
|
||||||
|
if (node is StoreTreeNode)
|
||||||
|
{
|
||||||
|
node.CheckStateDirect = state;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
base.SetCheck(node, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private readonly ZPushAccount _account;
|
private readonly ZPushAccount _account;
|
||||||
private readonly SharedFoldersManager _folders;
|
private readonly SharedFoldersManager _folders;
|
||||||
private readonly SyncId _initialSyncId;
|
private readonly SyncId _initialSyncId;
|
||||||
@ -67,6 +120,9 @@ namespace Acacia.Features.SharedFolders
|
|||||||
|
|
||||||
).Images;
|
).Images;
|
||||||
|
|
||||||
|
// Set the check manager
|
||||||
|
kTreeFolders.CheckManager = new ShareCheckManager();
|
||||||
|
|
||||||
// Add the email address to the title
|
// Add the email address to the title
|
||||||
Text = string.Format(Text, account.Account.SmtpAddress);
|
Text = string.Format(Text, account.Account.SmtpAddress);
|
||||||
|
|
||||||
@ -143,10 +199,10 @@ namespace Acacia.Features.SharedFolders
|
|||||||
{
|
{
|
||||||
KTreeNode folderNode = node.FindNode(_initialFolder);
|
KTreeNode folderNode = node.FindNode(_initialFolder);
|
||||||
if (folderNode != null)
|
if (folderNode != null)
|
||||||
FocusNode(folderNode);
|
FocusNode(folderNode, true);
|
||||||
context.AddBusy(-1);
|
context.AddBusy(-1);
|
||||||
};
|
};
|
||||||
FocusNode(node);
|
FocusNode(node, true);
|
||||||
}
|
}
|
||||||
SetInitialFocus(kTreeFolders);
|
SetInitialFocus(kTreeFolders);
|
||||||
}
|
}
|
||||||
@ -165,41 +221,77 @@ namespace Acacia.Features.SharedFolders
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ApplyState
|
||||||
|
{
|
||||||
|
public int folders;
|
||||||
|
public readonly List<StoreTreeNode> stores = new List<StoreTreeNode>();
|
||||||
|
}
|
||||||
|
|
||||||
private void dialogButtons_Apply(object sender, EventArgs e)
|
private void dialogButtons_Apply(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
BusyText = Properties.Resources.SharedFolders_Applying_Label;
|
BusyText = Properties.Resources.SharedFolders_Applying_Label;
|
||||||
KUITask.New((ctx) =>
|
KUITask.New((ctx) =>
|
||||||
{
|
{
|
||||||
// We reuse the same busy indicationg for all calls. A count is kept to ensure it's removed.
|
// We reuse the same busy indicationg for all calls. A count is kept to ensure it's removed.
|
||||||
int count = 0;
|
ApplyState state = new ApplyState();
|
||||||
|
|
||||||
foreach (StoreTreeNode storeNode in _userFolders.Values)
|
foreach (StoreTreeNode storeNode in _userFolders.Values)
|
||||||
{
|
{
|
||||||
if (storeNode.IsDirty)
|
if (storeNode.IsDirty)
|
||||||
{
|
{
|
||||||
ctx.AddBusy(1);
|
ctx.AddBusy(1);
|
||||||
++count;
|
++state.folders;
|
||||||
|
|
||||||
_folders.SetSharesForStore(storeNode.User, storeNode.CurrentShares, ctx.CancellationToken);
|
_folders.SetSharesForStore(storeNode.User, storeNode.CurrentShares, ctx.CancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (storeNode.IsWholeStoreDirty)
|
||||||
|
{
|
||||||
|
state.stores.Add(storeNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return state;
|
||||||
})
|
})
|
||||||
.OnSuccess((ctx, count) =>
|
.OnSuccess((ctx, state) =>
|
||||||
{
|
{
|
||||||
// Update UI state
|
// Update UI state
|
||||||
foreach (StoreTreeNode storeNode in _userFolders.Values)
|
foreach (StoreTreeNode storeNode in _userFolders.Values)
|
||||||
if (storeNode.IsDirty)
|
if (storeNode.IsDirty)
|
||||||
storeNode.ChangesApplied();
|
storeNode.ChangesApplied();
|
||||||
|
|
||||||
ctx.AddBusy(-count);
|
ctx.AddBusy(-state.folders);
|
||||||
|
|
||||||
|
if (state.folders != 0)
|
||||||
|
{
|
||||||
// Sync account
|
// Sync account
|
||||||
_account.Account.SendReceive();
|
_account.Account.SendReceive();
|
||||||
|
|
||||||
// Show success
|
// Show success
|
||||||
ShowCompletion(Properties.Resources.SharedFolders_Applying_Success);
|
ShowCompletion(Properties.Resources.SharedFolders_Applying_Success);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.stores.Count > 0)
|
||||||
|
{
|
||||||
|
bool restart = MessageBox.Show(ThisAddIn.Instance.Window,
|
||||||
|
"Outlook will be restarted to open the new stores",
|
||||||
|
"Open stores",
|
||||||
|
MessageBoxButtons.OKCancel,
|
||||||
|
MessageBoxIcon.Information
|
||||||
|
) == DialogResult.OK;
|
||||||
|
|
||||||
|
// Reset state. Also do this when restarting, to avoid warning message about unsaved changes
|
||||||
|
foreach (StoreTreeNode node in state.stores)
|
||||||
|
node.WantShare = node.IsShared;
|
||||||
|
|
||||||
|
if (!restart)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Restart
|
||||||
|
IRestarter restarter = ThisAddIn.Instance.Restarter();
|
||||||
|
restarter.CloseWindows = true;
|
||||||
|
restarter.Restart();
|
||||||
|
}
|
||||||
}, true)
|
}, true)
|
||||||
.OnError((x) =>
|
.OnError((x) =>
|
||||||
{
|
{
|
||||||
@ -263,23 +355,24 @@ namespace Acacia.Features.SharedFolders
|
|||||||
node = new StoreTreeNode(_folders, gabLookup.GAB,
|
node = new StoreTreeNode(_folders, gabLookup.GAB,
|
||||||
user, user.DisplayName, currentShares ?? new Dictionary<BackendId, SharedFolder>());
|
user, user.DisplayName, currentShares ?? new Dictionary<BackendId, SharedFolder>());
|
||||||
node.DirtyChanged += UserSharesChanged;
|
node.DirtyChanged += UserSharesChanged;
|
||||||
|
node.CheckStateChanged += WholeStoreShareChanged;
|
||||||
_userFolders.Add(user, node);
|
_userFolders.Add(user, node);
|
||||||
kTreeFolders.RootNodes.Add(node);
|
kTreeFolders.RootNodes.Add(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (select)
|
if (select)
|
||||||
{
|
{
|
||||||
FocusNode(node);
|
FocusNode(node, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FocusNode(KTreeNode node)
|
private void FocusNode(KTreeNode node, bool expand)
|
||||||
{
|
{
|
||||||
// Scroll it to the top of the window
|
// Scroll it to the top of the window
|
||||||
kTreeFolders.SelectNode(node, KTree.ScrollMode.Top);
|
kTreeFolders.SelectNode(node, KTree.ScrollMode.Top);
|
||||||
|
|
||||||
// Start loading folders
|
// Start loading folders if requested
|
||||||
node.IsExpanded = true;
|
node.IsExpanded = expand;
|
||||||
|
|
||||||
// Clear any selected user
|
// Clear any selected user
|
||||||
gabLookup.SelectedUser = null;
|
gabLookup.SelectedUser = null;
|
||||||
@ -288,12 +381,25 @@ namespace Acacia.Features.SharedFolders
|
|||||||
kTreeFolders.Focus();
|
kTreeFolders.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly Dictionary<string, bool> _dirtyUsers = new Dictionary<string, bool>();
|
private readonly Dictionary<GABUser, bool> _dirtyWholeStores = new Dictionary<GABUser, bool>();
|
||||||
|
private readonly Dictionary<GABUser, bool> _dirtyUsers = new Dictionary<GABUser, bool>();
|
||||||
|
|
||||||
private void UserSharesChanged(StoreTreeNode node)
|
private void UserSharesChanged(StoreTreeNode node)
|
||||||
{
|
{
|
||||||
_dirtyUsers[node.User.UserName] = node.IsDirty;
|
_dirtyUsers[node.User] = node.IsDirty;
|
||||||
dialogButtons.IsDirty = _dirtyUsers.Values.Any((x) => x);
|
CheckDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WholeStoreShareChanged(KTreeNode node)
|
||||||
|
{
|
||||||
|
StoreTreeNode storeNode = (StoreTreeNode)node;
|
||||||
|
_dirtyWholeStores[storeNode.User] = storeNode.IsWholeStoreDirty;
|
||||||
|
CheckDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckDirty()
|
||||||
|
{
|
||||||
|
dialogButtons.IsDirty = _dirtyUsers.Values.Any((x) => x) || _dirtyWholeStores.Values.Any((x) => x);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Advanced options
|
#region Advanced options
|
||||||
@ -392,6 +498,25 @@ namespace Acacia.Features.SharedFolders
|
|||||||
}
|
}
|
||||||
private readonly List<FolderTreeNode> _optionPermissionNodes = new List<FolderTreeNode>();
|
private readonly List<FolderTreeNode> _optionPermissionNodes = new List<FolderTreeNode>();
|
||||||
|
|
||||||
|
private CheckState? OptionWholeStore
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (checkWholeStore.Visible)
|
||||||
|
return checkWholeStore.CheckState;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_labelWholeStore.Visible = checkWholeStore.Visible = value != null;
|
||||||
|
if (value != null)
|
||||||
|
checkWholeStore.CheckState = value.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private readonly List<StoreTreeNode> _optionWholeStoreNodes = new List<StoreTreeNode>();
|
||||||
|
private readonly List<bool> _optionWholeStoreNodesInitial = new List<bool>();
|
||||||
|
|
||||||
private void ShowOptions(KTreeNode[] nodes)
|
private void ShowOptions(KTreeNode[] nodes)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -404,24 +529,40 @@ namespace Acacia.Features.SharedFolders
|
|||||||
_optionRemindersNodes.Clear();
|
_optionRemindersNodes.Clear();
|
||||||
_optionRemindersInitial.Clear();
|
_optionRemindersInitial.Clear();
|
||||||
_optionPermissionNodes.Clear();
|
_optionPermissionNodes.Clear();
|
||||||
|
_optionWholeStoreNodes.Clear();
|
||||||
|
_optionWholeStoreNodesInitial.Clear();
|
||||||
OptionName = null;
|
OptionName = null;
|
||||||
OptionTrackName = null;
|
OptionTrackName = null;
|
||||||
OptionSendAs = null;
|
OptionSendAs = null;
|
||||||
OptionReminders = null;
|
OptionReminders = null;
|
||||||
OptionPermissions = null;
|
OptionPermissions = null;
|
||||||
|
OptionWholeStore = null;
|
||||||
bool readOnly = false;
|
bool readOnly = false;
|
||||||
|
bool haveStoreNodes = false;
|
||||||
|
bool haveFolderNodes = false;
|
||||||
|
|
||||||
foreach (KTreeNode node in nodes)
|
foreach (KTreeNode node in nodes)
|
||||||
{
|
{
|
||||||
// Ignore the root nodes
|
// Ignore the root nodes
|
||||||
if (node is StoreTreeNode)
|
if (node is StoreTreeNode)
|
||||||
|
{
|
||||||
|
if (!_folders.SupportsWholeStore)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
StoreTreeNode storeNode = (StoreTreeNode)node;
|
||||||
|
haveStoreNodes = true;
|
||||||
|
_optionWholeStoreNodes.Add(storeNode);
|
||||||
|
_optionWholeStoreNodesInitial.Add(storeNode.IsShared);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
FolderTreeNode folderNode = (FolderTreeNode)node;
|
FolderTreeNode folderNode = (FolderTreeNode)node;
|
||||||
// Can only set options for shared folders
|
// Can only set options for shared folders
|
||||||
if (!folderNode.IsShared)
|
if (!folderNode.IsShared)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
haveFolderNodes = true;
|
||||||
|
|
||||||
// Set all controls to read-only if any of the nodes is read-only
|
// Set all controls to read-only if any of the nodes is read-only
|
||||||
if (folderNode.IsReadOnly)
|
if (folderNode.IsReadOnly)
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
@ -448,9 +589,36 @@ namespace Acacia.Features.SharedFolders
|
|||||||
// Show permissions for all shared nodes
|
// Show permissions for all shared nodes
|
||||||
_optionPermissionNodes.Add(folderNode);
|
_optionPermissionNodes.Add(folderNode);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Now check consistency of the options
|
// Now check consistency of the options
|
||||||
|
|
||||||
|
if (haveFolderNodes && haveStoreNodes)
|
||||||
|
{
|
||||||
|
// Mixed nodes, no options
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (haveStoreNodes)
|
||||||
|
{
|
||||||
|
if (_optionWholeStoreNodes.Count > 0)
|
||||||
|
{
|
||||||
|
bool isShared = _optionWholeStoreNodes.First().WantShare;
|
||||||
|
if (_optionWholeStoreNodes.All(x => x.WantShare == isShared))
|
||||||
|
{
|
||||||
|
OptionWholeStore = isShared ? CheckState.Checked : CheckState.Unchecked;
|
||||||
|
checkWholeStore.ThreeState = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OptionWholeStore = CheckState.Indeterminate;
|
||||||
|
checkWholeStore.ThreeState = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Only show the name if there is a single node.
|
// Only show the name if there is a single node.
|
||||||
// We do that here so there doesn't have to be duplication if testing if it's sharedd,
|
// We do that here so there doesn't have to be duplication if testing if it's sharedd,
|
||||||
// ect
|
// ect
|
||||||
@ -502,6 +670,7 @@ namespace Acacia.Features.SharedFolders
|
|||||||
checkReminders.ThreeState = true;
|
checkReminders.ThreeState = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Apply read-only state
|
// Apply read-only state
|
||||||
_layoutOptions.Enabled = !readOnly;
|
_layoutOptions.Enabled = !readOnly;
|
||||||
@ -538,6 +707,23 @@ namespace Acacia.Features.SharedFolders
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkWholeStore_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _optionWholeStoreNodes.Count; ++i)
|
||||||
|
{
|
||||||
|
StoreTreeNode node = _optionWholeStoreNodes[i];
|
||||||
|
bool wholeStore = false;
|
||||||
|
switch (checkWholeStore.CheckState)
|
||||||
|
{
|
||||||
|
case CheckState.Checked: wholeStore = true; break;
|
||||||
|
case CheckState.Indeterminate: wholeStore = _optionWholeStoreNodesInitial[i]; break;
|
||||||
|
case CheckState.Unchecked: wholeStore = false; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
node.WantShare = wholeStore;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void checkSendAs_CheckedChanged(object sender, EventArgs e)
|
private void checkSendAs_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _optionSendAsNodes.Count; ++i)
|
for (int i = 0; i < _optionSendAsNodes.Count; ++i)
|
||||||
@ -586,22 +772,5 @@ namespace Acacia.Features.SharedFolders
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private void kTreeFolders_DoubleClick(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
// TODO: This is some testing code for [KOE-123]
|
|
||||||
/*
|
|
||||||
if (ModifierKeys.HasFlag(Keys.Shift) && kTreeFolders.SelectedNodes.Count == 1)
|
|
||||||
{
|
|
||||||
KTreeNode selected = kTreeFolders.SelectedNodes.First();
|
|
||||||
if (selected is StoreTreeNode)
|
|
||||||
{
|
|
||||||
// Open store for user
|
|
||||||
Acacia.Stubs.IRestarter restarter = ThisAddIn.Instance.Restarter();
|
|
||||||
restarter.CloseWindows = true;
|
|
||||||
restarter.OpenShare(this._account, ((StoreTreeNode)selected).User);
|
|
||||||
restarter.Restart();
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,7 @@
|
|||||||
<value>3, 38</value>
|
<value>3, 38</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="kTreeFolders.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="kTreeFolders.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>442, 277</value>
|
<value>442, 250</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="kTreeFolders.TabIndex" type="System.Int32, mscorlib">
|
<data name="kTreeFolders.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
@ -309,6 +309,117 @@
|
|||||||
<data name="_layoutOptions.ColumnCount" type="System.Int32, mscorlib">
|
<data name="_layoutOptions.ColumnCount" type="System.Int32, mscorlib">
|
||||||
<value>2</value>
|
<value>2</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="_labelWholeStore.AutoSize" type="System.Boolean, mscorlib">
|
||||||
|
<value>True</value>
|
||||||
|
</data>
|
||||||
|
<data name="_labelWholeStore.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
|
<value>Fill</value>
|
||||||
|
</data>
|
||||||
|
<data name="_labelWholeStore.ImageAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||||
|
<value>MiddleLeft</value>
|
||||||
|
</data>
|
||||||
|
<data name="_labelWholeStore.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>3, 0</value>
|
||||||
|
</data>
|
||||||
|
<data name="_labelWholeStore.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
|
<value>0, 4, 0, 3</value>
|
||||||
|
</data>
|
||||||
|
<data name="_labelWholeStore.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>90, 27</value>
|
||||||
|
</data>
|
||||||
|
<data name="_labelWholeStore.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>5</value>
|
||||||
|
</data>
|
||||||
|
<data name="_labelWholeStore.Text" xml:space="preserve">
|
||||||
|
<value>Open whole store</value>
|
||||||
|
</data>
|
||||||
|
<data name="_labelWholeStore.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||||
|
<value>MiddleLeft</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>_labelWholeStore.Name" xml:space="preserve">
|
||||||
|
<value>_labelWholeStore</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>_labelWholeStore.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>_labelWholeStore.Parent" xml:space="preserve">
|
||||||
|
<value>_layoutOptions</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>_labelWholeStore.ZOrder" xml:space="preserve">
|
||||||
|
<value>0</value>
|
||||||
|
</data>
|
||||||
|
<data name="checkWholeStore.AutoSize" type="System.Boolean, mscorlib">
|
||||||
|
<value>True</value>
|
||||||
|
</data>
|
||||||
|
<data name="checkWholeStore.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
|
<value>Left</value>
|
||||||
|
</data>
|
||||||
|
<data name="checkWholeStore.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||||
|
<value>NoControl</value>
|
||||||
|
</data>
|
||||||
|
<data name="checkWholeStore.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>102, 4</value>
|
||||||
|
</data>
|
||||||
|
<data name="checkWholeStore.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
|
<value>6, 4, 3, 3</value>
|
||||||
|
</data>
|
||||||
|
<data name="checkWholeStore.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
|
<value>0, 3, 0, 3</value>
|
||||||
|
</data>
|
||||||
|
<data name="checkWholeStore.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>15, 20</value>
|
||||||
|
</data>
|
||||||
|
<data name="checkWholeStore.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>9</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>checkWholeStore.Name" xml:space="preserve">
|
||||||
|
<value>checkWholeStore</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>checkWholeStore.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>checkWholeStore.Parent" xml:space="preserve">
|
||||||
|
<value>_layoutOptions</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>checkWholeStore.ZOrder" xml:space="preserve">
|
||||||
|
<value>1</value>
|
||||||
|
</data>
|
||||||
|
<data name="labelPermissionsValue.AutoSize" type="System.Boolean, mscorlib">
|
||||||
|
<value>True</value>
|
||||||
|
</data>
|
||||||
|
<data name="labelPermissionsValue.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
|
<value>Fill</value>
|
||||||
|
</data>
|
||||||
|
<data name="labelPermissionsValue.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||||
|
<value>NoControl</value>
|
||||||
|
</data>
|
||||||
|
<data name="labelPermissionsValue.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>99, 107</value>
|
||||||
|
</data>
|
||||||
|
<data name="labelPermissionsValue.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>346, 20</value>
|
||||||
|
</data>
|
||||||
|
<data name="labelPermissionsValue.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>8</value>
|
||||||
|
</data>
|
||||||
|
<data name="labelPermissionsValue.Text" xml:space="preserve">
|
||||||
|
<value>Share as</value>
|
||||||
|
</data>
|
||||||
|
<data name="labelPermissionsValue.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||||
|
<value>MiddleLeft</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>labelPermissionsValue.Name" xml:space="preserve">
|
||||||
|
<value>labelPermissionsValue</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>labelPermissionsValue.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>labelPermissionsValue.Parent" xml:space="preserve">
|
||||||
|
<value>_layoutOptions</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>labelPermissionsValue.ZOrder" xml:space="preserve">
|
||||||
|
<value>2</value>
|
||||||
|
</data>
|
||||||
<data name="_labelName.AutoSize" type="System.Boolean, mscorlib">
|
<data name="_labelName.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</data>
|
</data>
|
||||||
@ -316,10 +427,10 @@
|
|||||||
<value>Fill</value>
|
<value>Fill</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelName.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="_labelName.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>3, 0</value>
|
<value>3, 27</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelName.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="_labelName.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>82, 26</value>
|
<value>90, 26</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelName.TabIndex" type="System.Int32, mscorlib">
|
<data name="_labelName.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
@ -340,19 +451,19 @@
|
|||||||
<value>_layoutOptions</value>
|
<value>_layoutOptions</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>_labelName.ZOrder" xml:space="preserve">
|
<data name=">>_labelName.ZOrder" xml:space="preserve">
|
||||||
<value>0</value>
|
<value>3</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="textName.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
<data name="textName.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
<value>Fill</value>
|
<value>Fill</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="textName.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="textName.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>94, 3</value>
|
<value>102, 30</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="textName.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
<data name="textName.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
<value>6, 3, 3, 3</value>
|
<value>6, 3, 3, 3</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="textName.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="textName.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>351, 20</value>
|
<value>343, 20</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="textName.TabIndex" type="System.Int32, mscorlib">
|
<data name="textName.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
@ -367,7 +478,7 @@
|
|||||||
<value>_layoutOptions</value>
|
<value>_layoutOptions</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>textName.ZOrder" xml:space="preserve">
|
<data name=">>textName.ZOrder" xml:space="preserve">
|
||||||
<value>1</value>
|
<value>4</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelSendAs.AutoSize" type="System.Boolean, mscorlib">
|
<data name="_labelSendAs.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
@ -376,10 +487,10 @@
|
|||||||
<value>Fill</value>
|
<value>Fill</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelSendAs.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="_labelSendAs.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>3, 26</value>
|
<value>3, 53</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelSendAs.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="_labelSendAs.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>82, 27</value>
|
<value>90, 27</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelSendAs.TabIndex" type="System.Int32, mscorlib">
|
<data name="_labelSendAs.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>2</value>
|
<value>2</value>
|
||||||
@ -400,7 +511,7 @@
|
|||||||
<value>_layoutOptions</value>
|
<value>_layoutOptions</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>_labelSendAs.ZOrder" xml:space="preserve">
|
<data name=">>_labelSendAs.ZOrder" xml:space="preserve">
|
||||||
<value>2</value>
|
<value>5</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="checkSendAs.AutoSize" type="System.Boolean, mscorlib">
|
<data name="checkSendAs.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
@ -409,7 +520,7 @@
|
|||||||
<value>Left</value>
|
<value>Left</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="checkSendAs.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="checkSendAs.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>94, 30</value>
|
<value>102, 57</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="checkSendAs.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
<data name="checkSendAs.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
<value>6, 4, 3, 3</value>
|
<value>6, 4, 3, 3</value>
|
||||||
@ -433,7 +544,7 @@
|
|||||||
<value>_layoutOptions</value>
|
<value>_layoutOptions</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>checkSendAs.ZOrder" xml:space="preserve">
|
<data name=">>checkSendAs.ZOrder" xml:space="preserve">
|
||||||
<value>3</value>
|
<value>6</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelReminders.AutoSize" type="System.Boolean, mscorlib">
|
<data name="_labelReminders.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
@ -442,10 +553,10 @@
|
|||||||
<value>Fill</value>
|
<value>Fill</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelReminders.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="_labelReminders.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>3, 53</value>
|
<value>3, 80</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelReminders.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="_labelReminders.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>82, 27</value>
|
<value>90, 27</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelReminders.TabIndex" type="System.Int32, mscorlib">
|
<data name="_labelReminders.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>6</value>
|
<value>6</value>
|
||||||
@ -466,7 +577,7 @@
|
|||||||
<value>_layoutOptions</value>
|
<value>_layoutOptions</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>_labelReminders.ZOrder" xml:space="preserve">
|
<data name=">>_labelReminders.ZOrder" xml:space="preserve">
|
||||||
<value>4</value>
|
<value>7</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="checkReminders.AutoSize" type="System.Boolean, mscorlib">
|
<data name="checkReminders.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
@ -475,7 +586,7 @@
|
|||||||
<value>Left</value>
|
<value>Left</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="checkReminders.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="checkReminders.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>94, 57</value>
|
<value>102, 84</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="checkReminders.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
<data name="checkReminders.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
<value>6, 4, 3, 3</value>
|
<value>6, 4, 3, 3</value>
|
||||||
@ -499,7 +610,7 @@
|
|||||||
<value>_layoutOptions</value>
|
<value>_layoutOptions</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>checkReminders.ZOrder" xml:space="preserve">
|
<data name=">>checkReminders.ZOrder" xml:space="preserve">
|
||||||
<value>5</value>
|
<value>8</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelPermissions.AutoSize" type="System.Boolean, mscorlib">
|
<data name="_labelPermissions.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
@ -508,13 +619,13 @@
|
|||||||
<value>Fill</value>
|
<value>Fill</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelPermissions.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="_labelPermissions.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>3, 80</value>
|
<value>3, 107</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelPermissions.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
<data name="_labelPermissions.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
<value>0, 4, 0, 3</value>
|
<value>0, 4, 0, 3</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelPermissions.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="_labelPermissions.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>82, 20</value>
|
<value>90, 20</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelPermissions.TabIndex" type="System.Int32, mscorlib">
|
<data name="_labelPermissions.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>4</value>
|
<value>4</value>
|
||||||
@ -535,61 +646,22 @@
|
|||||||
<value>_layoutOptions</value>
|
<value>_layoutOptions</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>_labelPermissions.ZOrder" xml:space="preserve">
|
<data name=">>_labelPermissions.ZOrder" xml:space="preserve">
|
||||||
<value>6</value>
|
<value>9</value>
|
||||||
</data>
|
|
||||||
<data name="labelPermissionsValue.AutoSize" type="System.Boolean, mscorlib">
|
|
||||||
<value>True</value>
|
|
||||||
</data>
|
|
||||||
<data name="labelPermissionsValue.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
|
||||||
<value>Fill</value>
|
|
||||||
</data>
|
|
||||||
<data name="labelPermissionsValue.ImageAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
|
||||||
<value>MiddleLeft</value>
|
|
||||||
</data>
|
|
||||||
<data name="labelPermissionsValue.Location" type="System.Drawing.Point, System.Drawing">
|
|
||||||
<value>91, 80</value>
|
|
||||||
</data>
|
|
||||||
<data name="labelPermissionsValue.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
|
||||||
<value>0, 4, 0, 3</value>
|
|
||||||
</data>
|
|
||||||
<data name="labelPermissionsValue.Size" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>354, 20</value>
|
|
||||||
</data>
|
|
||||||
<data name="labelPermissionsValue.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>5</value>
|
|
||||||
</data>
|
|
||||||
<data name="labelPermissionsValue.Text" xml:space="preserve">
|
|
||||||
<value>Permissions</value>
|
|
||||||
</data>
|
|
||||||
<data name="labelPermissionsValue.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
|
||||||
<value>MiddleLeft</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>labelPermissionsValue.Name" xml:space="preserve">
|
|
||||||
<value>labelPermissionsValue</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>labelPermissionsValue.Type" xml:space="preserve">
|
|
||||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>labelPermissionsValue.Parent" xml:space="preserve">
|
|
||||||
<value>_layoutOptions</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>labelPermissionsValue.ZOrder" xml:space="preserve">
|
|
||||||
<value>7</value>
|
|
||||||
</data>
|
</data>
|
||||||
<data name="_layoutOptions.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
<data name="_layoutOptions.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
<value>Fill</value>
|
<value>Fill</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_layoutOptions.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="_layoutOptions.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>0, 318</value>
|
<value>0, 291</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_layoutOptions.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
<data name="_layoutOptions.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
<value>0, 0, 0, 0</value>
|
<value>0, 0, 0, 0</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_layoutOptions.RowCount" type="System.Int32, mscorlib">
|
<data name="_layoutOptions.RowCount" type="System.Int32, mscorlib">
|
||||||
<value>4</value>
|
<value>5</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_layoutOptions.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="_layoutOptions.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>448, 100</value>
|
<value>448, 127</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_layoutOptions.TabIndex" type="System.Int32, mscorlib">
|
<data name="_layoutOptions.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>2</value>
|
<value>2</value>
|
||||||
@ -607,7 +679,7 @@
|
|||||||
<value>2</value>
|
<value>2</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_layoutOptions.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
|
<data name="_layoutOptions.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
|
||||||
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="_labelName" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="textName" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="_labelSendAs" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="checkSendAs" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="_labelReminders" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="checkReminders" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="_labelPermissions" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="labelPermissionsValue" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Absolute,20" /></TableLayoutSettings></value>
|
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="_labelWholeStore" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="checkWholeStore" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="labelPermissionsValue" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="_labelName" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="textName" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="_labelSendAs" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="checkSendAs" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="_labelReminders" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="checkReminders" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="_labelPermissions" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0" /></TableLayoutSettings></value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_layoutMain.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
<data name="_layoutMain.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
<value>Fill</value>
|
<value>Fill</value>
|
||||||
|
@ -41,6 +41,11 @@ namespace Acacia.Features.SharedFolders
|
|||||||
_query.Dispose();
|
_query.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool SupportsWholeStore
|
||||||
|
{
|
||||||
|
get { return true; } // TODO: use capability
|
||||||
|
}
|
||||||
|
|
||||||
public FeatureSharedFolders Feature { get { return _feature; } }
|
public FeatureSharedFolders Feature { get { return _feature; } }
|
||||||
|
|
||||||
#region API
|
#region API
|
||||||
|
@ -65,7 +65,7 @@ namespace Acacia.Features.SharedFolders
|
|||||||
|
|
||||||
ChildLoader = new UserFolderLoader(this, folders, user);
|
ChildLoader = new UserFolderLoader(this, folders, user);
|
||||||
ChildLoader.ReloadOnCloseOpen = true;
|
ChildLoader.ReloadOnCloseOpen = true;
|
||||||
HasCheckBox = false;
|
HasCheckBox = folders.SupportsWholeStore;
|
||||||
ApplyReadOnly(this, IsReadOnly);
|
ApplyReadOnly(this, IsReadOnly);
|
||||||
|
|
||||||
// TODO: better icons, better way of handling this
|
// TODO: better icons, better way of handling this
|
||||||
@ -92,6 +92,38 @@ namespace Acacia.Features.SharedFolders
|
|||||||
get { return ((UserFolderLoader)ChildLoader).User; }
|
get { return ((UserFolderLoader)ChildLoader).User; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsShared
|
||||||
|
{
|
||||||
|
get { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool WantShare
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return CheckState != System.Windows.Forms.CheckState.Unchecked;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
CheckState = value ? System.Windows.Forms.CheckState.Checked : System.Windows.Forms.CheckState.Unchecked;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCheckStateChanged()
|
||||||
|
{
|
||||||
|
base.OnCheckStateChanged();
|
||||||
|
if (WantShare)
|
||||||
|
{
|
||||||
|
// Reload, this will return no children
|
||||||
|
ChildLoader.Reload();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChildLoader.Reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region Share management
|
#region Share management
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -204,6 +236,14 @@ namespace Acacia.Features.SharedFolders
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsWholeStoreDirty
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return WantShare != IsShared;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ChangesApplied()
|
public void ChangesApplied()
|
||||||
{
|
{
|
||||||
// Save a copy of current folders to initial folders
|
// Save a copy of current folders to initial folders
|
||||||
@ -232,6 +272,8 @@ namespace Acacia.Features.SharedFolders
|
|||||||
|
|
||||||
protected override object DoLoadChildren(KTreeNode node)
|
protected override object DoLoadChildren(KTreeNode node)
|
||||||
{
|
{
|
||||||
|
if (!WantsChildren(node))
|
||||||
|
return null;
|
||||||
return _folders.GetStoreFolders(User);
|
return _folders.GetStoreFolders(User);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,8 +299,19 @@ namespace Acacia.Features.SharedFolders
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool WantsChildren(KTreeNode node)
|
||||||
|
{
|
||||||
|
// No children if we're sharing the whole store
|
||||||
|
if (node is StoreTreeNode)
|
||||||
|
return !((StoreTreeNode)node).WantShare;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void DoRenderChildren(KTreeNode node, object loaded, KTreeNodes children)
|
protected override void DoRenderChildren(KTreeNode node, object loaded, KTreeNodes children)
|
||||||
{
|
{
|
||||||
|
if (!WantsChildren(node))
|
||||||
|
return;
|
||||||
|
|
||||||
List<AvailableFolder> folders = (List<AvailableFolder>)loaded;
|
List<AvailableFolder> folders = (List<AvailableFolder>)loaded;
|
||||||
foreach (AvailableFolder folder in folders.OrderBy(f => f, new FolderComparer(true)))
|
foreach (AvailableFolder folder in folders.OrderBy(f => f, new FolderComparer(true)))
|
||||||
{
|
{
|
||||||
@ -319,6 +372,8 @@ namespace Acacia.Features.SharedFolders
|
|||||||
case KTreeNodeLoader.LoadingState.Loading:
|
case KTreeNodeLoader.LoadingState.Loading:
|
||||||
return Properties.Resources.SharedFolders_Loading;
|
return Properties.Resources.SharedFolders_Loading;
|
||||||
case KTreeNodeLoader.LoadingState.Loaded:
|
case KTreeNodeLoader.LoadingState.Loaded:
|
||||||
|
if (!WantsChildren(children.Parent))
|
||||||
|
return null;
|
||||||
if (children.Count == 0)
|
if (children.Count == 0)
|
||||||
return Properties.Resources.SharedFolders_None;
|
return Properties.Resources.SharedFolders_None;
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user