[git] GpgOL - branch, master, updated. gpgol-1.3.0-33-gac29e4a

by Andre Heinecke cvs at cvs.gnupg.org
Thu Dec 10 19:39:16 CET 2015


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  ac29e4ae6c30d37ee8cba136247bb3c4dd955562 (commit)
       via  3d7f4b75a8ece7c3c66b08eee32bd98c4a891408 (commit)
       via  5369902bddd8975cfd4643412ba42a14211f8e82 (commit)
       via  12e9f287d876f2cc6c913e32bcfca0f19ea11191 (commit)
       via  c7c30d4e43e1f53ae152e35d8cb91ce51b96f0e8 (commit)
       via  6d668bf011300999c6f1126b0b18749b9f964509 (commit)
       via  5479446f94250cf52bff3f1af6cfc4ce2b2560f2 (commit)
      from  c83341bf492e73bea4041e91ec2a08ed6d68888a (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 ac29e4ae6c30d37ee8cba136247bb3c4dd955562
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Dec 10 19:38:40 2015 +0100

    Disable S/MIME support by default
    
    * src/main.c (read_options): Default to false for S/MIME support.

diff --git a/src/main.c b/src/main.c
index b8b9160..147bf0d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -610,7 +610,7 @@ read_options (void)
 
 
   load_extension_value ("enableSmime", &val);
-  opt.enable_smime = (!val || atoi (val));
+  opt.enable_smime = !val ? 0 : atoi (val);
   xfree (val); val = NULL;
 
 /*   load_extension_value ("defaultProtocol", &val); */

commit 3d7f4b75a8ece7c3c66b08eee32bd98c4a891408
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Dec 10 19:34:52 2015 +0100

    Set protocol to OpenPGP if S/MIME is disabled
    
    * src/mail.cpp (do_crypto): Set protocol according to opts.

diff --git a/src/mail.cpp b/src/mail.cpp
index 3a5052e..8f215b6 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -232,6 +232,7 @@ Mail::do_crypto ()
 {
   int err = -1,
       flags = 0;
+  protocol_t proto = opt.enable_smime ? PROTOCOL_UNKNOWN : PROTOCOL_OPENPGP;
   if (!needs_crypto())
     {
       return 0;
@@ -248,17 +249,17 @@ Mail::do_crypto ()
     {
       log_debug ("%s:%s: Sign / Encrypting message",
                  SRCNAME, __func__);
-      err = message_sign_encrypt (message, PROTOCOL_UNKNOWN,
+      err = message_sign_encrypt (message, proto,
                                   NULL, get_sender ());
     }
   else if (flags == 2)
     {
-      err = message_sign (message, PROTOCOL_UNKNOWN,
+      err = message_sign (message, proto,
                           NULL, get_sender ());
     }
   else if (flags == 1)
     {
-      err = message_encrypt (message, PROTOCOL_UNKNOWN,
+      err = message_encrypt (message, proto,
                              NULL, get_sender ());
     }
   else

commit 5369902bddd8975cfd4643412ba42a14211f8e82
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Dec 10 19:26:30 2015 +0100

    Fix logic error in save avoidance
    
    * src/mailitem-events.cpp (Write): Only check for needs_save again.
     (Read): Set needs save if a smime message should be reverted.

diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index 8b53739..ddeecfc 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -174,6 +174,12 @@ EVENT_SINK_INVOKE(MailItemEvents)
               log_error ("%s:%s: Failed to insert plaintext into oom.",
                          SRCNAME, __func__);
             }
+          if (!opt.enable_smime && m_mail->is_smime ())
+            {
+              /* We want to save the mail when it's an smime mail and smime
+                 is disabled to revert it. */
+              m_mail->set_needs_save (true);
+            }
           break;
         }
 #if 0
@@ -263,8 +269,7 @@ EVENT_SINK_INVOKE(MailItemEvents)
              break;
            }
 
-          if ((!opt.enable_smime && m_mail->is_smime ()) &&
-              (m_mail->is_crypto_mail () && !m_mail->needs_save ()))
+          if (m_mail->is_crypto_mail () && !m_mail->needs_save ())
             {
               /* We cancel the write event to stop outlook from excessively
                  syncing our changes.

commit 12e9f287d876f2cc6c913e32bcfca0f19ea11191
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Dec 10 19:25:04 2015 +0100

    Make default encrypt and default sign work
    
    * src/mailitem-events.cpp (Open): Set draft_info_flags according
     to settings.

diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index 1f101a5..8b53739 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -26,6 +26,7 @@
 #include "ocidl.h"
 #include "windowmessages.h"
 #include "mail.h"
+#include "mapihelp.h"
 
 const wchar_t * save_props[] = {
   L"Categories",
@@ -131,6 +132,32 @@ EVENT_SINK_INVOKE(MailItemEvents)
     }
   switch(dispid)
     {
+      case Open:
+        {
+          LPMESSAGE message;
+          int draft_flags;
+          if (!opt.encrypt_default && !opt.sign_default)
+            {
+              return S_OK;
+            }
+          message = get_oom_base_message (m_object);
+          if (!message)
+            {
+              log_error ("%s:%s: Failed to get message.",
+                         SRCNAME, __func__);
+              break;
+            }
+          if (opt.encrypt_default)
+            {
+              draft_flags = 1;
+            }
+          if (opt.sign_default)
+            {
+              draft_flags += 2;
+            }
+          set_gpgol_draft_info_flags (message, draft_flags);
+          RELDISP (message);
+        }
       case BeforeRead:
         {
           if (m_mail->process_message ())

commit c7c30d4e43e1f53ae152e35d8cb91ce51b96f0e8
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Dec 10 19:19:38 2015 +0100

    Add Options control to ribbon and prep. Sigstat
    
    * src/gpgoladdin.cpp (getCustomUI): Add dialogBoxLauncher for opts.
      (getCustomUI): Prepare for status in reader window.
      (GpgolRibbonExtender::Invoke): Call the functions.
      (GpgolRibbonExtender::GetIDsOfNames): New names.
    * src/mail.cpp (Mail::insert_plaintext): Invalidate ribbon.
    * src/ribbon-callbacks.cpp (get_crypt_status): New.
    * src/ribbon-callbacks.h: Add prototypes
    
    --
    The signature status code basically works but the UI does not
    work. Using toggle buttons does not work because the user can
    change them. Disabling them greys them out and this does not
    look right.

diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index 01c2084..a039a5e 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -49,6 +49,7 @@
 #include "eventsink.h"
 #include "windowmessages.h"
 #include "mail.h"
+#include "addin-options.h"
 
 #include <gpg-error.h>
 #include <list>
@@ -510,6 +511,9 @@ GpgolRibbonExtender::GetIDsOfNames (REFIID riid, LPOLESTR *rgszNames,
       ID_MAPPER (L"getEncryptPressed", ID_GET_ENCRYPT_PRESSED)
       ID_MAPPER (L"getSignPressed", ID_GET_SIGN_PRESSED)
       ID_MAPPER (L"ribbonLoaded", ID_ON_LOAD);
+      ID_MAPPER (L"openOptions", ID_CMD_OPEN_OPTIONS)
+      ID_MAPPER (L"getSigStatus", ID_GET_SIG_STATUS)
+      ID_MAPPER (L"getEncStatus", ID_GET_ENC_STATUS)
     }
 
   if (cNames > 1)
@@ -568,11 +572,19 @@ GpgolRibbonExtender::Invoke (DISPID dispid, REFIID riid, LCID lcid,
         return get_crypt_pressed (parms->rgvarg[0].pdispVal, 1, result);
       case ID_GET_SIGN_PRESSED:
         return get_crypt_pressed (parms->rgvarg[0].pdispVal, 2, result);
+      case ID_GET_ENC_STATUS:
+        return get_crypt_status (parms->rgvarg[0].pdispVal, 1, result);
+      case ID_GET_SIG_STATUS:
+        return get_crypt_status (parms->rgvarg[0].pdispVal, 2, result);
       case ID_ON_LOAD:
           {
-            log_debug ("A new Ribbon control was born: %p",
-                       parms->rgvarg[0].pdispVal);
             g_ribbon_uis.push_back (parms->rgvarg[0].pdispVal);
+            return S_OK;
+          }
+      case ID_CMD_OPEN_OPTIONS:
+          {
+            options_dialog_box (NULL);
+            return S_OK;
           }
       case ID_BTN_CERTMANAGER:
       case ID_BTN_ENCRYPT:
@@ -604,12 +616,12 @@ GpgolRibbonExtender::GetCustomUI (BSTR RibbonID, BSTR * RibbonXml)
 {
   char * buffer = NULL;
 
-  const char *certManagerTTip =
+/*  const char *certManagerTTip =
     _("Start the Certificate Management Software");
   const char *certManagerSTip =
     _("Open GPA or Kleopatra to manage your certificates. "
       "You can use this you to generate your "
-      "own certificates. ");
+      "own certificates. ");*/
   const char *encryptTTip =
     _("Encrypt the message.");
   const char *encryptSTip =
@@ -618,7 +630,18 @@ GpgolRibbonExtender::GetCustomUI (BSTR RibbonID, BSTR * RibbonXml)
     _("Sign the message.");
   const char *signSTip =
     _("Sign the message and all attchments before sending.");
-
+  const char *optsSTip =
+    _("Open the settings dialog for GpgOL");
+#if 0
+  const char *encryptedTTip =
+    "If this is toggled the message was encrypted. (this is development UI)";
+  const char *encryptedSTip =
+    "TODO insert more details here";
+  const char *signedTTip =
+    "If this is toggled the message was signed. (this is development UI)";
+  const char *signedSTip =
+    "TODO insert more details here";
+#endif
   log_debug ("%s:%s: GetCustomUI for id: %ls", SRCNAME, __func__, RibbonID);
 
   if (!RibbonXml || !RibbonID)
@@ -634,13 +657,6 @@ GpgolRibbonExtender::GetCustomUI (BSTR RibbonID, BSTR * RibbonXml)
         "    <tab idMso=\"TabNewMailMessage\">"
         "     <group id=\"general\""
         "            label=\"%s\">"
-        "       <button id=\"CustomButton\""
-        "               getImage=\"btnCertManager\""
-        "               size=\"large\""
-        "               label=\"%s\""
-        "               screentip=\"%s\""
-        "               supertip=\"%s\""
-        "               onAction=\"startCertManager\"/>"
         "       <toggleButton id=\"mimeEncrypt\""
         "               getImage=\"btnEncryptLarge\""
         "               size=\"large\""
@@ -657,14 +673,73 @@ GpgolRibbonExtender::GetCustomUI (BSTR RibbonID, BSTR * RibbonXml)
         "               supertip=\"%s\""
         "               onAction=\"signMime\""
         "               getPressed=\"getSignPressed\"/>"
+        "       <dialogBoxLauncher>"
+        "         <button id=\"optsBtn\""
+        "                 onAction=\"openOptions\""
+        "                 screentip=\"%s\"/>"
+        "       </dialogBoxLauncher>"
         "     </group>"
         "    </tab>"
         "   </tabs>"
         " </ribbon>"
         "</customUI>", _("GpgOL"),
-        _("Start Certificate Manager"), certManagerTTip, certManagerSTip,
         _("Encrypt"), encryptTTip, encryptSTip,
-        _("Sign"), signTTip, signSTip
+        _("Sign"), signTTip, signSTip,
+        optsSTip
+        );
+    }
+  else if (!wcscmp (RibbonID, L"Microsoft.Outlook.Mail.Read"))
+    {
+      gpgrt_asprintf (&buffer,
+        "<customUI xmlns=\"http://schemas.microsoft.com/office/2009/07/customui\""
+        " onLoad=\"ribbonLoaded\">"
+#if 0
+        " <ribbon>"
+        "   <tabs>"
+        "    <tab idMso=\"TabReadMessage\">"
+        "     <group id=\"general\""
+        "            label=\"%s\">"
+        "       <toggleButton id=\"idEncrypted\""
+        "               getImage=\"btnCryptStatus\""
+        "               size=\"large\""
+        "               label=\"%s\""
+        "               screentip=\"%s\""
+        "               supertip=\"%s\""
+        "               getEnabled=\"getEncStatus\"/>"
+        "       <button id=\"idSigned\""
+        "               getImage=\"btnSignLarge\""
+        "               size=\"large\""
+        "               label=\"%s\""
+        "               screentip=\"%s\""
+        "               supertip=\"%s\""
+        "               onAction=\"verifyBody\""
+        "               getEnabled=\"getSigStatus\"/>"
+        "       <dialogBoxLauncher>"
+        "         <button id=\"optsBtn\""
+        "                 onAction=\"openOptions\""
+        "                 screentip=\"%s\"/>"
+        "       </dialogBoxLauncher>"
+        "     </group>"
+        "    </tab>"
+        "   </tabs>"
+        " </ribbon>"
+#endif
+        "<contextMenus>"
+        " <contextMenu idMso=\"ContextMenuAttachments\">"
+        "   <button id=\"gpgol_decrypt\""
+        "           label=\"%s\""
+        "           getImage=\"btnDecrypt\""
+        "           onAction=\"attachmentDecryptCallback\"/>"
+        " </contextMenu>"
+        "</contextMenus>"
+        "</customUI>",
+#if 0
+        _("GpgOL"),
+        _("Encrypted"), encryptedTTip, encryptedSTip,
+        _("Signed"), signedTTip, signedSTip,
+        optsSTip,
+#endif
+        _("Decrypt")
         );
     }
 
diff --git a/src/mail.cpp b/src/mail.cpp
index 72971b4..3a5052e 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -27,6 +27,7 @@
 #include "mapihelp.h"
 #include "message.h"
 #include "revert.h"
+#include "gpgoladdin.h"
 
 #include <map>
 
@@ -219,6 +220,8 @@ Mail::insert_plaintext ()
       err = -1;
     }
 
+  /* Invalidate UI to set the correct sig status. */
+  gpgoladdin_invalidate_ui ();
 done:
   RELDISP (base_message);
   return err;
diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index 9079086..ee3dde7 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -1405,3 +1405,79 @@ done:
 
   return S_OK;
 }
+
+/* Get the encrypt / sign status of this mail. */
+HRESULT get_crypt_status (LPDISPATCH ctrl, int flags, VARIANT *result)
+{
+  HRESULT hr;
+  LPDISPATCH context = NULL,
+             mailitem = NULL;
+  LPMESSAGE message = NULL;
+  char *sigstat;
+
+  /* First the usual defensive check about our parameters */
+  if (!ctrl || !result)
+    {
+      log_error ("%s:%s:%i", SRCNAME, __func__, __LINE__);
+      return E_FAIL;
+    }
+
+  result->vt = VT_BOOL | VT_BYREF;
+  result->pboolVal = (VARIANT_BOOL*) xmalloc (sizeof (VARIANT_BOOL));
+
+  hr = getContext (ctrl, &context);
+
+  if (hr)
+    {
+      log_error ("%s:%s:%i : hresult %lx", SRCNAME, __func__, __LINE__,
+                 hr);
+      return E_FAIL;
+    }
+
+  mailitem = get_oom_object (context, "CurrentItem");
+
+  if (!mailitem)
+    {
+      log_error ("%s:%s: Failed to get mailitem.",
+                 SRCNAME, __func__);
+      goto done;
+    }
+
+  message = get_oom_base_message (mailitem);
+
+  if (!message)
+    {
+      log_error ("%s:%s: No message found.",
+                 SRCNAME, __func__);
+      goto done;
+    }
+
+  sigstat = mapi_get_sig_status (message);
+  /* sigstat will never be NULL */
+  if (flags & OP_SIGN)
+    {
+      *(result->pboolVal) = *sigstat == '!' ? VARIANT_TRUE : VARIANT_FALSE;
+    }
+  else if (flags & OP_ENCRYPT)
+    {
+      msgtype_t type = mapi_get_message_type (message);
+      /* FIXME: This reports encrypted for Opaque signed messages ! */
+      if (type == MSGTYPE_GPGOL_OPAQUE_ENCRYPTED ||
+          type == MSGTYPE_GPGOL_PGP_MESSAGE ||
+          type == MSGTYPE_GPGOL_MULTIPART_ENCRYPTED)
+        {
+          *(result->pboolVal) = VARIANT_TRUE;
+        }
+      else
+        {
+          *(result->pboolVal) = VARIANT_FALSE;
+        }
+    }
+
+done:
+  RELDISP (context);
+  RELDISP (mailitem);
+  RELDISP (message);
+
+  return S_OK;
+}
diff --git a/src/ribbon-callbacks.h b/src/ribbon-callbacks.h
index 571d36c..bbd52aa 100644
--- a/src/ribbon-callbacks.h
+++ b/src/ribbon-callbacks.h
@@ -41,6 +41,9 @@
 #define ID_GET_SIGN_PRESSED     15
 #define ID_GET_ENCRYPT_PRESSED  16
 #define ID_ON_LOAD              17
+#define ID_CMD_OPEN_OPTIONS     18
+#define ID_GET_SIG_STATUS       19
+#define ID_GET_ENC_STATUS       20
 
 #define ID_BTN_CERTMANAGER       IDI_KEY_MANAGER_64_PNG
 #define ID_BTN_DECRYPT           IDI_DECRYPT_16_PNG
@@ -69,6 +72,8 @@ HRESULT mime_encrypt (LPDISPATCH ctrl);
 HRESULT mime_sign (LPDISPATCH ctrl);
 /* Get the toggle state of a crypt button. Flag value 1: encrypt, 2: sign */
 HRESULT get_crypt_pressed (LPDISPATCH ctrl, int flags, VARIANT *result);
+/* Get the general crypto status / if the buttons should be toggled. */
+HRESULT get_crypt_status (LPDISPATCH ctrl, int flags, VARIANT *result);
 /* Callback to get our own control reference */
 HRESULT ribbon_loaded (LPDISPATCH ctrl);
 #endif

commit 6d668bf011300999c6f1126b0b18749b9f964509
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Dec 10 19:17:15 2015 +0100

    Remove unused definition of registry key
    
    * src/config-dialog.c (GNUPG_REGKEY): Removed.
    
    --
    Reg key is now changed so that value was wrong.

diff --git a/src/config-dialog.c b/src/config-dialog.c
index 4587fc8..9a5508f 100644
--- a/src/config-dialog.c
+++ b/src/config-dialog.c
@@ -31,8 +31,6 @@
 #include "gpgol-ids.h"
 #include "dialogs.h"
 
-/* Registry path to GnuPG */
-#define REGPATH "Software\\GNU\\GnuPG"
 
 /* Registry path to store plugin settings */
 #define GPGOL_REGPATH "Software\\GNU\\GpgOL"

commit 5479446f94250cf52bff3f1af6cfc4ce2b2560f2
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Dec 10 19:14:21 2015 +0100

    Add new options dialog for gpgol > 2010
    
    * src/Makefile.am: Add new files.
    * src/addin-options.cpp: New.
    * src/addin-options.h: New.
    * src/dialogs.h: Add ID's
    * src/dialogs.rc: Add Dialog layout.
    
    --
    Reusing the old options dialog was too much hassle as that dialog
    is part of the settings page in outlook.

diff --git a/src/Makefile.am b/src/Makefile.am
index 6e02fb4..c22f452 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -85,7 +85,8 @@ gpgol_SOURCES = \
 	rfc2047parse.h rfc2047parse.c \
 	mlang-charset.cpp mlang-charset.h \
 	gmime-table-private.h \
-	exechelp.c exechelp.h
+	exechelp.c exechelp.h \
+	addin-options.cpp addin-options.h
 
 
 #treeview_SOURCES = treeview.c
diff --git a/src/addin-options.cpp b/src/addin-options.cpp
new file mode 100644
index 0000000..0017882
--- /dev/null
+++ b/src/addin-options.cpp
@@ -0,0 +1,129 @@
+/* addin-options.cpp - Options for the Ol >= 2010 Addin
+ *    Copyright (C) 2015 Intevation GmbH
+ *
+ * This file is part of GpgOL.
+ *
+ * GpgOL is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * GpgOL 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <windows.h>
+#include "dialogs.h"
+#include "common.h"
+#include "engine.h"
+
+/* To avoid writing a dialog template for each language we use gettext
+   for the labels and hope that there is enough space in the dialog to
+   fit the longest translation.. */
+static void
+set_labels (HWND dlg)
+{
+  static struct { int itemid; const char *label; } labels[] = {
+    { IDC_G_GENERAL,        N_("General")},
+    { IDC_ENABLE_SMIME,     N_("Enable the S/MIME support")},
+
+    { IDC_G_SEND,           N_("Message sending")},
+    { IDC_ENCRYPT_DEFAULT,  N_("&Encrypt new messages by default")},
+    { IDC_SIGN_DEFAULT,     N_("&Sign new messages by default")},
+
+    { IDC_GPG_OPTIONS,      N_("Debug...")},
+    { IDC_GPG_CONF,         N_("Configure GnuPG")},
+    { IDC_VERSION_INFO,     N_("Version ")VERSION},
+    { 0, NULL}
+  };
+  int i;
+
+  for (i=0; labels[i].itemid; i++)
+    SetDlgItemText (dlg, labels[i].itemid, _(labels[i].label));
+}
+
+
+static INT_PTR CALLBACK
+options_window_proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+  (void)lParam;
+  switch (uMsg)
+    {
+      case WM_INITDIALOG:
+        {
+          SendDlgItemMessage (hDlg, IDC_ENABLE_SMIME, BM_SETCHECK,
+                              !!opt.enable_smime, 0L);
+          SendDlgItemMessage (hDlg, IDC_ENCRYPT_DEFAULT, BM_SETCHECK,
+                              !!opt.encrypt_default, 0L);
+          SendDlgItemMessage (hDlg, IDC_SIGN_DEFAULT, BM_SETCHECK,
+                              !!opt.sign_default, 0L);
+          set_labels (hDlg);
+          ShowWindow (GetDlgItem (hDlg, IDC_GPG_OPTIONS),
+                      opt.enable_debug ? SW_SHOW : SW_HIDE);
+          log_debug ("Init Window");
+        }
+      return 1;
+      case WM_LBUTTONDOWN:
+        {
+          return 1;
+        }
+      case WM_COMMAND:
+        switch (LOWORD (wParam))
+          {
+            case IDOK:
+              opt.enable_smime = !!SendDlgItemMessage
+                (hDlg, IDC_ENABLE_SMIME, BM_GETCHECK, 0, 0L);
+
+              opt.encrypt_default = !!SendDlgItemMessage
+                (hDlg, IDC_ENCRYPT_DEFAULT, BM_GETCHECK, 0, 0L);
+              opt.sign_default = !!SendDlgItemMessage
+                (hDlg, IDC_SIGN_DEFAULT, BM_GETCHECK, 0, 0L);
+              write_options ();
+              EndDialog (hDlg, TRUE);
+              break;
+            case IDC_GPG_CONF:
+              engine_start_confdialog (hDlg);
+              break;
+            case IDC_GPG_OPTIONS:
+              config_dialog_box (hDlg);
+              break;
+          }
+      case WM_SYSCOMMAND:
+        switch (LOWORD (wParam))
+          {
+            case SC_CLOSE:
+              EndDialog (hDlg, TRUE);
+          }
+
+      break;
+    }
+  return 0;
+}
+
+void
+options_dialog_box (HWND parent)
+{
+  int resid;
+  INT_PTR err;
+
+  resid = IDD_ADDIN_OPTIONS;
+
+  if (!parent)
+    parent = GetDesktopWindow ();
+  err = DialogBoxParam (glob_hinst, MAKEINTRESOURCE (resid), parent,
+                        options_window_proc, 0);
+  if (err <= 0)
+    {
+      log_debug ("Failed with: return code: %x last err %lx", err, GetLastError());
+    }
+  log_debug ("Opened Options?");
+}
diff --git a/src/addin-options.h b/src/addin-options.h
new file mode 100644
index 0000000..27d72fa
--- /dev/null
+++ b/src/addin-options.h
@@ -0,0 +1,25 @@
+#ifndef ADDIN_OPTIONS_H
+#define ADDIN_OPTIONS_H
+/* addin-options.cpp - Options for the Ol >= 2010 Addin
+ *    Copyright (C) 2015 Intevation GmbH
+ *
+ * This file is part of GpgOL.
+ *
+ * GpgOL is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * GpgOL 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+/* Show the options dialog */
+void options_dialog_box (HWND parent);
+#endif // ADDIN_OPTIONS_H
diff --git a/src/dialogs.h b/src/dialogs.h
index 81c351b..6f9943d 100644
--- a/src/dialogs.h
+++ b/src/dialogs.h
@@ -78,6 +78,7 @@
 
 /* Ids used for the main config dialog.  */
 #define IDD_GPG_OPTIONS                 0x5000
+#define IDD_ADDIN_OPTIONS               0x5001
 #define IDC_TIME_PHRASES                0x5010
 #define IDC_ENCRYPT_DEFAULT             0x5020
 #define IDC_SIGN_DEFAULT                0x5030
@@ -85,6 +86,7 @@
 #define IDC_OPENPGP_DEFAULT             0x5050
 #define IDC_SMIME_DEFAULT               0x5060
 #define IDC_GPG_OPTIONS                 0x5070
+#define IDC_ADDIN_OPTIONS               0x5071
 #define IDC_BITMAP                      0x5080
 #define IDC_VERSION_INFO                0x5090
 #define IDC_ENCRYPT_TO                  0x50A0
@@ -97,6 +99,8 @@
 #define IDC_BODY_AS_ATTACHMENT          0x5110
 #define IDC_GPG_CONF                    0x5120
 #define IDC_G10CODE_STRING              0x5130
+#define IDC_GPG4WIN_STRING              0x5131
+#define IDC_START_CERTMAN               0x5132
 
 /* Ids for PNG Images */
 #define IDI_ENCRYPT_16_PNG              0x6000
diff --git a/src/dialogs.rc b/src/dialogs.rc
index 45b4628..7ea674d 100644
--- a/src/dialogs.rc
+++ b/src/dialogs.rc
@@ -290,3 +290,44 @@ BEGIN
                     198, 96, 50, 14
 END
 
+IDD_ADDIN_OPTIONS DIALOGEX DISCARDABLE  300, 300, 266, 150
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT | DS_SETFONT
+CAPTION "GpgOL"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    /* General options box.  */
+    GROUPBOX        "general-options", IDC_G_GENERAL,
+                    9, 9, 250, 25
+
+    CONTROL         "enable-smime", IDC_ENABLE_SMIME,
+                    "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+                    24, 19, 215, 10
+
+    /* Send options box.  */
+    GROUPBOX        "send-options", IDC_G_SEND,
+                    9, 40, 250, 38
+
+    CONTROL         "encrypt-by-default", IDC_ENCRYPT_DEFAULT,
+                    "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+                    24, 50, 215, 10
+
+    CONTROL         "sign-by-default", IDC_SIGN_DEFAULT,
+                    "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+                    24, 61, 215, 10
+
+    /* Stuff at the lower left corner.  */
+    LTEXT           "GpgOL by Gpg4win", IDC_GPG4WIN_STRING,
+                      8, 124, 100, 8
+    LTEXT           "Version x ", IDC_VERSION_INFO,
+                      8, 135, 100, 9
+
+    PUSHBUTTON      "advanced", IDC_GPG_OPTIONS,
+                    180, 100, 70, 14
+
+    PUSHBUTTON      "gpgconf", IDC_GPG_CONF,
+                    180, 115, 70, 14
+
+    DEFPUSHBUTTON   "&OK", IDOK,
+                    180, 130, 70, 14
+
+END

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

Summary of changes:
 src/Makefile.am                       |   3 +-
 src/addin-options.cpp                 | 129 ++++++++++++++++++++++++++++++++++
 src/{eventsinks.h => addin-options.h} |  15 ++--
 src/config-dialog.c                   |   2 -
 src/dialogs.h                         |   4 ++
 src/dialogs.rc                        |  41 +++++++++++
 src/gpgoladdin.cpp                    | 103 +++++++++++++++++++++++----
 src/mail.cpp                          |  10 ++-
 src/mailitem-events.cpp               |  36 +++++++++-
 src/main.c                            |   2 +-
 src/ribbon-callbacks.cpp              |  76 ++++++++++++++++++++
 src/ribbon-callbacks.h                |   5 ++
 12 files changed, 394 insertions(+), 32 deletions(-)
 create mode 100644 src/addin-options.cpp
 copy src/{eventsinks.h => addin-options.h} (66%)


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




More information about the Gnupg-commits mailing list