Skip to content

Commit aee5856

Browse files
committed
Remove back to query result and call this function in ChangeQuery & ReQuery
1 parent 2843236 commit aee5856

File tree

11 files changed

+8
-39
lines changed

11 files changed

+8
-39
lines changed

Flow.Launcher.Core/Plugin/JsonRPCV2Models/JsonRPCPublicAPI.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,5 @@ public void OpenAppUri(string appUri)
170170
{
171171
_api.OpenAppUri(appUri);
172172
}
173-
174-
public void BackToQueryResults()
175-
{
176-
_api.BackToQueryResults();
177-
}
178173
}
179174
}

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ namespace Flow.Launcher.Plugin
1717
public interface IPublicAPI
1818
{
1919
/// <summary>
20-
/// Change Flow.Launcher query
20+
/// Change Flow.Launcher query.
21+
/// When current results is from context menu or history, we will back to query results before changing query.
2122
/// </summary>
2223
/// <param name="query">query text</param>
2324
/// <param name="requery">
@@ -299,17 +300,11 @@ public interface IPublicAPI
299300

300301
/// <summary>
301302
/// Reloads the query.
302-
/// This method should run when selected item is from query results.
303+
/// When current results is from context menu or history, we will back to query results before changing query.
303304
/// </summary>
304305
/// <param name="reselect">Choose the first result after reload if true; keep the last selected result if false. Default is true.</param>
305306
public void ReQuery(bool reselect = true);
306307

307-
/// <summary>
308-
/// Back to the query results.
309-
/// This method should run when selected item is from context menu or history.
310-
/// </summary>
311-
public void BackToQueryResults();
312-
313308
/// <summary>
314309
/// Displays a standardised Flow message box.
315310
/// </summary>

Flow.Launcher/CustomQueryHotkeySetting.xaml.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ public void UpdateItem(CustomPluginHotkey item)
7676

7777
private void BtnTestActionKeyword_OnClick(object sender, RoutedEventArgs e)
7878
{
79-
// if user happens to open context menu, we need to return back to query results before changing query
80-
App.API.BackToQueryResults();
8179
App.API.ChangeQuery(tbAction.Text);
8280
Application.Current.MainWindow.Show();
8381
Application.Current.MainWindow.Opacity = 1;

Flow.Launcher/CustomShortcutSetting.xaml.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ private void cmdEsc_OnPress(object sender, ExecutedRoutedEventArgs e)
6464

6565
private void BtnTestShortcut_OnClick(object sender, RoutedEventArgs e)
6666
{
67-
// if user happens to open context menu, we need to return back to query results before changing query
68-
App.API.BackToQueryResults();
6967
App.API.ChangeQuery(tbExpand.Text);
7068
Application.Current.MainWindow.Show();
7169
Application.Current.MainWindow.Opacity = 1;

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,6 @@ public bool IsGameModeOn()
319319

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

322-
public void BackToQueryResults() => _mainVM.BackToQueryResults();
323-
324322
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.OK) =>
325323
MessageBoxEx.Show(messageBoxText, caption, button, icon, defaultResult);
326324

Flow.Launcher/ResultListBox.xaml.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,7 @@ private void ResultList_MouseMove(object sender, MouseEventArgs e)
149149
var rawQuery = query;
150150
var effect = DragDrop.DoDragDrop((DependencyObject)sender, data, DragDropEffects.Move | DragDropEffects.Copy);
151151
if (effect == DragDropEffects.Move)
152-
{
153-
// if user happens to open context menu, we need to return back to query results before changing query
154-
App.API.BackToQueryResults();
155152
App.API.ChangeQuery(rawQuery, true);
156-
}
157153
}
158154
private void ResultListBox_OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
159155
{

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,8 @@ public void ReQuery()
279279

280280
public void ReQuery(bool reselect)
281281
{
282-
if (SelectedIsFromQueryResults())
283-
{
284-
QueryResults(isReQuery: true, reSelect: reselect);
285-
}
282+
BackToQueryResults();
283+
QueryResults(isReQuery: true, reSelect: reselect);
286284
}
287285

288286
[RelayCommand]
@@ -491,7 +489,7 @@ private void Esc()
491489
}
492490
}
493491

494-
public void BackToQueryResults()
492+
private void BackToQueryResults()
495493
{
496494
if (!SelectedIsFromQueryResults())
497495
{
@@ -610,6 +608,8 @@ public void ChangeQueryText(string queryText, bool isReQuery = false)
610608
{
611609
Application.Current.Dispatcher.Invoke(() =>
612610
{
611+
BackToQueryResults();
612+
613613
if (QueryText != queryText)
614614
{
615615
// re-query is done in QueryText's setter method
@@ -1266,8 +1266,6 @@ private Result ContextMenuTopMost(Result result)
12661266
{
12671267
_topMostRecord.Remove(result);
12681268
App.API.ShowMsg(InternationalizationManager.Instance.GetTranslation("success"));
1269-
// if user happens to open context menu, we need to return back to query results before changing query
1270-
App.API.BackToQueryResults();
12711269
App.API.ReQuery();
12721270
return false;
12731271
}
@@ -1285,8 +1283,6 @@ private Result ContextMenuTopMost(Result result)
12851283
{
12861284
_topMostRecord.AddOrUpdate(result);
12871285
App.API.ShowMsg(InternationalizationManager.Instance.GetTranslation("success"));
1288-
// if user happens to open context menu, we need to return back to query results before changing query
1289-
App.API.BackToQueryResults();
12901286
App.API.ReQuery();
12911287
return false;
12921288
}

Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ public string Category
6464
private void ShowCommandQuery(string action)
6565
{
6666
var actionKeyword = PluginManagerData.Metadata.ActionKeywords.Any() ? PluginManagerData.Metadata.ActionKeywords[0] + " " : String.Empty;
67-
// if user happens to open context menu, we need to return back to query results before changing query
68-
App.API.BackToQueryResults();
6967
App.API.ChangeQuery($"{actionKeyword}{action} {_plugin.Name}");
7068
App.API.ShowMainWindow();
7169
}

Flow.Launcher/ViewModel/PluginViewModel.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ private void OpenSourceCodeLink()
146146
[RelayCommand]
147147
private void OpenDeletePluginWindow()
148148
{
149-
// if user happens to open context menu, we need to return back to query results before changing query
150-
PluginManager.API.BackToQueryResults();
151149
PluginManager.API.ChangeQuery($"{PluginManagerActionKeyword} uninstall {PluginPair.Metadata.Name}".Trim(), true);
152150
PluginManager.API.ShowMainWindow();
153151
}
@@ -161,5 +159,4 @@ private void SetActionKeywords()
161159
changeKeywordsWindow.ShowDialog();
162160
}
163161
}
164-
165162
}

Plugins/Flow.Launcher.Plugin.Program/Main.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ public List<Result> LoadContextMenus(Result selectedResult)
264264
Context.API.GetTranslation("flowlauncher_plugin_program_disable_dlgtitle_success"),
265265
Context.API.GetTranslation(
266266
"flowlauncher_plugin_program_disable_dlgtitle_success_message"));
267-
Context.API.BackToQueryResults();
268267
Context.API.ReQuery();
269268
return false;
270269
},

0 commit comments

Comments
 (0)