mirror of
https://github.com/Kopano-dev/kopano-ol-extension.git
synced 2023-10-10 13:37:40 +02:00
[KOE-139] Added tooltips and support for disabling tree nodes in shared folders dialog, to support configured folders
This commit is contained in:
parent
4b868456b0
commit
be5d698654
@ -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
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ namespace Acacia.Controls
|
||||
|
||||
public int? ImageIndex { get; set; }
|
||||
public object Tag { get; set; }
|
||||
public string ToolTip { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -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;
|
||||
|
@ -261,7 +261,8 @@ namespace Acacia.Features.SharedFolders
|
||||
|
||||
// Add the node
|
||||
node = new StoreTreeNode(_folders, gabLookup.GAB,
|
||||
user, user.DisplayName, currentShares ?? new Dictionary<BackendId, SharedFolder>());
|
||||
user, user.DisplayName, currentShares ?? new Dictionary<BackendId, SharedFolder>(),
|
||||
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
|
||||
{
|
||||
|
@ -607,7 +607,7 @@
|
||||
<value>2</value>
|
||||
</data>
|
||||
<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" /></TableLayoutSettings></value>
|
||||
<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>
|
||||
</data>
|
||||
<data name="_layoutMain.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
|
@ -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<BackendId, SharedFolder> currentFolders)
|
||||
Dictionary<BackendId, SharedFolder> 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);
|
||||
|
@ -1093,6 +1093,16 @@ namespace Acacia.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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..
|
||||
/// </summary>
|
||||
internal static string SharedFolders_Node_Readonly_ToolTip {
|
||||
get {
|
||||
return ResourceManager.GetString("SharedFolders_Node_Readonly_ToolTip", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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..
|
||||
/// </summary>
|
||||
|
@ -520,4 +520,8 @@
|
||||
<data name="SharedFolders_LocalFolder_Title" xml:space="preserve">
|
||||
<value>Shared folders</value>
|
||||
</data>
|
||||
<data name="SharedFolders_Node_Readonly_ToolTip" xml:space="preserve">
|
||||
<value>The folder has been configured by your system administrator and cannot be modified.
|
||||
Please contact your system administrator for any required changes.</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user