From cd01b2197b17a2de9c6c1bcb7390a1fa2bdd23eb Mon Sep 17 00:00:00 2001 From: RKrom Date: Sun, 4 Nov 2012 16:24:12 +0000 Subject: [PATCH] Fixed bug #3582282 with displaying a dialog so the user can retry the operation after closing the dialog of the target application. git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2233 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- Greenshot/Languages/language-de-DE.xml | 2 + Greenshot/Languages/language-en-US.xml | 56 ++++++++++--------- GreenshotInterop/Interop/COMWrapper.cs | 25 +++++++-- .../OfficeExport/OutlookEmailExporter.cs | 4 +- 4 files changed, 53 insertions(+), 34 deletions(-) diff --git a/Greenshot/Languages/language-de-DE.xml b/Greenshot/Languages/language-de-DE.xml index 1f092546b..9779b5a88 100644 --- a/Greenshot/Languages/language-de-DE.xml +++ b/Greenshot/Languages/language-de-DE.xml @@ -35,6 +35,8 @@ schnell zu finden. Vielen Dank :) Rot Farbauswahl Transparent + Das Ziel hat Greenshot abgewiesen, vermutlich ist ein Dialogfeld geöffnet. Schließen Sie das Dialogfeld und versuchen Sie es erneut. + Greenshot Zugriff abgewiesen Die Greenshot Einstellungen konnten nicht gespeichert werden. Bitte prüfen Sie die Berechtigungen auf '{0}'. Über Greenshot Bereich abfotografieren diff --git a/Greenshot/Languages/language-en-US.xml b/Greenshot/Languages/language-en-US.xml index 67dfab462..44a7361a3 100644 --- a/Greenshot/Languages/language-en-US.xml +++ b/Greenshot/Languages/language-en-US.xml @@ -5,18 +5,18 @@ If you like Greenshot, you are welcome to support us: Greenshot is hosted by sourceforge.net at Icons from Yusuke Kamiyamane's Fugue icon set (Creative Commons Attribution 3.0 license) - Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom -Greenshot comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. + Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom +Greenshot comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. Details about the GNU General Public License: About Greenshot Greenshot - the revolutionary screenshot utility Close - Sorry, an unexpected error occured. - -The good news is: you can help us getting rid of it by filing a bug report. -Please visit the URL below, create a new bug report and paste the contents from the text area into the description. - -Please add a meaningful summary and enclose any information you consider to be helpful for reproducing the issue. + Sorry, an unexpected error occured. + +The good news is: you can help us getting rid of it by filing a bug report. +Please visit the URL below, create a new bug report and paste the contents from the text area into the description. + +Please add a meaningful summary and enclose any information you consider to be helpful for reproducing the issue. Also, we would highly appreciate if you checked whether a tracker item already exists for this bug. (You can use the search to find those quickly.) Thank you :) Error Cancel @@ -35,6 +35,8 @@ Also, we would highly appreciate if you checked whether a tracker item already e Red Color picker Transparent + The destination rejected Greenshot access, a dialog is probably open. Close the dialog and try again. + Greenshot access rejected Could not save Greenshot's configuration file. Please check access permissions for '{0}'. About Greenshot Capture region @@ -145,7 +147,7 @@ Also, we would highly appreciate if you checked whether a tracker item already e Outlook with text Error An instance of Greenshot is already running. - Cannot save file to {0}. + Cannot save file to {0}. Please check write accessibility of the selected storage location. The file "{0}" could not be opened. Could not open link '{0}'. @@ -205,22 +207,22 @@ Please check write accessibility of the selected storage location. Internet Explorer capture JPEG quality Language - The following placeholders will be replaced automatically in the pattern defined: -${YYYY} year, 4 digits -${MM} month, 2 digits -${DD} day, 2 digits -${hh} hour, 2 digits -${mm} minute, 2 digits -${ss} second, 2 digits -${NUM} incrementing number, 6 digits -${title} Window title -${user} Windows user -${domain} Windows domain -${hostname} PC name - -You can also have Greenshot create directories dynamically, simply use the backslash symbol (\) to separate folders and filename. -Example: the pattern ${YYYY}-${MM}-${DD}\${hh}-${mm}-${ss} -will generate a folder for the current day in your default storage location, e.g. 2008-06-29, the contained screenshot file's name will be based on the current + The following placeholders will be replaced automatically in the pattern defined: +${YYYY} year, 4 digits +${MM} month, 2 digits +${DD} day, 2 digits +${hh} hour, 2 digits +${mm} minute, 2 digits +${ss} second, 2 digits +${NUM} incrementing number, 6 digits +${title} Window title +${user} Windows user +${domain} Windows domain +${hostname} PC name + +You can also have Greenshot create directories dynamically, simply use the backslash symbol (\) to separate folders and filename. +Example: the pattern ${YYYY}-${MM}-${DD}\${hh}-${mm}-${ss} +will generate a folder for the current day in your default storage location, e.g. 2008-06-29, the contained screenshot file's name will be based on the current time, e.g. 11_58_32 (plus extension defined in the settings) Network and updates Output @@ -255,8 +257,8 @@ time, e.g. 11_58_32 (plus extension defined in the settings) A newer version of Greenshot is available! Do you want to download Greenshot {0}? Please wait while the page in Internet Explorer is captured... Warning - The hotkey(s) "{0}" could not be registered. This problem is probably caused by another tool claiming usage of the same hotkey(s)! You could either change your hotkey settings or deactivate/change the software making use of the hotkey(s). - + The hotkey(s) "{0}" could not be registered. This problem is probably caused by another tool claiming usage of the same hotkey(s)! You could either change your hotkey settings or deactivate/change the software making use of the hotkey(s). + All Greenshot features still work directly from the tray icon context menu without hotkeys. Use custom color Preserve transparency diff --git a/GreenshotInterop/Interop/COMWrapper.cs b/GreenshotInterop/Interop/COMWrapper.cs index a756c7f6f..ff0cd07bf 100644 --- a/GreenshotInterop/Interop/COMWrapper.cs +++ b/GreenshotInterop/Interop/COMWrapper.cs @@ -24,6 +24,8 @@ using System.Runtime.InteropServices; using System.Runtime.Remoting; using System.Runtime.Remoting.Messaging; using System.Runtime.Remoting.Proxies; +using System.Windows.Forms; +using GreenshotPlugin.Core; namespace Greenshot.Interop { /// @@ -33,6 +35,7 @@ namespace Greenshot.Interop { private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(COMWrapper)); private const int MK_E_UNAVAILABLE = -2147221021; private const int CO_E_CLASSSTRING = -2147221005; + private const int RPC_E_CALL_REJECTED = unchecked((int)0x80010001); #region Private Data @@ -556,11 +559,23 @@ namespace Greenshot.Interop { } } - try { - returnValue = invokeType.InvokeMember(methodName, flags, null, invokeObject, args, argModifiers, null, null); - } catch (Exception ex) { - return new ReturnMessage(ex, callMessage); - } + do { + try { + returnValue = invokeType.InvokeMember(methodName, flags, null, invokeObject, args, argModifiers, null, null); + break; + } catch (Exception ex) { + // Test for rejected + COMException comEx = ex as COMException; + if (comEx != null && comEx.ErrorCode == RPC_E_CALL_REJECTED) { + DialogResult result = MessageBox.Show(Language.GetString("com_rejected"), Language.GetString("com_rejected_title"), MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); + if (result == DialogResult.OK) { + continue; + } + } + // Not rejected OR pressed cancel + return new ReturnMessage(ex, callMessage); + } + } while (true); // Handle enum and interface return types if (null != returnValue) { diff --git a/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs b/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs index 6962d9441..9bb4f60b8 100644 --- a/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs +++ b/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs @@ -364,9 +364,9 @@ namespace Greenshot.Interop.Office { newMail.Display(false); newMail.GetInspector().Activate(); } catch (Exception ex) { - LOG.WarnFormat("Problem displaying the new email, retrying to display it. Problem: {0}", ex.Message); + LOG.Warn("Problem displaying the new email, retrying to display it. Problem:", ex); Thread retryDisplayEmail = new Thread(delegate() { - int retries = 60; + int retries = 10; int retryInXSeconds = 5; while (retries-- > 0) { Thread.Sleep(retryInXSeconds * 1000);