mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
add notification for successful screenshot taking
This commit is contained in:
parent
71834751b0
commit
b34862e469
4 changed files with 21 additions and 2 deletions
|
|
@ -45,7 +45,7 @@ plasma_install_package(shell org.kde.plasma.phone shells)
|
|||
|
||||
install(DIRECTORY kwinmultitasking/ DESTINATION ${DATA_INSTALL_DIR}/kwin/scripts/org.kde.phone.multitasking)
|
||||
install(FILES kwinmultitasking/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME kwin-script-org.kde.phone.multitasking.desktop)
|
||||
|
||||
install(FILES plasma_phone_components.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
||||
install(DIRECTORY components/ DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell)
|
||||
|
||||
add_subdirectory(bin)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ target_link_libraries(plasma_applet_phonepanel
|
|||
Qt5::Gui
|
||||
Qt5::DBus
|
||||
KF5::Plasma
|
||||
KF5::I18n)
|
||||
KF5::I18n
|
||||
KF5::Notifications)
|
||||
|
||||
install(TARGETS plasma_applet_phonepanel DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
|
||||
#install(FILES plasma-phonepanel-default.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <KNotification>
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDBusPendingReply>
|
||||
#include <QFile>
|
||||
|
|
@ -176,6 +179,13 @@ void PhonePanel::takeScreenshot()
|
|||
qDebug() << lImage;
|
||||
if(!lImage.save(filePath, "PNG")) {
|
||||
qWarning() << "Failed to save screenshot to" << filePath;
|
||||
} else {
|
||||
KNotification *notif = new KNotification("captured");
|
||||
notif->setComponentName(QStringLiteral("plasma_phone_components"));
|
||||
notif->setTitle(i18n("New Screenshot"));
|
||||
notif->setUrls({filePath});
|
||||
notif->setText(i18n("New screenshot saved to %1", filePath));
|
||||
notif->sendEvent();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
|||
8
plasma_phone_components.notifyrc
Normal file
8
plasma_phone_components.notifyrc
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[Global]
|
||||
IconName=preferences-system-windows-effect-screenshot
|
||||
Name=Plasma
|
||||
|
||||
[Event/captured]
|
||||
Name=Captured
|
||||
Comment=Captured
|
||||
Action=Popup
|
||||
Loading…
Reference in a new issue