diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-08-08 18:14:23 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-08-08 18:14:23 +0000 |
commit | cdcfb07b963cc844f78db0015c0d51298dd8bc90 (patch) | |
tree | bb592666d2af5b2f79c4e6054bb94d5e37773655 | |
parent | css for verifynotification (diff) | |
download | gpg4usb-cdcfb07b963cc844f78db0015c0d51298dd8bc90.tar.gz gpg4usb-cdcfb07b963cc844f78db0015c0d51298dd8bc90.zip |
changed removeNoteByClassname to hideNoteByClassname since remove doesn't work
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@509 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r-- | editorpage.cpp | 23 | ||||
-rw-r--r-- | editorpage.h | 3 | ||||
-rw-r--r-- | gpgwin.cpp | 2 | ||||
-rw-r--r-- | verifynotification.cpp | 12 | ||||
-rw-r--r-- | verifynotification.h | 2 |
5 files changed, 14 insertions, 28 deletions
diff --git a/editorpage.cpp b/editorpage.cpp index 7725e02..f6c6504 100644 --- a/editorpage.cpp +++ b/editorpage.cpp @@ -65,27 +65,18 @@ void EditorPage::showNotificationWidget(QWidget *widget, const char *className) mainLayout->addWidget(widget); } -void EditorPage::removeNoteByClass(const char *className) { +void EditorPage::hideNoteByClass(const char *className) +{ qDebug() << "length:" << this->children().length(); - - foreach(QObject *tmp, this->children()) { - qDebug() << "bla" << tmp->property(className); - if (tmp->property(className) == true) { - mainLayout->removeWidget(qobject_cast <QWidget*> (tmp)); + QList<QWidget *> widgets = findChildren<QWidget *>(); + foreach(QWidget * widget, widgets) + { + if (widget->property(className) == true) { + widget->hide(); } } } -void EditorPage::showVerifyLabel(bool showLabel) -{ - if (showLabel == true) { - notificationWidget->show(); - } else { - notificationWidget->hide(); - } - -} - void setSaveState() { // curPage()->setFilePath(""); diff --git a/editorpage.h b/editorpage.h index a879704..ada38eb 100644 --- a/editorpage.h +++ b/editorpage.h @@ -37,9 +37,8 @@ public: const QString& getFilePath() const; void setFilePath(const QString &filePath); QPlainTextEdit *getTextPage(); - void showVerifyLabel(bool showLabel); void showNotificationWidget(QWidget *widget, const char *className); - void removeNoteByClass(const char *className); + void hideNoteByClass(const char *className); private: QPlainTextEdit *textPage; @@ -732,6 +732,7 @@ void GpgWin::verify() int textIsSigned = isSigned(text); gpgme_signature_t sign = mCtx->verify(text); + edit->curPage()->hideNoteByClass("verifyNotification"); if (sign == NULL) { return; @@ -777,7 +778,6 @@ void GpgWin::verify() verifyLabelText.remove(verifyLabelText.length()-1,1); vn->setVerifyLabel(verifyLabelText); - edit->curPage()->removeNoteByClass("verifyNotification"); edit->curPage()->showNotificationWidget(vn, "verifyNotification"); } diff --git a/verifynotification.cpp b/verifynotification.cpp index e6b3819..b9db071 100644 --- a/verifynotification.cpp +++ b/verifynotification.cpp @@ -5,26 +5,22 @@ VerifyNotification::VerifyNotification(GpgME::Context *ctx, QWidget *parent ) : QWidget(parent) { mCtx = ctx; - verifyLabel = new QLabel("Verified"); + verifyLabel = new QLabel(this); - QHBoxLayout *notificationWidgetLayout = new QHBoxLayout(); + notificationWidgetLayout = new QHBoxLayout(this); notificationWidgetLayout->setContentsMargins(0,0,0,0); notificationWidgetLayout->addWidget(verifyLabel,2); -// notificationWidget = new QWidget(this); - - //this->setStyleSheet("background-color: #CBFDCB;"); this->setLayout(notificationWidgetLayout); QAction *importFromKeyserverAct = new QAction(tr("Import missing key from Keyserver"), this); connect(importFromKeyserverAct, SIGNAL(triggered()), this, SLOT(importFromKeyserver())); - QMenu *detailMenu = new QMenu(); + QMenu *detailMenu = new QMenu(this); detailMenu->addAction(importFromKeyserverAct); keysNotInList = new QStringList(); - QPushButton *verifyButton = new QPushButton("Details"); + QPushButton *verifyButton = new QPushButton("Details",this); verifyButton->setMenu(detailMenu); - // notificationWidgetLayout->addStretch(1); notificationWidgetLayout->addWidget(verifyButton); } diff --git a/verifynotification.h b/verifynotification.h index 5f5cd99..2c069b7 100644 --- a/verifynotification.h +++ b/verifynotification.h @@ -29,7 +29,7 @@ public slots: private: QLabel *verifyLabel; GpgME::Context *mCtx; - + QHBoxLayout *notificationWidgetLayout; }; #endif // VERIFYNOTIFICATION_H |