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

List:       amarok-devel
Subject:    extragear/multimedia/amarok/src/collection/sqlcollection
From:       Jeff Mitchell <kde-dev () emailgoeshere ! com>
Date:       2009-03-05 3:33:47
Message-ID: 1236224027.052002.31138.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 935422 by mitchell:

PLEASE TEST

Right now, directories that no longer exist are never removed from the database.  As \
far as I can tell this is a bug, not a feature (dynamic collection detects existing \
directories that are no longer mounted, and does not deal with deleted directories).  \
In fact, the code detecting directory deletion up to this point has done the exact \
same thing as the code that detects changed mtimes -- i.e., it tells the scanner to \
scan it (even though it doesn't exist).

This commit should fix that by deleting directories that no longer exist from the \
database during an incremental scan.  This works in my testing and intuitively it's \
correct, but please test this.

CCMAIL: amarok-devel@kde.org


 M  +16 -1     ScanManager.cpp  


--- trunk/extragear/multimedia/amarok/src/collection/sqlcollection/ScanManager.cpp \
#935421:935422 @@ -360,6 +360,7 @@
             .arg( deviceIds ) );
 
     QList<int> changedFolderIds;
+    QList<int> deletedFolderIds;
 
     QStringList result;
     for( QListIterator<QString> iter( values ); iter.hasNext(); )
@@ -382,8 +383,8 @@
         else
         {
             // this folder has been removed
-            result << folder;
             changedFolderIds << id;
+            deletedFolderIds << id;
         }
     }
     {
@@ -412,6 +413,20 @@
             }
         }
     }
+    {
+        QString ids;
+        foreach( int id, deletedFolderIds )
+        {
+            if( !ids.isEmpty() )
+                ids += ',';
+            ids += QString::number( id );
+        }
+        if( !ids.isEmpty() )
+        {
+            QString sql = QString( "DELETE FROM directories WHERE id IN ( %1 );" \
).arg( ids ); +            m_collection->query( sql );
+        }
+    }
     //debug() << "Scanning the following dirs: " << result;
     return result;
 }
_______________________________________________
Amarok-devel mailing list
Amarok-devel@kde.org
https://mail.kde.org/mailman/listinfo/amarok-devel


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

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