Merge remote-tracking branch 'origin/dev' into update_python_msg

This commit is contained in:
Jeremy 2021-09-15 21:17:49 +10:00
commit cfca962ba1
7 changed files with 31 additions and 35 deletions

View file

@ -75,10 +75,10 @@ namespace Flow.Launcher.Plugin.Explorer.Search
keyword == Settings.SearchActionKeyword, keyword == Settings.SearchActionKeyword,
Settings.ActionKeyword.PathSearchActionKeyword => Settings.PathSearchKeywordEnabled && Settings.ActionKeyword.PathSearchActionKeyword => Settings.PathSearchKeywordEnabled &&
keyword == Settings.PathSearchActionKeyword, keyword == Settings.PathSearchActionKeyword,
Settings.ActionKeyword.FileContentSearchActionKeyword => keyword == Settings.ActionKeyword.FileContentSearchActionKeyword => Settings.FileContentSearchKeywordEnabled &&
Settings.FileContentSearchActionKeyword, keyword == Settings.FileContentSearchActionKeyword,
Settings.ActionKeyword.IndexSearchActionKeyword => Settings.IndexOnlySearchKeywordEnabled && Settings.ActionKeyword.IndexSearchActionKeyword => Settings.IndexSearchKeywordEnabled &&
keyword == Settings.IndexSearchActionKeyword keyword == Settings.IndexSearchActionKeyword
}; };
} }

View file

@ -1,9 +1,7 @@
using Flow.Launcher.Plugin.Explorer.Search; using Flow.Launcher.Plugin.Explorer.Search;
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks; using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
using Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
namespace Flow.Launcher.Plugin.Explorer namespace Flow.Launcher.Plugin.Explorer
{ {
@ -25,13 +23,15 @@ namespace Flow.Launcher.Plugin.Explorer
public string FileContentSearchActionKeyword { get; set; } = Constants.DefaultContentSearchActionKeyword; public string FileContentSearchActionKeyword { get; set; } = Constants.DefaultContentSearchActionKeyword;
public bool FileContentSearchKeywordEnabled { get; set; } = true;
public string PathSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; public string PathSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
public bool PathSearchKeywordEnabled { get; set; } public bool PathSearchKeywordEnabled { get; set; }
public string IndexSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; public string IndexSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
public bool IndexOnlySearchKeywordEnabled { get; set; } public bool IndexSearchKeywordEnabled { get; set; }
public bool WarnWindowsSearchServiceOff { get; set; } = true; public bool WarnWindowsSearchServiceOff { get; set; } = true;
@ -48,7 +48,8 @@ namespace Flow.Launcher.Plugin.Explorer
ActionKeyword.SearchActionKeyword => SearchActionKeyword, ActionKeyword.SearchActionKeyword => SearchActionKeyword,
ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword, ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword,
ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword, ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword,
ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword,
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyWord property not found")
}; };
internal void SetActionKeyword(ActionKeyword actionKeyword, string keyword) => _ = actionKeyword switch internal void SetActionKeyword(ActionKeyword actionKeyword, string keyword) => _ = actionKeyword switch
@ -57,23 +58,25 @@ namespace Flow.Launcher.Plugin.Explorer
ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword = keyword, ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword = keyword,
ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword = keyword, ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword = keyword,
ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword = keyword, ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword = keyword,
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property") _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyWord property not found")
}; };
internal bool? GetActionKeywordEnabled(ActionKeyword actionKeyword) => actionKeyword switch internal bool GetActionKeywordEnabled(ActionKeyword actionKeyword) => actionKeyword switch
{ {
ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled, ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled,
ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled, ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled,
ActionKeyword.IndexSearchActionKeyword => IndexOnlySearchKeywordEnabled, ActionKeyword.IndexSearchActionKeyword => IndexSearchKeywordEnabled,
_ => null ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled,
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyword enabled status not defined")
}; };
internal void SetActionKeywordEnabled(ActionKeyword actionKeyword, bool enable) => _ = actionKeyword switch internal void SetActionKeywordEnabled(ActionKeyword actionKeyword, bool enable) => _ = actionKeyword switch
{ {
ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled = enable, ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled = enable,
ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled = enable, ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled = enable,
ActionKeyword.IndexSearchActionKeyword => IndexOnlySearchKeywordEnabled = enable, ActionKeyword.IndexSearchActionKeyword => IndexSearchKeywordEnabled = enable,
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property") ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled = enable,
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyword enabled status not defined")
}; };
} }
} }

View file

@ -30,8 +30,7 @@
<CheckBox Name="ChkActionKeywordEnabled" ToolTip="{DynamicResource plugin_explorer_actionkeyword_enabled_tooltip}" <CheckBox Name="ChkActionKeywordEnabled" ToolTip="{DynamicResource plugin_explorer_actionkeyword_enabled_tooltip}"
Margin="10" Grid.Row="0" Grid.Column="2" Content="{DynamicResource plugin_explorer_actionkeyword_enabled}" Margin="10" Grid.Row="0" Grid.Column="2" Content="{DynamicResource plugin_explorer_actionkeyword_enabled}"
Width="auto" Width="auto"
VerticalAlignment="Center" IsChecked="{Binding Enabled}" VerticalAlignment="Center" IsChecked="{Binding Enabled}" />
Visibility="{Binding Visible}"/>
<Button Name="DownButton" <Button Name="DownButton"
Click="OnDoneButtonClick" Grid.Row="1" Grid.Column="2" Click="OnDoneButtonClick" Grid.Row="1" Grid.Column="2"
Margin="10 0 10 0" Width="80" Height="35" Margin="10 0 10 0" Width="80" Height="35"

View file

@ -19,22 +19,18 @@ namespace Flow.Launcher.Plugin.Explorer.Views
public string ActionKeyword public string ActionKeyword
{ {
get => _actionKeyword; get => actionKeyword;
set set
{ {
// Set Enable to be true if user change ActionKeyword // Set Enable to be true if user change ActionKeyword
if (Enabled is not null) Enabled = true;
Enabled = true; actionKeyword = value;
_actionKeyword = value;
} }
} }
public bool? Enabled { get; set; } public bool Enabled { get; set; }
private string _actionKeyword; private string actionKeyword;
public Visibility Visible =>
CurrentActionKeyword.Enabled is not null ? Visibility.Visible : Visibility.Collapsed;
public ActionKeywordSetting(SettingsViewModel settingsViewModel, public ActionKeywordSetting(SettingsViewModel settingsViewModel,
ActionKeywordView selectedActionKeyword) ActionKeywordView selectedActionKeyword)
@ -74,8 +70,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
var oldActionKeyword = CurrentActionKeyword.Keyword; var oldActionKeyword = CurrentActionKeyword.Keyword;
// == because of nullable if (!Enabled || !settingsViewModel.IsActionKeywordAlreadyAssigned(ActionKeyword))
if (Enabled == false || !settingsViewModel.IsActionKeywordAlreadyAssigned(ActionKeyword))
{ {
// Update View Data // Update View Data
CurrentActionKeyword.Keyword = Enabled == true ? ActionKeyword : Query.GlobalPluginWildcardSign; CurrentActionKeyword.Keyword = Enabled == true ? ActionKeyword : Query.GlobalPluginWildcardSign;
@ -84,7 +79,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
switch (Enabled) switch (Enabled)
{ {
// reset to global so it does not take up an action keyword when disabled // reset to global so it does not take up an action keyword when disabled
// not for null Enable plugin // not for null Enable plugin
case false when oldActionKeyword != Query.GlobalPluginWildcardSign: case false when oldActionKeyword != Query.GlobalPluginWildcardSign:
settingsViewModel.UpdateActionKeyword(CurrentActionKeyword.KeywordProperty, settingsViewModel.UpdateActionKeyword(CurrentActionKeyword.KeywordProperty,
Query.GlobalPluginWildcardSign, oldActionKeyword); Query.GlobalPluginWildcardSign, oldActionKeyword);

View file

@ -325,7 +325,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
} }
public string Description { get; private init; } public string Description { get; private init; }
public string Color => Enabled ?? true ? "Black" : "Gray"; public string Color => Enabled ? "Black" : "Gray";
internal Settings.ActionKeyword KeywordProperty { get; } internal Settings.ActionKeyword KeywordProperty { get; }
@ -335,11 +335,10 @@ namespace Flow.Launcher.Plugin.Explorer.Views
set => _settings.SetActionKeyword(KeywordProperty, value); set => _settings.SetActionKeyword(KeywordProperty, value);
} }
public bool? Enabled public bool Enabled
{ {
get => _settings.GetActionKeywordEnabled(KeywordProperty); get => _settings.GetActionKeywordEnabled(KeywordProperty);
set => _settings.SetActionKeywordEnabled(KeywordProperty, set => _settings.SetActionKeywordEnabled(KeywordProperty, value);
value ?? throw new ArgumentException("Unexpected null value"));
} }
} }
} }

View file

@ -9,7 +9,7 @@
"Name": "Explorer", "Name": "Explorer",
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search", "Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
"Author": "Jeremy Wu", "Author": "Jeremy Wu",
"Version": "1.8.4", "Version": "1.8.5",
"Language": "csharp", "Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher", "Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll", "ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",

View file

@ -1,4 +1,4 @@
version: '1.8.2.{build}' version: '1.8.3.{build}'
init: init:
- ps: | - ps: |
@ -79,5 +79,5 @@ on_success:
if ($env:APPVEYOR_REPO_BRANCH -eq "master" -and $env:APPVEYOR_REPO_TAG -eq "true") if ($env:APPVEYOR_REPO_BRANCH -eq "master" -and $env:APPVEYOR_REPO_TAG -eq "true")
{ {
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
.\wingetcreate.exe update Flow-Launcher.Flow-Launcher -s true -u https://github.com/Flow-Launcher/Flow.Launcher/releases/download/v$env:flowVersion/Flow-Launcher-v$env:flowVersion.exe -v $env:flowVersion -t $env:winget_token .\wingetcreate.exe update Flow-Launcher.Flow-Launcher -s true -u https://github.com/Flow-Launcher/Flow.Launcher/releases/download/v$env:flowVersion/Flow-Launcher-Setup.exe -v $env:flowVersion -t $env:winget_token
} }