[Digikam-devel] extragear/graphics/digikam/utilities

Gilles Caulier caulier.gilles at gmail.com
Mon May 18 09:27:27 BST 2009


SVN commit 969391 by cgilles:

bugfix : same here than Light Table : if BatchQueueManager is not busy. Remove items in Queue deleted from Album Gui
CCMAIL: digikam-devel at kde.org


 M  +0 -4      lighttable/lighttablebar.cpp  
 M  +41 -3     queuemanager/queuelist.cpp  
 M  +4 -0      queuemanager/queuelist.h  
 M  +5 -0      queuemanager/queuemgrwindow.cpp  
 M  +1 -0      queuemanager/queuemgrwindow.h  


--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.cpp #969390:969391
@@ -683,10 +683,6 @@
 
 void LightTableBar::slotCollectionImageChange(const CollectionImageChangeset& changeset)
 {
-    // ignore when closed
-    if (!isVisible())
-        return;
-
     switch(changeset.operation())
     {
         case CollectionImageChangeset::Removed:
--- trunk/extragear/graphics/digikam/utilities/queuemanager/queuelist.cpp #969390:969391
@@ -53,6 +53,8 @@
 #include "ddragobjects.h"
 #include "queuemgrwindow.h"
 #include "queuetooltip.h"
+#include "databasewatch.h"
+#include "databasechangesets.h"
 
 namespace Digikam
 {
@@ -250,6 +252,10 @@
 
     // -----------------------------------------------------------
 
+    connect(DatabaseAccess::databaseWatch(), SIGNAL(collectionImageChange(const CollectionImageChangeset&)),
+            this, SLOT(slotCollectionImageChange(const CollectionImageChangeset&)),
+            Qt::QueuedConnection);
+
     connect(d->thumbLoadThread, SIGNAL(signalThumbnailLoaded(const LoadingDescription&, const QPixmap&)),
             this, SLOT(slotThumbnailLoaded(const LoadingDescription&, const QPixmap&)));
 
@@ -668,6 +674,11 @@
 
 void QueueListView::removeItemByInfo(const ImageInfo& info)
 {
+    removeItemById(info.id());
+}
+
+void QueueListView::removeItemById(qlonglong id)
+{
     hideToolTip();
 
     bool find;
@@ -678,7 +689,7 @@
         while (*it)
         {
             QueueListViewItem* item = dynamic_cast<QueueListViewItem*>(*it);
-            if (item->info() == info)
+            if (item->info().id() == id)
             {
                 delete item;
                 find = true;
@@ -694,16 +705,20 @@
 
 bool QueueListView::findItemByInfo(const ImageInfo& info)
 {
+    return findItemById(info.id());
+}
+
+bool QueueListView::findItemById(qlonglong id)
+{
     QTreeWidgetItemIterator it(this);
     while (*it)
     {
         QueueListViewItem* item = dynamic_cast<QueueListViewItem*>(*it);
-        if (item->info() == info)
+        if (item->info().id() == id)
             return true;
 
         ++it;
     }
-
     return false;
 }
 
@@ -839,4 +854,27 @@
     popmenu.exec(QCursor::pos());
 }
 
+void QueueListView::slotCollectionImageChange(const CollectionImageChangeset& changeset)
+{
+    if (QueueMgrWindow::queueManagerWindow()->isBusy())
+        return;
+
+    switch(changeset.operation())
+    {
+        case CollectionImageChangeset::Removed:
+        case CollectionImageChangeset::RemovedAll:
+        {
+            foreach(qlonglong id, changeset.ids())
+            {
+                removeItemById(id);
+            }
+            break;
+        }
+        default:
+        {
+            break;
+        }
+    }
+}
+
 }  // namespace Digikam
--- trunk/extragear/graphics/digikam/utilities/queuemanager/queuelist.h #969390:969391
@@ -83,6 +83,7 @@
 
 // -------------------------------------------------------------------------
 
+class CollectionImageChangeset;
 class QueueListViewPriv;
 
 class QueueListView : public QTreeWidget
@@ -96,6 +97,7 @@
 
     int  itemsCount();
     void removeItemByInfo(const ImageInfo& info);
+    void removeItemById(qlonglong id);
 
     ImageInfoList pendingItemsList();
     int           pendingItemsCount();
@@ -125,6 +127,7 @@
 
 private Q_SLOTS:
 
+    void slotCollectionImageChange(const CollectionImageChangeset&);
     void slotThumbnailLoaded(const LoadingDescription&, const QPixmap&);
     void slotContextMenu();
     void slotToolTip();
@@ -132,6 +135,7 @@
 private:
 
     bool findItemByInfo(const ImageInfo& info);
+    bool findItemById(qlonglong id);
     void removeItems(int removeType);
     void updateDestFileNames();
     void hideToolTip();
--- trunk/extragear/graphics/digikam/utilities/queuemanager/queuemgrwindow.cpp #969390:969391
@@ -165,6 +165,11 @@
     return QMap<int, QString>();
 }
 
+bool QueueMgrWindow::isBusy() const
+{
+    return d->busy;
+}
+
 void QueueMgrWindow::closeEvent(QCloseEvent* e)
 {
     if (!e) return;
--- trunk/extragear/graphics/digikam/utilities/queuemanager/queuemgrwindow.h #969390:969391
@@ -61,6 +61,7 @@
     static QueueMgrWindow *queueManagerWindow();
     static bool            queueManagerWindowCreated();
 
+    bool isBusy() const;
     void addNewQueue();
     void loadImageInfos(const ImageInfoList& list, int queueId);
     void refreshView();



More information about the Digikam-devel mailing list