Hi!

Since version 3.1 KDE includes KPassivePopup, a "dialog-like popup that
displays messages without interrupting the user". The patch uses this
class to notify the user when someone on his notify list goes online.

Two issues remain:
1. Make it configurable? Perhaps not really needed, since by using the
   notify list the user already decided that he wants to be notified.
2. Logging in: When multiple user which are on the notify list are
   online while logging into icq, multiple popups are shown
   simultaneously.
diff -ur licq-20030730/plugins/qt-gui/src/mainwin.cpp licq-20030730-jm/plugins/qt-gui/src/mainwin.cpp
--- licq-20030730/plugins/qt-gui/src/mainwin.cpp	2003-07-10 07:48:07.000000000 +0200
+++ licq-20030730-jm/plugins/qt-gui/src/mainwin.cpp	2003-08-04 16:42:46.000000000 +0200
@@ -27,6 +27,9 @@
 #include <kwin.h>
 #include <kiconloader.h>
 #include <kurl.h>
+#if KDE_VERSION >= 310
+#include <kpassivepopup.h>
+#endif
 #else
 #include <qapplication.h>
 #endif
@@ -1385,8 +1388,27 @@
       }
 
       if(sig->SubSignal() == USER_STATUS && sig->Argument() == 1)
+      {
         userView->AnimationOnline(szId, nPPID);
 
+#if defined(USE_KDE) && (KDE_VERSION >= 310)
+        // User on notify list went online -> show popup at systray icon
+        if (licqIcon && u->OnlineNotify())
+        {
+          QTextCodec *codec = UserCodec::codecForICQUser(u);
+          QString alias = codec->toUnicode(u->GetAlias());
+          // Escape HTML
+          alias.replace(QChar('&'), "&amp;");
+          alias.replace(QChar('<'), "&lt;");
+          alias.replace(QChar('>'), "&gt;");
+
+          QString msg(tr("<b>%1</b> is online").arg(alias));
+          QPixmap px = iconForStatus(u->StatusFull());
+          KPassivePopup::message("Licq", msg, px, licqIcon, NULL, 4000);
+        }
+#endif
+      }
+
       // Update their floaty
       CUserView *v = CUserView::FindFloaty(szId, nPPID);
 
ciao
  Jörg

Reply via email to