Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new public api function BackToQueryResults for chaning the query list back to query results list #3087

Merged
merged 3 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,15 @@ public interface IPublicAPI

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

/// <summary>
/// Back to the query results.
/// This method should run when selected item is from context menu or history.
/// </summary>
public void BackToQueryResults();
}
}
2 changes: 2 additions & 0 deletions Flow.Launcher/PublicAPIInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ public bool IsGameModeOn()

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

public void BackToQueryResults() => _mainVM.BackToQueryResults();

jjw24 marked this conversation as resolved.
Show resolved Hide resolved
#endregion

#region Private Methods
Expand Down
10 changes: 9 additions & 1 deletion Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
Expand Down Expand Up @@ -484,6 +484,14 @@ private void Esc()
}
}

public void BackToQueryResults()
{
if (!SelectedIsFromQueryResults())
{
SelectedResults = Results;
}
}

[RelayCommand]
public void ToggleGameMode()
{
Expand Down
Loading