Bug 88884 - unselection an album does not update the calculated total
Summary: unselection an album does not update the calculated total
Status: RESOLVED UNMAINTAINED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Generic-Archive (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-05 13:51 UTC by Jesper Pedersen
Modified: 2017-08-18 13:35 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesper Pedersen 2004-09-05 13:51:51 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

When selecting albums to burn, if you uncheck a checkbox, the total is not updated, which is pretty annoying, as this means that when you go above the limit, then you cannot easily try which album not to include to fit the cd, by unselecting some.
Comment 1 Renchi Raju 2004-10-05 04:48:15 UTC
CVS commit by pahlibar: 



when items are toggled in the imagecollectionselector, make sure that the 
selectionChanged signal is emitted. a couple of dirty hacks was needed to
make this work

CCMAIL: 88884-done@bugs.kde.org


  M +44 -5     imagecollectionselector.cpp   1.11
  M +2 -0      imagecollectionselector.h   1.8


--- kdeextragear-libs-1/libkipi/libkipi/imagecollectionselector.cpp  #1.10:1.11
@@ -53,13 +53,24 @@ class ImageCollectionItem : public QChec
 {
 public:
-    ImageCollectionItem(QListView * parent, ImageCollection collection)
+    ImageCollectionItem(ImageCollectionSelector* selector,
+                        QListView * parent, ImageCollection collection)
     : QCheckListItem( parent, collection.name(), QCheckListItem::CheckBox),
-      _imageCollection(collection)
+      _imageCollection(collection), _selector(selector)
     {}
 
     ImageCollection imageCollection() const { return _imageCollection; }
 
+protected:
+
+    virtual void stateChange(bool val)
+    {
+        QCheckListItem::stateChange(val);
+        _selector->emitSelectionChanged();
+    }
+    
 private:
+    
     ImageCollection _imageCollection;
+    ImageCollectionSelector* _selector;
 };
 
@@ -144,8 +154,13 @@ void ImageCollectionSelector::fillList()
     bool currentWasInList = false;
     
+    /* note: the extensive use of blocksignals is to prevent bombarding
+       the plugin with too many selection changed signals. do not remove
+       them */
+    
+    blockSignals(true);
     for( QValueList<ImageCollection>::Iterator it = collections.begin() ;
          it != collections.end() ; ++it )
     {
-        ImageCollectionItem* item = new ImageCollectionItem( d->_list, *it);
+        ImageCollectionItem* item = new ImageCollectionItem( this, d->_list, *it);
         if (!currentWasInList && *it == current) {
             item->setOn(true);
@@ -160,4 +175,10 @@ void ImageCollectionSelector::fillList()
         d->_itemToSelect = d->_list->firstChild();
     }
+    blockSignals(false);
+}
+
+void ImageCollectionSelector::emitSelectionChanged()
+{
+    emit selectionChanged();
 }
 
@@ -181,8 +202,14 @@ void ImageCollectionSelector::slotSelect
     QListViewItemIterator it( d->_list );
 
+    /* note: the extensive use of blocksignals is to prevent bombarding
+       the plugin with too many selection changed signals. do not remove
+       them */
+    blockSignals(true);
     for (; it.current(); ++it) {
         ImageCollectionItem *item = static_cast<ImageCollectionItem*>( it.current() );
         item->setOn(true);
     }
+    blockSignals(false);
+    
     emit selectionChanged();
 }
@@ -192,8 +219,14 @@ void ImageCollectionSelector::slotInvert
     QListViewItemIterator it( d->_list );
 
+    /* note: the extensive use of blocksignals is to prevent bombarding
+       the plugin with too many selection changed signals. do not remove
+       them */
+    blockSignals(true);
     for (; it.current(); ++it) {
         ImageCollectionItem *item = static_cast<ImageCollectionItem*>( it.current() );
         item->setOn(!item->isOn());
     }
+    blockSignals(false);
+
     emit selectionChanged();
 }
@@ -203,8 +236,14 @@ void ImageCollectionSelector::slotSelect
     QListViewItemIterator it( d->_list );
 
+    /* note: the extensive use of blocksignals is to prevent bombarding
+       the plugin with too many selection changed signals. do not remove
+       them */
+    blockSignals(true);
     for (; it.current(); ++it) {
         ImageCollectionItem *item = static_cast<ImageCollectionItem*>( it.current() );
         item->setOn(false);
     }
+    blockSignals(false);
+    
     emit selectionChanged();
 }

--- kdeextragear-libs-1/libkipi/libkipi/imagecollectionselector.h  #1.7:1.8
@@ -62,4 +62,6 @@ private:
     Private* d;
     void fillList();
+    void emitSelectionChanged();
+    friend class ImageCollectionItem;
 
 private slots: