[Digikam-devel] [Bug 119201] Sometimes DigiKam fails to show newly downloaded photos (exemple found for Bug 119073: wish list rescan option)

Tom Albers tomalbers at kde.nl
Mon Jan 2 20:21:55 GMT 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=119201         




------- Additional Comments From tomalbers kde nl  2006-01-02 21:21 -------
SVN commit 493648 by toma:

Backport of the fix for the camergui:
When a directory is created, a watch is put on it to spot new files 
but it can occur that the file is copied there before the watch is 
completely setup. That is why as an extra safeguard run scanlib 
over the folders we used when the cameragui is closed. 
CCBUG: 119201



 M  +5 -0      digikam/scanlib.cpp  
 M  +7 -0      digikam/scanlib.h  
 M  +20 -2     utilities/cameragui/cameraui.cpp  
 M  +1 -0      utilities/cameragui/cameraui.h  


--- branches/stable/extragear/graphics/digikam/digikam/scanlib.cpp #493647:493648
 @ -150,6 +150,11  @
     }
 }
 
+void ScanLib::findMissingItems(const QString &path)
+{
+    allFiles(path);
+}
+
 void ScanLib::findMissingItems()
 {
     QString albumPath = AlbumManager::instance()->getLibraryPath();
--- branches/stable/extragear/graphics/digikam/digikam/scanlib.h #493647:493648
 @ -71,6 +71,13  @
     */
     void findMissingItems();
 
+    
+    /**
+     * This calls allFiles with a given path.
+     *  param path the path to scan.
+     */
+    void findMissingItems(const QString &path);
+            
     /** 
      * This queries the db for items that have no date
      * for each item found, storeItemInDatabase is called.
--- branches/stable/extragear/graphics/digikam/utilities/cameragui/cameraui.cpp #493647:493648
 @ -46,6 +46,7  @
 #include <kiconloader.h>
 #include <kpopupmenu.h>
 #include <khelpmenu.h>
+#include <kdebug.h>
 
 #include <kcalendarsystem.h>
 
 @ -67,6 +68,7  @
 #include "cameraiconitem.h"
 #include "cameracontroller.h"
 #include "cameraui.h"
+#include "scanlib.h"
 
 CameraUI::CameraUI(QWidget* parent, const QString& title,
                    const QString& model, const QString& port,
 @ -269,12 +271,26  @
 
 void CameraUI::closeEvent(QCloseEvent* e)
 {
+    // When a directory is created, a watch is put on it to spot new files
+    // but it can occur that the file is copied there before the watch is
+    // completely setup. That is why as an extra safeguard run scanlib
+    // over the folders we used. Bug: 119201
+    ScanLib sLib;
+    for (QStringList::iterator it = m_foldersToScan.begin(); 
+         it != m_foldersToScan.end(); ++it)
+    {
+        kdDebug() << "Scanning " << (*it) << endl;
+        sLib.findMissingItems( (*it) );
+    }
+    
+    //---------------------------------------------------
+
     if(!m_lastDestURL.isEmpty())
         emit signalLastDestination(m_lastDestURL);
 
     delete m_controller;
     saveSettings();
-    e->accept();    
+    e->accept();
 }
 
 
 @ -469,10 +485,12  @
             }
 
             u.addPath(dirName);
+            m_foldersToScan.append(u.path());
             u.addPath(downloadName.isEmpty() ? name : downloadName);
         }
         else
         {
+            m_foldersToScan.append(u.path());
             u.addPath(downloadName.isEmpty() ? name : downloadName);
         }
         m_controller->download(folder, name, u.path(), autoRotate);
 @ -482,7 +500,7  @
 
     if (total <= 0)
         return;
-
+    
     m_lastDestURL = url;            
     m_progress->setProgress(0);
     m_progress->setTotalSteps(total);
--- branches/stable/extragear/graphics/digikam/utilities/cameragui/cameraui.h #493647:493648
 @ -97,6 +97,7  @
     CameraController* m_controller;
     
     KURL              m_lastDestURL;
+    QStringList       m_foldersToScan;
 
 private slots:



More information about the Digikam-devel mailing list