mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-14 11:39:16 +08:00
Fix query history for the new result panel
This commit is contained in:
parent
d946e18fa2
commit
e3cdfe27d1
@ -473,6 +473,7 @@ namespace Wox
|
|||||||
|
|
||||||
private void ResetQueryHistoryIndex()
|
private void ResetQueryHistoryIndex()
|
||||||
{
|
{
|
||||||
|
pnlResult.RemoveResultsFor(QueryHistoryStorage.MetaData);
|
||||||
QueryHistoryStorage.Instance.Reset();
|
QueryHistoryStorage.Instance.Reset();
|
||||||
}
|
}
|
||||||
private void Query(string text)
|
private void Query(string text)
|
||||||
@ -487,18 +488,18 @@ namespace Wox
|
|||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(keyword))
|
if (!string.IsNullOrEmpty(keyword))
|
||||||
{
|
{
|
||||||
pnlResult.RemoveResultsExcept(PluginManager.NonGlobalPlugins[keyword]);
|
pnlResult.RemoveResultsExcept(PluginManager.NonGlobalPlugins[keyword].Metadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(keyword))
|
if (string.IsNullOrEmpty(keyword))
|
||||||
{
|
{
|
||||||
pnlResult.RemoveResultsFor(PluginManager.NonGlobalPlugins[lastKeyword]);
|
pnlResult.RemoveResultsFor(PluginManager.NonGlobalPlugins[lastKeyword].Metadata);
|
||||||
}
|
}
|
||||||
else if (lastKeyword != keyword)
|
else if (lastKeyword != keyword)
|
||||||
{
|
{
|
||||||
pnlResult.RemoveResultsExcept(PluginManager.NonGlobalPlugins[keyword]);
|
pnlResult.RemoveResultsExcept(PluginManager.NonGlobalPlugins[keyword].Metadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_lastQuery = query;
|
_lastQuery = query;
|
||||||
@ -738,14 +739,11 @@ namespace Wox
|
|||||||
{
|
{
|
||||||
if (history != null)
|
if (history != null)
|
||||||
{
|
{
|
||||||
var historyMetadata = new PluginMetadata
|
var historyMetadata = QueryHistoryStorage.MetaData;
|
||||||
{
|
|
||||||
ID = "Query history",
|
|
||||||
Name = "Query history"
|
|
||||||
};
|
|
||||||
ChangeQueryText(history.Query, true);
|
ChangeQueryText(history.Query, true);
|
||||||
var executeQueryHistoryTitle = GetTranslation("executeQuery");
|
var executeQueryHistoryTitle = GetTranslation("executeQuery");
|
||||||
var lastExecuteTime = GetTranslation("lastExecuteTime");
|
var lastExecuteTime = GetTranslation("lastExecuteTime");
|
||||||
|
pnlResult.RemoveResultsExcept(historyMetadata);
|
||||||
UpdateResultViewInternal(new List<Result>()
|
UpdateResultViewInternal(new List<Result>()
|
||||||
{
|
{
|
||||||
new Result(){
|
new Result(){
|
||||||
|
@ -40,19 +40,19 @@ namespace Wox
|
|||||||
|
|
||||||
public int MaxResultsToShow { get { return UserSettingStorage.Instance.MaxResultsToShow * 50; } }
|
public int MaxResultsToShow { get { return UserSettingStorage.Instance.MaxResultsToShow * 50; } }
|
||||||
|
|
||||||
internal void RemoveResultsFor(PluginPair plugin)
|
internal void RemoveResultsFor(PluginMetadata metadata)
|
||||||
{
|
{
|
||||||
lock (_resultsUpdateLock)
|
lock (_resultsUpdateLock)
|
||||||
{
|
{
|
||||||
_results.RemoveAll(r => r.PluginID == plugin.Metadata.ID);
|
_results.RemoveAll(r => r.PluginID == metadata.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void RemoveResultsExcept(PluginPair plugin)
|
internal void RemoveResultsExcept(PluginMetadata metadata)
|
||||||
{
|
{
|
||||||
lock (_resultsUpdateLock)
|
lock (_resultsUpdateLock)
|
||||||
{
|
{
|
||||||
_results.RemoveAll(r => r.PluginID != plugin.Metadata.ID);
|
_results.RemoveAll(r => r.PluginID != metadata.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wox.Infrastructure.Storage;
|
using Wox.Infrastructure.Storage;
|
||||||
|
using Wox.Plugin;
|
||||||
|
|
||||||
namespace Wox.Storage
|
namespace Wox.Storage
|
||||||
{
|
{
|
||||||
@ -16,6 +17,9 @@ namespace Wox.Storage
|
|||||||
private int MaxHistory = 300;
|
private int MaxHistory = 300;
|
||||||
private int cursor = 0;
|
private int cursor = 0;
|
||||||
|
|
||||||
|
public static PluginMetadata MetaData { get; } = new PluginMetadata
|
||||||
|
{ ID = "Query history", Name = "Query history" };
|
||||||
|
|
||||||
protected override string ConfigFolder
|
protected override string ConfigFolder
|
||||||
{
|
{
|
||||||
get { return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Config"); }
|
get { return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Config"); }
|
||||||
|
Loading…
Reference in New Issue
Block a user