aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--context.cpp8
-rw-r--r--context.h2
-rw-r--r--editorpage.cpp19
-rw-r--r--editorpage.h7
-rw-r--r--gpgwin.cpp7
-rw-r--r--textedit.h2
6 files changed, 35 insertions, 10 deletions
diff --git a/context.cpp b/context.cpp
index 46dcbc6..52593bf 100644
--- a/context.cpp
+++ b/context.cpp
@@ -496,8 +496,9 @@ void Context::executeGpgCommand(QStringList arguments, QByteArray *stdOut, QByte
* -> list of sigs
* -> valid
*/
-void Context::verify(QByteArray inBuffer) {
+int Context::verify(QByteArray inBuffer) {
+ int error=0;
gpgme_data_t in;
gpgme_error_t err;
gpgme_signature_t sign;
@@ -517,6 +518,9 @@ void Context::verify(QByteArray inBuffer) {
qDebug() << "sig summary: " << sign->summary;
qDebug() << "sig fingerprint: " << sign->fpr;
qDebug() << "sig status: " << sign->status << " - " << gpg_err_code(sign->status) << " - " << gpg_strerror(sign->status);
+ if (sign->status != 0) {
+ error = 1;
+ }
qDebug() << "sig validity: " << sign->validity;
qDebug() << "sig validity reason: " << sign->validity_reason << " - " << gpg_err_code(sign->validity_reason) << " - " << gpgme_strerror(sign->validity_reason);
sign = sign->next;
@@ -600,7 +604,7 @@ If SIG is a detached
qDebug() << "sig validity reason: " << sign->validity_reason << " - " << gpg_err_code(sign->validity_reason) << " - " << gpgme_strerror(sign->validity_reason);
*/
-
+ return error;
}
/***
diff --git a/context.h b/context.h
index bd73a79..28abc24 100644
--- a/context.h
+++ b/context.h
@@ -70,7 +70,7 @@ public:
void clearPasswordCache();
void exportSecretKey(QString uid, QByteArray *outBuffer);
gpgme_key_t getKeyDetails(QString uid);
- void verify(QByteArray in);
+ int verify(QByteArray in);
void decryptVerify(QByteArray in);
void sign(const QByteArray &inBuffer, QByteArray *outBuffer);
bool sign(QStringList *uidList, const QByteArray &inBuffer, QByteArray *outBuffer );
diff --git a/editorpage.cpp b/editorpage.cpp
index 4bead12..efbdf2e 100644
--- a/editorpage.cpp
+++ b/editorpage.cpp
@@ -28,10 +28,16 @@ EditorPage::EditorPage(const QString &filePath, QWidget *parent) : QWidget(paren
fullFilePath(filePath)
{
textPage = new QPlainTextEdit();
-
- mainLayout = new QHBoxLayout();
+ verifyLabel = new QLabel("Verified");
+ verifyLabel->setAutoFillBackground(1);
+ QPalette verifyPalette = verifyLabel->palette();
+ verifyPalette.setColor(QPalette::Background, "#CBFDCB");
+ verifyLabel->setPalette(verifyPalette);
+ this->showVerifyLabel(false);
+ mainLayout = new QVBoxLayout();
mainLayout->setSpacing(0);
mainLayout->addWidget(textPage);
+ mainLayout->addWidget(verifyLabel);
mainLayout->setContentsMargins(0,0,0,0);
setLayout(mainLayout);
setAttribute(Qt::WA_DeleteOnClose);
@@ -56,7 +62,14 @@ void EditorPage::setFilePath(const QString &filePath)
fullFilePath = filePath;
}
-
+void EditorPage::showVerifyLabel(bool showLabel)
+{
+ if (showLabel == true) {
+ verifyLabel->show();
+ } else {
+ verifyLabel->hide();
+ }
+}
void setSaveState()
{
diff --git a/editorpage.h b/editorpage.h
index cd8ca19..e49a58c 100644
--- a/editorpage.h
+++ b/editorpage.h
@@ -23,8 +23,9 @@
#define EDITORPAGE_H
#include <QPlainTextEdit>
-class QHBoxLayout;
+class QVBoxLayout;
class QString;
+class QLabel;
class EditorPage : public QWidget
{
@@ -35,11 +36,13 @@ public:
const QString& getFilePath() const;
void setFilePath(const QString &filePath);
QPlainTextEdit *getTextPage();
+ void showVerifyLabel(bool showLabel);
private:
QPlainTextEdit *textPage;
- QHBoxLayout *mainLayout;
+ QVBoxLayout *mainLayout;
QString fullFilePath;
+ QLabel *verifyLabel;
void setSaveState();
};
diff --git a/gpgwin.cpp b/gpgwin.cpp
index 400c64a..ba448ff 100644
--- a/gpgwin.cpp
+++ b/gpgwin.cpp
@@ -694,7 +694,12 @@ void GpgWin::sign()
void GpgWin::verify()
{
- mCtx->verify(edit->curTextPage()->toPlainText().toUtf8());
+ int error = mCtx->verify(edit->curTextPage()->toPlainText().toUtf8());
+ if (error == 0) {
+ edit->curPage()->showVerifyLabel(true);
+ } else {
+ edit->curPage()->showVerifyLabel(false);
+ }
}
void GpgWin::importKeyDialog()
diff --git a/textedit.h b/textedit.h
index 1e05a35..2ecc28f 100644
--- a/textedit.h
+++ b/textedit.h
@@ -109,11 +109,11 @@ public slots:
void closeTab();
void switchTabUp();
void switchTabDown();
+ EditorPage *curPage();
private:
QString strippedName(const QString &fullFileName);
bool maybeSaveFile();
- EditorPage *curPage();
void setCursorPosition();
QString mIconPath;
int countPage;