← Back to team overview

ayatana-commits team mailing list archive

[Branch ~agateau/plasma-indicatordisplay/trunk] Rev 69: Remove interest on servers when we go away.

 

------------------------------------------------------------
revno: 69
committer: Aurelien Gateau <aurelien.gateau@xxxxxxxxxxxxx>
branch nick: plasma-indicatordisplay
timestamp: Thu 2009-09-10 15:19:07 +0200
message:
  Remove interest on servers when we go away.
modified:
  src/indicatordisplay.cpp
  src/indicatordisplay.h


--
lp:plasma-indicatordisplay
https://code.launchpad.net/~agateau/plasma-indicatordisplay/trunk

Your team ayatana-commits is subscribed to branch lp:plasma-indicatordisplay.
To unsubscribe from this branch go to https://code.launchpad.net/~agateau/plasma-indicatordisplay/trunk/+edit-subscription.
=== modified file 'src/indicatordisplay.cpp'
--- src/indicatordisplay.cpp	2009-09-01 13:34:44 +0000
+++ src/indicatordisplay.cpp	2009-09-10 13:19:07 +0000
@@ -49,6 +49,7 @@
 
 IndicatorDisplay::~IndicatorDisplay()
 {
+    removeInterestOnServers();
     delete mView;
 }
 
@@ -248,6 +249,22 @@
     mListener->setInterest(server, QIndicate::InterestServerSignal, true);
 }
 
+void IndicatorDisplay::removeInterestOnServers()
+{
+    for (int row = mSourceModel->rowCount() - 1; row >= 0; --row) {
+        QIndicate::Listener::Server* server = 0;
+        QIndicate::Listener::Indicator* indicator = 0;
+        QModelIndex index = mSourceModel->index(row, 0);
+        mSourceModel->getProxiesForIndex(index, &server, &indicator);
+        if (server) {
+            mListener->setInterest(server, QIndicate::InterestServerDisplay, false);
+            mListener->setInterest(server, QIndicate::InterestServerSignal, false);
+        } else {
+            kWarning() << "No server for row" << row;
+        }
+    }
+}
+
 #ifdef DUMP_MODELS
 #include "modeldump.h"
 

=== modified file 'src/indicatordisplay.h'
--- src/indicatordisplay.h	2009-09-01 13:34:44 +0000
+++ src/indicatordisplay.h	2009-09-10 13:19:07 +0000
@@ -62,6 +62,7 @@
     void initView();
     void updateIcon(bool newStuff);
     void updateIconState();
+    void removeInterestOnServers();
 };
 
 #endif /* INDICATORDISPLAY_H */