From 9bcd46bc010b64f2bff14463db3c4c0e82ff693b Mon Sep 17 00:00:00 2001 From: nils Date: Tue, 26 Jul 2011 01:41:06 +0000 Subject: changed bool iscompletlysigned to int issigned and added setverifylabel to verifynotification-class git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@505 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- gpgwin.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'gpgwin.cpp') diff --git a/gpgwin.cpp b/gpgwin.cpp index 843c61f..21d3175 100644 --- a/gpgwin.cpp +++ b/gpgwin.cpp @@ -708,15 +708,20 @@ void GpgWin::sign() cursor.endEditBlock(); } } -bool GpgWin::isCompletedlySigned(const QByteArray &text) { - +/* + * 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.startsWith("-----BEGIN PGP SIGNED MESSAGE-----") && text.endsWith("-----END PGP SIGNATURE-----")) { - qDebug() << "totally signed"; - return true; - } else { - qDebug("partially signed"); - return false; + return 2; } + if (text.contains("-----BEGIN PGP SIGNED MESSAGE-----") && text.contains("-----END PGP SIGNATURE-----")) { + return 1; + } + return 0; } void GpgWin::verify() @@ -725,7 +730,7 @@ void GpgWin::verify() QByteArray text = edit->curTextPage()->toPlainText().toAscii(); // TODO: toUtf8() here? preventNoDataErr(&text); - isCompletedlySigned(text); + isSigned(text); gpgme_signature_t sign = mCtx->verify(text); @@ -734,10 +739,10 @@ void GpgWin::verify() } else { // TODO: should get verifynotification get the whole signature for analysizing VerifyNotification *vn = new VerifyNotification(); + vn->setVerifyLabel(QString("Verified")); edit->curPage()->showNotificationWidget(vn); } - // while (sign) { qDebug() << "sig summary: " << sign->summary; qDebug() << "sig fingerprint: " << sign->fpr; @@ -748,9 +753,7 @@ void GpgWin::verify() qDebug() << "kein passender Schlüssel gefunden. Vom Schlüsselserver importieren?"; } sign = sign->next; - } - } void GpgWin::importKeyDialog() -- cgit