[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/D3376icc-effect-5.14.5
parent
620663cb28
commit
adfaac4d60
|
@ -20,6 +20,7 @@ set(kwin_effect_KDE_LIBS
|
||||||
KF5::Plasma # screenedge effect
|
KF5::Plasma # screenedge effect
|
||||||
KF5::IconThemes
|
KF5::IconThemes
|
||||||
KF5::Service
|
KF5::Service
|
||||||
|
KF5::Notifications # screenshot effect
|
||||||
)
|
)
|
||||||
|
|
||||||
set(kwin_effect_QT_LIBS
|
set(kwin_effect_QT_LIBS
|
||||||
|
|
|
@ -30,6 +30,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <QMatrix4x4>
|
#include <QMatrix4x4>
|
||||||
#include <xcb/xcb_image.h>
|
#include <xcb/xcb_image.h>
|
||||||
|
|
||||||
|
#include <KLocalizedString>
|
||||||
|
#include <KNotification>
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -240,6 +243,10 @@ QString ScreenShotEffect::saveTempImage(const QImage &img)
|
||||||
}
|
}
|
||||||
img.save(&temp);
|
img.save(&temp);
|
||||||
temp.close();
|
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();
|
return temp.fileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue