From f399ef8f693a003d25587c052e247032dbd13deb Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Fri, 24 Oct 2014 13:09:51 +0800 Subject: [PATCH] fix #151 Add context menu for programs --- Plugins/Wox.Plugin.FindFile/Images/edit.png | Bin 5765 -> 0 bytes Plugins/Wox.Plugin.FindFile/Images/open.png | Bin 0 -> 941 bytes Plugins/Wox.Plugin.FindFile/Main.cs | 2 +- .../Wox.Plugin.FindFile.csproj | 6 ++-- Wox.Infrastructure/WindowsShellRun.cs | 17 ++++------ Wox.Plugin.SystemPlugins/Program/Programs.cs | 31 ++++++++++++++++-- Wox.Plugin/IPublicAPI.cs | 2 +- .../StringNullOrEmptyToVisibilityConverter.cs | 21 ++++++++++++ Wox/Images/menu.png | Bin 0 -> 346 bytes Wox/Images/open.png | Bin 0 -> 941 bytes Wox/MainWindow.xaml.cs | 4 +-- Wox/ResultPanel.xaml | 7 ++-- Wox/Wox.csproj | 8 +++++ 13 files changed, 76 insertions(+), 22 deletions(-) delete mode 100644 Plugins/Wox.Plugin.FindFile/Images/edit.png create mode 100644 Plugins/Wox.Plugin.FindFile/Images/open.png create mode 100644 Wox/Images/menu.png create mode 100644 Wox/Images/open.png diff --git a/Plugins/Wox.Plugin.FindFile/Images/edit.png b/Plugins/Wox.Plugin.FindFile/Images/edit.png deleted file mode 100644 index f1710b7c89c33e8a083dbec8c25ec8de38e4971a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5765 zcmV;07JBK4P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_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9dV7>0o)L_ebP-#thm2f9xcx>)NO@;-o3zQj7 z8K1frb85#YhRx~Q1sS$&l@(;j)$L?zVGMe0+2wRq&S+D|svF+#8D;eo9W*m|1q@xZ z8+gTYr?!Z(h2lNZ2Sw zbD!e<*49!F^B7mFkK2O_4=yQpI>E5qtMHA+)WDk`dT;%FVYX%+GtWvJPOY73cb9X; zL~thhIlYqjb@Bsed8Gfx2eZ7LbQyNM_&dG#dQi%*&Yh(SHXAN+FkI4HajMQ|`+Eb1 z(`|Qu1<5dPxc1tsP}XDnel5uY6V@(Wy(X)z$Ep>UzPQ))Z??g;MOJ^U7()Gxx_XZB zB|B*Tjbiv)xBquWx_ZUMf4(ojSH1XJ#rQ74K(2qjnCnNa^Pi7rd}ql}nd{fSZrwUN z<{$qQ1n;^2W03wGwC}-3<#oWMu3F+6QIe8al4_M)lnSI6j0_A7bPbGj4GlsJ46O_- ztxSMiGb;mw`x7p4qG-s?PsvQH1Zpra(={;EH3Didurjf*GPZzd;8AJp25MmNboFyt I=akR{03N=HV*mgE literal 0 HcmV?d00001 diff --git a/Plugins/Wox.Plugin.FindFile/Main.cs b/Plugins/Wox.Plugin.FindFile/Main.cs index f53522f852..6d35e1ac45 100644 --- a/Plugins/Wox.Plugin.FindFile/Main.cs +++ b/Plugins/Wox.Plugin.FindFile/Main.cs @@ -92,7 +92,7 @@ namespace Wox.Plugin.FindFile } return true; }, - IcoPath = "Images/edit.png" + IcoPath = "Images/open.png" }); if (!record.IsFolder) diff --git a/Plugins/Wox.Plugin.FindFile/Wox.Plugin.FindFile.csproj b/Plugins/Wox.Plugin.FindFile/Wox.Plugin.FindFile.csproj index 707e2744f4..4db15cf579 100644 --- a/Plugins/Wox.Plugin.FindFile/Wox.Plugin.FindFile.csproj +++ b/Plugins/Wox.Plugin.FindFile/Wox.Plugin.FindFile.csproj @@ -54,9 +54,6 @@ - - Always - Always @@ -66,6 +63,9 @@ Always + + Always + Always diff --git a/Wox.Infrastructure/WindowsShellRun.cs b/Wox.Infrastructure/WindowsShellRun.cs index 054802cc52..f8ec456b4a 100644 --- a/Wox.Infrastructure/WindowsShellRun.cs +++ b/Wox.Infrastructure/WindowsShellRun.cs @@ -78,7 +78,7 @@ namespace Wox.Infrastructure [DllImport("shlwapi.dll", CharSet = CharSet.Unicode)] static extern bool UrlIs(string pszUrl, int UrlIs); - static void ShellExecCmdLine(IntPtr hInstance, IntPtr hwnd, string command, string startDir, global::System.Diagnostics.ProcessWindowStyle nShow, ShellExecCmdLineFlags dwSeclFlags) + static void ShellExecCmdLine(IntPtr hInstance, IntPtr hwnd, string command, string startDir, global::System.Diagnostics.ProcessWindowStyle nShow, ShellExecCmdLineFlags dwSeclFlags,bool runAsAdministrator = false) { string cmd = command; string args = null; @@ -143,6 +143,7 @@ namespace Wox.Infrastructure startInfo.UseShellExecute = true; startInfo.Arguments = args; startInfo.FileName = cmd; + if (runAsAdministrator) startInfo.Verb = "runas"; startInfo.WindowStyle = global::System.Diagnostics.ProcessWindowStyle.Normal; startInfo.ErrorDialog = (dwSeclFlags | ShellExecCmdLineFlags.SECL_NO_UI) == 0; startInfo.ErrorDialogParentHandle = hwnd; @@ -280,17 +281,12 @@ namespace Wox.Infrastructure hresult); } - public static void Start(string cmd) + public static void Start(string cmd, bool runAsAdministrator = false) { - Start(cmd, false); + Start(cmd, false, IntPtr.Zero,runAsAdministrator); } - public static void Start(string cmd, bool showErrorDialog) - { - Start(cmd, false, IntPtr.Zero); - } - - public static void Start(string cmd, bool showErrorDialog, IntPtr errorDialogHwnd) + public static void Start(string cmd, bool showErrorDialog, IntPtr errorDialogHwnd, bool runAsAdministrator = false) { cmd = cmd.Trim(); // PathRemoveBlanks cmd = Environment.ExpandEnvironmentVariables(cmd); // SHExpandEnvironmentStrings @@ -306,7 +302,8 @@ namespace Wox.Infrastructure cmd, null, // i have no ideas about this field global::System.Diagnostics.ProcessWindowStyle.Normal, - ShellExecCmdLineFlags.SECL__IGNORE_ERROR | ShellExecCmdLineFlags.SECL_USE_IDLIST | ShellExecCmdLineFlags.SECL_LOG_USAGE | (showErrorDialog ? 0 : ShellExecCmdLineFlags.SECL_NO_UI) + ShellExecCmdLineFlags.SECL__IGNORE_ERROR | ShellExecCmdLineFlags.SECL_USE_IDLIST | ShellExecCmdLineFlags.SECL_LOG_USAGE | (showErrorDialog ? 0 : ShellExecCmdLineFlags.SECL_NO_UI), + runAsAdministrator ); if (!string.IsNullOrEmpty(home) && Directory.Exists(home)) Environment.CurrentDirectory = oldCwd; } diff --git a/Wox.Plugin.SystemPlugins/Program/Programs.cs b/Wox.Plugin.SystemPlugins/Program/Programs.cs index ff87a84667..75432d8b5d 100644 --- a/Wox.Plugin.SystemPlugins/Program/Programs.cs +++ b/Wox.Plugin.SystemPlugins/Program/Programs.cs @@ -42,6 +42,31 @@ namespace Wox.Plugin.SystemPlugins.Program context.API.HideApp(); context.API.ShellRun(c.ExecutePath); return true; + }, + ContextMenu = new List() + { + new Result() + { + Title = "Open", + Action = _ => + { + context.API.HideApp(); + context.API.ShellRun(c.ExecutePath); + return true; + }, + IcoPath = "Images/open.png" + }, + new Result() + { + Title = "Open With Administrator", + Action = _ => + { + context.API.HideApp(); + context.API.ShellRun(c.ExecutePath,true); + return true; + }, + IcoPath = "Images/cmd.png" + } } }).ToList(); } @@ -84,11 +109,11 @@ namespace Wox.Plugin.SystemPlugins.Program Type sourceClass; if (SourceTypes.TryGetValue(source.Type, out sourceClass)) { - ConstructorInfo constructorInfo = sourceClass.GetConstructor(new[] {typeof (ProgramSource)}); + ConstructorInfo constructorInfo = sourceClass.GetConstructor(new[] { typeof(ProgramSource) }); if (constructorInfo != null) { IProgramSource programSource = - constructorInfo.Invoke(new object[] {source}) as IProgramSource; + constructorInfo.Invoke(new object[] { source }) as IProgramSource; sources.Add(programSource); } } @@ -106,7 +131,7 @@ namespace Wox.Plugin.SystemPlugins.Program } // filter duplicate program - tempPrograms = tempPrograms.GroupBy(x => new {x.ExecutePath, x.ExecuteName}) + tempPrograms = tempPrograms.GroupBy(x => new { x.ExecutePath, x.ExecuteName }) .Select(g => g.First()).ToList(); programs = tempPrograms; diff --git a/Wox.Plugin/IPublicAPI.cs b/Wox.Plugin/IPublicAPI.cs index 85e501b651..64ff13ab08 100644 --- a/Wox.Plugin/IPublicAPI.cs +++ b/Wox.Plugin/IPublicAPI.cs @@ -9,7 +9,7 @@ namespace Wox.Plugin void PushResults(Query query,PluginMetadata plugin, List results); - bool ShellRun(string cmd); + bool ShellRun(string cmd, bool runAsAdministrator = false); void ChangeQuery(string query, bool requery = false); diff --git a/Wox/Converters/StringNullOrEmptyToVisibilityConverter.cs b/Wox/Converters/StringNullOrEmptyToVisibilityConverter.cs index d6d01f0714..f536e74735 100644 --- a/Wox/Converters/StringNullOrEmptyToVisibilityConverter.cs +++ b/Wox/Converters/StringNullOrEmptyToVisibilityConverter.cs @@ -1,6 +1,8 @@ using System; +using System.Collections.Generic; using System.Globalization; using System.Windows; +using Wox.Plugin; namespace Wox.Converters { @@ -21,4 +23,23 @@ namespace Wox.Converters return this; } } + + public class ContextMenuEmptyToWidthConverter : ConvertorBase + { + public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + List results = value as List; + return results == null || results.Count == 0 ? 0 : 17; + } + + public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } + } } \ No newline at end of file diff --git a/Wox/Images/menu.png b/Wox/Images/menu.png new file mode 100644 index 0000000000000000000000000000000000000000..d7395f4d9fbc9552f63ae80b8e9dc81a69b108d7 GIT binary patch literal 346 zcmV-g0j2(lP)_i805%p8yo?|oB#pKyMEoD$5(D2??fPI~X5lx?yjd1S(T#}CbWF9F zrs)#L@$(2B1i^#P^GxfyQkG@3EQ@l00V~FFWGGzMm5(|CE6TE@JkKSJ&ghER^KHdH z^`0ZDsycBbkmq^Y9)Oh|K=43U(gVw~499V3pF~xhb84FA&4*!N*fR`6>ib?fzReZ$`bwr$gHrm76XpfpVxZ`)RS;QKyxU8fviz>2!A1sqM1MEeS0 snQ5B$?S$7O9&AlsO!xo)*GGT>03%omcdi7(3jhEB07*qoM6N<$f@>X-X#fBK literal 0 HcmV?d00001 diff --git a/Wox/Images/open.png b/Wox/Images/open.png new file mode 100644 index 0000000000000000000000000000000000000000..6006d12104249ddab4cf3141602310260f23e79c GIT binary patch literal 941 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI zAngIhZYQ(tK!Rljj_E*J0gT&!&6&%}W%Q|8xKRNt$gE7qd%* z>*nUNg6TYsm-+*}rZw2R?sv@a-*gntM@Wm zL`pwfA1>l)USFf;BD}N_Wp{GQ8td zD7oe$$KoK($#A6g>3rrJM;MZw5AJ9dV7>0o)L_ebP-#thm2f9xcx>)NO@;-o3zQj7 z8K1frb85#YhRx~Q1sS$&l@(;j)$L?zVGMe0+2wRq&S+D|svF+#8D;eo9W*m|1q@xZ z8+gTYr?!Z(h2lNZ2Sw zbD!e<*49!F^B7mFkK2O_4=yQpI>E5qtMHA+)WDk`dT;%FVYX%+GtWvJPOY73cb9X; zL~thhIlYqjb@Bsed8Gfx2eZ7LbQyNM_&dG#dQi%*&Yh(SHXAN+FkI4HajMQ|`+Eb1 z(`|Qu1<5dPxc1tsP}XDnel5uY6V@(Wy(X)z$Ep>UzPQ))Z??g;MOJ^U7()Gxx_XZB zB|B*Tjbiv)xBquWx_ZUMf4(ojSH1XJ#rQ74K(2qjnCnNa^Pi7rd}ql}nd{fSZrwUN z<{$qQ1n;^2W03wGwC}-3<#oWMu3F+6QIe8al4_M)lnSI6j0_A7bPbGj4GlsJ46O_- ztxSMiGb;mw`x7p4qG-s?PsvQH1Zpra(={;EH3Didurjf*GPZzd;8AJp25MmNboFyt I=akR{03N=HV*mgE literal 0 HcmV?d00001 diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index bce6c69777..dc3e617dd2 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -720,14 +720,14 @@ namespace Wox this.Opacity = this.AllowsTransparency ? UserSettingStorage.Instance.Opacity : 1; } - public bool ShellRun(string cmd) + public bool ShellRun(string cmd, bool runAsAdministrator = false) { try { if (string.IsNullOrEmpty(cmd)) throw new ArgumentNullException(); - Wox.Infrastructure.WindowsShellRun.Start(cmd); + WindowsShellRun.Start(cmd, runAsAdministrator); return true; } catch (Exception ex) diff --git a/Wox/ResultPanel.xaml b/Wox/ResultPanel.xaml index d1a8e28afd..a156d6fc18 100644 --- a/Wox/ResultPanel.xaml +++ b/Wox/ResultPanel.xaml @@ -7,7 +7,7 @@ mc:Ignorable="d" d:DesignWidth="100" d:DesignHeight="100"> - + @@ -24,6 +24,7 @@ + @@ -32,14 +33,16 @@ - + + + diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 6dbd0ac08f..e969c37806 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -392,6 +392,14 @@ + + + PreserveNewest + + + + +