File indexing completed on 2024-04-28 09:46:10

0001 /*
0002     SPDX-FileCopyrightText: 2002 Jean-Baptiste Mardelle <bj@altern.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef KGPGAPPLET_H
0007 #define KGPGAPPLET_H
0008 
0009 #include <QApplication>
0010 #include <QKeySequence>
0011 
0012 #include <KLocalizedString>
0013 #include <KLazyLocalizedString>
0014 
0015 class KeysManager;
0016 class KGpgExternalActions;
0017 class QCommandLineParser;
0018 class QDir;
0019 class QString;
0020 
0021 static constexpr const KLazyLocalizedString EMailTemplateText = kli18n(
0022     "Hi,\n\nplease find attached the user id '%UIDNAME%' of your key %KEYID% signed by me. "
0023     "This mail is encrypted with that key to make sure you control both the email address and the key.\n\n"
0024     "If you have multiple user ids, I sent the signature for each user id separately to that user id's associated email address. "
0025     "You can import the signatures by running each through `gpg --import` after you have decrypted them with `gpg --decrypt`.\n\n"
0026     "If you are using KGpg store the attachment to disk and then import it. Just select `Import Key...` from `Keys` menu and open the file.\n\n"
0027     "Note that I did not upload your key to any keyservers. If you want this new signature to be available to others, please upload it yourself. "
0028     "With GnuPG this can be done using gpg --keyserver subkeys.pgp.net --send-key %KEYID%.\n\n" 
0029     "With KGpg you can right click on the key once you imported all user ids and choose `Export Public Key...`.\n\n"
0030     "If you have any questions, don't hesitate to ask.\n");
0031 
0032 class KGpgApp : public QApplication
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037     KGpgApp(int &argc, char **argv);
0038     ~KGpgApp() override;
0039 
0040     bool newInstance();
0041     QKeySequence goHome;
0042 
0043     /**
0044      * @brief configure the QCommandLineParser to know about the control arguments
0045      */
0046     void setupCmdlineParser(QCommandLineParser &parser);
0047 
0048     /**
0049      * @brief process the actions requested by the user
0050      */
0051     void handleArguments(const QCommandLineParser &parser, const QDir &workingDirectory);
0052 
0053 public Q_SLOTS:
0054     void slotDBusActivation(const QStringList &arguments, const QString &workingDirectory);
0055 
0056 private:
0057     KGpgExternalActions *w;
0058     KeysManager *s_keyManager;
0059 
0060 private Q_SLOTS:
0061     void slotHandleQuit();
0062     void assistantOver(const QString &defaultKeyId);
0063 };
0064 
0065 #endif // KGPGAPPLET_H