Summary: | unselection an album does not update the calculated total | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Jesper Pedersen <blackie> |
Component: | Plugin-Generic-Archive | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED UNMAINTAINED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Jesper Pedersen
2004-09-05 13:51:51 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: |