From 492c02eea4660d01d2de89249b3524f9e1e75119 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 30 Jun 2020 06:45:04 +1000 Subject: [PATCH] add custom plugin ToolTip on result hover over --- Flow.Launcher.Plugin/Result.cs | 10 ++++++++++ Flow.Launcher/ResultListBox.xaml | 4 ++-- Flow.Launcher/ViewModel/ResultViewModel.cs | 8 ++++++++ .../Flow.Launcher.Plugin.Explorer/Search/Constants.cs | 2 +- .../Search/ResultManager.cs | 6 +++++- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index bfd2fb0a4..d210ba1d8 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -130,5 +130,15 @@ namespace Flow.Launcher.Plugin /// Plugin ID that generated this result /// public string PluginID { get; internal set; } + + /// + /// Show message as ToolTip on result Title hover over + /// + public string TitleToolTip { get; set; } + + /// + /// Show message as ToolTip on result SubTitle hover over + /// + public string SubTitleToolTip { get; set; } } } \ No newline at end of file diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index a8560c263..3280dc457 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -62,7 +62,7 @@ @@ -71,7 +71,7 @@ - diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 0a9731f18..4392234eb 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -29,6 +29,14 @@ namespace Flow.Launcher.ViewModel public string OpenResultModifiers => Settings.OpenResultModifiers; + public string ShowTitleToolTip => string.IsNullOrEmpty(Result.TitleToolTip) + ? Result.Title + : Result.TitleToolTip; + + public string ShowSubTitleToolTip => string.IsNullOrEmpty(Result.SubTitleToolTip) + ? Result.SubTitle + : Result.SubTitleToolTip; + public ImageSource Image { get diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs index 9c8a300bc..5285dfe6e 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs @@ -16,7 +16,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search internal const string DifferentUserIconImagePath = "Images\\user.png"; internal const string IndexingOptionsIconImagePath = "Images\\windowsindexingoptions.png"; - internal const string DefaultFolderSubtitleString = "Ctrl + Enter to open the directory"; + internal const string ToolTipOpenDirectory = "Ctrl + Enter to open the directory"; internal const char AllFilesFolderSearchWildcard = '>'; diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index e2fd1c7da..dacc57c22 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -38,13 +38,15 @@ namespace Flow.Launcher.Plugin.Explorer.Search return false; } } - + string changeTo = path.EndsWith(Constants.DirectorySeperator) ? path : path + Constants.DirectorySeperator; context.API.ChangeQuery(string.IsNullOrEmpty(query.ActionKeyword) ? changeTo : query.ActionKeyword + " " + changeTo); return false; }, + TitleToolTip = Constants.ToolTipOpenDirectory, + SubTitleToolTip = Constants.ToolTipOpenDirectory, ContextData = new SearchResult { Type = ResultType.Folder, FullPath = path, ShowIndexState = showIndexState, WindowsIndexed = windowsIndexed } }; } @@ -85,6 +87,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search FilesFolders.OpenPath(retrievedDirectoryPath); return true; }, + TitleToolTip = Constants.ToolTipOpenDirectory, + SubTitleToolTip = Constants.ToolTipOpenDirectory, ContextData = new SearchResult { Type = ResultType.Folder, FullPath = retrievedDirectoryPath, ShowIndexState = true, WindowsIndexed = windowsIndexed } }; }