Sophie

Sophie

distrib > Mandriva > 2010.1 > i586 > media > main-testing-src > by-pkgid > 357e0466909645e33fa8bfa6e2222a8a > files > 12

kdebase4-runtime-4.4.5-0.1mdv2010.2.src.rpm

Index: runtime/solid-device-automounter/kcm/DeviceModel.cpp
===================================================================
--- runtime/solid-device-automounter/kcm/DeviceModel.cpp        (révision 1107758)
+++ runtime/solid-device-automounter/kcm/DeviceModel.cpp        (révision 1107759)
@@ -13,9 +13,7 @@
 DeviceModel::DeviceModel(QObject *parent)
     : QAbstractItemModel(parent)
 {
-    foreach(const QString &dev, AutomounterSettings::knownDevices()) {
-        addNewDevice(dev);
-    }
+    reload();
     
     connect(Solid::DeviceNotifier::instance(), SIGNAL(deviceAdded(const QString)), this, SLOT(deviceAttached(const QString)));
     connect(Solid::DeviceNotifier::instance(), SIGNAL(deviceRemoved(const QString)), this, SLOT(deviceRemoved(const QString)));
@@ -113,10 +111,19 @@
 void
 DeviceModel::reload()
 {
+    beginResetModel();
+    m_loginForced.clear();
+    m_attachedForced.clear();
+    m_attached.clear();
+    m_disconnected.clear();
+    foreach(const QString &dev, AutomounterSettings::knownDevices()) {
+        addNewDevice(dev);
+    }
     foreach(const QString &udi, m_loginForced.keys()) {
         m_loginForced[udi] = AutomounterSettings::deviceAutomountIsForced(udi, AutomounterSettings::Login);
         m_attachedForced[udi] = AutomounterSettings::deviceAutomountIsForced(udi, AutomounterSettings::Attach);
     }
+    endResetModel();
 }
 
 QModelIndex