Commit 87392e09 authored by Boudhayan Gupta's avatar Boudhayan Gupta

Add notification with save path on Save and Quit

BUG: 357142
FIXED-IN: 16.08
parent 7a177901
...@@ -282,7 +282,7 @@ bool ExportManager::isFileExists(const QUrl &url) ...@@ -282,7 +282,7 @@ bool ExportManager::isFileExists(const QUrl &url)
// save slots // save slots
void ExportManager::doSave(const QUrl &url) void ExportManager::doSave(const QUrl &url, bool notify)
{ {
if (mSavePixmap.isNull()) { if (mSavePixmap.isNull()) {
emit errorMessage(i18n("Cannot save an empty screenshot image.")); emit errorMessage(i18n("Cannot save an empty screenshot image."));
...@@ -296,6 +296,9 @@ void ExportManager::doSave(const QUrl &url) ...@@ -296,6 +296,9 @@ void ExportManager::doSave(const QUrl &url)
setSaveLocation(dir.absolutePath()); setSaveLocation(dir.absolutePath());
emit imageSaved(savePath); emit imageSaved(savePath);
if (notify) {
emit forceNotify(savePath);
}
} }
} }
......
...@@ -63,13 +63,14 @@ class ExportManager : public QObject ...@@ -63,13 +63,14 @@ class ExportManager : public QObject
void saveLocationChanged(const QString &location); void saveLocationChanged(const QString &location);
void pixmapChanged(const QPixmap &pixmap); void pixmapChanged(const QPixmap &pixmap);
void imageSaved(const QUrl &savedAt); void imageSaved(const QUrl &savedAt);
void forceNotify(const QUrl &savedAt);
public slots: public slots:
QUrl getAutosaveFilename(); QUrl getAutosaveFilename();
QUrl tempSave(const QString &mimetype = "png"); QUrl tempSave(const QString &mimetype = "png");
void doSave(const QUrl &url = QUrl()); void doSave(const QUrl &url = QUrl(), bool notify = false);
void doSaveAs(QWidget *parentWindow = 0); void doSaveAs(QWidget *parentWindow = 0);
void doCopyToClipboard(); void doCopyToClipboard();
void doPrint(QPrinter *printer); void doPrint(QPrinter *printer);
......
...@@ -324,6 +324,7 @@ void KSMainWindow::saveAs() ...@@ -324,6 +324,7 @@ void KSMainWindow::saveAs()
void KSMainWindow::saveAndExit() void KSMainWindow::saveAndExit()
{ {
SpectacleConfig::instance()->setLastUsedSaveMode(0); SpectacleConfig::instance()->setLastUsedSaveMode(0);
ExportManager::instance()->doSave(); qApp->setQuitOnLastWindowClosed(false);
QApplication::quit(); ExportManager::instance()->doSave(QUrl(), true);
hide();
} }
...@@ -65,6 +65,7 @@ SpectacleCore::SpectacleCore(StartMode startMode, ImageGrabber::GrabMode grabMod ...@@ -65,6 +65,7 @@ SpectacleCore::SpectacleCore(StartMode startMode, ImageGrabber::GrabMode grabMod
connect(mImageGrabber, &ImageGrabber::pixmapChanged, this, &SpectacleCore::screenshotUpdated); connect(mImageGrabber, &ImageGrabber::pixmapChanged, this, &SpectacleCore::screenshotUpdated);
connect(mImageGrabber, &ImageGrabber::imageGrabFailed, this, &SpectacleCore::screenshotFailed); connect(mImageGrabber, &ImageGrabber::imageGrabFailed, this, &SpectacleCore::screenshotFailed);
connect(mExportManager, &ExportManager::imageSaved, this, &SpectacleCore::doCopyPath); connect(mExportManager, &ExportManager::imageSaved, this, &SpectacleCore::doCopyPath);
connect(mExportManager, &ExportManager::forceNotify, this, &SpectacleCore::doNotify);
switch (startMode) { switch (startMode) {
case DBusMode: case DBusMode:
...@@ -231,7 +232,6 @@ void SpectacleCore::doNotify(const QUrl &savedAt) ...@@ -231,7 +232,6 @@ void SpectacleCore::doNotify(const QUrl &savedAt)
connect(notify, &KNotification::action1Activated, this, [this, savedAt] { connect(notify, &KNotification::action1Activated, this, [this, savedAt] {
new KRun(savedAt, nullptr); new KRun(savedAt, nullptr);
QTimer::singleShot(250, this, &SpectacleCore::allDone); QTimer::singleShot(250, this, &SpectacleCore::allDone);
}); });
connect(notify, &QObject::destroyed, this, &SpectacleCore::allDone); connect(notify, &QObject::destroyed, this, &SpectacleCore::allDone);
......
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