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

List:       kde-commits
Subject:    [muon/Plasma/5.2] libmuon/resources: Make the REsourcesUpdatesModel react to backend deletion as wel
From:       Aleix Pol <aleixpol () kde ! org>
Date:       2015-03-23 2:10:19
Message-ID: E1YZrop-0007vl-B0 () scm ! kde ! org
[Download RAW message or body]

Git commit 44c2e1dd5048ea355cc5d446fdd00ccbd25aa9e2 by Aleix Pol.
Committed on 23/03/2015 at 02:09.
Pushed by apol into branch 'Plasma/5.2'.

Make the REsourcesUpdatesModel react to backend deletion as well

M  +6    -0    libmuon/resources/ResourcesUpdatesModel.cpp
M  +3    -0    libmuon/resources/ResourcesUpdatesModel.h

http://commits.kde.org/muon/44c2e1dd5048ea355cc5d446fdd00ccbd25aa9e2

diff --git a/libmuon/resources/ResourcesUpdatesModel.cpp b/libmuon/resources/ResourcesUpdatesModel.cpp
index 1d2f1f1..d6466ac 100644
--- a/libmuon/resources/ResourcesUpdatesModel.cpp
+++ b/libmuon/resources/ResourcesUpdatesModel.cpp
@@ -65,11 +65,17 @@ void ResourcesUpdatesModel::addNewBackends()
             connect(updater, SIGNAL(downloadSpeedChanged(quint64)), SIGNAL(downloadSpeedChanged()));
             connect(updater, SIGNAL(progressingChanged(bool)), SLOT(slotProgressingChanged(bool)));
             connect(updater, SIGNAL(cancelableChanged(bool)), SIGNAL(cancelableChanged()));
+            connect(updater, SIGNAL(destroyed(QObject*)), SLOT(updaterDestroyed(QObject*)));
             m_updaters += updater;
         }
     }
 }
 
+void ResourcesUpdatesModel::updaterDestroyed(QObject* obj)
+{
+    m_updaters.removeAll(qobject_cast<AbstractBackendUpdater*>(obj));
+}
+
 void ResourcesUpdatesModel::slotProgressingChanged(bool progressing)
 {
     if ((!progressing && !isProgressing()) || (isProgressing() && !m_isProgressing)) {
diff --git a/libmuon/resources/ResourcesUpdatesModel.h b/libmuon/resources/ResourcesUpdatesModel.h
index 028f0b2..b8299f1 100644
--- a/libmuon/resources/ResourcesUpdatesModel.h
+++ b/libmuon/resources/ResourcesUpdatesModel.h
@@ -70,6 +70,9 @@ class MUONCOMMON_EXPORT ResourcesUpdatesModel : public QStandardItemModel
         void cancel();
         void updateAll();
 
+    private slots:
+        void updaterDestroyed(QObject* obj);
+
     private:
         void setResourcesModel(ResourcesModel* model);
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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