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

List:       kde-commits
Subject:    extragear/multimedia/amarok/src
From:       Joe Rabinoff <bobqwatson () yahoo ! com>
Date:       2006-09-07 16:10:44
Message-ID: 1157645444.607125.3993.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 581814 by rabinoff:

The new CollectionDB::fileDeleted() signal now passes the uniqueid
when a file deletion is detected by the scan controller.



 M  +4 -2      collectionbrowser.cpp  
 M  +21 -4     collectiondb.cpp  
 M  +3 -5      collectiondb.h  
 M  +9 -3      scancontroller.cpp  


--- trunk/extragear/multimedia/amarok/src/collectionbrowser.cpp #581813:581814
@@ -1400,9 +1400,11 @@
             case DELETE:
                 KURL::List files = listSelected();
                 if ( DeleteDialog::showTrashDialog(this, files) )
+                  {
                     CollectionDB::instance()->removeSongs( files );
-                foreachType( KURL::List, files )
-                  CollectionDB::instance()->emitFileDeleted( (*it).path() );
+                    foreachType( KURL::List, files )
+                      CollectionDB::instance()->emitFileDeleted( (*it).path() );
+                  }
                 m_dirty = true;
                 QTimer::singleShot( 0, CollectionView::instance(), SLOT( \
renderView() ) );  break;
--- trunk/extragear/multimedia/amarok/src/collectiondb.cpp #581813:581814
@@ -3158,6 +3158,19 @@
     }
 }
 
+void 
+CollectionDB::emitFileDeleted( const QString &absPath, const QString &uniqueid )
+{ 
+  if( uniqueid.isEmpty() )
+    emit fileDeleted( absPath ); 
+  else
+    emit fileDeleted( absPath, uniqueid );
+
+  debug() << "fileDeleted emitted for " << absPath << " uniqueid: " 
+          << uniqueid << endl;
+}
+
+
 QString
 CollectionDB::urlFromUniqueId( const QString &id )
 {
@@ -4142,17 +4155,21 @@
     if( tagsRemoved )
       {
         QStringList result 
-          = query( QString( "SELECT deviceid, url FROM tags "
-                            "WHERE dir = '%2' AND deviceid = %1" )
+          = query( QString( "SELECT tags.deviceid, tags.url, uniqueid.uniqueid FROM \
tags " +                            "LEFT JOIN uniqueid ON uniqueid.url      = \
tags.url " +                            "                  AND uniqueid.deviceid = \
tags.deviceid " +                            "WHERE tags.dir = '%2' AND tags.deviceid \
                = %1" )
                    .arg( deviceid )
                    .arg( escapeString( rpath ) ) );
         QStringList::ConstIterator it = result.begin(), end = result.end();
         while( it != end )
           {
-            int deviceid2 = (*(it++)).toInt();
-            QString rpath2 = *(it++);
+            int deviceid2    = (*(it++)).toInt();
+            QString rpath2   =  *(it++);
+            QString uniqueid =  *(it++);
             *tagsRemoved << MountPointManager::instance()->getAbsolutePath(
                                 deviceid2, rpath2 );
+            *tagsRemoved << uniqueid;
           }
       }
 
--- trunk/extragear/multimedia/amarok/src/collectiondb.h #581813:581814
@@ -207,6 +207,7 @@
         void fileMoved( const QString &srcUrl, const QString &dstUrl );
         void fileMoved( const QString &srcUrl, const QString &dstUrl, const QString \
&uniqueid );  void fileDeleted( const QString &absPath );
+        void fileDeleted( const QString &absPath, const QString &uniqueid );
         void uniqueIdChanged( const QString &url, const QString &originalid, const \
                QString &newid );
         void coverChanged( const QString &artist, const QString &album ); //whenever \
                a cover changes
         void coverFetched( const QString &artist, const QString &album ); //only \
when fetching from amazon @@ -314,11 +315,8 @@
         //song methods
         bool addSong( MetaBundle* bundle, const bool incremental = false );
         void doAFTStuff( MetaBundle *bundle, const bool tempTables = true );
-        void emitFileDeleted( const QString &absPath )
-          { 
-            emit fileDeleted( absPath ); 
-            debug() << "fileDeleted emitted for " << absPath << endl;
-          }
+        void emitFileDeleted( const QString &absPath, 
+                              const QString &uniqueid = QString::null );
         bool newUniqueIdForFile( const QString &path );
         bool removeUniqueIdFromFile( const QString &path );
         QString urlFromUniqueId( const QString &id );
--- trunk/extragear/multimedia/amarok/src/scancontroller.cpp #581813:581814
@@ -131,9 +131,15 @@
       {
         m_filesFoundMutex.lock();
 
-        foreach( m_filesDeleted )
-          if( !m_filesFound.contains( *it )  ||  m_filesFound[ *it ] == false )
-            CollectionDB::instance()->emitFileDeleted( *it );
+        QStringList::ConstIterator it = m_filesDeleted.begin(), 
+          end = m_filesDeleted.end();
+        while( it != end )
+          {
+            QString path     = *(it++);
+            QString uniqueid = *(it++);
+            if( !m_filesFound.contains( path )  ||  m_filesFound[ path ] == false )
+              CollectionDB::instance()->emitFileDeleted( path, uniqueid );
+          }
 
         m_filesFoundMutex.unlock();
       }


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

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