Switch to correct buffer when indicator is activated.
[quassel.git] / src / qtui / indicatornotificationbackend.cpp
index 8322b84..3b808dd 100644 (file)
@@ -45,6 +45,8 @@ IndicatorNotificationBackend::IndicatorNotificationBackend(QObject *parent)
   _server = QIndicate::Server::defaultInstance();
   _server->setType("message.im");
   _server->setDesktopFile(DESKTOP_FILE);
+  connect(_server, SIGNAL(serverDisplay()), QtUi::mainWindow(), SLOT(forceActivated()));
+
   if (_enabled) {
     _server->show();
   }
@@ -66,6 +68,8 @@ void IndicatorNotificationBackend::notify(const Notification &notification) {
   if(!indicator) {
     indicator = new Indicator;
     _indicatorHash.insert(bufferId, indicator);
+    connect(indicator, SIGNAL(display()),
+      SLOT(indicatorDisplayed()));
   }
   indicator->lastNotificationId = notification.notificationId;
 
@@ -124,6 +128,11 @@ void IndicatorNotificationBackend::enabledChanged(const QVariant &v) {
   }
 }
 
+void IndicatorNotificationBackend::indicatorDisplayed() {
+  Indicator *indicator = static_cast<Indicator*>(sender());
+  emit activated(indicator->lastNotificationId);
+}
+
 SettingsPage *IndicatorNotificationBackend::createConfigWidget() const {
   return new ConfigWidget();
 }