add custom plugin ToolTip on result hover over

This commit is contained in:
Jeremy Wu 2020-06-30 06:45:04 +10:00
parent 3fa3090ee3
commit 492c02eea4
5 changed files with 26 additions and 4 deletions

View file

@ -130,5 +130,15 @@ namespace Flow.Launcher.Plugin
/// Plugin ID that generated this result
/// </summary>
public string PluginID { get; internal set; }
/// <summary>
/// Show message as ToolTip on result Title hover over
/// </summary>
public string TitleToolTip { get; set; }
/// <summary>
/// Show message as ToolTip on result SubTitle hover over
/// </summary>
public string SubTitleToolTip { get; set; }
}
}

View file

@ -62,7 +62,7 @@
</TextBlock>
</StackPanel>
<TextBlock Style="{DynamicResource ItemTitleStyle}" DockPanel.Dock="Left"
VerticalAlignment="Center" ToolTip="{Binding Result.Title}" x:Name="Title"
VerticalAlignment="Center" ToolTip="{Binding ShowTitleToolTip}" x:Name="Title"
Text="{Binding Result.Title}">
<vm:ResultsViewModel.FormattedText>
<MultiBinding Converter="{StaticResource HighlightTextConverter}">
@ -71,7 +71,7 @@
</MultiBinding>
</vm:ResultsViewModel.FormattedText>
</TextBlock>
<TextBlock Style="{DynamicResource ItemSubTitleStyle}" ToolTip="{Binding Result.SubTitle}"
<TextBlock Style="{DynamicResource ItemSubTitleStyle}" ToolTip="{Binding ShowSubTitleToolTip}"
Grid.Row="1" x:Name="SubTitle" Text="{Binding Result.SubTitle}" MinWidth="750">
<vm:ResultsViewModel.FormattedText>
<MultiBinding Converter="{StaticResource HighlightTextConverter}">

View file

@ -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

View file

@ -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 = '>';

View file

@ -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 }
};
}