Commit adfaac4d authored by Martin Flöser's avatar Martin Flöser

[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
parent 620663cb
......@@ -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
......
......@@ -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();
}
......
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