From 77245b9b30abac6c364025f4919b931b1fdad082 Mon Sep 17 00:00:00 2001 From: ubbo Date: Tue, 6 Dec 2011 20:44:53 +0000 Subject: use gpgconstants git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@671 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- gpg4usb.pro | 6 ++++-- gpgcontext.cpp | 8 ++++---- gpgcontext.h | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gpg4usb.pro b/gpg4usb.pro index 772dda1..dec67fc 100644 --- a/gpg4usb.pro +++ b/gpg4usb.pro @@ -36,7 +36,8 @@ HEADERS += attachments.h \ verifydetailsdialog.h \ verifykeydetailbox.h \ wizard.h \ - helppage.h + helppage.h \ + gpgconstants.h SOURCES += attachments.cpp \ gpgcontext.cpp \ @@ -60,7 +61,8 @@ SOURCES += attachments.cpp \ verifydetailsdialog.cpp \ verifykeydetailbox.cpp \ wizard.cpp \ - helppage.cpp + helppage.cpp \ + gpgconstants.cpp RC_FILE = gpg4usb.rc diff --git a/gpgcontext.cpp b/gpgcontext.cpp index 46edbe8..c632266 100644 --- a/gpgcontext.cpp +++ b/gpgcontext.cpp @@ -637,11 +637,11 @@ bool GpgContext::sign(QStringList *uidList, const QByteArray &inBuffer, QByteArr */ void GpgContext::preventNoDataErr(QByteArray *in) { - int block_start = in->indexOf("-----BEGIN PGP MESSAGE-----"); + int block_start = in->indexOf(GpgConstants::PGP_CRYPT_BEGIN); if (block_start > 0 && in->at(block_start - 1) != '\n') { in->insert(block_start, '\n'); } - block_start = in->indexOf("-----BEGIN PGP SIGNED MESSAGE-----"); + block_start = in->indexOf(GpgConstants::PGP_SIGNED_BEGIN); if (block_start > 0 && in->at(block_start - 1) != '\n') { in->insert(block_start, '\n'); } @@ -654,10 +654,10 @@ void GpgContext::preventNoDataErr(QByteArray *in) * - 2, if text is completly signed */ int GpgContext::textIsSigned(const QByteArray &text) { - if (text.trimmed().startsWith("-----BEGIN PGP SIGNED MESSAGE-----") && text.trimmed().endsWith("-----END PGP SIGNATURE-----")) { + if (text.trimmed().startsWith(GpgConstants::PGP_SIGNED_BEGIN) && text.trimmed().endsWith(GpgConstants::PGP_SIGNED_END)) { return 2; } - if (text.contains("-----BEGIN PGP SIGNED MESSAGE-----") && text.contains("-----END PGP SIGNATURE-----")) { + if (text.contains(GpgConstants::PGP_SIGNED_BEGIN) && text.contains(GpgConstants::PGP_SIGNED_END)) { return 1; } return 0; diff --git a/gpgcontext.h b/gpgcontext.h index be43764..f754418 100644 --- a/gpgcontext.h +++ b/gpgcontext.h @@ -22,6 +22,7 @@ #ifndef __SGPGMEPP_CONTEXT_H__ #define __SGPGMEPP_CONTEXT_H__ +#include "gpgconstants.h" #include #include #include -- cgit v1.2.3