mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03: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(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 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)
|
install(DIRECTORY components/ DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell)
|
||||||
|
|
||||||
add_subdirectory(bin)
|
add_subdirectory(bin)
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,8 @@ target_link_libraries(plasma_applet_phonepanel
|
||||||
Qt5::Gui
|
Qt5::Gui
|
||||||
Qt5::DBus
|
Qt5::DBus
|
||||||
KF5::Plasma
|
KF5::Plasma
|
||||||
KF5::I18n)
|
KF5::I18n
|
||||||
|
KF5::Notifications)
|
||||||
|
|
||||||
install(TARGETS plasma_applet_phonepanel DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
|
install(TARGETS plasma_applet_phonepanel DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
|
||||||
#install(FILES plasma-phonepanel-default.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
#install(FILES plasma-phonepanel-default.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,9 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <KNotification>
|
||||||
|
#include <KLocalizedString>
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDBusPendingReply>
|
#include <QDBusPendingReply>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
@ -176,6 +179,13 @@ void PhonePanel::takeScreenshot()
|
||||||
qDebug() << lImage;
|
qDebug() << lImage;
|
||||||
if(!lImage.save(filePath, "PNG")) {
|
if(!lImage.save(filePath, "PNG")) {
|
||||||
qWarning() << "Failed to save screenshot to" << filePath;
|
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