diff options
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/SystemTrayController.cpp | 12 | ||||
-rw-r--r-- | Swift/Controllers/XMPPEvents/EventController.h | 5 |
2 files changed, 14 insertions, 3 deletions
diff --git a/Swift/Controllers/SystemTrayController.cpp b/Swift/Controllers/SystemTrayController.cpp index 23a94fa..d3824c9 100644 --- a/Swift/Controllers/SystemTrayController.cpp +++ b/Swift/Controllers/SystemTrayController.cpp @@ -19,8 +19,16 @@ SystemTrayController::SystemTrayController(EventController* eventController, Sys eventController_->onEventQueueLengthChange.connect(boost::bind(&SystemTrayController::handleEventQueueLengthChange, this, _1)); } -void SystemTrayController::handleEventQueueLengthChange(int length) { - systemTray_->setUnreadMessages(length > 0); +void SystemTrayController::handleEventQueueLengthChange(int /*length*/) { + EventList events = eventController_->getEvents(); + bool found = false; + for (EventList::iterator it = events.begin(); it != events.end(); it++) { + if (boost::dynamic_pointer_cast<MessageEvent>(*it)) { + found = true; + break; + } + } + systemTray_->setUnreadMessages(found); } void SystemTrayController::setMyStatusType(StatusShow::Type type) { diff --git a/Swift/Controllers/XMPPEvents/EventController.h b/Swift/Controllers/XMPPEvents/EventController.h index b405556..ba3fd5b 100644 --- a/Swift/Controllers/XMPPEvents/EventController.h +++ b/Swift/Controllers/XMPPEvents/EventController.h @@ -16,16 +16,19 @@ #include "Swift/Controllers/XMPPEvents/MessageEvent.h" namespace Swift { + typedef std::vector<boost::shared_ptr<StanzaEvent> > EventList; class EventController { public: + EventController(); void handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceEvent); boost::signal<void (int)> onEventQueueLengthChange; boost::signal<void (boost::shared_ptr<StanzaEvent>)> onEventQueueEventAdded; + const EventList getEvents() const {return events_;} private: void handleEventConcluded(boost::shared_ptr<StanzaEvent> event); - std::vector<boost::shared_ptr<StanzaEvent> > events_; + EventList events_; }; } #endif |