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

List:       kde-commits
Subject:    KDE/kdebase/runtime/kioslave/trash
From:       David Faure <faure () kde ! org>
Date:       2006-10-31 23:17:44
Message-ID: 1162336664.861064.30764.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 600835 by dfaure:

Factor out the code that determines the id for a given device.
Still can't believe that the unit tests pass - the code doesn't actually seem to be called :/


 M  +9 -2      trashimpl.cpp  


--- trunk/KDE/kdebase/runtime/kioslave/trash/trashimpl.cpp #600834:600835
@@ -699,6 +699,13 @@
     // which will be done by the job soon after this.
 }
 
+static int idForDevice(Solid::Device& device)
+{
+    const Solid::Volume* volume = device.as<Solid::Volume>();
+    kDebug() << "major=" << volume->major() << " minor=" << volume->minor() << endl;
+    return volume->major()*1000 + volume->minor();
+}
+
 int TrashImpl::findTrashDirectory( const QString& origPath )
 {
     kDebug() << k_funcinfo << origPath << endl;
@@ -736,7 +743,7 @@
     Solid::Device device = lst[0];
 
     // new trash dir found, register it
-    id = device.as<Solid::Volume>()->major()*1000+device.as<Solid::Volume>()->minor();
+    id = idForDevice( device );
     m_trashDirectories.insert( id, trashDir );
     kDebug() << k_funcinfo << "found " << trashDir << " gave it id " << id << endl;
     if ( !mountPoint.endsWith( "/" ) )
@@ -758,7 +765,7 @@
             int trashId = idForTrashDirectory( trashDir );
             if ( trashId == -1 ) {
                 // new trash dir found, register it
-                trashId = (*it).as<Solid::Volume>()->major()*1000+(*it).as<Solid::Volume>()->minor();
+                trashId = idForDevice( *it );
                 m_trashDirectories.insert( trashId, trashDir );
                 kDebug() << k_funcinfo << "found " << trashDir << " gave it id " << trashId << endl;
                 if ( !topdir.endsWith( "/" ) )
[prev in list] [next in list] [prev in thread] [next in thread] 

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