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