From c672e2b17f14c8df54cfe9b43de44de1e445684a Mon Sep 17 00:00:00 2001 From: nils Date: Mon, 11 Jul 2011 01:21:35 +0000 Subject: added preventnodataerr for verifying git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@492 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- gpgwin.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gpgwin.cpp') diff --git a/gpgwin.cpp b/gpgwin.cpp index ba448ff..ec2c509 100644 --- a/gpgwin.cpp +++ b/gpgwin.cpp @@ -631,6 +631,10 @@ void GpgWin::preventNoDataErr(QByteArray *in) if (block_start > 0 && in->at(block_start - 1) != '\n') { in->insert(block_start, '\n'); } + block_start = in->indexOf("-----BEGIN PGP SIGNED MESSAGE-----"); + if (block_start > 0 && in->at(block_start - 1) != '\n') { + in->insert(block_start, '\n'); + } } void GpgWin::importKeyFromEdit() @@ -694,7 +698,10 @@ void GpgWin::sign() void GpgWin::verify() { - int error = mCtx->verify(edit->curTextPage()->toPlainText().toUtf8()); + QByteArray text = edit->curTextPage()->toPlainText().toAscii(); // TODO: toUtf8() here? + preventNoDataErr(&text); + + int error = mCtx->verify(text); if (error == 0) { edit->curPage()->showVerifyLabel(true); } else { -- cgit