Changeset View
Changeset View
Standalone View
Standalone View
src/ExportManager.cpp
Show First 20 Lines • Show All 498 Lines • ▼ Show 20 Line(s) | 493 | if (save(saveUrl)) { | |||
---|---|---|---|---|---|
499 | } | 499 | } | ||
500 | return true; | 500 | return true; | ||
501 | } | 501 | } | ||
502 | } | 502 | } | ||
503 | } | 503 | } | ||
504 | return false; | 504 | return false; | ||
505 | } | 505 | } | ||
506 | 506 | | |||
507 | void ExportManager::doSaveAndCopy(const QUrl &url) | ||||
davidre: The copying thing is missing here. Just call doCopyToClipboard | |||||
If I set doCopyToClipboard anywhere between L508 and L514, Spectacle hangs upon creating the file and saving to clipboard. aprcela: If I set `doCopyToClipboard` anywhere between L508 and L514, Spectacle hangs upon creating the… | |||||
I don't think it's too bad. If you watch it doesn't hang but starts when the image is saved (you can see the window title changing). Can you try to get a video if I am seeing something different than you? davidre: I don't think it's too bad. If you watch it doesn't hang but starts when the image is saved… | |||||
aprcela: Can't reproduce it now. Maybe my reboot last night helped.. | |||||
508 | { | ||||
509 | if (mSavePixmap.isNull()) { | ||||
510 | emit errorMessage(i18n("Cannot save an empty screenshot image.")); | ||||
511 | return; | ||||
512 | } | ||||
513 | | ||||
514 | QUrl savePath = url.isValid() ? url : getAutosaveFilename(); | ||||
515 | if (save(savePath)) { | ||||
516 | QDir dir(savePath.path()); | ||||
517 | dir.cdUp(); | ||||
518 | SpectacleConfig::instance()->setLastSaveFile(savePath); | ||||
519 | | ||||
520 | doCopyToClipboard(false); | ||||
521 | emit imageSavedAndCopied(savePath); | ||||
522 | } | ||||
523 | } | ||||
524 | | ||||
507 | // misc helpers | 525 | // misc helpers | ||
508 | 526 | | |||
509 | void ExportManager::doCopyToClipboard(bool notify) | 527 | void ExportManager::doCopyToClipboard(bool notify) | ||
510 | { | 528 | { | ||
511 | auto data = new QMimeData(); | 529 | auto data = new QMimeData(); | ||
512 | data->setImageData(mSavePixmap.toImage()); | 530 | data->setImageData(mSavePixmap.toImage()); | ||
513 | data->setData(QStringLiteral("x-kde-force-image-copy"), QByteArray()); | 531 | data->setData(QStringLiteral("x-kde-force-image-copy"), QByteArray()); | ||
514 | QApplication::clipboard()->setMimeData(data, QClipboard::Clipboard); | 532 | QApplication::clipboard()->setMimeData(data, QClipboard::Clipboard); | ||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |
The copying thing is missing here. Just call doCopyToClipboard