Commit e10b098e authored by Piyush Aggarwal's avatar Piyush Aggarwal 🎮
Browse files

systray: add photo plugin to systray actions

parent 3273cea4
Pipeline #66334 passed with stage
in 4 minutes and 13 seconds
......@@ -7,11 +7,14 @@
#include "deviceindicator.h"
#include <QFileDialog>
#include <QStandardPaths>
#include <QDateTime>
#include <KLocalizedString>
#include "interfaces/dbusinterfaces.h"
#include <dbushelper.h>
#include <dbushelpers.h>
#include <systray_actions.h>
DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
......@@ -60,6 +63,15 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
});
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_findmyphone")), [findDevice](bool available) { findDevice->setVisible(available); }, this);
// Get a photo
auto getPhoto = addAction(QIcon::fromTheme(QStringLiteral("camera-photo")), i18n("Get a photo"));
connect(getPhoto, &QAction::triggered, this, [device](){
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device->id() + QStringLiteral("/photo"), QStringLiteral("org.kde.kdeconnect.device.photo"), QStringLiteral("requestPhoto"));
msg.setArguments({QStandardPaths::standardLocations(QStandardPaths::DownloadLocation).first() + QDateTime::currentDateTime().toString(QStringLiteral("/dd-MM-yy_hh-mm-ss.png"))});
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
});
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_photo")), [getPhoto](bool available) { getPhoto->setVisible(available); }, this);
// Send file
const QString kdeconnectHandlerExecutable = QStandardPaths::findExecutable(QStringLiteral("kdeconnect-handler"));
if (!kdeconnectHandlerExecutable.isEmpty()) {
......
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