aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2011-07-22 22:57:35 +0000
committernils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2011-07-22 22:57:35 +0000
commita354065dd390bed674538b68bbbb23c7ce80eb51 (patch)
tree2c7dcc8b47179cd4147486965f0dcd39f4073a0c
parentverify returns gpgme_op_verify_result (diff)
downloadgpg4usb-a354065dd390bed674538b68bbbb23c7ce80eb51.tar.gz
gpg4usb-a354065dd390bed674538b68bbbb23c7ce80eb51.zip
independent notifcation area
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@503 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r--context.cpp2
-rw-r--r--editorpage.cpp20
-rw-r--r--editorpage.h5
-rw-r--r--gpg4usb.pro6
-rw-r--r--gpgwin.cpp11
-rw-r--r--release/css/default.css3
-rw-r--r--verifynotification.cpp30
-rw-r--r--verifynotification.h23
8 files changed, 89 insertions, 11 deletions
diff --git a/context.cpp b/context.cpp
index f849640..49af498 100644
--- a/context.cpp
+++ b/context.cpp
@@ -45,6 +45,8 @@ Context::Context()
* subsystem in GPGME. (from the info page) */
gpgme_check_version(NULL);
+ // TODO: Set gpgme_language to config
+ // http://lavica.fesb.hr/cgi-bin/info2html?%28gpgme%29Locale
setlocale(LC_ALL, "");
/** set locale, because tests do also */
gpgme_set_locale(NULL, LC_CTYPE, setlocale(LC_CTYPE, NULL));
diff --git a/editorpage.cpp b/editorpage.cpp
index 0839584..7680c36 100644
--- a/editorpage.cpp
+++ b/editorpage.cpp
@@ -28,13 +28,13 @@ EditorPage::EditorPage(const QString &filePath, QWidget *parent) : QWidget(paren
fullFilePath(filePath)
{
textPage = new QPlainTextEdit();
- verifyLabel = new QLabel("Verified");
- verifyLabel->setObjectName("verifyLabel");
- this->showVerifyLabel(false);
+
+ //notificationWidget = new QWidget(this);
+ //this->showVerifyLabel(false);
mainLayout = new QVBoxLayout();
mainLayout->setSpacing(0);
mainLayout->addWidget(textPage);
- mainLayout->addWidget(verifyLabel);
+ //mainLayout->addWidget(notificationWidget);
mainLayout->setContentsMargins(0,0,0,0);
setLayout(mainLayout);
setAttribute(Qt::WA_DeleteOnClose);
@@ -59,13 +59,21 @@ void EditorPage::setFilePath(const QString &filePath)
fullFilePath = filePath;
}
+void EditorPage::showNotificationWidget(QWidget *widget)
+{
+ //notificationWidget = widget;
+ //notificationWidget->show();
+ mainLayout->addWidget(widget);
+}
+
void EditorPage::showVerifyLabel(bool showLabel)
{
if (showLabel == true) {
- verifyLabel->show();
+ notificationWidget->show();
} else {
- verifyLabel->hide();
+ notificationWidget->hide();
}
+
}
void setSaveState()
diff --git a/editorpage.h b/editorpage.h
index e49a58c..9f8144c 100644
--- a/editorpage.h
+++ b/editorpage.h
@@ -24,6 +24,7 @@
#include <QPlainTextEdit>
class QVBoxLayout;
+class QHBoxLayout;
class QString;
class QLabel;
@@ -37,10 +38,14 @@ public:
void setFilePath(const QString &filePath);
QPlainTextEdit *getTextPage();
void showVerifyLabel(bool showLabel);
+ void showNotificationWidget(QWidget *widget);
private:
QPlainTextEdit *textPage;
QVBoxLayout *mainLayout;
+ QHBoxLayout *notificationWidgetLayout;
+ QWidget *notificationWidget;
+ QMenu *verifyMenu;
QString fullFilePath;
QLabel *verifyLabel;
void setSaveState();
diff --git a/gpg4usb.pro b/gpg4usb.pro
index dc50340..ef8e2a1 100644
--- a/gpg4usb.pro
+++ b/gpg4usb.pro
@@ -29,7 +29,8 @@ HEADERS += attachments.h \
textedit.h \
editorpage.h \
quitdialog.h \
- keyserverimportdialog.h
+ keyserverimportdialog.h \
+ verifynotification.h
SOURCES += attachments.cpp \
context.cpp \
gpgwin.cpp \
@@ -45,7 +46,8 @@ SOURCES += attachments.cpp \
textedit.cpp \
editorpage.cpp \
quitdialog.cpp \
- keyserverimportdialog.cpp
+ keyserverimportdialog.cpp \
+ verifynotification.cpp
RC_FILE = gpg4usb.rc
# comment out line below for static building
diff --git a/gpgwin.cpp b/gpgwin.cpp
index f206e40..74fdadf 100644
--- a/gpgwin.cpp
+++ b/gpgwin.cpp
@@ -22,6 +22,7 @@
#include "gpgwin.h"
#include "fileencryptiondialog.h"
#include "settingsdialog.h"
+#include "verifynotification.h"
GpgWin::GpgWin()
{
@@ -710,15 +711,21 @@ void GpgWin::sign()
void GpgWin::verify()
{
+ bool verified=false;
QByteArray text = edit->curTextPage()->toPlainText().toAscii(); // TODO: toUtf8() here?
preventNoDataErr(&text);
gpgme_signature_t sign = mCtx->verify(text);
+
if (sign == NULL) {
- edit->curPage()->showVerifyLabel(false);
return;
+ } else {
+ // TODO: should get verifynotification get the whole signature for analysizing
+ VerifyNotification *vn = new VerifyNotification();
+ edit->curPage()->showNotificationWidget(vn);
}
+ //
while (sign) {
qDebug() << "sig summary: " << sign->summary;
qDebug() << "sig fingerprint: " << sign->fpr;
@@ -729,8 +736,8 @@ void GpgWin::verify()
qDebug() << "kein passender Schlüssel gefunden. Vom Schlüsselserver importieren?";
}
sign = sign->next;
- }
+ }
}
diff --git a/release/css/default.css b/release/css/default.css
index 50e1344..bdd0137 100644
--- a/release/css/default.css
+++ b/release/css/default.css
@@ -1,7 +1,8 @@
/* CSS for GUI, look e.g. at http://doc.qt.nokia.com/latest/stylesheet-examples.html */
-QLabel#verifyLabel { background-color: #CBFDCB }
+#verifyBox { background-color: #CBFDCB }
+#cryptToolBar { background-color: #CBFDCB }
/*
QLabel, QAbstractButton {
font: bold;
diff --git a/verifynotification.cpp b/verifynotification.cpp
new file mode 100644
index 0000000..0c42fdf
--- /dev/null
+++ b/verifynotification.cpp
@@ -0,0 +1,30 @@
+#include "verifynotification.h"
+
+VerifyNotification::VerifyNotification(QWidget *parent) :
+ QWidget(parent)
+{
+ QLabel *verifyLabel = new QLabel("Verified");
+
+ QHBoxLayout *notificationWidgetLayout = new QHBoxLayout();
+ notificationWidgetLayout->setContentsMargins(0,0,0,0);
+ notificationWidgetLayout->addWidget(verifyLabel);
+
+// notificationWidget = new QWidget(this);
+
+ this->setStyleSheet("background-color: #CBFDCB;");
+ this->setLayout(notificationWidgetLayout);
+
+ QAction *openAct = new QAction(tr("&Open..."), this);
+ openAct->setShortcut(QKeySequence::Open);
+ openAct->setToolTip(tr("Open an existing file"));
+
+ QMenu *verifyMenu = new QMenu();
+ verifyMenu->addAction(openAct);
+
+ QPushButton *verifyButton = new QPushButton("Details");
+ verifyButton->setMenu(verifyMenu);
+ notificationWidgetLayout->addStretch(1);
+ notificationWidgetLayout->addWidget(verifyButton);
+
+
+}
diff --git a/verifynotification.h b/verifynotification.h
new file mode 100644
index 0000000..13c5fd0
--- /dev/null
+++ b/verifynotification.h
@@ -0,0 +1,23 @@
+#ifndef VERIFYNOTIFICATION_H
+#define VERIFYNOTIFICATION_H
+
+#include <QLabel>
+#include <QHBoxLayout>
+#include <QMenu>
+#include <QPushButton>
+
+#include <QWidget>
+
+class VerifyNotification : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit VerifyNotification(QWidget *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+#endif // VERIFYNOTIFICATION_H