1 /* 2 SPDX-FileCopyrightText: 2008, 2009, 2012, 2013, 2018 Rolf Eike Beer <kde@opensource.sf-tec.de> 3 SPDX-License-Identifier: GPL-2.0-or-later 4 */ 5 6 #ifndef KGPGTRANSACTIONPRIVATE_H 7 #define KGPGTRANSACTIONPRIVATE_H 8 9 #include "gpgproc.h" 10 11 #include <QUrl> 12 13 #include <KPasswordDialog> 14 #include <KNewPasswordDialog> 15 16 class KGpgTransaction; 17 18 class KGpgTransactionPrivate : public QObject { 19 public: 20 KGpgTransactionPrivate(KGpgTransaction *parent, bool allowChaining); 21 ~KGpgTransactionPrivate() override; 22 23 KGpgTransaction *m_parent; 24 GPGProc *m_process; 25 KGpgTransaction *m_inputTransaction; 26 KNewPasswordDialog *m_newPasswordDialog; 27 KPasswordDialog *m_passwordDialog; 28 int m_success; 29 int m_tries; 30 QString m_description; 31 bool m_chainingAllowed; 32 33 QStringList m_idhints; 34 QStringList m_expectedFingerprints; 35 36 QUrl m_overwriteUrl; ///< the file to overwrite or it's new name 37 38 void slotReadReady(); 39 void slotProcessExited(); 40 void slotProcessStarted(); 41 void slotInputTransactionDone(int result); 42 void slotPassphraseEntered(const QString &passphrase); 43 44 /** 45 * @brief a slot to handle the case that the passphrase entry was aborted by the user 46 * 47 * This will delete the sender as well as do the internal passphrase aborted handling. 48 */ 49 void slotPassphraseAborted(); 50 /** 51 * @brief do the internal passphrase aborted handling 52 */ 53 void handlePassphraseAborted(); 54 55 QList<int *> m_argRefs; 56 bool m_inputProcessDone; 57 int m_inputProcessResult; 58 bool m_ownProcessFinished; 59 60 /** 61 * terminate GnuPG session 62 */ 63 void sendQuit(void); 64 65 void write(const QByteArray &a); 66 67 static const QStringList &hintNames(void); 68 69 /** 70 * @brief handle if this a KEY_CONSIDERED line 71 * @param line the line from GnuPG output 72 * @returns if this is a KEY_CONSIDERED line 73 * 74 * In case this is a KEY_CONSIDERED line (i.e. the return value is true), 75 * but either it was malformed or the given fingerprint does not match any 76 * key in m_expectedFingerprints, the success value will be set to TS_MSG_SEQUENCE. 77 * 78 * @see setExpectedIds 79 */ 80 bool keyConsidered(const QString &line); 81 82 private: 83 void processDone(); 84 85 unsigned int m_quitTries; ///< how many times we tried to quit 86 QStringList m_quitLines; ///< what we received after we tried to quit 87 }; 88 89 #endif // KGPGTRANSACTIONPRIVATE_H 90