summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/EventViewer/QtEventWindow.cpp')
-rw-r--r--Swift/QtUI/EventViewer/QtEventWindow.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Swift/QtUI/EventViewer/QtEventWindow.cpp b/Swift/QtUI/EventViewer/QtEventWindow.cpp
index 06bfd98..3072497 100644
--- a/Swift/QtUI/EventViewer/QtEventWindow.cpp
+++ b/Swift/QtUI/EventViewer/QtEventWindow.cpp
@@ -1,9 +1,9 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2015 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include "Swift/QtUI/EventViewer/QtEventWindow.h"
@@ -48,13 +48,12 @@ QtEventWindow::QtEventWindow(UIEventStream* eventStream) : EventWindow(false) {
readButton_ = new QPushButton(tr("Display Notice"), this);
layout->addWidget(readButton_);
readButton_->setEnabled(false);
connect(readButton_, SIGNAL(clicked()), this, SLOT(handleReadClicked()));
connect(view_, SIGNAL(clicked(const QModelIndex&)), this, SLOT(handleItemClicked(const QModelIndex&)));
connect(view_, SIGNAL(activated(const QModelIndex&)), this, SLOT(handleItemActivated(const QModelIndex&)));
-
}
QtEventWindow::~QtEventWindow() {
delete model_;
delete delegate_;
/* Not view_ because this is the parent */
@@ -103,15 +102,17 @@ void QtEventWindow::handleItemActivated(const QModelIndex& item) {
}
void QtEventWindow::addEvent(boost::shared_ptr<StanzaEvent> event, bool active) {
view_->clearSelection();
model_->addEvent(event, active);
emit onNewEventCountUpdated(model_->getNewEventCount());
+ readButton_->setEnabled(model_->rowCount() > 0);
}
void QtEventWindow::removeEvent(boost::shared_ptr<StanzaEvent> event) {
view_->clearSelection();
model_->removeEvent(event);
emit onNewEventCountUpdated(model_->getNewEventCount());
+ readButton_->setEnabled(model_->rowCount() > 0);
}
}