Hi all!

The attached patch fixes a problem where the icon of the chat window
wasn't always in sync with the icon of the currently selected tab.
For example, the window icon would sometimes show a user as away while
the tab icon would (correctly) indicate that he is now online.

This comes partly from an issue in KDE >= 3.2 as noted in
UserEventTabDlg::setIcon() (which was copied from
CMainWindow::updateStatus()).
? licq_seticon.patch
Index: plugins/qt-gui/src/usereventdlg.cpp
===================================================================
RCS file: /cvsroot/licq/qt-gui/src/usereventdlg.cpp,v
retrieving revision 1.180
diff -u -r1.180 usereventdlg.cpp
--- plugins/qt-gui/src/usereventdlg.cpp	22 Apr 2005 13:13:05 -0000	1.180
+++ plugins/qt-gui/src/usereventdlg.cpp	6 May 2005 17:47:25 -0000
@@ -49,6 +49,9 @@
 #include <kapp.h>
 #include <kfiledialog.h>
 #include <kcolordialog.h>
+#if KDE_VERSION >= 320
+#include <kwin.h>
+#endif // KDE_VERSION
 #else
 #include <qfiledialog.h>
 #include <qcolordialog.h>
@@ -334,7 +337,8 @@
     {        
       if (u->NewMessages() > 0)
       {        
-        setIcon(CMainWindow::iconForEvent(ICQ_CMDxSUB_MSG));
+        if (tabw->currentPageIndex() == index)
+          setIcon(CMainWindow::iconForEvent(ICQ_CMDxSUB_MSG));
         flashTaskbar(true);
 
         // to clear it..
@@ -373,7 +377,8 @@
       // use status icon
       else
       {
-        setIcon(CMainWindow::iconForStatus(u->StatusFull(), u->IdString(), u->PPID()));
+        if (tabw->currentPageIndex() == index)
+          setIcon(CMainWindow::iconForStatus(u->StatusFull(), u->IdString(), u->PPID()));
         flashTaskbar(false);
 
         tabw->setTabIconSet(tab, CMainWindow::iconForStatus(u->StatusFull(), u->IdString(), u->PPID()));
@@ -419,6 +424,11 @@
 #if QT_VERSION >= 300
   if (tab->caption())
     setCaption(tab->caption());
+
+  if (!tabw->tabIconSet(tab).isNull() &&
+      !tabw->tabIconSet(tab).pixmap().isNull())
+    setIcon(tabw->tabIconSet(tab).pixmap());
+  
 #endif
 }
 
@@ -467,6 +477,20 @@
 #endif
 }
 
+#ifdef USE_KDE
+#if KDE_VERSION >= 320
+
+/* KDE 3.2 handles app-icon updates differently, since KDE 3.2 a simple setIcon() call
+   does no longer update the icon in kicker anymore :(
+   So we do it the "kde-way" here */
+void UserEventTabDlg::setIcon(const QPixmap &icon)
+{
+  KWin::setIcons(winId(), icon, icon);
+}
+
+#endif   // KDE_VERSION
+#endif // USE_KDE
+
 // -----------------------------------------------------------------------------
 
 void UserEventCommon::slot_setEncoding(int encodingMib) {
Index: plugins/qt-gui/src/usereventdlg.h
===================================================================
RCS file: /cvsroot/licq/qt-gui/src/usereventdlg.h,v
retrieving revision 1.70
diff -u -r1.70 usereventdlg.h
--- plugins/qt-gui/src/usereventdlg.h	31 Mar 2005 14:57:58 -0000	1.70
+++ plugins/qt-gui/src/usereventdlg.h	6 May 2005 17:47:26 -0000
@@ -93,6 +93,12 @@
   void updateTabLabel(ICQUser *u);
   void gotTyping(ICQUser *u, int);
 
+#ifdef USE_KDE
+#if KDE_VERSION >= 320
+  virtual void setIcon(const QPixmap &icon);
+#endif   // KDE_VERSION
+#endif // USE_KDE
+  
 private:
   CETabWidget *tabw;
   CMainWindow *mainwin;
ciao
  Jörg

Reply via email to