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

List:       kde-commits
Subject:    KDE/kdelibs/kfile
From:       Dawit Alemayehu <adawit () kde ! org>
Date:       2010-11-03 23:39:46
Message-ID: 20101103233946.216A7AC89B () svn ! kde ! org
[Download RAW message or body]

SVN commit 1192778 by adawit:

Avoid creation of multiple Solid:Device objects whenever KFilePlacesItem is \
instantiated with a non-empty "udi" parameter.

CCMAIL:ervin@kde.org

 M  +7 -6      kfileplacesitem.cpp  


--- trunk/KDE/kdelibs/kfile/kfileplacesitem.cpp #1192777:1192778
@@ -35,7 +35,7 @@
 KFilePlacesItem::KFilePlacesItem(KBookmarkManager *manager,
                                  const QString &address,
                                  const QString &udi)
-    : m_manager(manager), m_lister(0), m_folderIsEmpty(true), m_text()
+    : m_manager(manager), m_lister(0), m_folderIsEmpty(true), m_device(udi)
 {
     setBookmark(m_manager->findByAddress(address));
 
@@ -51,11 +51,12 @@
                     this, SLOT(onListerCompleted()));
             m_lister->openUrl(m_bookmark.url());
         }
-    } else if (!udi.isEmpty()) {
-        Solid::Device dev(udi);
-        Solid::StorageAccess *access = dev.as<Solid::StorageAccess>();
-        if (access!=0) {
-            connect(access, SIGNAL(accessibilityChanged(bool, const QString &)),
+    } else if (!udi.isEmpty() && m_device.isValid()) {
+        m_access = m_device.as<Solid::StorageAccess>();
+        m_volume = m_device.as<Solid::StorageVolume>();
+        m_disc = m_device.as<Solid::OpticalDisc>();
+        if (m_access) {
+            connect(m_access, SIGNAL(accessibilityChanged(bool, const QString &)),
                     this, SLOT(onAccessibilityChanged()));
         }
     }


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

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