From 68f49002ee2b89bbbb78240b0e6f66147e00866c Mon Sep 17 00:00:00 2001 From: nils Date: Sun, 11 Sep 2011 19:59:44 +0000 Subject: show details in different colours in verfiy detail dialog, further commenting and added fillTextEditWithText to textedit git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@530 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- verifynotification.cpp | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) (limited to 'verifynotification.cpp') diff --git a/verifynotification.cpp b/verifynotification.cpp index c177497..a13bcc8 100644 --- a/verifynotification.cpp +++ b/verifynotification.cpp @@ -26,7 +26,6 @@ VerifyNotification::VerifyNotification(GpgME::Context *ctx, QWidget *parent ) : { mCtx = ctx; verifyLabel = new QLabel(this); - verifyDetailText = new QString(); importFromKeyserverAct = new QAction(tr("Import missing key from Keyserver"), this); connect(importFromKeyserverAct, SIGNAL(triggered()), this, SLOT(importFromKeyserver())); @@ -47,15 +46,19 @@ VerifyNotification::VerifyNotification(GpgME::Context *ctx, QWidget *parent ) : notificationWidgetLayout->setContentsMargins(0,0,0,0); notificationWidgetLayout->addWidget(verifyLabel,2); notificationWidgetLayout->addWidget(detailsButton); - this->setLayout(notificationWidgetLayout); + verifyDetailListLayout = new QVBoxLayout(); } -void VerifyNotification::setVerifyDetailText (QString text) +void VerifyNotification::addVerifyDetailLabel(QString text,verify_label_status status,bool prepend) { - verifyDetailText->clear(); - verifyDetailText->append(text); - return; + if (prepend) { + verifyDetailStringVector.prepend(text); + verifyDetailStatusVector.prepend(status); + } else { + verifyDetailStringVector.append(text); + verifyDetailStatusVector.append(status); + } } void VerifyNotification::importFromKeyserver() @@ -90,6 +93,34 @@ void VerifyNotification::showImportAction(bool visible) void VerifyNotification::showVerifyDetails() { - QMessageBox::information(this,tr("Details"),QString(*verifyDetailText), QMessageBox::Ok); + QDialog *verifyDetailsDialog = new QDialog(this); + // QLabel *label = new QLabel(*verifyDetailText); + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); + connect(buttonBox, SIGNAL(rejected()), verifyDetailsDialog, SLOT(close())); + for (int i=0;iaddWidget(label); + switch (verifyDetailStatusVector[i]) { + case VERIFY_ERROR_OK: label->setObjectName("ok"); + break; + case VERIFY_ERROR_WARN: label->setObjectName("warning"); + break; + case VERIFY_ERROR_CRITICAL: label->setObjectName("critical"); + break; + default: + break; + } + } + +// verifyDetailStatusVector.append(status); + +// verifyDetailListLayout->addWidget(label); + + verifyDetailListLayout->addWidget(buttonBox); + + verifyDetailsDialog->setLayout(verifyDetailListLayout); + verifyDetailsDialog->show(); + + //QMessageBox::information(this,tr("Details"),QString(*verifyDetailText), QMessageBox::Ok); return; } -- cgit v1.2.3