From 8b7f7b16a890c9326c523e926ff369424a7a29fb Mon Sep 17 00:00:00 2001 From: Faryan Rezagholi Date: Sun, 1 Sep 2019 15:04:16 +0200 Subject: [PATCH] revised sort button in connection tree to be able to sort in both orders, fixes #1434 --- CHANGELOG.md | 1 + .../Window/ConnectionTreeWindow.Designer.cs | 14 +++++++------- mRemoteV1/UI/Window/ConnectionTreeWindow.cs | 19 +++++++++++++++++-- .../UI/Window/PortScanWindow.Designer.cs | 2 +- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba354b5b..4f780710 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] ### Added - #1512: Added option to close panel from right click menu +- #1434: Revised sort button in connection tree to be able to sort in both orders - #1400: Added file download handling to HTTP(S) connections using Gecko - #826: Allow selecting RDP version to use when connecting ### Changed diff --git a/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs b/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs index 1f819738..cf07e26c 100644 --- a/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs +++ b/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs @@ -6,7 +6,7 @@ internal System.Windows.Forms.MenuStrip msMain; internal System.Windows.Forms.ToolStripMenuItem mMenViewExpandAllFolders; internal System.Windows.Forms.ToolStripMenuItem mMenViewCollapseAllFolders; - internal System.Windows.Forms.ToolStripMenuItem mMenSortAscending; + internal System.Windows.Forms.ToolStripMenuItem mMenSort; internal System.Windows.Forms.ToolStripMenuItem mMenAddConnection; internal System.Windows.Forms.ToolStripMenuItem mMenAddFolder; public System.Windows.Forms.TreeView tvConnections; @@ -23,7 +23,7 @@ this.mMenAddFolder = new System.Windows.Forms.ToolStripMenuItem(); this.mMenViewExpandAllFolders = new System.Windows.Forms.ToolStripMenuItem(); this.mMenViewCollapseAllFolders = new System.Windows.Forms.ToolStripMenuItem(); - this.mMenSortAscending = new System.Windows.Forms.ToolStripMenuItem(); + this.mMenSort = new System.Windows.Forms.ToolStripMenuItem(); this.mMenFavorites = new System.Windows.Forms.ToolStripMenuItem(); this.vsToolStripExtender = new WeifenLuo.WinFormsUI.Docking.VisualStudioToolStripExtender(this.components); this.pbSearch = new mRemoteNG.UI.Controls.Base.NGPictureBox(this.components); @@ -77,7 +77,7 @@ this.mMenAddFolder, this.mMenViewExpandAllFolders, this.mMenViewCollapseAllFolders, - this.mMenSortAscending, + this.mMenSort, this.mMenFavorites}); this.msMain.Location = new System.Drawing.Point(0, 0); this.msMain.Name = "msMain"; @@ -122,10 +122,10 @@ // // mMenSortAscending // - this.mMenSortAscending.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.mMenSortAscending.Image = global::mRemoteNG.Resources.Sort_AZ; - this.mMenSortAscending.Name = "mMenSortAscending"; - this.mMenSortAscending.Size = new System.Drawing.Size(28, 20); + this.mMenSort.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.mMenSort.Image = global::mRemoteNG.Resources.Sort_AZ; + this.mMenSort.Name = "mMenSort"; + this.mMenSort.Size = new System.Drawing.Size(28, 20); // // mMenFavorites // diff --git a/mRemoteV1/UI/Window/ConnectionTreeWindow.cs b/mRemoteV1/UI/Window/ConnectionTreeWindow.cs index 01a7f592..8e9cdbc7 100644 --- a/mRemoteV1/UI/Window/ConnectionTreeWindow.cs +++ b/mRemoteV1/UI/Window/ConnectionTreeWindow.cs @@ -23,6 +23,7 @@ namespace mRemoteNG.UI.Window { private readonly IConnectionInitiator _connectionInitiator = new ConnectionInitiator(); private ThemeManager _themeManager; + private bool sortedAz = true; public ConnectionInfo SelectedNode => olvConnections.SelectedNode; @@ -89,7 +90,7 @@ namespace mRemoteNG.UI.Window mMenAddFolder.ToolTipText = Language.strAddFolder; mMenViewExpandAllFolders.ToolTipText = Language.strExpandAllFolders; mMenViewCollapseAllFolders.ToolTipText = Language.strCollapseAllFolders; - mMenSortAscending.ToolTipText = Language.strSortAsc; + mMenSort.ToolTipText = Language.strSort; mMenFavorites.ToolTipText = Language.Favorites; txtSearch.Text = Language.strSearchPrompt; @@ -199,7 +200,21 @@ namespace mRemoteNG.UI.Window olvConnections.CollapseAll(); olvConnections.Expand(olvConnections.GetRootConnectionNode()); }; - mMenSortAscending.Click += (sender, args) => olvConnections.SortRecursive(olvConnections.GetRootConnectionNode(), ListSortDirection.Ascending); + mMenSort.Click += (sender, args) => + { + if (sortedAz) + { + olvConnections.SortRecursive(olvConnections.GetRootConnectionNode(), ListSortDirection.Ascending); + mMenSort.Image = mRemoteNG.Resources.Sort_ZA; + sortedAz = false; + } + else + { + olvConnections.SortRecursive(olvConnections.GetRootConnectionNode(), ListSortDirection.Descending); + mMenSort.Image = mRemoteNG.Resources.Sort_AZ; + sortedAz = true; + } + }; mMenFavorites.Click += (sender, args) => { mMenFavorites.DropDownItems.Clear(); diff --git a/mRemoteV1/UI/Window/PortScanWindow.Designer.cs b/mRemoteV1/UI/Window/PortScanWindow.Designer.cs index b402e7a3..3335691b 100644 --- a/mRemoteV1/UI/Window/PortScanWindow.Designer.cs +++ b/mRemoteV1/UI/Window/PortScanWindow.Designer.cs @@ -1,4 +1,4 @@ - + using mRemoteNG.Themes; using mRemoteNG.UI.Controls;