Skip to content

Commit ac872ac

Browse files
authored
Merge pull request #3087 from Jack251970/dev1
Add new public api function BackToQueryResults for chaning the query list back to query results list
2 parents 304f98e + bce07ee commit ac872ac

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Flow.Launcher.Plugin.SharedModels;
1+
using Flow.Launcher.Plugin.SharedModels;
22
using JetBrains.Annotations;
33
using System;
44
using System.Collections.Generic;
@@ -295,11 +295,17 @@ public interface IPublicAPI
295295

296296
/// <summary>
297297
/// Reloads the query.
298-
/// This method should run
298+
/// This method should run when selected item is from query results.
299299
/// </summary>
300300
/// <param name="reselect">Choose the first result after reload if true; keep the last selected result if false. Default is true.</param>
301301
public void ReQuery(bool reselect = true);
302302

303+
/// <summary>
304+
/// Back to the query results.
305+
/// This method should run when selected item is from context menu or history.
306+
/// </summary>
307+
public void BackToQueryResults();
308+
303309
/// <summary>
304310
/// Displays a standardised Flow message box.
305311
/// </summary>

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Net;
@@ -319,6 +319,8 @@ public bool IsGameModeOn()
319319

320320
public void ReQuery(bool reselect = true) => _mainVM.ReQuery(reselect);
321321

322+
public void BackToQueryResults() => _mainVM.BackToQueryResults();
323+
322324
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.OK) =>
323325
MessageBoxEx.Show(messageBoxText, caption, button, icon, defaultResult);
324326

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,14 @@ private void Esc()
486486
}
487487
}
488488

489+
public void BackToQueryResults()
490+
{
491+
if (!SelectedIsFromQueryResults())
492+
{
493+
SelectedResults = Results;
494+
}
495+
}
496+
489497
[RelayCommand]
490498
public void ToggleGameMode()
491499
{

0 commit comments

Comments
 (0)