Hi again,

the patch i just recently posted won't work with QT2.x.
Here's the patch again, I fixed it so that it can be compiled
with QT2.x but the bug fix is not implemented then.
Sorry all QT2 owners. :)

Regards,
Tumppi.
--- licq/plugins/qt-gui/src/ewidgets.orig.h     2002-08-29 02:37:03.000000000 +0300
+++ licq/plugins/qt-gui/src/ewidgets.h  2002-08-29 02:37:58.000000000 +0300
@@ -129,6 +129,7 @@
   Q_OBJECT
 private:
   unsigned long m_nUin;
+  QWidget *parentWidget;
 public:
   CMessageViewWidget(unsigned long _nUin, QWidget* parent=0, const char * name =0);
   virtual ~CMessageViewWidget(){};
--- licq/plugins/qt-gui/src/ewidgets.orig.cpp   2002-08-29 02:36:53.000000000 +0300
+++ licq/plugins/qt-gui/src/ewidgets.cpp        2002-08-29 04:42:40.000000000 +0300
@@ -506,6 +506,7 @@
 :CHistoryWidget(parent,name)
 {
   m_nUin= _nUin;
+  parentWidget = parent;
   // add all unread messages.
 //   ICQUser *u = gUserManager.FetchUser(_nUin, LOCK_W);
 //   if (u != NULL && u->NewMessages() > 0)
@@ -608,7 +609,12 @@
 #endif 
   GotoEnd();
 
-  if (e->Direction() == D_RECEIVER && e->SubCommand() == ICQ_CMDxSUB_MSG) {
+#if QT_VERSION >= 300
+  if (parentWidget && parentWidget->isActiveWindow() &&
+#else
+  if (
+#endif
+      e->Direction() == D_RECEIVER && e->SubCommand() == ICQ_CMDxSUB_MSG) {
     ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R );
     if (u != NULL) {
        u->EventClearId(e->Id());
--- licq/plugins/qt-gui/src/usereventdlg.orig.h 2002-08-29 02:37:20.000000000 +0300
+++ licq/plugins/qt-gui/src/usereventdlg.h      2002-08-29 04:41:46.000000000 +0300
@@ -160,6 +160,9 @@
   virtual ~UserSendCommon();
 
   void setText(const QString& txt);
+#if QT_VERSION >= 300
+  virtual void windowActivationChange(bool activated);
+#endif
 
 signals:
   void autoCloseNotify();
--- licq/plugins/qt-gui/src/usereventdlg.orig.cpp       2002-08-29 02:37:13.000000000 
+0300
+++ licq/plugins/qt-gui/src/usereventdlg.cpp    2002-08-29 04:40:43.000000000 +0300
@@ -1025,6 +1025,33 @@
 {
 }
 
+
+#if QT_VERSION >= 300
+//-----UserSendCommon::windowActivationChange--------------------------------
+void UserSendCommon::windowActivationChange(bool activated)
+{
+    if (activated && mainwin->m_bMsgChatView)
+    {
+       ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R);
+       if (u != NULL && u->NewMessages() > 0)
+       {
+           vector<int> idList;
+           for (unsigned short i = 0; i < u->NewMessages(); i++)
+           {
+               CUserEvent *e = u->EventPeek(i);
+               if (e->Direction() == D_RECEIVER && e->SubCommand() == ICQ_CMDxSUB_MSG)
+                    idList.push_back(e->Id());
+           }
+
+           for (int i = 0; i < idList.size(); i++)
+               u->EventClearId(idList[i]);
+       }
+       gUserManager.DropUser(u);
+    }
+}
+#endif
+
+
 //-----UserSendCommon::slot_SetForegroundColor-------------------------------
 void UserSendCommon::slot_SetForegroundICQColor()
 {

Reply via email to