Skip to content

Commit b7da4a9

Browse files
committed
Update tooltips for results
1 parent af3dfc7 commit b7da4a9

File tree

1 file changed

+30
-14
lines changed

1 file changed

+30
-14
lines changed

Flow.Launcher.Plugin.OneNote/ResultCreator.cs

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public class ResultCreator
1717
private readonly IconProvider iconProvider;
1818

1919
private const string PathSeparator = " > ";
20-
private const string Unread = "\u2022 ";
20+
private const string BulletPoint = "\u2022 ";
21+
private const string TrianglePoint = "\u2023 ";
2122

2223
private string ActionKeyword => context.CurrentPluginMetadata.ActionKeyword;
2324
public ResultCreator(PluginInitContext context, Settings settings, IconProvider iconProvider)
@@ -36,14 +37,14 @@ private string GetTitle(IOneNoteItem item, List<int> highlightData)
3637
if (!item.IsUnread || !settings.ShowUnread)
3738
return title;
3839

39-
title = title.Insert(0, Unread);
40+
title = title.Insert(0, BulletPoint);
4041

4142
if (highlightData == null)
4243
return title;
4344

4445
for (int i = 0; i < highlightData.Count; i++)
4546
{
46-
highlightData[i] += Unread.Length;
47+
highlightData[i] += BulletPoint.Length;
4748
}
4849
return title;
4950

@@ -143,19 +144,30 @@ public Result CreateOneNoteItemResult(IOneNoteItem item, bool actionIsAutoComple
143144
{
144145
case OneNoteNotebook notebook:
145146
toolTip =
146-
$"Last Modified:\t{notebook.LastModified:F}\n" +
147-
$"Sections:\t\t{notebook.Sections.Count()}\n" +
148-
$"Sections Groups:\t{notebook.SectionGroups.Count()}";
147+
$"""
148+
Last Modified:
149+
{TrianglePoint}{notebook.LastModified:F}
150+
151+
Contains:
152+
{TrianglePoint}{"section group".ToQuantity(notebook.SectionGroups.Count())}
153+
{TrianglePoint}{"section".ToQuantity(notebook.Sections.Count())}
154+
{TrianglePoint}{"page".ToQuantity(notebook.GetPages().Count())}
155+
""";
149156

150157
subTitle = string.Empty;
151158
iconInfo = new IconGeneratorInfo(notebook);
152159
break;
153160
case OneNoteSectionGroup sectionGroup:
154161
toolTip =
155-
$"Path:\t\t{subTitle}\n" +
156-
$"Last Modified:\t{sectionGroup.LastModified:F}\n" +
157-
$"Sections:\t\t{sectionGroup.Sections.Count()}\n" +
158-
$"Sections Groups:\t{sectionGroup.SectionGroups.Count()}";
162+
$"""
163+
Last Modified:
164+
{TrianglePoint}{sectionGroup.LastModified:F}
165+
166+
Contains:
167+
{TrianglePoint}{"section group".ToQuantity(sectionGroup.SectionGroups.Count())}
168+
{TrianglePoint}{"section".ToQuantity(sectionGroup.Sections.Count())}
169+
{TrianglePoint}{"page".ToQuantity(sectionGroup.GetPages().Count())}
170+
""";
159171

160172
iconInfo = new IconGeneratorInfo(sectionGroup);
161173
break;
@@ -166,9 +178,13 @@ public Result CreateOneNoteItemResult(IOneNoteItem item, bool actionIsAutoComple
166178
}
167179

168180
toolTip =
169-
$"Path:\t\t{subTitle}\n" +
170-
$"Last Modified:\t{section.LastModified}\n" +
171-
$"Pages:\t\t{section.Pages.Count()}";
181+
$"""
182+
Last Modified:
183+
{TrianglePoint}{section.LastModified:F}
184+
185+
Contains:
186+
{TrianglePoint}{"page".ToQuantity(section.GetPages().Count())}
187+
""";
172188

173189
iconInfo = new IconGeneratorInfo(section);
174190
break;
@@ -179,7 +195,6 @@ public Result CreateOneNoteItemResult(IOneNoteItem item, bool actionIsAutoComple
179195

180196
subTitle = subTitle[..^(page.Name.Length + PathSeparator.Length)];
181197
toolTip =
182-
$"Path:\t\t {subTitle} \n" +
183198
$"Created:\t\t{page.Created:F}\n" +
184199
$"Last Modified:\t{page.LastModified:F}";
185200

@@ -382,6 +397,7 @@ public List<Result> ContextMenu(Result selectedResult)
382397
}
383398
return results;
384399
}
400+
385401
public List<Result> NoItemsInCollection(List<Result> results, IOneNoteItem parent)
386402
{
387403
// parent can be null if the collection only contains notebooks.

0 commit comments

Comments
 (0)