diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Controls/KTree.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Controls/KTree.cs index a4b3d1d..cbcd617 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Controls/KTree.cs +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Controls/KTree.cs @@ -56,7 +56,7 @@ namespace Acacia.Controls CheckStateChanged(this, new CheckStateChangedEventArgs(node)); } } - + private ToolTip toolTip; private KCheckManager _checkManager; [Browsable(false)] public KCheckManager CheckManager @@ -181,6 +181,8 @@ namespace Acacia.Controls SetStyle(ControlStyles.Selectable, true); BackColor = SystemColors.Window; + toolTip = new ToolTip(); + _rootNodes = new KTreeNodes(this); SetupRenderer(); InitScrollBars(); @@ -449,6 +451,12 @@ namespace Acacia.Controls // Render new node if (_highlightNode != null) Rerender(_highlightNode); + + // Update any tooltips + if (old?.ToolTip != null) + toolTip.SetToolTip(this, null); + if (_highlightNode?.ToolTip != null) + toolTip.SetToolTip(this, _highlightNode.ToolTip); } } @@ -1147,20 +1155,5 @@ namespace Acacia.Controls #endregion - - #region Winforms Autogenerated - - private void InitializeComponent() - { - this.SuspendLayout(); - // - // KTree - // - this.Name = "KTree"; - this.ResumeLayout(false); - } - - #endregion - } } diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Controls/KTreeNode.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Controls/KTreeNode.cs index 0d69747..83183b7 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Controls/KTreeNode.cs +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Controls/KTreeNode.cs @@ -64,6 +64,7 @@ namespace Acacia.Controls public int? ImageIndex { get; set; } public object Tag { get; set; } + public string ToolTip { get; set; } #endregion diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/FolderTreeNode.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/FolderTreeNode.cs index 16c3230..f1efeda 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/FolderTreeNode.cs +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/FolderTreeNode.cs @@ -30,6 +30,7 @@ namespace Acacia.Features.SharedFolders private readonly StoreTreeNode _store; private readonly AvailableFolder _folder; private SharedFolder _share; + public bool IsReadOnly { get { return _store.IsReadOnly; } } public FolderTreeNode(StoreTreeNode store, AvailableFolder folder, SharedFolder share) { @@ -39,6 +40,8 @@ namespace Acacia.Features.SharedFolders this.Text = folder.Name; + HasCheckBox = !IsReadOnly; + // Image // TODO: clean this up int index = ((int)OutlookConstants.BASIC_SYNC_TYPES[(int)folder.Type]) - 1; diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/SharedFoldersDialog.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/SharedFoldersDialog.cs index 9d0f93d..efce1de 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/SharedFoldersDialog.cs +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/SharedFoldersDialog.cs @@ -261,7 +261,8 @@ namespace Acacia.Features.SharedFolders // Add the node node = new StoreTreeNode(_folders, gabLookup.GAB, - user, user.DisplayName, currentShares ?? new Dictionary()); + user, user.DisplayName, currentShares ?? new Dictionary(), + false); node.DirtyChanged += UserSharesChanged; _userFolders.Add(user, node); kTreeFolders.RootNodes.Add(node); @@ -409,6 +410,7 @@ namespace Acacia.Features.SharedFolders OptionSendAs = null; OptionReminders = null; OptionPermissions = null; + bool readOnly = false; foreach (KTreeNode node in nodes) { @@ -421,6 +423,10 @@ namespace Acacia.Features.SharedFolders if (!folderNode.IsShared) continue; + // Set all controls to read-only if any of the nodes is read-only + if (folderNode.IsReadOnly) + readOnly = true; + SharedFolder share = folderNode.SharedFolder; AvailableFolder folder = folderNode.AvailableFolder; @@ -497,6 +503,9 @@ namespace Acacia.Features.SharedFolders checkReminders.ThreeState = true; } } + + // Apply read-only state + _layoutOptions.Enabled = !readOnly; } finally { diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/SharedFoldersDialog.resx b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/SharedFoldersDialog.resx index a3eb232..79c73f4 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/SharedFoldersDialog.resx +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/SharedFoldersDialog.resx @@ -607,7 +607,7 @@ 2 - <?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" /></TableLayoutSettings> + <?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> Fill diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/StoreTreeNode.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/StoreTreeNode.cs index d7b57c3..4f8733f 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/StoreTreeNode.cs +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/StoreTreeNode.cs @@ -46,8 +46,11 @@ namespace Acacia.Features.SharedFolders private readonly GABHandler _gab; private readonly GABUser _user; + public readonly bool IsReadOnly; + public StoreTreeNode(SharedFoldersManager folders, GABHandler gab, GABUser user, string text, - Dictionary currentFolders) + Dictionary currentFolders, + bool readOnly) : base(text) { @@ -55,6 +58,7 @@ namespace Acacia.Features.SharedFolders this._feature = folders.Feature; this._gab = gab; this._user = user; + this.IsReadOnly = readOnly; // Create an empty current state. When loading the nodes, the shares will be added. This has the benefit of // cleaning up automatically any obsolote shares. @@ -63,6 +67,7 @@ namespace Acacia.Features.SharedFolders ChildLoader = new UserFolderLoader(this, folders, user); ChildLoader.ReloadOnCloseOpen = true; HasCheckBox = false; + ApplyReadOnly(this, IsReadOnly); // TODO: better icons, better way of handling this ImageIndex = user == GABUser.USER_PUBLIC ? 0 : 11; @@ -78,6 +83,11 @@ namespace Acacia.Features.SharedFolders Control = _reloader; } + private static void ApplyReadOnly(KTreeNode node, bool isReadOnly) + { + node.ToolTip = isReadOnly ? Properties.Resources.SharedFolders_Node_Readonly_ToolTip : null; + } + public GABUser User { get { return ((UserFolderLoader)ChildLoader).User; } @@ -264,6 +274,7 @@ namespace Acacia.Features.SharedFolders // Create the tree node SharedFolder share = rootNode.GetInitialShareState(folder); FolderTreeNode child = new FolderTreeNode(rootNode, folder, share); + ApplyReadOnly(child, child.IsReadOnly); // Add children.Add(child); diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Properties/Resources.Designer.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Properties/Resources.Designer.cs index 1e86f86..112e362 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Properties/Resources.Designer.cs +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Properties/Resources.Designer.cs @@ -1093,6 +1093,16 @@ namespace Acacia.Properties { } } + /// + /// Looks up a localized string similar to The folder has been configured by your system administrator and cannot be modified. + ///Please contact your system administrator for any required changes.. + /// + internal static string SharedFolders_Node_Readonly_ToolTip { + get { + return ResourceManager.GetString("SharedFolders_Node_Readonly_ToolTip", resourceCulture); + } + } + /// /// Looks up a localized string similar to No shared folders are available or you do not have permissions to view the root of the inbox.. /// diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Properties/Resources.resx b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Properties/Resources.resx index 0c60b45..a714232 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Properties/Resources.resx +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Properties/Resources.resx @@ -520,4 +520,8 @@ Shared folders + + The folder has been configured by your system administrator and cannot be modified. +Please contact your system administrator for any required changes. + \ No newline at end of file