[git] GpgOL - branch, master, updated. gpgol-1.1.3-45-g1b5a49b

by Andre Heinecke cvs at cvs.gnupg.org
Wed Jul 31 13:18:58 CEST 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG extension for MS Outlook".

The branch, master has been updated
       via  1b5a49b6039d86989f5154ea0fd6e45d9c912d37 (commit)
       via  6ac963560bd8cc1db76224199a2a3590cf0dbf3b (commit)
       via  1a0dcb04964a2240a1f8dd44a88fc05f513d5b05 (commit)
       via  b8c18d25c53e06716a28fc4e4983a6aac6f881bb (commit)
      from  3408e003620e0c5a1c7f8a52085b9668dcdaf862 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1b5a49b6039d86989f5154ea0fd6e45d9c912d37
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jul 31 10:51:19 2013 +0000

    Enable Addin for Outlook 2013
    
        * src/gpgoladdin.cpp (GpgolAddin::OnConnection): Do not disable
        for major version 15
    
    --
      At least decrypting text still crashes but other actions work.
      Also needs some more GUI hooks but basically its OK.

diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index 1e08688..7738c39 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -230,7 +230,9 @@ GpgolAddin::OnConnection (LPDISPATCH Application, ext_ConnectMode ConnectMode,
   log_debug ("%s:%s:   using GPGME %s\n",
              SRCNAME, __func__, version);
 
-  if (!version || !strlen (version) || strncmp (version, "14", 2))
+  if (!version || !strlen (version) ||
+      (strncmp (version, "14", 2) &&
+       strncmp (version, "15", 2)))
     {
       m_disabled = true;
       log_debug ("%s:%s: Disabled addin for unsupported version.",

commit 6ac963560bd8cc1db76224199a2a3590cf0dbf3b
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jul 31 10:33:02 2013 +0000

    Reanable GUI for adding an encrypted attachment
    
        * src/gpgoladding.cpp (getCustomUI): Enable Add encrypted
        attachment button.

diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index 099015b..1e08688 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -559,8 +559,6 @@ GpgolRibbonExtender::GetCustomUI (BSTR RibbonID, BSTR * RibbonXml)
         L"               label=\"%S\""
         L"               onAction=\"decryptBody\"/>"
         L"     </group>"
-        /*
-           TODO: Implement
         L"     <group id=\"attachmentGroup\""
         L"            label=\"%S\">"
         L"       <button id=\"encryptSignFile\""
@@ -569,7 +567,6 @@ GpgolRibbonExtender::GetCustomUI (BSTR RibbonID, BSTR * RibbonXml)
         L"               label=\"%S\""
         L"               onAction=\"addEncSignedAttachment\"/>"
         L"     </group>"
-        */
         L"    </tab>"
         L"   </tabs>"
         L" </ribbon>"
@@ -590,11 +587,8 @@ GpgolRibbonExtender::GetCustomUI (BSTR RibbonID, BSTR * RibbonXml)
         _("Textbody"),
         _("Encrypt"),
         _("Decrypt"),
-        /*
-           TODO: Implement
         _("Attachments"),
-        _("Encrypted file"),
-        */
+        _("Add Encrypted file"),
         _("Encrypt"), _("Decrypt")
         );
     }

commit 1a0dcb04964a2240a1f8dd44a88fc05f513d5b05
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jul 31 10:29:24 2013 +0000

    Add get_open_filename utility function
    
        Can be used to open an existing file using the Windows
        filedialog.
    
        * src/common.c, src/common.h: Add get_open_filename.

diff --git a/src/common.c b/src/common.c
index ec8c370..f458b15 100644
--- a/src/common.c
+++ b/src/common.c
@@ -189,6 +189,43 @@ get_system_check_bitmap (int checked)
   return result;
 }
 
+/* Return the path to a file that should be worked with.
+   Returns a malloced string (UTF-8) on success.
+   HWND is the current Window.
+   Title is a UTF-8 encoded string containing the
+   dialog title and may be NULL.
+   On error (i.e. cancel) NULL is returned. */
+char *
+get_open_filename (HWND root, const char *title)
+{
+  OPENFILENAMEW ofn;
+  wchar_t fname[MAX_PATH+1];
+  wchar_t *wTitle = NULL;
+
+  if (title)
+    {
+      wTitle = utf8_to_wchar2 (title, strlen(title));
+    }
+  memset (fname, 0, sizeof (fname));
+
+  /* Set up the ofn structure */
+  memset (&ofn, 0, sizeof (ofn));
+  ofn.lStructSize = sizeof (ofn);
+  ofn.hwndOwner = root;
+  ofn.lpstrFile = fname;
+  ofn.nMaxFile = MAX_PATH;
+  ofn.lpstrTitle = wTitle;
+  ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
+
+  if (GetOpenFileNameW (&ofn))
+    {
+      xfree (wTitle);
+      return wchar_to_utf8_2 (fname, MAX_PATH);
+    }
+  xfree (wTitle);
+  return NULL;
+}
+
 
 /* Return a filename to be used for saving an attachment. Returns a
    malloced string on success. HWND is the current Window and SRCNAME
diff --git a/src/common.h b/src/common.h
index ede4d2b..265a470 100644
--- a/src/common.h
+++ b/src/common.h
@@ -180,6 +180,7 @@ void set_global_hinstance (HINSTANCE hinst);
 void center_window (HWND childwnd, HWND style);
 HBITMAP get_system_check_bitmap (int checked);
 char *get_save_filename (HWND root, const char *srcname);
+char *get_open_filename (HWND root, const char *title);
 char *utf8_to_wincp (const char *string);
 
 const char *default_homedir (void);

commit b8c18d25c53e06716a28fc4e4983a6aac6f881bb
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jul 31 10:25:45 2013 +0000

    Factor out duplicated code and move to oomhelp
    
        * src/oomhelp.cpp, src/oomhelp.h (get_oom_context_window): New.
        * src/ribbon-callbacks.cpp (encryptInspector)
        (decryptAttachments, decryptInspector, startCertManager): Use
        get_oom_context_window.
        * src/oomhelp.h, src/ribbon-callbacks.cpp (RELDISP): Move macro
        from ribbon-callbacks.cpp to oomhelp.h

diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp
index 59e5cdb..73270f2 100644
--- a/src/oomhelp.cpp
+++ b/src/oomhelp.cpp
@@ -770,3 +770,22 @@ del_oom_button (LPDISPATCH pObj)
                SRCNAME, __func__, hr);
 }
 
+/* Gets the current contexts HWND. Returns NULL on error */
+HWND
+get_oom_context_window (LPDISPATCH context)
+{
+  LPOLEWINDOW actExplorer;
+  HWND ret = NULL;
+  actExplorer = (LPOLEWINDOW) get_oom_object(context,
+                                             "Application.ActiveExplorer");
+  if (actExplorer)
+    actExplorer->GetWindow (&ret);
+  else
+    {
+      log_debug ("%s:%s: Could not find active window",
+                 SRCNAME, __func__);
+    }
+  RELDISP (actExplorer);
+  return ret;
+}
+
diff --git a/src/oomhelp.h b/src/oomhelp.h
index 4c0d2f0..1f62cbf 100644
--- a/src/oomhelp.h
+++ b/src/oomhelp.h
@@ -22,6 +22,8 @@
 
 #include <unknwn.h>
 
+/* Helper to release dispatcher */
+#define RELDISP(dispatcher) if (dispatcher) dispatcher->Release()
 
 #define MSOCONTROLBUTTON    1
 #define MSOCONTROLEDIT      2
@@ -116,6 +118,8 @@ LPDISPATCH add_oom_button (LPDISPATCH pObj);
 /* Delete a button.  */
 void del_oom_button (LPDISPATCH button);
 
+/* Get the HWND of the active window in the current context */
+HWND get_oom_context_window (LPDISPATCH context);
 
 #ifdef __cplusplus
 }
diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index 7712d06..2b6d809 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -46,9 +46,6 @@
 #include "mimemaker.h"
 #include "filetype.h"
 
-/* Helper to release dispatcher */
-#define RELDISP(dispatcher) if (dispatcher) dispatcher->Release()
-
 /* Gets the context of a ribbon control. And prints some
    useful debug output */
 HRESULT getContext (LPDISPATCH ctrl, LPDISPATCH *context)
@@ -91,7 +88,6 @@ encryptInspector (LPDISPATCH ctrl, int flags)
   HRESULT hr;
   int recipientsCnt;
   HWND curWindow;
-  LPOLEWINDOW actExplorer;
   protocol_t protocol;
   unsigned int session_number;
   int i;
@@ -104,17 +100,7 @@ encryptInspector (LPDISPATCH ctrl, int flags)
   memset (encsink, 0, sizeof *encsink);
   memset (sink, 0, sizeof *sink);
 
-  actExplorer = (LPOLEWINDOW) get_oom_object(context,
-                                             "Application.ActiveExplorer");
-  if (actExplorer)
-    actExplorer->GetWindow (&curWindow);
-  else
-    {
-      log_debug ("%s:%s: Could not find active window",
-                 SRCNAME, __func__);
-      curWindow = NULL;
-    }
-  RELDISP (actExplorer);
+  curWindow = get_oom_context_window (context);
 
   wordEditor = get_oom_object (context, "WordEditor");
   application = get_oom_object (wordEditor, "get_Application");
@@ -385,7 +371,6 @@ decryptAttachments (LPDISPATCH ctrl)
   HRESULT hr = 0;
   int i = 0;
   HWND curWindow;
-  LPOLEWINDOW actExplorer;
   int err;
 
   hr = getContext(ctrl, &context);
@@ -401,18 +386,7 @@ decryptAttachments (LPDISPATCH ctrl)
 
   attachmentCount = get_oom_int (attachmentSelection, "Count");
 
-  actExplorer = (LPOLEWINDOW) get_oom_object(attachmentSelection,
-                                             "Application.ActiveExplorer");
-  if (actExplorer)
-    actExplorer->GetWindow (&curWindow);
-  else
-    {
-      log_debug ("%s:%s: Could not find active window",
-                 SRCNAME, __func__);
-      curWindow = NULL;
-    }
-
-  RELDISP (actExplorer);
+  curWindow = get_oom_context_window (context);
 
   {
     char *filenames[attachmentCount + 1];
@@ -509,7 +483,6 @@ decryptInspector (LPDISPATCH ctrl, int flags)
 
   LPSTREAM tmpstream = NULL;
   engine_filter_t filter = NULL;
-  LPOLEWINDOW actExplorer;
   HWND curWindow;
   char* encData = NULL;
   int encDataLen = 0;
@@ -527,17 +500,7 @@ decryptInspector (LPDISPATCH ctrl, int flags)
   memset (decsink, 0, sizeof *decsink);
   memset (sink, 0, sizeof *sink);
 
-  actExplorer = (LPOLEWINDOW) get_oom_object(context,
-                                             "Application.ActiveExplorer");
-  if (actExplorer)
-    actExplorer->GetWindow (&curWindow);
-  else
-    {
-      log_debug ("%s:%s: Could not find active window",
-                 SRCNAME, __func__);
-      curWindow = NULL;
-    }
-  RELDISP (actExplorer);
+  curWindow = get_oom_context_window (context);
 
   if (!(flags & DECRYPT_INSPECTOR_BODY))
     {
@@ -846,23 +809,12 @@ startCertManager (LPDISPATCH ctrl)
   HRESULT hr;
   LPDISPATCH context;
   HWND curWindow;
-  LPOLEWINDOW actExplorer;
 
   hr = getContext (ctrl, &context);
   if (FAILED(hr))
       return hr;
 
-  actExplorer = (LPOLEWINDOW) get_oom_object(context,
-                                             "Application.ActiveExplorer");
-  if (actExplorer)
-    actExplorer->GetWindow (&curWindow);
-  else
-    {
-      log_debug ("%s:%s: Could not find active window",
-                 SRCNAME, __func__);
-      curWindow = NULL;
-    }
-  RELDISP (actExplorer);
+  curWindow = get_oom_context_window (context);
 
   engine_start_keymanager (curWindow);
 }

-----------------------------------------------------------------------

Summary of changes:
 src/common.c             |   37 ++++++++++++++++++++++++++++++
 src/common.h             |    1 +
 src/gpgoladdin.cpp       |   12 +++------
 src/oomhelp.cpp          |   19 +++++++++++++++
 src/oomhelp.h            |    4 +++
 src/ribbon-callbacks.cpp |   56 +++------------------------------------------
 6 files changed, 69 insertions(+), 60 deletions(-)


hooks/post-receive
-- 
GnuPG extension for MS Outlook
http://git.gnupg.org




More information about the Gnupg-commits mailing list