Default disabling Outlook export to meeting items, the bitmaps are changed to BMP by Outlook. Also removed some old obsolete code.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1668 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-02-20 13:39:58 +00:00
commit 7669f78de6
4 changed files with 20 additions and 54 deletions

View file

@ -74,7 +74,9 @@ namespace Greenshot.Destinations {
exePath = GetExePath("OUTLOOK.EXE"); exePath = GetExePath("OUTLOOK.EXE");
if (exePath != null && File.Exists(exePath)) { if (exePath != null && File.Exists(exePath)) {
applicationIcon = GetExeIcon(exePath, 0); applicationIcon = GetExeIcon(exePath, 0);
meetingIcon = GetExeIcon(exePath, 2); if (conf.OutlookAllowExportInMeetings) {
meetingIcon = GetExeIcon(exePath, 2);
}
} else { } else {
exePath = null; exePath = null;
} }
@ -148,6 +150,10 @@ namespace Greenshot.Destinations {
get { get {
if (isOutlookUsed && outlookInspectorCaption != null) { if (isOutlookUsed && outlookInspectorCaption != null) {
if (OlObjectClass.olAppointment.Equals(outlookInspectorType)) { 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; return meetingIcon;
} else { } else {
return mailIcon; return mailIcon;

View file

@ -111,28 +111,6 @@ namespace Greenshot {
return returnValue; 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<EmailFormat>(combobox_emailformat, availableValues, selectedEmailFormat);
} else {
//checkbox_email.Enabled = false;
//checkbox_email.Checked = false;
//combobox_emailformat.Visible = false;
}
}
private void SetWindowCaptureMode(WindowCaptureMode selectedWindowCaptureMode) { private void SetWindowCaptureMode(WindowCaptureMode selectedWindowCaptureMode) {
WindowCaptureMode[] availableModes; WindowCaptureMode[] availableModes;
if (!DWM.isDWMEnabled()) { if (!DWM.isDWMEnabled()) {
@ -286,7 +264,6 @@ namespace Greenshot {
textbox_screenshotname.Text = coreConfiguration.OutputFileFilenamePattern; textbox_screenshotname.Text = coreConfiguration.OutputFileFilenamePattern;
combobox_primaryimageformat.SelectedItem = coreConfiguration.OutputFileFormat; combobox_primaryimageformat.SelectedItem = coreConfiguration.OutputFileFormat;
SetEmailFormat(coreConfiguration.OutputEMailFormat);
SetWindowCaptureMode(coreConfiguration.WindowCaptureMode); SetWindowCaptureMode(coreConfiguration.WindowCaptureMode);
checkbox_copypathtoclipboard.Checked = coreConfiguration.OutputFileCopyPathToClipboard; checkbox_copypathtoclipboard.Checked = coreConfiguration.OutputFileCopyPathToClipboard;
@ -351,10 +328,6 @@ namespace Greenshot {
coreConfiguration.OutputFileFormat = OutputFormat.png; coreConfiguration.OutputFileFormat = OutputFormat.png;
} }
// TODO: Fix
//coreConfiguration.OutputEMailFormat = GetSelected<EmailFormat>(combobox_emailformat);
coreConfiguration.OutputEMailFormat = EmailFormat.OUTLOOK_HTML;
coreConfiguration.OutputFileCopyPathToClipboard = checkbox_copypathtoclipboard.Checked; coreConfiguration.OutputFileCopyPathToClipboard = checkbox_copypathtoclipboard.Checked;
coreConfiguration.OutputFileJpegQuality = trackBarJpegQuality.Value; coreConfiguration.OutputFileJpegQuality = trackBarJpegQuality.Value;
coreConfiguration.OutputFilePromptJpegQuality = checkbox_alwaysshowjpegqualitydialog.Checked; coreConfiguration.OutputFilePromptJpegQuality = checkbox_alwaysshowjpegqualitydialog.Checked;

View file

@ -151,7 +151,7 @@ namespace Greenshot.Helpers.OfficeInterop {
if (!currentItem.Sent) { if (!currentItem.Sent) {
return true; 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))) { if (string.IsNullOrEmpty(currentItem.Organizer) || (currentUser == null && currentUser.Equals(currentItem.Organizer))) {
return true; return true;
} else { } else {
@ -331,8 +331,8 @@ namespace Greenshot.Helpers.OfficeInterop {
} catch (Exception e) { } catch (Exception e) {
LOG.Error("Problem reading signature!", e); LOG.Error("Problem reading signature!", e);
} }
switch(conf.OutputEMailFormat) { switch(conf.OutlookEmailFormat) {
case EmailFormat.OUTLOOK_TXT: case EmailFormat.Text:
newMail.Attachments.Add(tmpFile, OlAttachmentType.olByValue, 1, attachmentName); newMail.Attachments.Add(tmpFile, OlAttachmentType.olByValue, 1, attachmentName);
newMail.BodyFormat = OlBodyFormat.olFormatPlain; newMail.BodyFormat = OlBodyFormat.olFormatPlain;
if (bodyString == null) { if (bodyString == null) {
@ -340,7 +340,7 @@ namespace Greenshot.Helpers.OfficeInterop {
} }
newMail.Body = bodyString; newMail.Body = bodyString;
break; break;
case EmailFormat.OUTLOOK_HTML: case EmailFormat.HTML:
default: default:
// Create the attachment // Create the attachment
Attachment attachment = newMail.Attachments.Add(tmpFile, OlAttachmentType.olByValue, 0, attachmentName); 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); LOG.DebugFormat("Found email signature: {0}", signatureName);
string extension; string extension;
switch(conf.OutputEMailFormat) { switch(conf.OutlookEmailFormat) {
case EmailFormat.OUTLOOK_TXT: case EmailFormat.Text:
extension = ".txt"; extension = ".txt";
break; break;
case EmailFormat.OUTLOOK_HTML: case EmailFormat.HTML:
default: default:
extension = ".htm"; extension = ".htm";
break; break;

View file

@ -38,11 +38,7 @@ namespace GreenshotPlugin.Core {
Screen, GDI, Aero, AeroTransparent, Auto Screen, GDI, Aero, AeroTransparent, Auto
} }
public enum EmailFormat { public enum EmailFormat {
MAPI, OUTLOOK_TXT, OUTLOOK_HTML Text, HTML
}
public enum EmailExport {
AlwaysNew,
TryOpenElseNew
} }
/// <summary> /// <summary>
@ -99,10 +95,10 @@ namespace GreenshotPlugin.Core {
[IniProperty("OutputFileReduceColors", Description="If set to true, than the colors of the output file are reduced to 256 (8-bit) colors", DefaultValue="false")] [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; public bool OutputFileReduceColors;
[IniProperty("OutputEMailFormat", Description="Default type for emails. (txt, html)")] [IniProperty("OutlookEmailFormat", Description = "Default type for emails. (Text, HTML)", DefaultValue="HTML")]
public EmailFormat OutputEMailFormat; public EmailFormat OutlookEmailFormat;
[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")] [IniProperty("OutlookAllowExportInMeetings", Description = "Allow export in meeting items", DefaultValue="False")]
public EmailExport OutputOutlookMethod; public bool OutlookAllowExportInMeetings;
[IniProperty("OutputFileCopyPathToClipboard", Description="When saving a screenshot, copy the path to the clipboard?", DefaultValue="true")] [IniProperty("OutputFileCopyPathToClipboard", Description="When saving a screenshot, copy the path to the clipboard?", DefaultValue="true")]
public bool OutputFileCopyPathToClipboard; public bool OutputFileCopyPathToClipboard;
@ -259,11 +255,6 @@ namespace GreenshotPlugin.Core {
return Environment.GetFolderPath(Environment.SpecialFolder.Desktop); return Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
case "DWMBackgroundColor": case "DWMBackgroundColor":
return Color.White; return Color.White;
case "OutputEMailFormat":
if (EmailConfigHelper.HasOutlook()) {
return EmailFormat.OUTLOOK_HTML;
}
return EmailFormat.MAPI;
case "ActiveTitleFixes": case "ActiveTitleFixes":
List<string> activeDefaults = new List<string>(); List<string> activeDefaults = new List<string>();
activeDefaults.Add("Firefox"); activeDefaults.Add("Firefox");
@ -319,10 +310,6 @@ namespace GreenshotPlugin.Core {
if (OutputDestinations.Count == 0) { if (OutputDestinations.Count == 0) {
OutputDestinations.Add("Editor"); 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 // Prevent both settings at once, bug #3435056
if (OutputDestinations.Contains("Clipboard") && OutputFileCopyPathToClipboard) { if (OutputDestinations.Contains("Clipboard") && OutputFileCopyPathToClipboard) {
OutputFileCopyPathToClipboard = false; OutputFileCopyPathToClipboard = false;