Summary: | view object dialog menu actions are shown when zero objects exist | ||
---|---|---|---|
Product: | [Applications] kst | Reporter: | Adam Treat <treat> |
Component: | general | Assignee: | kst |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 1.x | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: | Fix for this bug |
Description
Adam Treat
2006-09-22 22:11:06 UTC
Created attachment 17882 [details]
Fix for this bug
Please review.
Looks good except hasContent() should be const. Would be best to use a proper iterator too. SVN commit 593050 by treat: * Don't enable the 'view object' dialogs when they contain no content. BUG: 134514 M +6 -0 kst.cpp M +14 -0 kstviewfitsdialog_i.cpp M +2 -0 kstviewfitsdialog_i.h M +5 -0 kstviewmatricesdialog_i.cpp M +2 -0 kstviewmatricesdialog_i.h M +4 -0 kstviewscalarsdialog_i.cpp M +2 -0 kstviewscalarsdialog_i.h M +5 -0 kstviewvectorsdialog_i.cpp M +2 -0 kstviewvectorsdialog_i.h --- trunk/extragear/graphics/kst/src/libkstapp/kst.cpp #593049:593050 @@ -2074,6 +2074,12 @@ void KstApp::updateDataDialogs(bool dm, bool vm) { + + ViewScalarsDialogAction->setEnabled(viewScalarsDialog->hasContent()); + ViewVectorsDialogAction->setEnabled(viewVectorsDialog->hasContent()); + ViewMatricesDialogAction->setEnabled(viewMatricesDialog->hasContent()); + ViewFitsDialogAction->setEnabled(viewFitsDialog->hasContent()); + if (!viewScalarsDialog->isHidden()) { viewScalarsDialog->updateViewScalarsDialog(); } --- trunk/extragear/graphics/kst/src/libkstapp/kstviewfitsdialog_i.cpp #593049:593050 @@ -53,6 +53,20 @@ KstViewFitsDialogI::~KstViewFitsDialogI() { } + +bool KstViewFitsDialogI::hasContent() const { + bool content = false; + KstPluginList fits = kstObjectSubList<KstDataObject,KstPlugin>(KST::dataObjectList); + KstPluginList::ConstIterator it = fits.begin(); + for (; it != fits.end(); ++it) { + (*it)->readLock(); + content = (*it)->plugin()->data()._isFit ? true : content; + (*it)->unlock(); + } + return content; +} + + void KstViewFitsDialogI::fillComboBox(const QString& str) { QString fitName = str; --- trunk/extragear/graphics/kst/src/libkstapp/kstviewfitsdialog_i.h #593049:593050 @@ -30,6 +30,8 @@ virtual ~KstViewFitsDialogI(); KstFitTable* tableFits; + bool hasContent() const; + public slots: void updateViewFitsDialog(); void showViewFitsDialog(); --- trunk/extragear/graphics/kst/src/libkstapp/kstviewmatricesdialog_i.cpp #593049:593050 @@ -53,6 +53,11 @@ } +bool KstViewMatricesDialogI::hasContent() const { + return !KST::matrixList.isEmpty(); +} + + void KstViewMatricesDialogI::updateViewMatricesDialog() { matrixSelector->update(); QString matrix = matrixSelector->selectedMatrix(); --- trunk/extragear/graphics/kst/src/libkstapp/kstviewmatricesdialog_i.h #593049:593050 @@ -30,6 +30,8 @@ virtual ~KstViewMatricesDialogI(); KstMatrixTable* _tableMatrices; + bool hasContent() const; + public slots: void updateViewMatricesDialog(); void updateViewMatricesDialog(const QString& strVector); --- trunk/extragear/graphics/kst/src/libkstapp/kstviewscalarsdialog_i.cpp #593049:593050 @@ -56,6 +56,10 @@ } +bool KstViewScalarsDialogI::hasContent() const { + return !KST::scalarList.isEmpty(); +} + void KstViewScalarsDialogI::updateViewScalarsDialog() { KST::scalarList.lock().readLock(); int needed = KST::scalarList.count(); --- trunk/extragear/graphics/kst/src/libkstapp/kstviewscalarsdialog_i.h #593049:593050 @@ -30,6 +30,8 @@ virtual ~KstViewScalarsDialogI(); KstScalarTable* tableScalars; + bool hasContent() const; + protected slots: virtual void languageChange(); --- trunk/extragear/graphics/kst/src/libkstapp/kstviewvectorsdialog_i.cpp #593049:593050 @@ -57,6 +57,11 @@ } +bool KstViewVectorsDialogI::hasContent() const { + return !KST::vectorList.isEmpty(); +} + + void KstViewVectorsDialogI::updateViewVectorsDialog() { vectorSelector->update(); QString vector = vectorSelector->selectedVector(); --- trunk/extragear/graphics/kst/src/libkstapp/kstviewvectorsdialog_i.h #593049:593050 @@ -30,6 +30,8 @@ virtual ~KstViewVectorsDialogI(); KstVectorTable* tableVectors; + bool hasContent() const; + public slots: void updateViewVectorsDialog(); void updateViewVectorsDialog(const QString& strVector); |