Skip to content

Commit 829fccf

Browse files
authored
Merge pull request #242 from Flow-Launcher/add_pluginsmanager_contextmenu
Add context menu for PluginsManager
2 parents f61a727 + 919f72b commit 829fccf

File tree

7 files changed

+66
-7
lines changed

7 files changed

+66
-7
lines changed

Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Flow.Launcher.Infrastructure.UserSettings;
2+
using Flow.Launcher.Plugin.PluginsManager.Models;
23
using System;
34
using System.Collections.Generic;
45
using System.Text;
@@ -19,11 +20,60 @@ public ContextMenu(PluginInitContext context, Settings settings)
1920

2021
public List<Result> LoadContextMenus(Result selectedResult)
2122
{
22-
// Open website
23-
// Go to source code
24-
// Report an issue?
25-
// Request a feature?
26-
return new List<Result>();
23+
var pluginManifestInfo = selectedResult.ContextData as UserPlugin;
24+
25+
return new List<Result>
26+
{
27+
new Result
28+
{
29+
Title = Context.API.GetTranslation("plugin_pluginsmanager_plugin_contextmenu_openwebsite_title"),
30+
SubTitle = Context.API.GetTranslation("plugin_pluginsmanager_plugin_contextmenu_openwebsite_subtitle"),
31+
IcoPath = "Images\\website.png",
32+
Action = _ =>
33+
{
34+
SharedCommands.SearchWeb.NewTabInBrowser(pluginManifestInfo.Website);
35+
return true;
36+
}
37+
},
38+
new Result
39+
{
40+
Title = Context.API.GetTranslation("plugin_pluginsmanager_plugin_contextmenu_gotosourcecode_title"),
41+
SubTitle = Context.API.GetTranslation("plugin_pluginsmanager_plugin_contextmenu_gotosourcecode_subtitle"),
42+
IcoPath = "Images\\sourcecode.png",
43+
Action = _ =>
44+
{
45+
SharedCommands.SearchWeb.NewTabInBrowser(pluginManifestInfo.UrlSourceCode);
46+
return true;
47+
}
48+
},
49+
new Result
50+
{
51+
Title = Context.API.GetTranslation("plugin_pluginsmanager_plugin_contextmenu_newissue_title"),
52+
SubTitle = Context.API.GetTranslation("plugin_pluginsmanager_plugin_contextmenu_newissue_subtitle"),
53+
IcoPath = "Images\\request.png",
54+
Action = _ =>
55+
{
56+
// standard UrlSourceCode format in PluginsManifest's plugins.json file: https://github.com/jjw24/WoxDictionary/tree/master
57+
var link = pluginManifestInfo.UrlSourceCode.StartsWith("https://github.com")
58+
? pluginManifestInfo.UrlSourceCode.Replace("/tree/master", "/issues/new/choose")
59+
: pluginManifestInfo.UrlSourceCode;
60+
61+
SharedCommands.SearchWeb.NewBrowserWindow(link);
62+
return true;
63+
}
64+
},
65+
new Result
66+
{
67+
Title = Context.API.GetTranslation("plugin_pluginsmanager_plugin_contextmenu_pluginsmanifest_title"),
68+
SubTitle = Context.API.GetTranslation("plugin_pluginsmanager_plugin_contextmenu_pluginsmanifest_subtitle"),
69+
IcoPath = selectedResult.IcoPath,
70+
Action = _ =>
71+
{
72+
SharedCommands.SearchWeb.NewBrowserWindow("https://github.com/Flow-Launcher/Flow.Launcher.PluginsManifest");
73+
return true;
74+
}
75+
}
76+
};
2777
}
2878
}
2979
}
49.6 KB
Loading
11.6 KB
Loading
131 KB
Loading

Plugins/Flow.Launcher.Plugin.PluginsManager/Languages/en.xaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,13 @@
1818
<system:String x:Key="plugin_pluginsmanager_plugin_description">Management of installing, uninstalling or updating Flow Launcher plugins</system:String>
1919

2020
<!--Context menu items-->
21+
<system:String x:Key="plugin_pluginsmanager_plugin_contextmenu_openwebsite_title">Open website</system:String>
22+
<system:String x:Key="plugin_pluginsmanager_plugin_contextmenu_openwebsite_subtitle">Visit the plugin's website</system:String>
23+
<system:String x:Key="plugin_pluginsmanager_plugin_contextmenu_gotosourcecode_title">See source code</system:String>
24+
<system:String x:Key="plugin_pluginsmanager_plugin_contextmenu_gotosourcecode_subtitle">See the plugin's source code</system:String>
25+
<system:String x:Key="plugin_pluginsmanager_plugin_contextmenu_newissue_title">Suggest an enhancement or submit an issue</system:String>
26+
<system:String x:Key="plugin_pluginsmanager_plugin_contextmenu_newissue_subtitle">Suggest an enhancement or submit an issue to the plugin developer</system:String>
27+
<system:String x:Key="plugin_pluginsmanager_plugin_contextmenu_pluginsmanifest_title">Go to Flow's plugins repository</system:String>
28+
<system:String x:Key="plugin_pluginsmanager_plugin_contextmenu_pluginsmanifest_subtitle">Visit the PluginsManifest repository to see comunity-made plugin submissions</system:String>
2129

2230
</ResourceDictionary>

Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ internal List<Result> RequestInstallOrUpdate(string searchName)
115115
InstallOrUpdate(x);
116116

117117
return true;
118-
}
118+
},
119+
ContextData = x
119120
})
120121
.ToList();
121122

Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Name": "Plugins Manager",
77
"Description": "Management of installing, uninstalling or updating Flow Launcher plugins",
88
"Author": "Jeremy Wu",
9-
"Version": "1.1.0",
9+
"Version": "1.2.0",
1010
"Language": "csharp",
1111
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
1212
"ExecuteFileName": "Flow.Launcher.Plugin.PluginsManager.dll",

0 commit comments

Comments
 (0)