Changeset View
Changeset View
Standalone View
Standalone View
src/SpectacleCore.cpp
Context not available. | |||||
219 | } | 219 | } | ||
---|---|---|---|---|---|
220 | 220 | | |||
221 | if (copyToClipboard) { | 221 | if (copyToClipboard) { | ||
222 | mExportManager->doCopyToClipboard(); | 222 | mExportManager->doCopyToClipboard(mNotify); | ||
223 | } else { | 223 | } else { | ||
224 | QUrl savePath = (mStartMode == BackgroundMode && mFileNameUrl.isValid() && mFileNameUrl.isLocalFile()) ? | 224 | QUrl savePath = (mStartMode == BackgroundMode && mFileNameUrl.isValid() && mFileNameUrl.isLocalFile()) ? | ||
225 | mFileNameUrl : QUrl(); | 225 | mFileNameUrl : QUrl(); | ||
226 | mExportManager->doSave(savePath); | 226 | mExportManager->doSave(savePath); | ||
227 | } | 227 | } | ||
228 | 228 | | |||
229 | // if we notify, we emit allDone only if the user either dismissed the notification or pressed | 229 | // if we notify, we emit allDone only if the user either dismissed the notification or pressed | ||
230 | // the "Open" button, otherwise the app closes before it can react to it. | 230 | // the "Open" button, otherwise the app closes before it can react to it. | ||
Context not available. | |||||
283 | 283 | | |||
284 | const QString &path = savedAt.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash).path(); | 284 | const QString &path = savedAt.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash).path(); | ||
285 | 285 | | |||
286 | // a speaking message is prettier than a URL, special case for the default pictures location | 286 | // a speaking message is prettier than a URL, special case for copy to clipboard and the default pictures location | ||
287 | if (path == QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)) { | 287 | if (copyToClipboard) { | ||
288 | notify->setText(i18n("A screenshot was saved to your clipboard.")); | ||||
289 | } else if (path == QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)) { | ||||
288 | notify->setText(i18nc("Placeholder is filename", "A screenshot was saved as '%1' to your Pictures folder.", savedAt.fileName())); | 290 | notify->setText(i18nc("Placeholder is filename", "A screenshot was saved as '%1' to your Pictures folder.", savedAt.fileName())); | ||
289 | } else { | 291 | } else { | ||
290 | notify->setText(i18n("A screenshot was saved as '%1' to '%2'.", savedAt.fileName(), path)); | 292 | notify->setText(i18n("A screenshot was saved as '%1' to '%2'.", savedAt.fileName(), path)); | ||
291 | } | 293 | } | ||
292 | 294 | | |||
293 | notify->setActions({i18nc("Open the screenshot we just saved", "Open")}); | 295 | if (!copyToClipboard) { | ||
294 | notify->setUrls({savedAt}); | 296 | notify->setActions({i18nc("Open the screenshot we just saved", "Open")}); | ||
297 | notify->setUrls({savedAt}); | ||||
298 | } | ||||
295 | 299 | | |||
296 | connect(notify, &KNotification::action1Activated, this, [this, savedAt] { | 300 | connect(notify, &KNotification::action1Activated, this, [this, savedAt] { | ||
297 | new KRun(savedAt, nullptr); | 301 | new KRun(savedAt, nullptr); | ||
Context not available. |