diff options
author | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-12-06 20:44:53 +0000 |
---|---|---|
committer | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-12-06 20:44:53 +0000 |
commit | 77245b9b30abac6c364025f4919b931b1fdad082 (patch) | |
tree | 80bc4e9e6833ac885494f7db8101c72fbec79b7e | |
parent | add class for constants (diff) | |
download | gpg4usb-77245b9b30abac6c364025f4919b931b1fdad082.tar.gz gpg4usb-77245b9b30abac6c364025f4919b931b1fdad082.zip |
use gpgconstants
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@671 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r-- | gpg4usb.pro | 6 | ||||
-rw-r--r-- | gpgcontext.cpp | 8 | ||||
-rw-r--r-- | 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 <locale.h> #include <errno.h> #include <gpgme.h> |