[git] GpgOL - branch, outlook14, updated. gpgol-1.1.3-5-g5dd6e2b

by Andre Heinecke cvs at cvs.gnupg.org
Fri Jul 5 11:28:20 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, outlook14 has been updated
       via  5dd6e2b9a52e05f754109c5858eebc330f6a0176 (commit)
      from  e1853176eaf2e0411f471f1cc30a783676a5d912 (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 5dd6e2b9a52e05f754109c5858eebc330f6a0176
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Jul 5 09:01:45 2013 +0000

    Add ContextualTab action for Attachments
    
        Proof of concept how additional ui elements can be added.
    
        * src/gpgoladdin.cpp (GetCustomUI): Add contextualTabs element,
        add comment pointing to the documentation for this.
        (decryptAttachments): Handle Explorer context additionally
        to the AttachmentSelection context. Better error handling.

diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index 7f55b69..40063d0 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -437,6 +437,7 @@ GpgolRibbonExtender::decryptAttachments(LPRIBBONCONTROL ctrl)
 {
   BSTR idStr = NULL;
   LPDISPATCH context = NULL;
+  LPDISPATCH attachmentSelection;
   int attachmentCount;
   HRESULT hr = 0;
   int i = 0;
@@ -463,10 +464,18 @@ GpgolRibbonExtender::decryptAttachments(LPRIBBONCONTROL ctrl)
       SysFreeString (idStr);
     }
 
-  attachmentCount = get_oom_int (context, "Count");
-  log_debug ("Count: %i ", attachmentCount);
+  attachmentSelection = get_oom_object (context, "AttachmentSelection");
+  if (!attachmentSelection)
+    {
+      /* We can be called from a context menu, in that case we
+         directly have an AttachmentSelection context. Otherwise
+         we have an Explorer context with an Attachment Selection property. */
+      attachmentSelection = context;
+    }
+
+  attachmentCount = get_oom_int (attachmentSelection, "Count");
 
-  actExplorer = (LPOLEWINDOW) get_oom_object(context,
+  actExplorer = (LPOLEWINDOW) get_oom_object(attachmentSelection,
                                              "Application.ActiveExplorer");
   if (actExplorer)
     actExplorer->GetWindow (&curWindow);
@@ -491,7 +500,15 @@ GpgolRibbonExtender::decryptAttachments(LPRIBBONCONTROL ctrl)
       DISPID saveID;
 
       snprintf (buf, sizeof (buf), "Item(%i)", i);
-      attachmentObj = get_oom_object (context, buf);
+      attachmentObj = get_oom_object (attachmentSelection, buf);
+      if (!attachmentObj)
+        {
+          /* Should be impossible */
+          filenames[i-1] = NULL;
+          log_error ("%s:%s: could not find Item %i;",
+                     SRCNAME, __func__, i);
+          break;
+        }
       filename = get_oom_string (attachmentObj, "FileName");
 
       saveID = lookup_oom_dispid (attachmentObj, "SaveAsFile");
@@ -526,7 +543,11 @@ GpgolRibbonExtender::decryptAttachments(LPRIBBONCONTROL ctrl)
   for (i = 0; i < attachmentCount; i++)
     xfree (filenames[i]);
 
-  return err ? E_FAIL : S_OK;
+  log_debug ("%s:%s: Leaving. Err: %i",
+             SRCNAME, __func__, err);
+
+  return S_OK; /* If we return an error outlook will show that our
+                  callback function failed in an ugly window. */
 }
 
 STDMETHODIMP
@@ -592,6 +613,14 @@ loadXMLResource (int id)
   return SysAllocString (reinterpret_cast<OLECHAR*>(xmlData));
 }
 
+/* Returns the XML markup for the various RibbonID's
+
+   The custom ui syntax is documented at:
+   http://msdn.microsoft.com/en-us/library/dd926139%28v=office.12%29.aspx
+
+   The outlook specific elements are documented at:
+   http://msdn.microsoft.com/en-us/library/office/ee692172%28v=office.14%29.aspx
+*/
 STDMETHODIMP
 GpgolRibbonExtender::GetCustomUI (BSTR RibbonID, BSTR * RibbonXml)
 {
@@ -620,12 +649,25 @@ GpgolRibbonExtender::GetCustomUI (BSTR RibbonID, BSTR * RibbonXml)
         L"     </group>"
         L"    </tab>"
         L"   </tabs>"
+        L"  <contextualTabs>"
+        L"    <tabSet idMso=\"TabSetAttachments\">"
+        L"        <tab idMso=\"TabAttachments\">"
+        L"            <group label=\"GnuPG\" id=\"gnupgLabel\">"
+        L"                <button id=\"gpgol_contextual_decrypt\""
+        L"                    size=\"large\""
+        L"                    label=\"Save and decrypt\""
+        L"                    imageMso=\"HappyFace\""
+        L"                    onAction=\"AttachmentDecryptCallback\" />"
+        L"            </group>"
+        L"        </tab>"
+        L"    </tabSet>"
+        L"  </contextualTabs>"
         L" </ribbon>"
         L" <contextMenus>"
         L" <contextMenu idMso=\"ContextMenuAttachments\">"
-            L"<button id=\"gpgol_decrypt\""
-                L" label=\"Save and decrypt\""
-                L" onAction=\"AttachmentDecryptCallback\"/>"
+        L"   <button id=\"gpgol_decrypt\""
+        L"    label=\"Save and decrypt\""
+        L"    onAction=\"AttachmentDecryptCallback\"/>"
         L" </contextMenu>"
         L" </contextMenus>"
         L"</customUI>"

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

Summary of changes:
 src/gpgoladdin.cpp |   58 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 50 insertions(+), 8 deletions(-)


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




More information about the Gnupg-commits mailing list