[git] GpgOL - branch, master, updated. gpgol-2.1.1-4-g07811af

by Andre Heinecke cvs at cvs.gnupg.org
Mon Apr 30 11:46:21 CEST 2018


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  07811afb552bfc1e51aea25a39cb52327831198b (commit)
      from  fe71109d918e3a847111a4c5336e14c608132880 (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 07811afb552bfc1e51aea25a39cb52327831198b
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Apr 30 11:44:54 2018 +0200

    Launch Kleopatra config dialog with parent
    
    * src/addin-options.cpp (launch_kleo_config): New.
    (options_window_proc): Use it.
    
    --
    This fixes that the config dialog might be opened in the
    background, or that the assuan communication fails.
    
    Fixes
    GnuPG-Bug-Id: T3946

diff --git a/src/addin-options.cpp b/src/addin-options.cpp
index 32b47eb..6677a30 100644
--- a/src/addin-options.cpp
+++ b/src/addin-options.cpp
@@ -27,6 +27,11 @@
 #include "common.h"
 #include "engine.h"
 
+#include <string>
+
+#include <gpgme++/context.h>
+#include <gpgme++/data.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.. */
@@ -77,6 +82,63 @@ enable_disable_opts (HWND hDlg)
   xfree (uiserver);
 }
 
+static void
+launch_kleo_config (HWND hDlg)
+{
+  char *uiserver = get_uiserver_name ();
+  bool showError = false;
+  if (uiserver)
+    {
+      std::string path (uiserver);
+      xfree (uiserver);
+      if (path.find("kleopatra.exe") != std::string::npos)
+        {
+        size_t dpos;
+        if ((dpos = path.find(" --daemon")) != std::string::npos)
+            {
+              path.erase(dpos, strlen(" --daemon"));
+            }
+          auto ctx = GpgME::Context::createForEngine(GpgME::SpawnEngine);
+          if (!ctx)
+            {
+              log_error ("%s:%s: No spawn engine.",
+                         SRCNAME, __func__);
+            }
+            std::string parentWid = std::to_string ((int) (intptr_t) hDlg);
+            const char *argv[] = {path.c_str(),
+                                  "--config",
+                                  "--parent-windowid",
+                                  parentWid.c_str(),
+                                  NULL };
+            log_debug ("%s:%s: Starting %s %s %s",
+                       SRCNAME, __func__, path.c_str(), argv[1], argv[2]);
+            GpgME::Data d(GpgME::Data::null);
+            ctx->spawnAsync(path.c_str(), argv, d, d,
+                            d, (GpgME::Context::SpawnFlags) (
+                                GpgME::Context::SpawnAllowSetFg |
+                                GpgME::Context::SpawnShowWindow));
+        }
+      else
+        {
+          showError = true;
+        }
+    }
+  else
+    {
+      showError = true;
+    }
+
+  if (showError)
+    {
+      MessageBox (NULL,
+                  _("Could not find Kleopatra.\n"
+                  "Please reinstall Gpg4win with the Kleopatra component enabled."),
+                  _("GpgOL"),
+                  MB_ICONINFORMATION|MB_OK);
+    }
+
+}
+
 static INT_PTR CALLBACK
 options_window_proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
@@ -149,7 +211,7 @@ options_window_proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
                 break;
               }
             case IDC_GPG_CONF:
-              engine_start_confdialog (hDlg);
+              launch_kleo_config (hDlg);
               break;
             case IDC_GPG_OPTIONS:
               config_dialog_box (hDlg);

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

Summary of changes:
 src/addin-options.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 63 insertions(+), 1 deletion(-)


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




More information about the Gnupg-commits mailing list