Commit a43c16d3 authored by David Redondo's avatar David Redondo 🏎

Conform to dbus activatable spec

parent 0b3bb8a6
......@@ -6,7 +6,7 @@ include(ECMConfiguredInstall)
ecm_install_configured_files(INPUT app-org.kde.spectacle.service.in DESTINATION ${SYSTEMD_USER_UNIT_INSTALL_DIR})
ecm_generate_dbus_service_file(
NAME org.kde.Spectacle
NAME org.kde.spectacle
EXECUTABLE "${CMAKE_INSTALL_PREFIX}/bin/spectacle --dbus"
SYSTEMD_SERVICE app-org.kde.spectacle.service
DESTINATION ${KDE_INSTALL_DBUSSERVICEDIR}
......
......@@ -3,4 +3,4 @@ Description=Spectacle screenshot capture utility
[Service]
ExecStart=@CMAKE_INSTALL_PREFIX@/bin/spectacle --dbus
BusName=org.kde.Spectacle
BusName=org.kde.spectacle
......@@ -154,6 +154,7 @@ Type=Application
Terminal=false
StartupNotify=false
Actions=FullScreenScreenShot;CurrentMonitorScreenShot;ActiveWindowScreenShot;RectangularRegionScreenShot;
DBusActivatable=true
X-DBUS-StartupType=Unique
X-DBUS-ServiceName=org.kde.Spectacle
X-KDE-Shortcuts=Print
......
......@@ -104,5 +104,17 @@ int main(int argc, char **argv)
// fire it up
lCore.onActivateRequested(app.arguments(), QStringLiteral());
QObject::connect(&service, &KDBusService::activateActionRequested, &lCore, [&lCore] (const QString& actionName, const QVariant &parameters) {
if (actionName == QLatin1String("FullScreenScreenShot")) {
lCore.takeNewScreenshot(Spectacle::CaptureMode::AllScreens, 0, false, true);
} else if (actionName == QLatin1String("CurrentMonitorScreenShot")) {
lCore.takeNewScreenshot(Spectacle::CaptureMode::CurrentScreen, 0, false, true);
} else if (actionName == QLatin1String("ActiveWindowScreenShot")) {
lCore.takeNewScreenshot(Spectacle::CaptureMode::ActiveWindow, 0, false, true);
} else if (actionName == QLatin1String("RectangularRegionScreenShot")) {
lCore.takeNewScreenshot(Spectacle::CaptureMode::RectangularRegion, 0, false, true);
}
});
return app.exec();
}
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