[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/base/plasma/applets/presence
From:       Abner Silva <abner.silva () kdemail ! net>
Date:       2009-08-13 18:23:01
Message-ID: 1250187781.055560.27648.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1010985 by abnerf:

Using a timer to set up a timeout for the updating presence msg. Sometimes
when we try to set up an invalid presence status (like some xmpp server that
doesn't supports invisible presence) the data engine will not emit any
presence changed signal and the applet will wait forever for that signal.
This timer will avoid this blocking situation. So when it timeouts the
applet will return to the last presence status.

BUG: 203344
BUG: 203345

 M  +17 -1     presencewidget.cpp  
 M  +2 -0      presencewidget.h  


--- trunk/playground/base/plasma/applets/presence/presencewidget.cpp #1010984:1010985
@@ -24,6 +24,7 @@
 // Qt
 #include <QGraphicsLinearLayout>
 #include <QLabel>
+#include <QTimer>
 
 // Plasma
 #include <Plasma/IconWidget>
@@ -51,7 +52,8 @@
       m_presenceMessageLabel(0),
       m_presenceMsg(""),
       m_waitLayout(0),
-      m_waitWidget(0)
+      m_waitWidget(0),
+      m_waitTimer(0)
 {
      init();
 }
@@ -205,6 +207,18 @@
     m_waitWidget->setMinimumHeight(s);
     m_waitWidget->setMaximumHeight(s);
 
+    /* FIXME - Workaround =)
+     * Sometimes when we try to set up an invalid presence status (like some
+     * xmpp server that doesn't supports invisible presence) the data engine
+     * will not emit any presence changed signal and the applet will wait
+     * forever for that signal. For that reason this timer is needed to avoid
+     * this blocking situation. So when it timeouts the applet will return to
+     * the last presence status.*/
+    m_waitTimer = new QTimer(this);
+    m_waitTimer->setInterval(30000);
+    connect(m_waitTimer, SIGNAL(timeout()),
+            this, SLOT(onPresenceStatusSwitch()));
+
     m_currentStatusLayout->addItem(m_waitWidget);
     m_currentStatusWidget->setLayout(m_currentStatusLayout);
 
@@ -270,6 +284,7 @@
         m_iconsWidget->show();
     }
     else if (m_waitWidget->isVisible()) {
+        m_waitTimer->stop();
         m_waitWidget->hide();
         m_currentStatusLayout->removeItem(m_waitWidget);
 
@@ -282,6 +297,7 @@
 
         m_currentStatusLayout->addItem(m_waitWidget);
         m_waitWidget->show();
+        m_waitTimer->start();
     }
 }
 
--- trunk/playground/base/plasma/applets/presence/presencewidget.h #1010984:1010985
@@ -32,6 +32,7 @@
 }
 
 class QGraphicsLinearLayout;
+class QTimer;
 
 class PresenceWidget : public QGraphicsWidget
 {
@@ -85,6 +86,7 @@
     PresenceStatus m_currentStatus;
     QGraphicsLinearLayout *m_waitLayout;
     QGraphicsWidget *m_waitWidget;
+    QTimer *m_waitTimer;
 };
 
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic