-
-
Notifications
You must be signed in to change notification settings - Fork 449
[Program Plugin] Support .url file #1476
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
750cfa4
Support .url file
LeLocTai b559ad1
Adjust Text / Change Button / Add Layout
onesounds c27761e
- Adjust Strings
onesounds 24ad8ed
Adjust Strings and add guide text
onesounds d5be961
Adjust margin
onesounds d13c381
Data binding for suffixes
VictoriousRaptor b77a8f7
Fix suffixes
VictoriousRaptor 1715f81
protocols setting
VictoriousRaptor 5103b2b
Update text
VictoriousRaptor 642ea4a
bugfix
VictoriousRaptor 6f46504
Adjust text
VictoriousRaptor 2ba1559
bugfix
VictoriousRaptor 568dced
Check null
VictoriousRaptor c8dfd56
Check if url field is null
VictoriousRaptor af7539a
Merge branch 'dev' into dev
VictoriousRaptor c194d21
Fix IcoPath for epic urls
VictoriousRaptor 902c88d
fix typo
VictoriousRaptor d1bb08a
Merge branch 'dev' into dev
VictoriousRaptor cc65562
Save settings
VictoriousRaptor 81555ec
formatting
jjw24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 44 additions & 12 deletions
56
Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,76 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Windows; | ||
|
||
namespace Flow.Launcher.Plugin.Program | ||
{ | ||
/// <summary> | ||
/// ProgramSuffixes.xaml 的交互逻辑 | ||
/// </summary> | ||
public partial class ProgramSuffixes | ||
{ | ||
private PluginInitContext context; | ||
private Settings _settings; | ||
public Dictionary<string, bool> SuffixesStatus { get; set; } | ||
public Dictionary<string, bool> ProtocolsStatus { get; set; } | ||
public bool UseCustomSuffixes { get; set; } | ||
public bool UseCustomProtocols { get; set; } | ||
|
||
public ProgramSuffixes(PluginInitContext context, Settings settings) | ||
{ | ||
this.context = context; | ||
InitializeComponent(); | ||
_settings = settings; | ||
tbSuffixes.Text = string.Join(Settings.SuffixSeperator.ToString(), _settings.ProgramSuffixes); | ||
SuffixesStatus = new Dictionary<string, bool>(_settings.BuiltinSuffixesStatus); | ||
ProtocolsStatus = new Dictionary<string, bool>(_settings.BuiltinProtocolsStatus); | ||
UseCustomSuffixes = _settings.UseCustomSuffixes; | ||
UseCustomProtocols = _settings.UseCustomProtocols; | ||
InitializeComponent(); | ||
tbSuffixes.Text = string.Join(Settings.SuffixSeparator, _settings.CustomSuffixes); | ||
tbProtocols.Text = string.Join(Settings.SuffixSeparator, _settings.CustomProtocols); | ||
} | ||
|
||
private void BtnCancel_OnClick(object sender, RoutedEventArgs e) | ||
{ | ||
Close(); | ||
} | ||
private void ButtonBase_OnClick(object sender, RoutedEventArgs e) | ||
|
||
private void BtnAdd_OnClick(object sender, RoutedEventArgs e) | ||
{ | ||
var suffixes = tbSuffixes.Text.Split(Settings.SuffixSeperator, StringSplitOptions.RemoveEmptyEntries); | ||
var suffixes = tbSuffixes.Text.Split(Settings.SuffixSeparator, StringSplitOptions.RemoveEmptyEntries); | ||
var protocols = tbProtocols.Text.Split(Settings.SuffixSeparator, StringSplitOptions.RemoveEmptyEntries); | ||
|
||
if (suffixes.Length == 0) | ||
if (suffixes.Length == 0 && UseCustomSuffixes) | ||
{ | ||
string warning = context.API.GetTranslation("flowlauncher_plugin_program_suffixes_cannot_empty"); | ||
MessageBox.Show(warning); | ||
return; | ||
} | ||
|
||
_settings.ProgramSuffixes = suffixes; | ||
if (protocols.Length == 0 && UseCustomProtocols) | ||
{ | ||
string warning = context.API.GetTranslation("flowlauncher_plugin_protocols_cannot_empty"); | ||
MessageBox.Show(warning); | ||
return; | ||
} | ||
|
||
string msg = context.API.GetTranslation("flowlauncher_plugin_program_update_file_suffixes"); | ||
MessageBox.Show(msg); | ||
_settings.CustomSuffixes = suffixes; | ||
_settings.CustomProtocols = protocols; | ||
_settings.BuiltinSuffixesStatus = new Dictionary<string, bool>(SuffixesStatus); | ||
_settings.BuiltinProtocolsStatus = new Dictionary<string, bool>(ProtocolsStatus); | ||
_settings.UseCustomSuffixes = UseCustomSuffixes; | ||
_settings.UseCustomProtocols = UseCustomProtocols; | ||
|
||
DialogResult = true; | ||
} | ||
|
||
private void BtnReset_OnClick(object sender, RoutedEventArgs e) | ||
{ | ||
apprefMS.IsChecked = true; | ||
exe.IsChecked = true; | ||
lnk.IsChecked = true; | ||
CustomFiles.IsChecked = false; | ||
|
||
steam.IsChecked = true; | ||
epic.IsChecked = true; | ||
http.IsChecked = false; | ||
CustomProtocol.IsChecked = false; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The loadFullImage will not do anything actually. We may want to change how cache work later. pending to be do in #1351.