File indexing completed on 2023-12-03 09:19:03

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 
0014 class KeysManager;
0015 class KGpgExternalActions;
0016 class QCommandLineParser;
0017 class QDir;
0018 class QString;
0019 
0020 static const QString EMailTemplateText=i18n(
0021     "Hi,\n\nplease find attached the user id '%UIDNAME%' of your key %KEYID% signed by me. "
0022     "This mail is encrypted with that key to make sure you control both the email address and the key.\n\n"
0023     "If you have multiple user ids, I sent the signature for each user id separately to that user id's associated email address. "
0024     "You can import the signatures by running each through `gpg --import` after you have decrypted them with `gpg --decrypt`.\n\n"
0025     "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"
0026     "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. "
0027     "With GnuPG this can be done using gpg --keyserver subkeys.pgp.net --send-key %KEYID%.\n\n" 
0028     "With KGpg you can right click on the key once you imported all user ids and choose `Export Public Key...`.\n\n"
0029     "If you have any questions, don't hesitate to ask.\n");
0030 
0031 class KGpgApp : public QApplication
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036     KGpgApp(int &argc, char **argv);
0037     ~KGpgApp() override;
0038 
0039     bool newInstance();
0040     QKeySequence goHome;
0041 
0042     /**
0043      * @brief configure the QCommandLineParser to know about the control arguments
0044      */
0045     void setupCmdlineParser(QCommandLineParser &parser);
0046 
0047     /**
0048      * @brief process the actions requested by the user
0049      */
0050     void handleArguments(const QCommandLineParser &parser, const QDir &workingDirectory);
0051 
0052 public Q_SLOTS:
0053     void slotDBusActivation(const QStringList &arguments, const QString &workingDirectory);
0054 
0055 private:
0056     KGpgExternalActions *w;
0057     KeysManager *s_keyManager;
0058 
0059 private Q_SLOTS:
0060     void slotHandleQuit();
0061     void assistantOver(const QString &defaultKeyId);
0062 };
0063 
0064 #endif // KGPGAPPLET_H