From b47f2cdbb8c58b2f2051725443da26c3fb88e1a1 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Mon, 12 Apr 2010 18:18:09 +0100
Subject: Flash the taskbar on new messages.

Fixes: #207

diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp
index 59a4b66..42c80a7 100644
--- a/Swift/QtUI/QtChatTabs.cpp
+++ b/Swift/QtUI/QtChatTabs.cpp
@@ -14,6 +14,7 @@
 #include <QTabWidget>
 #include <QLayout>
 #include <QTabBar>
+#include <QApplication>
 
 namespace Swift {
 QtChatTabs::QtChatTabs() : QWidget() {
@@ -113,8 +114,9 @@ void QtChatTabs::handleTabTitleUpdated(QWidget* widget) {
 	}
 	tabs_->setTabText(index, widget->windowTitle());
 	QColor tabTextColor;
+	bool flash = false;
 	switch (tabbable->getWidgetAlertState()) {
-	case QtTabbable::WaitingActivity : tabTextColor = QColor(255, 0, 0); break;
+	case QtTabbable::WaitingActivity : flash = true; tabTextColor = QColor(255, 0, 0); break;
 	case QtTabbable::ImpendingActivity : tabTextColor = QColor(0, 255, 0); break;
 	default : tabTextColor = QColor(-1,-1,-1);//invalid resets to default
 	}
@@ -122,6 +124,12 @@ void QtChatTabs::handleTabTitleUpdated(QWidget* widget) {
 	if (widget == tabs_->currentWidget()) {
 		setWindowTitle(widget->windowTitle());
 	}
+
+	if (flash) {
+#ifndef SWIFTEN_PLATFORM_MACOSX
+		QApplication::alert(this, 3000);
+#endif
+	}
 }
 
 void QtChatTabs::resizeEvent(QResizeEvent*) {
-- 
cgit v0.10.2-6-g49f6