Verified Commit ba92b650 authored by Antonio Prcela's avatar Antonio Prcela
Browse files

Separate messages for a failed and canceled screenshot

Add a new function that gets called when an screenshot has been canceled.

BUG: 427645
parent ba2b192a
......@@ -487,6 +487,11 @@ void KSMainWindow::imageCopied()
void KSMainWindow::screenshotCanceled()
showInlineMessage(i18n("Screenshot capture canceled."), KMessageWidget::Information);
void KSMainWindow::screenshotFailed()
showInlineMessage(i18n("Could not take a screenshot. Please report this bug here: <a href=\"\">create a spectacle bug</a>"),
......@@ -86,6 +86,7 @@ class KSMainWindow: public QDialog
void setScreenshotAndShow(const QPixmap &pixmap);
void imageSaved(const QUrl &location);
void imageSavedAndCopied(const QUrl &location);
void screenshotCanceled();
void screenshotFailed();
......@@ -297,7 +297,7 @@ void SpectacleCore::screenshotUpdated(const QPixmap &thePixmap)
if(!mQuickEditor) {
mQuickEditor = std::make_unique<QuickEditor>(thePixmap, mWaylandPlasmashell);
connect(mQuickEditor.get(), &QuickEditor::grabDone, this, &SpectacleCore::screenshotUpdated);
connect(mQuickEditor.get(), &QuickEditor::grabCancelled, this, &SpectacleCore::screenshotFailed);
connect(mQuickEditor.get(), &QuickEditor::grabCancelled, this, &SpectacleCore::screenshotCanceled);
} else {
......@@ -354,6 +354,14 @@ void SpectacleCore::screenshotUpdated(const QPixmap &thePixmap)
void SpectacleCore::screenshotCanceled()
  • This line crashes spectacle when you cancel a screenshot in background mode or when invoking via shortcut.

  • The line 362? L361 has been removed in the final commit mMainWindow->setScreenshotAndShow(QPixmap());

    I can't reproduce it. Tried running it via spectacle -b and then cancel with CTRL+C, does not crash. At least no error. Also tried with Shift+Meta+Print and canceled with Esc. Both while spectacle was running and when it wasn't. No unexpected crash. Any specific steps to do to reproduce it?

  • Region mode, otherwise we do not get screenshotCanceled ;). When we are in not GuiMode there is no main window so mMainWindow->setScreenshotAndShow(QPixmap()); a null pointer.

  • Since I still can't reproduce it :( ... for example with Shift+Meta+Print (launches Region mode), can you try it with this commit? aprcela/spectacle@104d1b2d

  • Feel free to merge that commit :)

Please register or sign in to reply
void SpectacleCore::screenshotFailed()
if (ExportManager::instance()->captureMode() == Spectacle::CaptureMode::RectangularRegion && mQuickEditor) {
......@@ -73,6 +73,7 @@ class SpectacleCore: public QObject
void takeNewScreenshot(Spectacle::CaptureMode theCaptureMode, int theTimeout, bool theIncludePointer, bool theIncludeDecorations);
void showErrorMessage(const QString &theErrString);
void screenshotUpdated(const QPixmap &thePixmap);
void screenshotCanceled();
void screenshotFailed();
void doStartDragAndDrop();
void doNotify(const QUrl &theSavedAt);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment