aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--context.cpp16
-rw-r--r--context.h10
-rw-r--r--gpgwin.cpp18
-rw-r--r--gpgwin.h10
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;
+}
+
}
diff --git a/context.h b/context.h
index 8338fed..375758c 100644
--- a/context.h
+++ b/context.h
@@ -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();
diff --git a/gpgwin.cpp b/gpgwin.cpp
index d0f2ba4..66b0220 100644
--- a/gpgwin.cpp
+++ b/gpgwin.cpp
@@ -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");
diff --git a/gpgwin.h b/gpgwin.h
index 20d2a04..8b91f56 100644
--- a/gpgwin.h
+++ b/gpgwin.h
@@ -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*/