aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Gräßlin <[email protected]>2016-11-16 09:50:18 +0100
committerMartin Gräßlin <[email protected]>2016-11-16 13:05:49 +0100
commitadfaac4d60333f13e0e6c6c7d40375682307d248 (patch)
treed2adba4ad3a7875e7934154e6a73d6a66e344c8f
parent620663cb281f1a8f38d4cfc20b67ed9932413e6b (diff)
[effects] Show a notification when a screenshot got saved to file
Summary: Inform the user about the path to where a screenshot got saved through a notification. This is helpful on the one hand that the user sees that the screenshot got saved and from a security perspective that the user is informed when a screenshot is taken through the dbus interface. It doesn't prevent non-authorized screenshot taking, but at least the user is informed about it. Reviewers: #kwin, #plasma, #vdg Subscribers: plasma-devel, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D3376
-rw-r--r--effects/CMakeLists.txt1
-rw-r--r--effects/screenshot/screenshot.cpp7
2 files changed, 8 insertions, 0 deletions
diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt
index 73dd8bb..9142a57 100644
--- a/effects/CMakeLists.txt
+++ b/effects/CMakeLists.txt
@@ -20,6 +20,7 @@ set(kwin_effect_KDE_LIBS
KF5::Plasma # screenedge effect
KF5::IconThemes
KF5::Service
+ KF5::Notifications # screenshot effect
)
set(kwin_effect_QT_LIBS
diff --git a/effects/screenshot/screenshot.cpp b/effects/screenshot/screenshot.cpp
index b01bacd..86e12cd 100644
--- a/effects/screenshot/screenshot.cpp
+++ b/effects/screenshot/screenshot.cpp
@@ -30,6 +30,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QMatrix4x4>
#include <xcb/xcb_image.h>
+#include <KLocalizedString>
+#include <KNotification>
+
namespace KWin
{
@@ -240,6 +243,10 @@ QString ScreenShotEffect::saveTempImage(const QImage &img)
}
img.save(&temp);
temp.close();
+ KNotification::event(KNotification::Notification,
+ i18nc("Notification caption that a screenshot got saved to file", "Screenshot"),
+ i18nc("Notification with path to screenshot file", "Screenshot saved to %1", temp.fileName()),
+ QStringLiteral("spectacle"));
return temp.fileName();
}