diff options
-rw-r--r-- | context.cpp | 16 | ||||
-rw-r--r-- | context.h | 10 | ||||
-rw-r--r-- | gpgwin.cpp | 18 | ||||
-rw-r--r-- | gpgwin.h | 10 |
4 files changed, 27 insertions, 27 deletions
diff --git a/context.cpp b/context.cpp index 87b6c3f..d7a17a1 100644 --- a/context.cpp +++ b/context.cpp @@ -633,6 +633,22 @@ void Context::preventNoDataErr(QByteArray *in) } } +/* + * isSigned returns: + * - 0, if text isn't signed at all + * - 1, if text is partially signed + * - 2, if text is completly signed + */ +int Context::textIsSigned(const QByteArray &text) { + if (text.trimmed().startsWith("-----BEGIN PGP SIGNED MESSAGE-----") && text.trimmed().endsWith("-----END PGP SIGNATURE-----")) { + return 2; + } + if (text.contains("-----BEGIN PGP SIGNED MESSAGE-----") && text.contains("-----END PGP SIGNATURE-----")) { + return 1; + } + return 0; +} + } @@ -98,6 +98,16 @@ public: */ void preventNoDataErr(QByteArray *in); + /** + * @brief + * + * @param text + * @return \li 2, if the text is completly signed, + * \li 1, if the text is partially signed, + * \li 0, if the text is not signed at all. + */ + int textIsSigned(const QByteArray &text); + signals: void keyDBChanged(); @@ -634,29 +634,13 @@ void GpgWin::decrypt() edit->fillTextEditWithText(QString::fromUtf8(*decrypted)); } -/* - * isSigned returns: - * - 0, if text isn't signed at all - * - 1, if text is partially signed - * - 2, if text is completly signed - */ -int GpgWin::isSigned(const QByteArray &text) { - if (text.trimmed().startsWith("-----BEGIN PGP SIGNED MESSAGE-----") && text.trimmed().endsWith("-----END PGP SIGNATURE-----")) { - return 2; - } - if (text.contains("-----BEGIN PGP SIGNED MESSAGE-----") && text.contains("-----END PGP SIGNATURE-----")) { - return 1; - } - return 0; -} - void GpgWin::verify() { QDateTime timestamp; verify_label_status verifyStatus=VERIFY_ERROR_OK; QByteArray text = edit->curTextPage()->toPlainText().toAscii(); // TODO: toUtf8() here? mCtx->preventNoDataErr(&text); - int textIsSigned = isSigned(text); + int textIsSigned = mCtx->textIsSigned(text); gpgme_signature_t sign = mCtx->verify(text); edit->curPage()->closeNoteByClass("verifyNotification"); @@ -208,16 +208,6 @@ private: */ void parseMime(QByteArray *message); - /** - * @brief - * - * @param text - * @return \li 2, if the text is completly signed, - * \li 1, if the text is partially signed, - * \li 0, if the text is not signed at all. - */ - int isSigned(const QByteArray &text); - TextEdit *edit; /** Tabwidget holding the edit-windows */ QMenu *fileMenu; /** Submenu for file-operations*/ QMenu *editMenu; /** Submenu for text-operations*/ |