Changeset View
Changeset View
Standalone View
Standalone View
src/SpectacleConfig.cpp
Show First 20 Lines • Show All 352 Lines • ▼ Show 20 Line(s) | |||||
353 | } | 353 | } | ||
354 | 354 | | |||
355 | void SpectacleConfig::setDefaultSaveLocation(const QUrl &location) | 355 | void SpectacleConfig::setDefaultSaveLocation(const QUrl &location) | ||
356 | { | 356 | { | ||
357 | mGeneralConfig.writePathEntry(QStringLiteral("default-save-location"), location.toString()); | 357 | mGeneralConfig.writePathEntry(QStringLiteral("default-save-location"), location.toString()); | ||
358 | mGeneralConfig.sync(); | 358 | mGeneralConfig.sync(); | ||
359 | } | 359 | } | ||
360 | 360 | | |||
361 | // copy file to clipboard after the screenshot has been made | ||||
362 | | ||||
363 | SpectacleConfig::CopyImageToClipboardSetting SpectacleConfig::copyImageToClipboardSetting() const | ||||
364 | { | ||||
365 | mConfig->reparseConfiguration(); | ||||
366 | int clipboardAction = static_cast<int>(SpectacleConfig::CopyImageToClipboardSetting::DoNotChangeClipboard); | ||||
davidre: We forgot the actual config key, and I guess `clipboardAction` should be `doNothing`. The key… | |||||
367 | int readValue = mGuiConfig.readEntry(QStringLiteral("copyImageToClipboard"), clipboardAction); | ||||
368 | if ((KWindowSystem::isPlatformWayland() || qstrcmp(qgetenv("XDG_SESSION_TYPE"), "wayland") == 0 ) | ||||
369 | && readValue == SpectacleConfig::CopyImageToClipboardSetting::CopyImageToClipboard) { | ||||
370 | return SpectacleConfig::CopyImageToClipboardSetting::DoNotChangeClipboard; | ||||
371 | } | ||||
372 | return static_cast<SpectacleConfig::CopyImageToClipboardSetting>(readValue); | ||||
We don't need this whole logic here. The print key stuff needed it because one Focusing the window only works on X11 right now and not on Wayland. Just return static_cast<SpectacleConfig::CopyImageToClipboardSetting>(mGuiConfig.readEntry(QStringLiteral("copyImageToClipboard"), clipboardAction); (Or split in two lines if it is to long). davidre: We don't need this whole logic here. The print key stuff needed it because one Focusing the… | |||||
373 | } | ||||
374 | | ||||
375 | void SpectacleConfig::setCopyImageToClipboardSetting (SpectacleConfig::CopyImageToClipboardSetting action) | ||||
376 | { | ||||
377 | mGuiConfig.writeEntry(QStringLiteral("copyImageToClipboard"), static_cast<int>(action)); | ||||
378 | mGuiConfig.sync(); | ||||
379 | } | ||||
380 | | ||||
361 | // copy file location to clipboard after saving | 381 | // copy file location to clipboard after saving | ||
362 | 382 | | |||
363 | bool SpectacleConfig::copySaveLocationToClipboard() const | 383 | bool SpectacleConfig::copySaveLocationToClipboard() const | ||
364 | { | 384 | { | ||
365 | return mGeneralConfig.readEntry(QStringLiteral("copySaveLocation"), false); | 385 | return mGeneralConfig.readEntry(QStringLiteral("copySaveLocation"), false); | ||
366 | } | 386 | } | ||
367 | 387 | | |||
368 | void SpectacleConfig::setCopySaveLocationToClipboard(bool enabled) | 388 | void SpectacleConfig::setCopySaveLocationToClipboard(bool enabled) | ||
Show All 36 Lines |
We forgot the actual config key, and I guess clipboardAction should be doNothing. The key could. just be afterTakingScreenshot.