Added a way to disable destinations in the configuration, for now OneNote is disabled by default. (As I am not satisfied with the way it works)

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1830 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-05-04 08:36:25 +00:00
parent 544d3ee158
commit 6e95cf210d
13 changed files with 16 additions and 32 deletions

View file

@ -50,12 +50,6 @@ namespace GreenshotOCR {
} }
} }
public override bool isActive {
get {
return true;
}
}
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
OcrPlugin.DoOCR(surface); OcrPlugin.DoOCR(surface);
return true; return true;

View file

@ -128,7 +128,7 @@ namespace Greenshot.Destinations {
public override bool isActive { public override bool isActive {
get { get {
return isActiveFlag; return base.isActive && isActiveFlag;
} }
} }

View file

@ -90,7 +90,7 @@ namespace Greenshot.Destinations {
public override bool isActive { public override bool isActive {
get { get {
return exePath != null; return base.isActive && exePath != null;
} }
} }

View file

@ -35,6 +35,7 @@ using Greenshot.IniFile;
namespace Greenshot.Destinations { namespace Greenshot.Destinations {
public class OneNoteDestination : AbstractDestination { public class OneNoteDestination : AbstractDestination {
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(WordDestination)); private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(WordDestination));
public const string DESIGNATION = "OneNote";
private static CoreConfiguration conf = IniConfig.GetIniSection<CoreConfiguration>(); private static CoreConfiguration conf = IniConfig.GetIniSection<CoreConfiguration>();
private static string exePath = null; private static string exePath = null;
private static Image applicationIcon = null; private static Image applicationIcon = null;
@ -61,7 +62,7 @@ namespace Greenshot.Destinations {
public override string Designation { public override string Designation {
get { get {
return "OneNote"; return DESIGNATION;
} }
} }
@ -89,7 +90,7 @@ namespace Greenshot.Destinations {
public override bool isActive { public override bool isActive {
get { get {
return exePath != null; return base.isActive && exePath != null;
} }
} }

View file

@ -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<IDestination> destinations) { public static ContextMenuStrip CreatePickerMenu(bool addDynamics, ISurface surface, ICaptureDetails captureDetails, IEnumerable<IDestination> destinations) {
ContextMenuStrip menu = new ContextMenuStrip(); ContextMenuStrip menu = new ContextMenuStrip();
menu.Closing += delegate(object source, ToolStripDropDownClosingEventArgs eventArgs) { menu.Closing += delegate(object source, ToolStripDropDownClosingEventArgs eventArgs) {

View file

@ -90,7 +90,7 @@ namespace Greenshot.Destinations {
public override bool isActive { public override bool isActive {
get { get {
return exePath != null; return base.isActive && exePath != null;
} }
} }

View file

@ -92,7 +92,7 @@ namespace Greenshot.Destinations {
public override bool isActive { public override bool isActive {
get { get {
return exePath != null; return base.isActive && exePath != null;
} }
} }

View file

@ -81,7 +81,7 @@ namespace GreenshotConfluencePlugin {
public override bool isActive { public override bool isActive {
get { get {
return !string.IsNullOrEmpty(config.Url); return base.isActive && !string.IsNullOrEmpty(config.Url);
} }
} }

View file

@ -55,12 +55,6 @@ namespace ExternalCommand {
return presetCommand; return presetCommand;
} }
} }
public override bool isActive {
get {
return true;
}
}
public override IEnumerable<IDestination> DynamicDestinations() { public override IEnumerable<IDestination> DynamicDestinations() {
yield break; yield break;

View file

@ -73,7 +73,7 @@ namespace GreenshotJiraPlugin {
public override bool isActive { public override bool isActive {
get { get {
return !string.IsNullOrEmpty(config.Url); return base.isActive && !string.IsNullOrEmpty(config.Url);
} }
} }

View file

@ -29,6 +29,7 @@ using System.Reflection;
using Microsoft.Win32; using Microsoft.Win32;
using Greenshot.Plugin; using Greenshot.Plugin;
using Greenshot.IniFile;
namespace GreenshotPlugin.Core { namespace GreenshotPlugin.Core {
/// <summary> /// <summary>
@ -37,6 +38,7 @@ namespace GreenshotPlugin.Core {
public abstract class AbstractDestination : IDestination { public abstract class AbstractDestination : IDestination {
private const string PATH_KEY = @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\"; private const string PATH_KEY = @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\";
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(AbstractDestination)); private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(AbstractDestination));
private static CoreConfiguration configuration = IniConfig.GetIniSection<CoreConfiguration>();
public static string GetExePath(string exeName) { public static string GetExePath(string exeName) {
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(PATH_KEY + exeName, false)) { using (RegistryKey key = Registry.LocalMachine.OpenSubKey(PATH_KEY + exeName, false)) {
@ -168,6 +170,9 @@ namespace GreenshotPlugin.Core {
public virtual bool isActive { public virtual bool isActive {
get { get {
if (configuration.ExcludeDestinations != null && configuration.ExcludeDestinations.Contains(Designation)) {
return false;
}
return true; return true;
} }
} }

View file

@ -148,6 +148,8 @@ namespace GreenshotPlugin.Core {
public List<string> IncludePlugins; public List<string> IncludePlugins;
[IniProperty("ExcludePlugins", Description="Comma separated list of Plugins which are NOT allowed.")] [IniProperty("ExcludePlugins", Description="Comma separated list of Plugins which are NOT allowed.")]
public List<string> ExcludePlugins; public List<string> ExcludePlugins;
[IniProperty("ExcludeDestinations", Description = "Comma separated list of destinations which should be disabled.", DefaultValue = "OneNote")]
public List<string> ExcludeDestinations;
[IniProperty("UpdateCheckInterval", Description="How many days between every update check? (0=no checks)", DefaultValue="1")] [IniProperty("UpdateCheckInterval", Description="How many days between every update check? (0=no checks)", DefaultValue="1")]
public int UpdateCheckInterval; public int UpdateCheckInterval;

View file

@ -55,12 +55,6 @@ namespace PluginExample {
} }
} }
public override bool isActive {
get {
return true;
}
}
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
CoreConfiguration config = IniConfig.GetIniSection<CoreConfiguration>(); CoreConfiguration config = IniConfig.GetIniSection<CoreConfiguration>();
OutputSettings outputSettings = new OutputSettings(); OutputSettings outputSettings = new OutputSettings();