From 3c3087793a354c3b2b687a9f5ba1b9e4e69bd40a Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Thu, 21 Nov 2024 19:18:05 +0800
Subject: [PATCH 1/2] add new public api for chaning the query list back to
query results list
---
Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs | 6 ++++++
Flow.Launcher/PublicAPIInstance.cs | 2 ++
Flow.Launcher/ViewModel/MainViewModel.cs | 10 +++++++++-
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
index c95a8ce7b23..e5df91ae978 100644
--- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
+++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
@@ -298,5 +298,11 @@ public interface IPublicAPI
///
/// Choose the first result after reload if true; keep the last selected result if false. Default is true.
public void ReQuery(bool reselect = true);
+
+ ///
+ /// Back to the query results.
+ /// This method should run when selected item is from context menu or history.
+ ///
+ public void BackToQueryResults();
}
}
diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs
index 20b02ddee8b..8a07e7a5c0a 100644
--- a/Flow.Launcher/PublicAPIInstance.cs
+++ b/Flow.Launcher/PublicAPIInstance.cs
@@ -318,6 +318,8 @@ public bool IsGameModeOn()
public void ReQuery(bool reselect = true) => _mainVM.ReQuery(reselect);
+ public void BackToQueryResults() => _mainVM.BackToQueryResults();
+
#endregion
#region Private Methods
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index 6c17e21f0d2..445484347ad 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
@@ -484,6 +484,14 @@ private void Esc()
}
}
+ public void BackToQueryResults()
+ {
+ if (!SelectedIsFromQueryResults())
+ {
+ SelectedResults = Results;
+ }
+ }
+
[RelayCommand]
public void ToggleGameMode()
{
From 6df0837906b07e7c84084fa8ceb6e49ce7ce5529 Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Thu, 21 Nov 2024 19:18:15 +0800
Subject: [PATCH 2/2] improve requery doc
---
Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
index e5df91ae978..f3d7731223d 100644
--- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
+++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
@@ -294,7 +294,7 @@ public interface IPublicAPI
///
/// Reloads the query.
- /// This method should run
+ /// This method should run when selected item is from query results.
///
/// Choose the first result after reload if true; keep the last selected result if false. Default is true.
public void ReQuery(bool reselect = true);