diff --git a/src/Gui/KSWidget.cpp b/src/Gui/KSWidget.cpp --- a/src/Gui/KSWidget.cpp +++ b/src/Gui/KSWidget.cpp @@ -165,8 +165,9 @@ mCaptureOnClick->setChecked (lConfigMgr->onClickChecked()); mCaptureTransientOnly->setChecked (lConfigMgr->captureTransientWindowOnlyChecked()); mQuitAfterSaveOrCopy->setChecked (lConfigMgr->quitAfterSaveOrCopyChecked()); - if (lConfigMgr->captureMode() >= 0) { - mCaptureArea->setCurrentIndex (lConfigMgr->captureMode()); + int index = mCaptureArea->findData(lConfigMgr->captureMode()); + if (index != -1) { + mCaptureArea->setCurrentIndex (index); } mDelayMsec->setValue (lConfigMgr->captureDelay()); } @@ -234,10 +235,9 @@ void KSWidget::captureModeChanged(int theIndex) { - SpectacleConfig::instance()->setCaptureMode(theIndex); - - Spectacle::CaptureMode lCaptureMode = static_cast(mCaptureArea->itemData(theIndex).toInt()); + SpectacleConfig::instance()->setCaptureMode(lCaptureMode); + switch(lCaptureMode) { case Spectacle::CaptureMode::WindowUnderCursor: mWindowDecorations->setEnabled(true); diff --git a/src/SpectacleConfig.cpp b/src/SpectacleConfig.cpp --- a/src/SpectacleConfig.cpp +++ b/src/SpectacleConfig.cpp @@ -119,7 +119,7 @@ mGeneralConfig.sync(); } -QUrl SpectacleConfig::lastSaveLocation() const +QUrl SpectacleConfig::lastSaveLocation() const { return this->lastSaveFile().adjusted(QUrl::RemoveFilename); } @@ -245,12 +245,12 @@ int SpectacleConfig::captureMode() const { - return std::max(0, mGuiConfig.readEntry(QStringLiteral("captureModeIndex"), 0)); + return std::max(0, mGuiConfig.readEntry(QStringLiteral("captureMode"), 0)); } void SpectacleConfig::setCaptureMode(int index) { - mGuiConfig.writeEntry(QStringLiteral("captureModeIndex"), index); + mGuiConfig.writeEntry(QStringLiteral("captureMode"), index); mGuiConfig.sync(); }