diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am index e5358b49..510802a8 100644 --- a/lang/qt/src/Makefile.am +++ b/lang/qt/src/Makefile.am @@ -152,6 +152,10 @@ camelcase_headers= \ GpgCardJob private_qgpgme_headers = \ + changeexpiryjob_p.h \ + encryptjob_p.h \ + importjob_p.h \ + listallkeysjob_p.h \ qgpgme_export.h \ protocol_p.h \ job_p.h \ @@ -187,6 +191,7 @@ private_qgpgme_headers = \ qgpgmetofupolicyjob.h \ qgpgmegpgcardjob.h \ qgpgmequickjob.h \ + signencryptjob_p.h \ threadedjobmixin.h \ util.h diff --git a/lang/qt/src/changeexpiryjob.cpp b/lang/qt/src/changeexpiryjob.cpp index 49f68cc1..96d02167 100644 --- a/lang/qt/src/changeexpiryjob.cpp +++ b/lang/qt/src/changeexpiryjob.cpp @@ -36,27 +36,13 @@ #endif #include "changeexpiryjob.h" -#include "job_p.h" +#include "changeexpiryjob_p.h" #include using namespace GpgME; using namespace QGpgME; -namespace -{ -struct ChangeExpiryJobPrivate : public JobPrivate -{ - ChangeExpiryJobPrivate() - { - } - - ~ChangeExpiryJobPrivate() override = default; - - ChangeExpiryJob::Options m_options = ChangeExpiryJob::Default; -}; -} - void ChangeExpiryJob::setOptions(ChangeExpiryJob::Options options) { auto d = jobPrivate(this); diff --git a/lang/qt/src/changeexpiryjob_p.h b/lang/qt/src/changeexpiryjob_p.h new file mode 100644 index 00000000..c6c91c25 --- /dev/null +++ b/lang/qt/src/changeexpiryjob_p.h @@ -0,0 +1,51 @@ +/* + changeexpiryjob_p.h + + This file is part of qgpgme, the Qt API binding for gpgme + Copyright (c) 2021,2023 g10 Code GmbH + Software engineering by Ingo Klöcker + + QGpgME is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + QGpgME 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 + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __QGPGME_CHANGEEXPIRYJOB_P_H__ +#define __QGPGME_CHANGEEXPIRYJOB_P_H__ + +#include "job_p.h" + +#include "changeexpiryjob.h" + +namespace QGpgME +{ + +struct ChangeExpiryJobPrivate : public JobPrivate +{ + ChangeExpiryJob::Options m_options = ChangeExpiryJob::Default; +}; + +} + +#endif // __QGPGME_CHANGEEXPIRYJOB_P_H__ diff --git a/lang/qt/src/encryptjob.cpp b/lang/qt/src/encryptjob.cpp index 7533bd9d..7b9f0f2b 100644 --- a/lang/qt/src/encryptjob.cpp +++ b/lang/qt/src/encryptjob.cpp @@ -36,18 +36,10 @@ #endif #include "encryptjob.h" -#include "job_p.h" +#include "encryptjob_p.h" using namespace QGpgME; -namespace -{ -struct EncryptJobPrivate : public JobPrivate -{ - QString m_fileName; -}; -} - void EncryptJob::setFileName(const QString &fileName) { auto d = jobPrivate(this); diff --git a/lang/qt/src/encryptjob_p.h b/lang/qt/src/encryptjob_p.h new file mode 100644 index 00000000..4a93f5b3 --- /dev/null +++ b/lang/qt/src/encryptjob_p.h @@ -0,0 +1,49 @@ +/* + encryptjob_p.h + + This file is part of qgpgme, the Qt API binding for gpgme + Copyright (c) 2022,2023 g10 Code GmbH + Software engineering by Ingo Klöcker + + QGpgME is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + QGpgME 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 + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __QGPGME_ENCRYPTJOB_P_H__ +#define __QGPGME_ENCRYPTJOB_P_H__ + +#include "job_p.h" + +namespace QGpgME +{ + +struct EncryptJobPrivate : public JobPrivate +{ + QString m_fileName; +}; + +} + +#endif // __QGPGME_ENCRYPTJOB_P_H__ diff --git a/lang/qt/src/importjob.cpp b/lang/qt/src/importjob.cpp index 4f40d9b1..ee5318a4 100644 --- a/lang/qt/src/importjob.cpp +++ b/lang/qt/src/importjob.cpp @@ -36,29 +36,13 @@ #endif #include "importjob.h" -#include "job_p.h" +#include "importjob_p.h" #include using namespace GpgME; using namespace QGpgME; -namespace -{ -struct ImportJobPrivate : public JobPrivate -{ - ImportJobPrivate() - { - } - - ~ImportJobPrivate() override = default; - - QString m_importFilter; - Key::Origin m_keyOrigin = Key::OriginUnknown; - QString m_keyOriginUrl; -}; -} - void QGpgME::ImportJob::setImportFilter(const QString &filter) { const auto d = jobPrivate(this); diff --git a/lang/qt/src/importjob_p.h b/lang/qt/src/importjob_p.h new file mode 100644 index 00000000..9f0a35ae --- /dev/null +++ b/lang/qt/src/importjob_p.h @@ -0,0 +1,53 @@ +/* + importjob_p.h + + This file is part of qgpgme, the Qt API binding for gpgme + Copyright (c) 2021,2023 g10 Code GmbH + Software engineering by Ingo Klöcker + + QGpgME is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + QGpgME 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 + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __QGPGME_IMPORTJOB_P_H__ +#define __QGPGME_IMPORTJOB_P_H__ + +#include "job_p.h" + +#include + +namespace QGpgME +{ + +struct ImportJobPrivate : public JobPrivate +{ + QString m_importFilter; + GpgME::Key::Origin m_keyOrigin = GpgME::Key::OriginUnknown; + QString m_keyOriginUrl; +}; + +} + +#endif // __QGPGME_IMPORTJOB_P_H__ diff --git a/lang/qt/src/job_p.h b/lang/qt/src/job_p.h index 3bce4cff..5a77b75b 100644 --- a/lang/qt/src/job_p.h +++ b/lang/qt/src/job_p.h @@ -57,11 +57,6 @@ JobPrivate *getJobPrivate(const Job *job); template static T *jobPrivate(const Job *job) { auto d = getJobPrivate(job); - if (!d) { - std::unique_ptr ref{new T}; - d = ref.get(); - setJobPrivate(job, std::move(ref)); - } return dynamic_cast(d); } diff --git a/lang/qt/src/listallkeysjob.cpp b/lang/qt/src/listallkeysjob.cpp index f72a45d1..1dce75bf 100644 --- a/lang/qt/src/listallkeysjob.cpp +++ b/lang/qt/src/listallkeysjob.cpp @@ -36,22 +36,10 @@ #endif #include "listallkeysjob.h" -#include "job_p.h" +#include "listallkeysjob_p.h" using namespace QGpgME; -namespace -{ -struct ListAllKeysJobPrivate : public JobPrivate -{ - ListAllKeysJobPrivate() = default; - - ~ListAllKeysJobPrivate() override = default; - - ListAllKeysJob::Options m_options = ListAllKeysJob::Default; -}; -} - void ListAllKeysJob::setOptions(ListAllKeysJob::Options options) { auto d = jobPrivate(this); diff --git a/lang/qt/src/listallkeysjob_p.h b/lang/qt/src/listallkeysjob_p.h new file mode 100644 index 00000000..582f028b --- /dev/null +++ b/lang/qt/src/listallkeysjob_p.h @@ -0,0 +1,51 @@ +/* + listallkeysjob_p.h + + This file is part of qgpgme, the Qt API binding for gpgme + Copyright (c) 2022,2023 g10 Code GmbH + Software engineering by Ingo Klöcker + + QGpgME is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + QGpgME 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 + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __QGPGME_LISTALLKEYSJOB_P_H__ +#define __QGPGME_LISTALLKEYSJOB_P_H__ + +#include "job_p.h" + +#include "listallkeysjob.h" + +namespace QGpgME +{ + +struct ListAllKeysJobPrivate : public JobPrivate +{ + ListAllKeysJob::Options m_options = ListAllKeysJob::Default; +}; + +} + +#endif // __QGPGME_LISTALLKEYSJOB_P_H__ diff --git a/lang/qt/src/qgpgmechangeexpiryjob.cpp b/lang/qt/src/qgpgmechangeexpiryjob.cpp index 5d4e8360..6bffbc87 100644 --- a/lang/qt/src/qgpgmechangeexpiryjob.cpp +++ b/lang/qt/src/qgpgmechangeexpiryjob.cpp @@ -5,7 +5,7 @@ Copyright (c) 2008 Klarälvdalens Datakonsult AB Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik Software engineering by Intevation GmbH - Copyright (c) 2021 g10 Code GmbH + Copyright (c) 2021,2023 g10 Code GmbH Software engineering by Ingo Klöcker QGpgME is free software; you can redistribute it and/or @@ -40,6 +40,8 @@ #include "qgpgmechangeexpiryjob.h" +#include "changeexpiryjob_p.h" + #include "context.h" #include "key.h" @@ -48,9 +50,28 @@ using namespace QGpgME; using namespace GpgME; +namespace +{ + +class QGpgMEChangeExpiryJobPrivate : public ChangeExpiryJobPrivate +{ + QGpgMEChangeExpiryJob *q = nullptr; + +public: + QGpgMEChangeExpiryJobPrivate(QGpgMEChangeExpiryJob *qq) + : q{qq} + { + } + + ~QGpgMEChangeExpiryJobPrivate() override = default; +}; + +} + QGpgMEChangeExpiryJob::QGpgMEChangeExpiryJob(Context *context) : mixin_type(context) { + setJobPrivate(this, std::unique_ptr{new QGpgMEChangeExpiryJobPrivate{this}}); lateInitialization(); } diff --git a/lang/qt/src/qgpgmeencryptjob.cpp b/lang/qt/src/qgpgmeencryptjob.cpp index cd544965..ae33db1d 100644 --- a/lang/qt/src/qgpgmeencryptjob.cpp +++ b/lang/qt/src/qgpgmeencryptjob.cpp @@ -5,7 +5,7 @@ Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik Software engineering by Intevation GmbH - Copyright (c) 2022 g10 Code GmbH + Copyright (c) 2022,2023 g10 Code GmbH Software engineering by Ingo Klöcker QGpgME is free software; you can redistribute it and/or @@ -40,6 +40,8 @@ #include "qgpgmeencryptjob.h" +#include "encryptjob_p.h" + #include "dataprovider.h" #include "context.h" @@ -54,10 +56,29 @@ using namespace QGpgME; using namespace GpgME; +namespace +{ + +class QGpgMEEncryptJobPrivate : public EncryptJobPrivate +{ + QGpgMEEncryptJob *q = nullptr; + +public: + QGpgMEEncryptJobPrivate(QGpgMEEncryptJob *qq) + : q{qq} + { + } + + ~QGpgMEEncryptJobPrivate() override = default; +}; + +} + QGpgMEEncryptJob::QGpgMEEncryptJob(Context *context) : mixin_type(context), mOutputIsBase64Encoded(false) { + setJobPrivate(this, std::unique_ptr{new QGpgMEEncryptJobPrivate{this}}); lateInitialization(); } diff --git a/lang/qt/src/qgpgmeimportjob.cpp b/lang/qt/src/qgpgmeimportjob.cpp index d609c5f1..e3fd251b 100644 --- a/lang/qt/src/qgpgmeimportjob.cpp +++ b/lang/qt/src/qgpgmeimportjob.cpp @@ -5,6 +5,8 @@ Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik Software engineering by Intevation GmbH + Copyright (c) 2023 g10 Code GmbH + Software engineering by Ingo Klöcker QGpgME is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -38,6 +40,8 @@ #include "qgpgmeimportjob.h" +#include "importjob_p.h" + #include "dataprovider.h" #include @@ -47,9 +51,28 @@ using namespace QGpgME; using namespace GpgME; +namespace +{ + +class QGpgMEImportJobPrivate : public ImportJobPrivate +{ + QGpgMEImportJob *q = nullptr; + +public: + QGpgMEImportJobPrivate(QGpgMEImportJob *qq) + : q{qq} + { + } + + ~QGpgMEImportJobPrivate() override = default; +}; + +} + QGpgMEImportJob::QGpgMEImportJob(Context *context) : mixin_type(context) { + setJobPrivate(this, std::unique_ptr{new QGpgMEImportJobPrivate{this}}); lateInitialization(); } diff --git a/lang/qt/src/qgpgmelistallkeysjob.cpp b/lang/qt/src/qgpgmelistallkeysjob.cpp index 2d1dc091..4bd7d8ba 100644 --- a/lang/qt/src/qgpgmelistallkeysjob.cpp +++ b/lang/qt/src/qgpgmelistallkeysjob.cpp @@ -5,7 +5,7 @@ Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik Software engineering by Intevation GmbH - Copyright (c) 2022 g10 Code GmbH + Copyright (c) 2022,2023 g10 Code GmbH Software engineering by Ingo Klöcker QGpgME is free software; you can redistribute it and/or @@ -40,6 +40,8 @@ #include "qgpgmelistallkeysjob.h" +#include "listallkeysjob_p.h" + #include "debug.h" #include "key.h" #include "context.h" @@ -59,10 +61,29 @@ using namespace QGpgME; using namespace GpgME; +namespace +{ + +class QGpgMEListAllKeysJobPrivate : public ListAllKeysJobPrivate +{ + QGpgMEListAllKeysJob *q = nullptr; + +public: + QGpgMEListAllKeysJobPrivate(QGpgMEListAllKeysJob *qq) + : q{qq} + { + } + + ~QGpgMEListAllKeysJobPrivate() override = default; +}; + +} + QGpgMEListAllKeysJob::QGpgMEListAllKeysJob(Context *context) : mixin_type(context), mResult() { + setJobPrivate(this, std::unique_ptr{new QGpgMEListAllKeysJobPrivate{this}}); lateInitialization(); } diff --git a/lang/qt/src/qgpgmesignencryptjob.cpp b/lang/qt/src/qgpgmesignencryptjob.cpp index 5466c54e..4a1082a9 100644 --- a/lang/qt/src/qgpgmesignencryptjob.cpp +++ b/lang/qt/src/qgpgmesignencryptjob.cpp @@ -5,7 +5,7 @@ Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik Software engineering by Intevation GmbH - Copyright (c) 2022 g10 Code GmbH + Copyright (c) 2022,2023 g10 Code GmbH Software engineering by Ingo Klöcker QGpgME is free software; you can redistribute it and/or @@ -40,6 +40,8 @@ #include "qgpgmesignencryptjob.h" +#include "signencryptjob_p.h" + #include "dataprovider.h" #include "context.h" @@ -55,10 +57,29 @@ using namespace QGpgME; using namespace GpgME; +namespace +{ + +class QGpgMESignEncryptJobPrivate : public SignEncryptJobPrivate +{ + QGpgMESignEncryptJob *q = nullptr; + +public: + QGpgMESignEncryptJobPrivate(QGpgMESignEncryptJob *qq) + : q{qq} + { + } + + ~QGpgMESignEncryptJobPrivate() override = default; +}; + +} + QGpgMESignEncryptJob::QGpgMESignEncryptJob(Context *context) : mixin_type(context), mOutputIsBase64Encoded(false) { + setJobPrivate(this, std::unique_ptr{new QGpgMESignEncryptJobPrivate{this}}); lateInitialization(); } diff --git a/lang/qt/src/signencryptjob.cpp b/lang/qt/src/signencryptjob.cpp index aa02fca3..2f4c5fd6 100644 --- a/lang/qt/src/signencryptjob.cpp +++ b/lang/qt/src/signencryptjob.cpp @@ -36,18 +36,10 @@ #endif #include "signencryptjob.h" -#include "job_p.h" +#include "signencryptjob_p.h" using namespace QGpgME; -namespace -{ -struct SignEncryptJobPrivate : public JobPrivate -{ - QString m_fileName; -}; -} - void SignEncryptJob::setFileName(const QString &fileName) { auto d = jobPrivate(this); diff --git a/lang/qt/src/signencryptjob_p.h b/lang/qt/src/signencryptjob_p.h new file mode 100644 index 00000000..85afae26 --- /dev/null +++ b/lang/qt/src/signencryptjob_p.h @@ -0,0 +1,49 @@ +/* + signencryptjob_p.h + + This file is part of qgpgme, the Qt API binding for gpgme + Copyright (c) 2022,2023 g10 Code GmbH + Software engineering by Ingo Klöcker + + QGpgME is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + QGpgME 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 + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __QGPGME_SIGNENCRYPTJOB_P_H__ +#define __QGPGME_SIGNENCRYPTJOB_P_H__ + +#include "job_p.h" + +namespace QGpgME +{ + +struct SignEncryptJobPrivate : public JobPrivate +{ + QString m_fileName; +}; + +} + +#endif // __QGPGME_SIGNENCRYPTJOB_P_H__