[git] GPGME - branch, gpgmepp, updated. gpgme-1.6.0-34-g0991485

by Andre Heinecke cvs at cvs.gnupg.org
Sun Apr 3 12:31:52 CEST 2016


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 Made Easy".

The branch, gpgmepp has been updated
       via  0991485170ca4ef90fd566540522027d0fc59a72 (commit)
      from  faf987dd62893955251378a2a715edd2892a540c (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 0991485170ca4ef90fd566540522027d0fc59a72
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Sun Apr 3 02:29:14 2016 -0800

    Qt: Add static factor methods for protocol
    
    * lang/qt/src/qgpgmebackend.cpp (QGpgME::openpgp, QGpgME::smime): New.
    * lang/qt/src/qgpgmebackend.h: Declare.
    * lang/qt/tests/t-keylist.cpp (KeyListTest::testSingleKeyListSync):
      Use new functions.
    
    --
    This replaces the cryptobackendfactory functionality from libkleo.

diff --git a/lang/qt/src/qgpgmebackend.cpp b/lang/qt/src/qgpgmebackend.cpp
index 1167dae..abecde2 100644
--- a/lang/qt/src/qgpgmebackend.cpp
+++ b/lang/qt/src/qgpgmebackend.cpp
@@ -507,3 +507,21 @@ const char *QGpgME::QGpgMEBackend::enumerateProtocols(int i) const
     default: return 0;
     }
 }
+
+static QGpgME::QGpgMEBackend *gpgmeBackend;
+
+QGpgME::Protocol *QGpgME::openpgp()
+{
+    if (!gpgmeBackend) {
+        gpgmeBackend = new QGpgME::QGpgMEBackend();
+    }
+    return gpgmeBackend->openpgp();
+}
+
+QGpgME::Protocol *QGpgME::smime()
+{
+    if (!gpgmeBackend) {
+        gpgmeBackend = new QGpgME::QGpgMEBackend();
+    }
+    return gpgmeBackend->smime();
+}
diff --git a/lang/qt/src/qgpgmebackend.h b/lang/qt/src/qgpgmebackend.h
index d442fa5..16b70cf 100644
--- a/lang/qt/src/qgpgmebackend.h
+++ b/lang/qt/src/qgpgmebackend.h
@@ -72,6 +72,20 @@ namespace QGpgME
 class CryptoConfig;
 class Protocol;
 
+/** Obtain a reference to the OpenPGP Protocol.
+ *
+ * The reference is to a static object.
+ * @returns Refrence to the OpenPGP Protocol.
+ */
+Protocol *openpgp();
+
+/** Obtain a reference to the smime Protocol.
+ *
+ * The reference is to a static object.
+ * @returns Refrence to the smime Protocol.
+ */
+Protocol *smime();
+
 class QGpgMEBackend
 {
 public:
diff --git a/lang/qt/tests/t-keylist.cpp b/lang/qt/tests/t-keylist.cpp
index 67ace7f..626d0a7 100644
--- a/lang/qt/tests/t-keylist.cpp
+++ b/lang/qt/tests/t-keylist.cpp
@@ -14,8 +14,7 @@ private Q_SLOTS:
 
     void testSingleKeyListSync()
     {
-        QGpgMEBackend backend;
-        KeyListJob *job = backend.openpgp()->keyListJob(false, false, false);
+        KeyListJob *job = openpgp()->keyListJob(false, false, false);
         std::vector<GpgME::Key> keys;
         GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("alfa at example.net"),
                                                 false, keys);

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

Summary of changes:
 lang/qt/src/qgpgmebackend.cpp | 18 ++++++++++++++++++
 lang/qt/src/qgpgmebackend.h   | 14 ++++++++++++++
 lang/qt/tests/t-keylist.cpp   |  3 +--
 3 files changed, 33 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list