mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 13:33:27 -07:00
Changed the EmailDestination to work if Outlook is installed as MAPI client but the Outlook plugin is not installed. Also made some progress on the MAPI Recipient properties, but this still doesn't work.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2486 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
c188ad10e8
commit
8980a505b1
2 changed files with 26 additions and 11 deletions
|
@ -49,9 +49,8 @@ namespace Greenshot.Destinations {
|
||||||
isActiveFlag = true;
|
isActiveFlag = true;
|
||||||
mapiClient = EmailConfigHelper.GetMapiClient();
|
mapiClient = EmailConfigHelper.GetMapiClient();
|
||||||
if (!string.IsNullOrEmpty(mapiClient)) {
|
if (!string.IsNullOrEmpty(mapiClient)) {
|
||||||
if (mapiClient.ToLower().Contains("microsoft outlook")) {
|
// Active as we have a mapi client, can be disabled later
|
||||||
isActiveFlag = false;
|
isActiveFlag = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,6 +83,15 @@ namespace Greenshot.Destinations {
|
||||||
|
|
||||||
public override bool isActive {
|
public override bool isActive {
|
||||||
get {
|
get {
|
||||||
|
if (isActiveFlag) {
|
||||||
|
// Disable if the office plugin is installed and the client is outlook
|
||||||
|
Type outlookdestination = Type.GetType("GreenshotOfficePlugin.OutlookDestination,GreenshotOfficePlugin");
|
||||||
|
if (outlookdestination != null) {
|
||||||
|
if (mapiClient.ToLower().Contains("microsoft outlook")) {
|
||||||
|
isActiveFlag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return base.isActive && isActiveFlag;
|
return base.isActive && isActiveFlag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,10 +55,16 @@ namespace Greenshot.Helpers {
|
||||||
public static void SendImage(string fullPath, string title) {
|
public static void SendImage(string fullPath, string title) {
|
||||||
MapiMailMessage message = new MapiMailMessage(title, null);
|
MapiMailMessage message = new MapiMailMessage(title, null);
|
||||||
message.Files.Add(fullPath);
|
message.Files.Add(fullPath);
|
||||||
message._recipientCollection.Add(new Recipient(conf.MailApiTo, RecipientType.To));
|
if (!string.IsNullOrEmpty(conf.MailApiTo)) {
|
||||||
message._recipientCollection.Add(new Recipient(conf.MailApiCC, RecipientType.CC));
|
message._recipientCollection.Add(new Recipient(conf.MailApiTo, RecipientType.To));
|
||||||
message._recipientCollection.Add(new Recipient(conf.MailApiBCC, RecipientType.BCC));
|
}
|
||||||
message.ShowDialog();
|
if (!string.IsNullOrEmpty(conf.MailApiCC)) {
|
||||||
|
message._recipientCollection.Add(new Recipient(conf.MailApiCC, RecipientType.CC));
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(conf.MailApiTo)) {
|
||||||
|
message._recipientCollection.Add(new Recipient(conf.MailApiBCC, RecipientType.BCC));
|
||||||
|
}
|
||||||
|
message.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -251,7 +257,9 @@ namespace Greenshot.Helpers {
|
||||||
|
|
||||||
// Check for error
|
// Check for error
|
||||||
if (errorCode != MAPI_CODES.SUCCESS && errorCode != MAPI_CODES.USER_ABORT) {
|
if (errorCode != MAPI_CODES.SUCCESS && errorCode != MAPI_CODES.USER_ABORT) {
|
||||||
_LogErrorMapi(errorCode);
|
string errorText = GetMapiError(errorCode);
|
||||||
|
LOG.Error("Error sending MAPI Email. Error: " + errorText + " (code = " + errorCode + ").");
|
||||||
|
MessageBox.Show(errorText, "Mail (MAPI) destination", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -350,7 +358,7 @@ namespace Greenshot.Helpers {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logs any Mapi errors.
|
/// Logs any Mapi errors.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void _LogErrorMapi(MAPI_CODES errorCode) {
|
private string GetMapiError(MAPI_CODES errorCode) {
|
||||||
|
|
||||||
string error = string.Empty;
|
string error = string.Empty;
|
||||||
|
|
||||||
|
@ -437,8 +445,7 @@ namespace Greenshot.Helpers {
|
||||||
error = "MAPI Invalid parameter.";
|
error = "MAPI Invalid parameter.";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return error;
|
||||||
LOG.Error("Error sending MAPI Email. Error: " + error + " (code = " + errorCode + ").");
|
|
||||||
}
|
}
|
||||||
#endregion Private Methods
|
#endregion Private Methods
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue