diff --git a/Greenshot/Destinations/EmailDestination.cs b/Greenshot/Destinations/EmailDestination.cs index b254955b2..bb93d0784 100644 --- a/Greenshot/Destinations/EmailDestination.cs +++ b/Greenshot/Destinations/EmailDestination.cs @@ -74,7 +74,9 @@ namespace Greenshot.Destinations { exePath = GetExePath("OUTLOOK.EXE"); if (exePath != null && File.Exists(exePath)) { applicationIcon = GetExeIcon(exePath, 0); - meetingIcon = GetExeIcon(exePath, 2); + if (conf.OutlookAllowExportInMeetings) { + meetingIcon = GetExeIcon(exePath, 2); + } } else { exePath = null; } @@ -148,6 +150,10 @@ namespace Greenshot.Destinations { get { if (isOutlookUsed && outlookInspectorCaption != null) { if (OlObjectClass.olAppointment.Equals(outlookInspectorType)) { + // Make sure we loaded the icon, maybe the configuration has been changed! + if (meetingIcon == null) { + meetingIcon = GetExeIcon(exePath, 2); + } return meetingIcon; } else { return mailIcon; diff --git a/Greenshot/Forms/SettingsForm.cs b/Greenshot/Forms/SettingsForm.cs index 885136db1..51e4b8d40 100644 --- a/Greenshot/Forms/SettingsForm.cs +++ b/Greenshot/Forms/SettingsForm.cs @@ -111,28 +111,6 @@ namespace Greenshot { return returnValue; } - private void SetEmailFormat(EmailFormat selectedEmailFormat) { - // TODO: Fix!! - // Setup the email settings - EmailFormat [] availableValues; - if (EmailConfigHelper.HasMAPI()) { - //checkbox_email.Enabled = true; - //combobox_emailformat.Visible = true; - if (EmailConfigHelper.HasOutlook()) { - availableValues = new EmailFormat[]{EmailFormat.MAPI, EmailFormat.OUTLOOK_TXT, EmailFormat.OUTLOOK_HTML}; - } else { - // Force MAPI in configuration if no Outlook - coreConfiguration.OutputEMailFormat = EmailFormat.MAPI; - availableValues = new EmailFormat[]{EmailFormat.MAPI}; - } - //PopulateComboBox(combobox_emailformat, availableValues, selectedEmailFormat); - } else { - //checkbox_email.Enabled = false; - //checkbox_email.Checked = false; - //combobox_emailformat.Visible = false; - } - } - private void SetWindowCaptureMode(WindowCaptureMode selectedWindowCaptureMode) { WindowCaptureMode[] availableModes; if (!DWM.isDWMEnabled()) { @@ -286,7 +264,6 @@ namespace Greenshot { textbox_screenshotname.Text = coreConfiguration.OutputFileFilenamePattern; combobox_primaryimageformat.SelectedItem = coreConfiguration.OutputFileFormat; - SetEmailFormat(coreConfiguration.OutputEMailFormat); SetWindowCaptureMode(coreConfiguration.WindowCaptureMode); checkbox_copypathtoclipboard.Checked = coreConfiguration.OutputFileCopyPathToClipboard; @@ -351,10 +328,6 @@ namespace Greenshot { coreConfiguration.OutputFileFormat = OutputFormat.png; } - // TODO: Fix - //coreConfiguration.OutputEMailFormat = GetSelected(combobox_emailformat); - coreConfiguration.OutputEMailFormat = EmailFormat.OUTLOOK_HTML; - coreConfiguration.OutputFileCopyPathToClipboard = checkbox_copypathtoclipboard.Checked; coreConfiguration.OutputFileJpegQuality = trackBarJpegQuality.Value; coreConfiguration.OutputFilePromptJpegQuality = checkbox_alwaysshowjpegqualitydialog.Checked; diff --git a/Greenshot/Helpers/OfficeInterop/OutlookWrapper.cs b/Greenshot/Helpers/OfficeInterop/OutlookWrapper.cs index 64ae4384d..0df31a676 100644 --- a/Greenshot/Helpers/OfficeInterop/OutlookWrapper.cs +++ b/Greenshot/Helpers/OfficeInterop/OutlookWrapper.cs @@ -151,7 +151,7 @@ namespace Greenshot.Helpers.OfficeInterop { if (!currentItem.Sent) { return true; } - } else if (outlookVersion.Major >=12 && OlObjectClass.olAppointment.Equals(currentItemClass)) { + } else if (outlookVersion.Major >= 12 && conf.OutlookAllowExportInMeetings && OlObjectClass.olAppointment.Equals(currentItemClass)) { if (string.IsNullOrEmpty(currentItem.Organizer) || (currentUser == null && currentUser.Equals(currentItem.Organizer))) { return true; } else { @@ -331,8 +331,8 @@ namespace Greenshot.Helpers.OfficeInterop { } catch (Exception e) { LOG.Error("Problem reading signature!", e); } - switch(conf.OutputEMailFormat) { - case EmailFormat.OUTLOOK_TXT: + switch(conf.OutlookEmailFormat) { + case EmailFormat.Text: newMail.Attachments.Add(tmpFile, OlAttachmentType.olByValue, 1, attachmentName); newMail.BodyFormat = OlBodyFormat.olFormatPlain; if (bodyString == null) { @@ -340,7 +340,7 @@ namespace Greenshot.Helpers.OfficeInterop { } newMail.Body = bodyString; break; - case EmailFormat.OUTLOOK_HTML: + case EmailFormat.HTML: default: // Create the attachment Attachment attachment = newMail.Attachments.Add(tmpFile, OlAttachmentType.olByValue, 0, attachmentName); @@ -446,11 +446,11 @@ namespace Greenshot.Helpers.OfficeInterop { } LOG.DebugFormat("Found email signature: {0}", signatureName); string extension; - switch(conf.OutputEMailFormat) { - case EmailFormat.OUTLOOK_TXT: + switch(conf.OutlookEmailFormat) { + case EmailFormat.Text: extension = ".txt"; break; - case EmailFormat.OUTLOOK_HTML: + case EmailFormat.HTML: default: extension = ".htm"; break; diff --git a/GreenshotPlugin/Core/CoreConfiguration.cs b/GreenshotPlugin/Core/CoreConfiguration.cs index 37fa5f628..67b4917e2 100644 --- a/GreenshotPlugin/Core/CoreConfiguration.cs +++ b/GreenshotPlugin/Core/CoreConfiguration.cs @@ -38,11 +38,7 @@ namespace GreenshotPlugin.Core { Screen, GDI, Aero, AeroTransparent, Auto } public enum EmailFormat { - MAPI, OUTLOOK_TXT, OUTLOOK_HTML - } - public enum EmailExport { - AlwaysNew, - TryOpenElseNew + Text, HTML } /// @@ -98,11 +94,11 @@ namespace GreenshotPlugin.Core { public OutputFormat OutputFileFormat = OutputFormat.png; [IniProperty("OutputFileReduceColors", Description="If set to true, than the colors of the output file are reduced to 256 (8-bit) colors", DefaultValue="false")] public bool OutputFileReduceColors; - - [IniProperty("OutputEMailFormat", Description="Default type for emails. (txt, html)")] - public EmailFormat OutputEMailFormat; - [IniProperty("OutputOutlookMethod", Description="How to export to outlook (AlwaysNew= always open a new one, TryOpenElseNew=look for open email else create a new)", DefaultValue="AlwaysNew")] - public EmailExport OutputOutlookMethod; + + [IniProperty("OutlookEmailFormat", Description = "Default type for emails. (Text, HTML)", DefaultValue="HTML")] + public EmailFormat OutlookEmailFormat; + [IniProperty("OutlookAllowExportInMeetings", Description = "Allow export in meeting items", DefaultValue="False")] + public bool OutlookAllowExportInMeetings; [IniProperty("OutputFileCopyPathToClipboard", Description="When saving a screenshot, copy the path to the clipboard?", DefaultValue="true")] public bool OutputFileCopyPathToClipboard; @@ -259,11 +255,6 @@ namespace GreenshotPlugin.Core { return Environment.GetFolderPath(Environment.SpecialFolder.Desktop); case "DWMBackgroundColor": return Color.White; - case "OutputEMailFormat": - if (EmailConfigHelper.HasOutlook()) { - return EmailFormat.OUTLOOK_HTML; - } - return EmailFormat.MAPI; case "ActiveTitleFixes": List activeDefaults = new List(); activeDefaults.Add("Firefox"); @@ -319,10 +310,6 @@ namespace GreenshotPlugin.Core { if (OutputDestinations.Count == 0) { OutputDestinations.Add("Editor"); } - // Check for Outlook, if it's not installed force email format to MAPI - if (OutputEMailFormat != EmailFormat.MAPI && !EmailConfigHelper.HasOutlook()) { - OutputEMailFormat = EmailFormat.MAPI; - } // Prevent both settings at once, bug #3435056 if (OutputDestinations.Contains("Clipboard") && OutputFileCopyPathToClipboard) { OutputFileCopyPathToClipboard = false;