diff --git a/src/filewidgets/kfilewidget.cpp b/src/filewidgets/kfilewidget.cpp --- a/src/filewidgets/kfilewidget.cpp +++ b/src/filewidgets/kfilewidget.cpp @@ -104,7 +104,9 @@ dummyAdded(false), confirmOverwrite(false), differentHierarchyLevelItemsEntered(false), - iconSizeSlider(nullptr) + iconSizeSlider(nullptr), + furtherAction(nullptr), + closerAction(nullptr) { } @@ -284,6 +286,8 @@ bool differentHierarchyLevelItemsEntered; QSlider *iconSizeSlider; + QAction *furtherAction; + QAction *closerAction; // The group which stores app-specific settings. These settings are recent // files and urls. Visual settings (view mode, sorting criteria...) are not @@ -513,13 +517,16 @@ this, SLOT(_k_slotIconSizeChanged(int))); connect(d->iconSizeSlider, SIGNAL(sliderMoved(int)), this, SLOT(_k_slotIconSizeSliderMoved(int))); - connect(d->ops, SIGNAL(currentIconSizeChanged(int)), - d->iconSizeSlider, SLOT(setValue(int))); + connect(d->ops, &KDirOperator::currentIconSizeChanged, [this](int value) { + d->iconSizeSlider->setValue(value); + d->furtherAction->setDisabled(value <= d->iconSizeSlider->minimum()); + d->closerAction->setDisabled(value >= d->iconSizeSlider->maximum()); + }); - QAction *furtherAction = new QAction(QIcon::fromTheme(QStringLiteral("file-zoom-out")), i18n("Zoom out"), this); - connect(furtherAction, SIGNAL(triggered()), SLOT(_k_zoomOutIconsSize())); - QAction *closerAction = new QAction(QIcon::fromTheme(QStringLiteral("file-zoom-in")), i18n("Zoom in"), this); - connect(closerAction, SIGNAL(triggered()), SLOT(_k_zoomInIconsSize())); + d->furtherAction = new QAction(QIcon::fromTheme(QStringLiteral("file-zoom-out")), i18n("Zoom out"), this); + connect(d->furtherAction, SIGNAL(triggered()), SLOT(_k_zoomOutIconsSize())); + d->closerAction = new QAction(QIcon::fromTheme(QStringLiteral("file-zoom-in")), i18n("Zoom in"), this); + connect(d->closerAction, SIGNAL(triggered()), SLOT(_k_zoomInIconsSize())); QWidget *midSpacer = new QWidget(this); midSpacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); @@ -543,9 +550,9 @@ d->toolbar->addAction(separator2); d->toolbar->addAction(coll->action(QStringLiteral("inline preview"))); d->toolbar->addWidget(midSpacer); - d->toolbar->addAction(furtherAction); + d->toolbar->addAction(d->furtherAction); d->toolbar->addWidget(d->iconSizeSlider); - d->toolbar->addAction(closerAction); + d->toolbar->addAction(d->closerAction); d->toolbar->addAction(separator3); d->toolbar->addAction(coll->action(QStringLiteral("mkdir"))); d->toolbar->addAction(menu);