Index: tools/advwidget/advwidget.cpp =================================================================== --- tools/advwidget/advwidget.cpp (revision 845) +++ tools/advwidget/advwidget.cpp (working copy) @@ -74,7 +74,9 @@ static bool stickEnabled; QWidget *parentWidget; + bool flashing_; + bool flashing() const; void doFlash(bool on); void posChanging(int *x, int *y, int *width, int *height); void moveEvent(QMoveEvent *e); @@ -92,6 +94,8 @@ GAdvancedWidget::Private::Private(QWidget *parent) : QObject(parent) + , parentWidget(parent) + , flashing_(false) { if ( !advancedWidgetShared ) advancedWidgetShared = new AdvancedWidgetShared(); @@ -193,8 +197,17 @@ } } +bool GAdvancedWidget::Private::flashing() const +{ + return flashing_; +} + void GAdvancedWidget::Private::doFlash(bool yes) { + flashing_ = yes; + if (parentWidget->window() != parentWidget) + return; + #ifdef Q_WS_WIN FLASHWINFO fwi; fwi.cbSize = sizeof(fwi); @@ -202,7 +215,7 @@ if (yes) { fwi.dwFlags = FLASHW_ALL | FLASHW_TIMER; fwi.dwTimeout = 0; - fwi.uCount = (UINT)-1; + fwi.uCount = 5; } else { fwi.dwFlags = FLASHW_STOP; @@ -273,14 +286,6 @@ } #endif -void GAdvancedWidget::preSetCaption() -{ -} - -void GAdvancedWidget::postSetCaption() -{ -} - void GAdvancedWidget::restoreSavedGeometry(QRect savedGeometry) { QRect geom = savedGeometry; @@ -307,6 +312,11 @@ d->parentWidget->resize(geom.size()); } +bool GAdvancedWidget::flashing() const +{ + return d->flashing(); +} + void GAdvancedWidget::doFlash(bool on) { d->doFlash( on ); Index: tools/advwidget/advwidget.h =================================================================== --- tools/advwidget/advwidget.h (revision 845) +++ tools/advwidget/advwidget.h (working copy) @@ -39,6 +39,8 @@ static void setStickToWindows(bool val); void restoreSavedGeometry(QRect savedGeometry); + + bool flashing() const; void doFlash(bool on); #ifdef Q_OS_WIN @@ -47,9 +49,6 @@ void moveEvent(QMoveEvent *e); - void preSetCaption(); - void postSetCaption(); - void windowActivationChange(bool oldstate); public: @@ -105,6 +104,13 @@ gAdvWidget->restoreSavedGeometry(savedGeometry); } + bool flashing() const + { + if (gAdvWidget) + return gAdvWidget->flashing(); + return false; + } + virtual void doFlash( bool on ) { if (gAdvWidget) @@ -128,14 +134,17 @@ void setWindowTitle( const QString &c ) { - if (gAdvWidget) - gAdvWidget->preSetCaption(); BaseClass::setWindowTitle( c ); - if (gAdvWidget) - gAdvWidget->postSetCaption(); + windowTitleChanged(); } protected: + virtual void windowTitleChanged() + { + doFlash(flashing()); + } + +protected: void windowActivationChange( bool oldstate ) { if (gAdvWidget) Index: tabs/tabbablewidget.cpp =================================================================== --- tabs/tabbablewidget.cpp (revision 845) +++ tabs/tabbablewidget.cpp (working copy) @@ -128,14 +128,6 @@ void TabbableWidget::doFlash(bool on) { - flashing_ = on; - if (!isTabbed()) { - AdvancedWidget::doFlash(on); - } + AdvancedWidget::doFlash(on); emit updateFlashState(); } - -bool TabbableWidget::flashing() const -{ - return flashing_; -} Index: tabs/tabdlg.h =================================================================== --- tabs/tabdlg.h (revision 845) +++ tabs/tabdlg.h (working copy) @@ -61,6 +61,8 @@ protected: void setShortcuts(); + + // reimplemented void closeEvent( QCloseEvent* ); void keyPressEvent(QKeyEvent *); void windowActivationChange(bool); Index: tabs/tabbablewidget.h =================================================================== --- tabs/tabbablewidget.h (revision 845) +++ tabs/tabbablewidget.h (working copy) @@ -59,7 +59,6 @@ // reimplemented virtual void doFlash(bool on); - bool flashing() const; signals: void updateFlashState(); @@ -71,15 +70,18 @@ public slots: virtual void activated(); void bringToFront(); + protected: + // reimplemented virtual void hideEvent(QHideEvent *event); + protected slots: void ensureTabbedCorrectly(); + private: Jid jid_; PsiAccount *pa_; TabManager *tabManager_; - bool flashing_; }; #endif Index: tabs/tabdlg.cpp =================================================================== --- tabs/tabdlg.cpp (revision 845) +++ tabs/tabdlg.cpp (working copy) @@ -92,10 +92,9 @@ } - +// FIXME: This is a bad idea to store pointers in QMimeData Q_DECLARE_METATYPE ( TabDlg* ); - void TabDlg::setShortcuts() { //act_close->setShortcuts(ShortcutManager::instance()->shortcuts("common.close")); @@ -347,19 +346,19 @@ void TabDlg::updateCaption() { QString cap = ""; - uint pending=0; - for ( int i=0; i 0) { + if (pending > 0) { cap += "* "; - if(pending > 1) + if (pending > 1) cap += QString("[%1] ").arg(pending); } cap += getName(); if (tabIsComposing[(TabbableWidget*)(tabs->currentPage())]) cap += tr(" is composing"); + setWindowTitle(cap); }