From 5ea80b2ca239086eeeda6520b5510640ad759c4d Mon Sep 17 00:00:00 2001 From: Yuriy Puchkov Date: Fri, 16 Oct 2020 15:03:42 +0300 Subject: [PATCH] Fix - update history widget on new capture --- src/core/controller.cpp | 9 +++++++++ src/core/controller.h | 1 + src/tools/storage/imgur/imguruploader.cpp | 2 ++ src/tools/storage/s3/imgs3uploader.cpp | 2 ++ src/widgets/capturelauncher.cpp | 3 --- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/core/controller.cpp b/src/core/controller.cpp index 2666d1e8..93fb4865 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -302,6 +302,15 @@ void Controller::updateConfigComponents() } } +void Controller::updateRecentScreenshots() +{ + if (nullptr != m_history) { + if (m_history->isVisible()) { + m_history->loadHistory(); + } + } +} + void Controller::showRecentScreenshots() { if (nullptr == m_history) { diff --git a/src/core/controller.h b/src/core/controller.h index 0cb9ee24..54cca5cc 100644 --- a/src/core/controller.h +++ b/src/core/controller.h @@ -45,6 +45,7 @@ public: void operator=(const Controller&) = delete; void enableExports(); + void updateRecentScreenshots(); signals: void captureTaken(uint id, QPixmap p); diff --git a/src/tools/storage/imgur/imguruploader.cpp b/src/tools/storage/imgur/imguruploader.cpp index 02bff6d8..710d5049 100644 --- a/src/tools/storage/imgur/imguruploader.cpp +++ b/src/tools/storage/imgur/imguruploader.cpp @@ -16,6 +16,7 @@ // along with Flameshot. If not, see . #include "imguruploader.h" +#include "src/core/controller.h" #include "src/utils/confighandler.h" #include "src/utils/filenamehandler.h" #include "src/utils/history.h" @@ -86,6 +87,7 @@ void ImgurUploader::handleReply(QNetworkReply* reply) QApplication::clipboard()->setText(imageUrl().toString()); SystemNotification().sendMessage( QObject::tr("URL copied to clipboard.")); + Controller::getInstance()->updateRecentScreenshots(); close(); } else { onUploadOk(); diff --git a/src/tools/storage/s3/imgs3uploader.cpp b/src/tools/storage/s3/imgs3uploader.cpp index c713e6f3..d7ff78e2 100644 --- a/src/tools/storage/s3/imgs3uploader.cpp +++ b/src/tools/storage/s3/imgs3uploader.cpp @@ -18,6 +18,7 @@ #include "imgs3uploader.h" #include "imgs3settings.h" +#include "src/core/controller.h" #include "src/utils/confighandler.h" #include "src/utils/history.h" #include "src/utils/systemnotification.h" @@ -200,6 +201,7 @@ void ImgS3Uploader::handleReplyUpload(QNetworkReply* reply) if (ConfigHandler().copyAndCloseAfterUploadEnabled()) { QApplication::clipboard()->setText(imageUrl().toString()); SystemNotification().sendMessage(tr("URL copied to clipboard.")); + Controller::getInstance()->updateRecentScreenshots(); close(); } else { onUploadOk(); diff --git a/src/widgets/capturelauncher.cpp b/src/widgets/capturelauncher.cpp index 1366b577..4c9edded 100644 --- a/src/widgets/capturelauncher.cpp +++ b/src/widgets/capturelauncher.cpp @@ -20,9 +20,6 @@ #include "src/utils/screengrabber.h" #include "src/utils/screenshotsaver.h" #include "src/widgets/imagelabel.h" - -#include "src/widgets/notificationwidget.h" -#include #include #include #include