From 4713847d2ecb155c7f033362f5148008384d0530 Mon Sep 17 00:00:00 2001 From: RKrom Date: Sat, 20 Oct 2012 12:56:55 +0000 Subject: [PATCH] Added a small change for the confluence plugin build, debug-info was included in the release. Also added a ExtendedWebBrowser, which suppresses Script-error messages when using the WebBrowser. (For this a the IOleCommandTarget was introduced). Had to update the readme.txt to make the version consistent. git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2176 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- Greenshot/Greenshot.sln | 20 +++++- .../releases/additional_files/readme.txt | 2 +- GreenshotConfluencePlugin/ConfluencePlugin.cs | 3 - .../GreenshotConfluencePlugin.csproj | 6 +- GreenshotInterop/GreenshotInterop.csproj | 1 + GreenshotInterop/Interop/IOleCommandTarget.cs | 35 +++++++++ .../OfficeInterop/OfficeCommunicator.cs | 71 +++++++++++++++++++ .../GreenshotOfficePlugin.csproj | 2 +- .../Controls/ExtendedWebBrowser.cs | 68 ++++++++++++++++++ .../Controls/OAuthLoginForm.Designer.cs | 8 +-- GreenshotPlugin/Controls/OAuthLoginForm.cs | 3 +- GreenshotPlugin/GreenshotPlugin.csproj | 6 ++ 12 files changed, 208 insertions(+), 17 deletions(-) create mode 100644 GreenshotInterop/Interop/IOleCommandTarget.cs create mode 100644 GreenshotInterop/OfficeInterop/OfficeCommunicator.cs create mode 100644 GreenshotPlugin/Controls/ExtendedWebBrowser.cs diff --git a/Greenshot/Greenshot.sln b/Greenshot/Greenshot.sln index 931b73d7d..60ae08ba3 100644 --- a/Greenshot/Greenshot.sln +++ b/Greenshot/Greenshot.sln @@ -135,14 +135,28 @@ Global {1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Release|Any CPU.Build.0 = Release|Any CPU {1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Release|x86.ActiveCfg = Release|x86 + {1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Debug|Any CPU.Build.0 = Debug|Any CPU + {697CF066-9077-4F22-99D9-D989CCE7282B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19FEEF09-313F-43C7-819D-F1BCA782B08B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C3052651-598A-44E2-AAB3-2E41311D50F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {47F23C86-604E-4CC3-8767-B3D4088F30BB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5B924697-4DCD-4F98-85F1-105CB84B7341}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|Any CPU.Build.0 = Debug|Any CPU {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|x86.ActiveCfg = Debug|x86 {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|x86.Build.0 = Debug|x86 - {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|x86.ActiveCfg = Debug|x86 {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|Any CPU.Build.0 = Release|Any CPU - {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|Any CPU.ActiveCfg = Release|Any CPU {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|x86.Build.0 = Release|x86 {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|x86.ActiveCfg = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution diff --git a/Greenshot/releases/additional_files/readme.txt b/Greenshot/releases/additional_files/readme.txt index f5c91fdb6..4de1d7f3c 100644 --- a/Greenshot/releases/additional_files/readme.txt +++ b/Greenshot/releases/additional_files/readme.txt @@ -4,7 +4,7 @@ Greenshot: A screenshot tool optimized for productivity. Save a screenshot or a CHANGE LOG: We changed the version to 1.0 after 5 years it should no longer have a "beta" feeling! -1.0.4 build 2172 Release Candidate 4 +1.0.4 build 2176 Release Candidate 4 Bugs resolved: * Fixed error during OAuth process due to authorization dialog not opening, see bug #3578480 diff --git a/GreenshotConfluencePlugin/ConfluencePlugin.cs b/GreenshotConfluencePlugin/ConfluencePlugin.cs index a42f765fd..9f4703702 100644 --- a/GreenshotConfluencePlugin/ConfluencePlugin.cs +++ b/GreenshotConfluencePlugin/ConfluencePlugin.cs @@ -96,9 +96,6 @@ namespace GreenshotConfluencePlugin { host = pluginHost; ConfluencePluginAttributes = myAttributes; - // Force exception when there is no Full Profile, this will make sure the plugin isn't loaded - HttpUtility.UrlEncode("bla"); - // Register configuration (don't need the configuration itself) config = IniConfig.GetIniSection(); if(config.IsDirty) { diff --git a/GreenshotConfluencePlugin/GreenshotConfluencePlugin.csproj b/GreenshotConfluencePlugin/GreenshotConfluencePlugin.csproj index 3f1fced27..370225b56 100644 --- a/GreenshotConfluencePlugin/GreenshotConfluencePlugin.csproj +++ b/GreenshotConfluencePlugin/GreenshotConfluencePlugin.csproj @@ -47,8 +47,6 @@ 3.5 - - @@ -237,8 +235,8 @@ copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)bin\$(Configuration)\Languag TRACE True False - Full - true + None + false DEBUG;TRACE diff --git a/GreenshotInterop/GreenshotInterop.csproj b/GreenshotInterop/GreenshotInterop.csproj index 775330ba1..e2a1e7bee 100644 --- a/GreenshotInterop/GreenshotInterop.csproj +++ b/GreenshotInterop/GreenshotInterop.csproj @@ -46,6 +46,7 @@ + diff --git a/GreenshotInterop/Interop/IOleCommandTarget.cs b/GreenshotInterop/Interop/IOleCommandTarget.cs new file mode 100644 index 000000000..660b631aa --- /dev/null +++ b/GreenshotInterop/Interop/IOleCommandTarget.cs @@ -0,0 +1,35 @@ +/* + * Greenshot - a free and open source screenshot tool + * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom + * + * For more information see: http://getgreenshot.org/ + * The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +using System; +using System.Runtime.InteropServices; + +namespace GreenshotInterop.Interop { + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComVisible(true), Guid("B722BCCB-4E68-101B-A2BC-00AA00404770")] + public interface IOleCommandTarget { + [return: MarshalAs(UnmanagedType.I4)] + [PreserveSig] + int QueryStatus([In, MarshalAs(UnmanagedType.LPStruct)] Guid pguidCmdGroup, int cCmds, IntPtr prgCmds, IntPtr pCmdText); + + [return: MarshalAs(UnmanagedType.I4)] + [PreserveSig] + int Exec([In, MarshalAs(UnmanagedType.LPStruct)] Guid pguidCmdGroup, int nCmdID, int nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut); + } +} diff --git a/GreenshotInterop/OfficeInterop/OfficeCommunicator.cs b/GreenshotInterop/OfficeInterop/OfficeCommunicator.cs new file mode 100644 index 000000000..f659d12b3 --- /dev/null +++ b/GreenshotInterop/OfficeInterop/OfficeCommunicator.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Greenshot.Interop; +using Greenshot.Interop.Office; + +namespace GreenshotInterop.OfficeInterop { + // See: http://msdn.microsoft.com/en-us/library/bb758788%28v=office.12%29 + [ComProgId("Communicator.UIAutomation")] + public interface IMessenger : Common { + void AutoSignin(); + string MyServiceId { + get; + } + IMessengerContact GetContact(string signinName, string serviceId); + IMessengerWindow InstantMessage(string contact); + } + + // See: http://msdn.microsoft.com/en-us/library/bb787250%28v=office.12%29 + public interface IMessengerContact : Common { + string FriendlyName { + get; + } + string ServiceName { + get; + } + string ServiceId { + get; + } + string SigninName { + get; + } + MISTATUS Status { + get; + } + } + + // See: http://msdn.microsoft.com/en-us/library/bb787207%28v=office.12%29 + public enum MISTATUS { + MISTATUS_UNKNOWN = 0x0000, + MISTATUS_OFFLINE = 0x0001, + MISTATUS_ONLINE = 0x0002, + MISTATUS_INVISIBLE = 0x0006, + MISTATUS_BUSY = 0x000A, + MISTATUS_BE_RIGHT_BACK = 0x000E, + MISTATUS_IDLE = 0x0012, + MISTATUS_AWAY = 0x0022, + MISTATUS_ON_THE_PHONE = 0x0032, + MISTATUS_OUT_TO_LUNCH = 0x0042, + MISTATUS_IN_A_MEETING = 0x0052, + MISTATUS_OUT_OF_OFFICE = 0x0062, + MISTATUS_DO_NOT_DISTURB = 0x0072, + MISTATUS_IN_A_CONFERENCE = 0x0082, + MISTATUS_ALLOW_URGENT_INTERRUPTIONS = 0x0092, + MISTATUS_MAY_BE_AVAILABLE = 0x00A2, + MISTATUS_CUSTOM = 0x00B2, + MISTATUS_LOCAL_FINDING_SERVER = 0x0100, + MISTATUS_LOCAL_CONNECTING_TO_SERVER = 0x0200, + MISTATUS_LOCAL_SYNCHRONIZING_WITH_SERVER = 0x0300, + MISTATUS_LOCAL_DISCONNECTING_FROM_SERVER = 0x0400 + } ; + + // See: http://msdn.microsoft.com/en-us/library/bb758816%28v=office.12%29 + public interface IMessengerWindow : Common { + bool IsClosed { + get; + } + void Show(); + } + +} diff --git a/GreenshotOfficePlugin/GreenshotOfficePlugin.csproj b/GreenshotOfficePlugin/GreenshotOfficePlugin.csproj index b76568023..51b7bdf42 100644 --- a/GreenshotOfficePlugin/GreenshotOfficePlugin.csproj +++ b/GreenshotOfficePlugin/GreenshotOfficePlugin.csproj @@ -1,7 +1,7 @@  - {D14382D5-D870-4B55-AC21-6E64A8A68420} + {92599C09-FF29-4ABD-B6E6-C48ECD781BAB} Debug x86 Library diff --git a/GreenshotPlugin/Controls/ExtendedWebBrowser.cs b/GreenshotPlugin/Controls/ExtendedWebBrowser.cs new file mode 100644 index 000000000..6ae1631e7 --- /dev/null +++ b/GreenshotPlugin/Controls/ExtendedWebBrowser.cs @@ -0,0 +1,68 @@ +/* + * Greenshot - a free and open source screenshot tool + * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom + * + * For more information see: http://getgreenshot.org/ + * The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; +using GreenshotInterop.Interop; + +namespace GreenshotPlugin.Controls { + public class ExtendedWebBrowser : WebBrowser { + protected class ExtendedWebBrowserSite : WebBrowserSite, IOleCommandTarget { + const int OLECMDID_SHOWSCRIPTERROR = 40; + const int OLECMDID_SHOWMESSAGE = 41; + + static Guid CGID_DocHostCommandHandler = new Guid("F38BC242-B950-11D1-8918-00C04FC2C836"); + + const int S_OK = 0; + const int OLECMDERR_E_NOTSUPPORTED = (-2147221248); + const int OLECMDERR_E_UNKNOWNGROUP = (-2147221244); + + public ExtendedWebBrowserSite(WebBrowser wb) : base(wb) { + } + + #region IOleCommandTarget Members + public int QueryStatus(Guid pguidCmdGroup, int cCmds, IntPtr prgCmds, IntPtr pCmdText) { + return OLECMDERR_E_NOTSUPPORTED; + } + + public int Exec(Guid pguidCmdGroup, int nCmdID, int nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { + if (pguidCmdGroup == CGID_DocHostCommandHandler) { + if (nCmdID == OLECMDID_SHOWSCRIPTERROR) { + // do not need to alter pvaOut as the docs says, enough to return S_OK here + return S_OK; + } + } + + return OLECMDERR_E_NOTSUPPORTED; + } + + #endregion + } + + protected override WebBrowserSiteBase CreateWebBrowserSiteBase() { + return new ExtendedWebBrowserSite(this); + } + + public ExtendedWebBrowser() { + } + } +} \ No newline at end of file diff --git a/GreenshotPlugin/Controls/OAuthLoginForm.Designer.cs b/GreenshotPlugin/Controls/OAuthLoginForm.Designer.cs index 7363fc4ec..18f1ed638 100644 --- a/GreenshotPlugin/Controls/OAuthLoginForm.Designer.cs +++ b/GreenshotPlugin/Controls/OAuthLoginForm.Designer.cs @@ -45,7 +45,7 @@ namespace GreenshotPlugin.Controls { /// private void InitializeComponent() { this.addressTextBox = new System.Windows.Forms.TextBox(); - this.browser = new System.Windows.Forms.WebBrowser(); + this.browser = new ExtendedWebBrowser(); this.SuspendLayout(); // // addressTextBox @@ -81,12 +81,12 @@ namespace GreenshotPlugin.Controls { this.ResumeLayout(false); this.PerformLayout(); - } + } - #endregion + #endregion private System.Windows.Forms.TextBox addressTextBox; - private System.Windows.Forms.WebBrowser browser; + private ExtendedWebBrowser browser; } } diff --git a/GreenshotPlugin/Controls/OAuthLoginForm.cs b/GreenshotPlugin/Controls/OAuthLoginForm.cs index 900f6800a..52c5cd8f4 100644 --- a/GreenshotPlugin/Controls/OAuthLoginForm.cs +++ b/GreenshotPlugin/Controls/OAuthLoginForm.cs @@ -55,7 +55,8 @@ namespace GreenshotPlugin.Controls { this.Text = browserTitle; this.addressTextBox.Text = authorizationLink; - browser.ScriptErrorsSuppressed = true; + // The script errors are suppressed by using the ExtendedWebBrowser + browser.ScriptErrorsSuppressed = false; browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(browser_DocumentCompleted); browser.Navigate(new Uri(authorizationLink)); diff --git a/GreenshotPlugin/GreenshotPlugin.csproj b/GreenshotPlugin/GreenshotPlugin.csproj index 1a41eeff8..99dd85b8f 100644 --- a/GreenshotPlugin/GreenshotPlugin.csproj +++ b/GreenshotPlugin/GreenshotPlugin.csproj @@ -113,9 +113,15 @@ Interop\IOleWindow.cs + + Interop\IOleCommandTarget.cs + Interop\IServiceProvider.cs + + Component + Form