diff --git a/Greenshot-OCR-Plugin/OCRDestination.cs b/Greenshot-OCR-Plugin/OCRDestination.cs index 32d05c60e..1155afa82 100644 --- a/Greenshot-OCR-Plugin/OCRDestination.cs +++ b/Greenshot-OCR-Plugin/OCRDestination.cs @@ -50,12 +50,6 @@ namespace GreenshotOCR { } } - public override bool isActive { - get { - return true; - } - } - public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { OcrPlugin.DoOCR(surface); return true; diff --git a/Greenshot/Destinations/EmailDestination.cs b/Greenshot/Destinations/EmailDestination.cs index 5495f2463..bc3b401b0 100644 --- a/Greenshot/Destinations/EmailDestination.cs +++ b/Greenshot/Destinations/EmailDestination.cs @@ -128,7 +128,7 @@ namespace Greenshot.Destinations { public override bool isActive { get { - return isActiveFlag; + return base.isActive && isActiveFlag; } } diff --git a/Greenshot/Destinations/ExcelDestination.cs b/Greenshot/Destinations/ExcelDestination.cs index 850b541ef..6f6bd929e 100644 --- a/Greenshot/Destinations/ExcelDestination.cs +++ b/Greenshot/Destinations/ExcelDestination.cs @@ -90,7 +90,7 @@ namespace Greenshot.Destinations { public override bool isActive { get { - return exePath != null; + return base.isActive && exePath != null; } } diff --git a/Greenshot/Destinations/OneNoteDestination.cs b/Greenshot/Destinations/OneNoteDestination.cs index e3fb127b1..1fdbda61c 100644 --- a/Greenshot/Destinations/OneNoteDestination.cs +++ b/Greenshot/Destinations/OneNoteDestination.cs @@ -35,6 +35,7 @@ using Greenshot.IniFile; namespace Greenshot.Destinations { public class OneNoteDestination : AbstractDestination { private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(WordDestination)); + public const string DESIGNATION = "OneNote"; private static CoreConfiguration conf = IniConfig.GetIniSection(); private static string exePath = null; private static Image applicationIcon = null; @@ -61,7 +62,7 @@ namespace Greenshot.Destinations { public override string Designation { get { - return "OneNote"; + return DESIGNATION; } } @@ -89,7 +90,7 @@ namespace Greenshot.Destinations { public override bool isActive { get { - return exePath != null; + return base.isActive && exePath != null; } } diff --git a/Greenshot/Destinations/PickerDestination.cs b/Greenshot/Destinations/PickerDestination.cs index ed6a538c0..1919959e4 100644 --- a/Greenshot/Destinations/PickerDestination.cs +++ b/Greenshot/Destinations/PickerDestination.cs @@ -58,12 +58,6 @@ namespace Greenshot.Destinations { } } - public override bool isActive { - get { - return true; - } - } - public static ContextMenuStrip CreatePickerMenu(bool addDynamics, ISurface surface, ICaptureDetails captureDetails, IEnumerable destinations) { ContextMenuStrip menu = new ContextMenuStrip(); menu.Closing += delegate(object source, ToolStripDropDownClosingEventArgs eventArgs) { diff --git a/Greenshot/Destinations/PowerpointDestination.cs b/Greenshot/Destinations/PowerpointDestination.cs index e27f6c529..e99f6e89c 100644 --- a/Greenshot/Destinations/PowerpointDestination.cs +++ b/Greenshot/Destinations/PowerpointDestination.cs @@ -90,7 +90,7 @@ namespace Greenshot.Destinations { public override bool isActive { get { - return exePath != null; + return base.isActive && exePath != null; } } diff --git a/Greenshot/Destinations/WordDestination.cs b/Greenshot/Destinations/WordDestination.cs index b575f4302..5fc6e5f83 100644 --- a/Greenshot/Destinations/WordDestination.cs +++ b/Greenshot/Destinations/WordDestination.cs @@ -92,7 +92,7 @@ namespace Greenshot.Destinations { public override bool isActive { get { - return exePath != null; + return base.isActive && exePath != null; } } diff --git a/GreenshotConfluencePlugin/ConfluenceDestination.cs b/GreenshotConfluencePlugin/ConfluenceDestination.cs index d510d3825..58cf86195 100644 --- a/GreenshotConfluencePlugin/ConfluenceDestination.cs +++ b/GreenshotConfluencePlugin/ConfluenceDestination.cs @@ -81,7 +81,7 @@ namespace GreenshotConfluencePlugin { public override bool isActive { get { - return !string.IsNullOrEmpty(config.Url); + return base.isActive && !string.IsNullOrEmpty(config.Url); } } diff --git a/GreenshotExternalCommandPlugin/ExternalCommandDestination.cs b/GreenshotExternalCommandPlugin/ExternalCommandDestination.cs index 67ca677e0..8ae381952 100644 --- a/GreenshotExternalCommandPlugin/ExternalCommandDestination.cs +++ b/GreenshotExternalCommandPlugin/ExternalCommandDestination.cs @@ -55,12 +55,6 @@ namespace ExternalCommand { return presetCommand; } } - - public override bool isActive { - get { - return true; - } - } public override IEnumerable DynamicDestinations() { yield break; diff --git a/GreenshotJiraPlugin/JiraDestination.cs b/GreenshotJiraPlugin/JiraDestination.cs index 55dbf82a0..c6f429177 100644 --- a/GreenshotJiraPlugin/JiraDestination.cs +++ b/GreenshotJiraPlugin/JiraDestination.cs @@ -73,7 +73,7 @@ namespace GreenshotJiraPlugin { public override bool isActive { get { - return !string.IsNullOrEmpty(config.Url); + return base.isActive && !string.IsNullOrEmpty(config.Url); } } diff --git a/GreenshotPlugin/Core/AbstractDestination.cs b/GreenshotPlugin/Core/AbstractDestination.cs index 90828d113..2d848b47c 100644 --- a/GreenshotPlugin/Core/AbstractDestination.cs +++ b/GreenshotPlugin/Core/AbstractDestination.cs @@ -29,6 +29,7 @@ using System.Reflection; using Microsoft.Win32; using Greenshot.Plugin; +using Greenshot.IniFile; namespace GreenshotPlugin.Core { /// @@ -37,6 +38,7 @@ namespace GreenshotPlugin.Core { public abstract class AbstractDestination : IDestination { private const string PATH_KEY = @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\"; private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(AbstractDestination)); + private static CoreConfiguration configuration = IniConfig.GetIniSection(); public static string GetExePath(string exeName) { using (RegistryKey key = Registry.LocalMachine.OpenSubKey(PATH_KEY + exeName, false)) { @@ -168,6 +170,9 @@ namespace GreenshotPlugin.Core { public virtual bool isActive { get { + if (configuration.ExcludeDestinations != null && configuration.ExcludeDestinations.Contains(Designation)) { + return false; + } return true; } } diff --git a/GreenshotPlugin/Core/CoreConfiguration.cs b/GreenshotPlugin/Core/CoreConfiguration.cs index 33326adf5..36e3fc4ec 100644 --- a/GreenshotPlugin/Core/CoreConfiguration.cs +++ b/GreenshotPlugin/Core/CoreConfiguration.cs @@ -148,6 +148,8 @@ namespace GreenshotPlugin.Core { public List IncludePlugins; [IniProperty("ExcludePlugins", Description="Comma separated list of Plugins which are NOT allowed.")] public List ExcludePlugins; + [IniProperty("ExcludeDestinations", Description = "Comma separated list of destinations which should be disabled.", DefaultValue = "OneNote")] + public List ExcludeDestinations; [IniProperty("UpdateCheckInterval", Description="How many days between every update check? (0=no checks)", DefaultValue="1")] public int UpdateCheckInterval; diff --git a/PluginExample/SimpleOutputDestination.cs b/PluginExample/SimpleOutputDestination.cs index e4c3a9f74..5b6d23fcc 100644 --- a/PluginExample/SimpleOutputDestination.cs +++ b/PluginExample/SimpleOutputDestination.cs @@ -55,12 +55,6 @@ namespace PluginExample { } } - public override bool isActive { - get { - return true; - } - } - public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { CoreConfiguration config = IniConfig.GetIniSection(); OutputSettings outputSettings = new OutputSettings();