Changeset View
Changeset View
Standalone View
Standalone View
src/SpectacleCore.cpp
Show First 20 Lines • Show All 331 Lines • ▼ Show 20 Line(s) | 304 | { | |||
---|---|---|---|---|---|
332 | } else if (lSavePath == QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)) { | 332 | } else if (lSavePath == QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)) { | ||
333 | lNotify->setText(i18nc("Placeholder is filename", "A screenshot was saved as '%1' to your Pictures folder.", theSavedAt.fileName())); | 333 | lNotify->setText(i18nc("Placeholder is filename", "A screenshot was saved as '%1' to your Pictures folder.", theSavedAt.fileName())); | ||
334 | } else { | 334 | } else { | ||
335 | lNotify->setText(i18n("A screenshot was saved as '%1' to '%2'.", theSavedAt.fileName(), lSavePath)); | 335 | lNotify->setText(i18n("A screenshot was saved as '%1' to '%2'.", theSavedAt.fileName(), lSavePath)); | ||
336 | } | 336 | } | ||
337 | 337 | | |||
338 | if (!mCopyToClipboard) { | 338 | if (!mCopyToClipboard) { | ||
339 | lNotify->setUrls({theSavedAt}); | 339 | lNotify->setUrls({theSavedAt}); | ||
340 | lNotify->setDefaultAction(i18nc("Open the screenshot we just saved", "Open")); | 340 | lNotify->setDefaultAction(i18nc("Open the screenshot we just saved", "Open")); | ||
341 | connect(lNotify, QOverload<uint>::of(&KNotification::activated), this, [this, theSavedAt](uint index) { | | |||
342 | if (index == 0) { | | |||
343 | new KRun(theSavedAt, nullptr); | | |||
344 | QTimer::singleShot(250, this, [this] { | | |||
345 | if (mStartMode != StartMode::Gui) { | | |||
346 | emit allDone(); | | |||
347 | } | | |||
348 | }); | | |||
349 | } | | |||
350 | }); | | |||
351 | } | 341 | } | ||
davidre: Do we need this here, too? | |||||
aprcela: Tested, works without. | |||||
I was not referencing the whole connect but if we need the other condition too. davidre: I was not referencing the whole connect but if we need the other condition too. | |||||
352 | 342 | | |||
353 | connect(lNotify, &QObject::destroyed, this, [this] { | 343 | connect(lNotify, &QObject::destroyed, this, [this] { | ||
354 | if (mStartMode != StartMode::Gui) { | 344 | if (mStartMode != StartMode::Gui || SpectacleConfig::instance()->quitAfterSaveOrCopyChecked()) { | ||
355 | emit allDone(); | 345 | emit allDone(); | ||
Can be simplified to mStartMode != StartMode::Gui || SpectacleConfig::instance()->quitAfterSaveOrCopyChecked() davidre: Can be simplified to `mStartMode != StartMode::Gui || SpectacleConfig::instance()… | |||||
aprcela: Done. Thanks ! | |||||
356 | } | 346 | } | ||
357 | }); | 347 | }); | ||
358 | 348 | | |||
359 | lNotify->sendEvent(); | 349 | lNotify->sendEvent(); | ||
360 | } | 350 | } | ||
361 | 351 | | |||
362 | void SpectacleCore::doCopyPath(const QUrl &savedAt) | 352 | void SpectacleCore::doCopyPath(const QUrl &savedAt) | ||
363 | { | 353 | { | ||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |
Do we need this here, too?