From cdcf44efa82513abd62d13f8554280b851aed8fd Mon Sep 17 00:00:00 2001 From: Albert Vaca Cintora Date: Thu, 14 Sep 2023 08:00:19 +0200 Subject: [PATCH] Remove photo plugin As discussed in Matrix and BUG: 474121 this plugin is confusing (because it doesn't actually take a photo, it just launches the camera on your phone) and its use case can be covered by taking a photo and sharing it, which only requires a couple extra clicks. --- cli/kdeconnect-cli.cpp | 13 -- .../kdeconnectdeclarativeplugin.cpp | 2 - indicator/deviceindicator.cpp | 18 --- interfaces/CMakeLists.txt | 1 - interfaces/dbusinterfaces.cpp | 8 - interfaces/dbusinterfaces.h | 8 - .../package/contents/ui/DeviceDelegate.qml | 27 ---- plasmoid/package/contents/ui/Photo.qml | 26 ---- plugins/CMakeLists.txt | 1 - plugins/photo/CMakeLists.txt | 5 - plugins/photo/kdeconnect_photo.json | 144 ------------------ plugins/photo/photoplugin.cpp | 49 ------ plugins/photo/photoplugin.h | 35 ----- 13 files changed, 337 deletions(-) delete mode 100644 plasmoid/package/contents/ui/Photo.qml delete mode 100644 plugins/photo/CMakeLists.txt delete mode 100644 plugins/photo/kdeconnect_photo.json delete mode 100644 plugins/photo/photoplugin.cpp delete mode 100644 plugins/photo/photoplugin.h diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp index 3ea771798..cdbeba026 100644 --- a/cli/kdeconnect-cli.cpp +++ b/cli/kdeconnect-cli.cpp @@ -70,7 +70,6 @@ int main(int argc, char **argv) parser.addOption( QCommandLineOption(QStringList{QStringLiteral("k"), QStringLiteral("send-keys")}, i18n("Sends keys to a said device"), QStringLiteral("key"))); parser.addOption(QCommandLineOption(QStringLiteral("my-id"), i18n("Display this device's id and exit"))); - parser.addOption(QCommandLineOption(QStringLiteral("photo"), i18n("Open the connected device's camera and transfer the photo"), QStringLiteral("path"))); // Hidden because it's an implementation detail QCommandLineOption deviceAutocomplete(QStringLiteral("shell-device-autocompletion")); @@ -318,18 +317,6 @@ int main(int argc, char **argv) QStringLiteral("org.kde.kdeconnect.device.findmyphone"), QStringLiteral("ring")); blockOnReply(QDBusConnection::sessionBus().asyncCall(msg)); - } else if (parser.isSet(QStringLiteral("photo"))) { - const QString fileName = parser.value(QStringLiteral("photo")); - if (!fileName.isEmpty()) { - QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), - QLatin1String("/modules/kdeconnect/devices/%1/photo").arg(device), - QStringLiteral("org.kde.kdeconnect.device.photo"), - QStringLiteral("requestPhoto")); - msg.setArguments({QUrl::fromLocalFile(fileName).toString()}); - blockOnReply(QDBusConnection::sessionBus().asyncCall(msg)); - } else { - QTextStream(stderr) << i18n("Please specify a filename for the photo") << Qt::endl; - } } else if (parser.isSet(QStringLiteral("send-keys"))) { QString seq = parser.value(QStringLiteral("send-keys")); QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), diff --git a/declarativeplugin/kdeconnectdeclarativeplugin.cpp b/declarativeplugin/kdeconnectdeclarativeplugin.cpp index e975f6526..b99ab8eae 100644 --- a/declarativeplugin/kdeconnectdeclarativeplugin.cpp +++ b/declarativeplugin/kdeconnectdeclarativeplugin.cpp @@ -82,7 +82,6 @@ void KdeConnectDeclarativePlugin::registerTypes(const char *uri) "RemoteSystemVolumeInterface", QStringLiteral("You're not supposed to instantiate interfaces")); qmlRegisterUncreatableType(uri, 1, 0, "ShareDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); - qmlRegisterUncreatableType(uri, 1, 0, "PhotoDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); qmlRegisterUncreatableType(uri, 1, 0, "BigscreenDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); qmlRegisterSingletonType(uri, 1, 0, "DaemonDbusInterface", [](QQmlEngine *, QJSEngine *) -> QObject * { return new DaemonDbusInterface; @@ -117,7 +116,6 @@ void KdeConnectDeclarativePlugin::registerTypes(const char *uri) registerFactory(uri, "SmsDbusInterfaceFactory"); registerFactory(uri, "RemoteCommandsDbusInterfaceFactory"); registerFactory(uri, "ShareDbusInterfaceFactory"); - registerFactory(uri, "PhotoDbusInterfaceFactory"); registerFactory(uri, "RemoteSystemVolumeDbusInterfaceFactory"); registerFactory(uri, "BigscreenDbusInterfaceFactory"); registerFactory(uri, "VirtualmonitorDbusInterfaceFactory"); diff --git a/indicator/deviceindicator.cpp b/indicator/deviceindicator.cpp index 1fcfce92c..67a53345f 100644 --- a/indicator/deviceindicator.cpp +++ b/indicator/deviceindicator.cpp @@ -91,24 +91,6 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface *device) }, 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")); - QStringList downloadDirs = QStandardPaths::standardLocations(QStandardPaths::DownloadLocation); - msg.setArguments({QString(downloadDirs.first() + QDateTime::currentDateTime().toString(QStringLiteral("/dd-MM-yy_hh-mm-ss.png")))}); - blockOnReply(QDBusConnection::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"), {QCoreApplication::applicationDirPath()}); if (!kdeconnectHandlerExecutable.isEmpty()) { diff --git a/interfaces/CMakeLists.txt b/interfaces/CMakeLists.txt index 71d5b1412..4eb67f539 100644 --- a/interfaces/CMakeLists.txt +++ b/interfaces/CMakeLists.txt @@ -61,7 +61,6 @@ geninterface(${PROJECT_SOURCE_DIR}/plugins/share/shareplugin.h generated/sharein geninterface(${PROJECT_SOURCE_DIR}/plugins/remotesystemvolume/remotesystemvolumeplugin.h generated/remotesystemvolumeinterface) geninterface(${PROJECT_SOURCE_DIR}/plugins/bigscreen/bigscreenplugin.h generated/bigscreeninterface) geninterface(${PROJECT_SOURCE_DIR}/plugins/virtualmonitor/virtualmonitorplugin.h generated/virtualmonitorinterface) -geninterface(${PROJECT_SOURCE_DIR}/plugins/photo/photoplugin.h generated/photointerface) geninterface(${PROJECT_SOURCE_DIR}/plugins/clipboard/clipboardplugin.h generated/deviceclipboardinterface) # System dbus interfaces diff --git a/interfaces/dbusinterfaces.cpp b/interfaces/dbusinterfaces.cpp index 91d35d203..649dcfdc3 100644 --- a/interfaces/dbusinterfaces.cpp +++ b/interfaces/dbusinterfaces.cpp @@ -170,14 +170,6 @@ ShareDbusInterface::ShareDbusInterface(const QString &deviceId, QObject *parent) { } -PhotoDbusInterface::PhotoDbusInterface(const QString &deviceId, QObject *parent) - : OrgKdeKdeconnectDevicePhotoInterface(DaemonDbusInterface::activatedService(), - QLatin1String("/modules/kdeconnect/devices/%1/photo").arg(deviceId), - QDBusConnection::sessionBus(), - parent) -{ -} - RemoteSystemVolumeDbusInterface::RemoteSystemVolumeDbusInterface(const QString &deviceId, QObject *parent) : OrgKdeKdeconnectDeviceRemotesystemvolumeInterface(DaemonDbusInterface::activatedService(), QLatin1String("/modules/kdeconnect/devices/%1/remotesystemvolume").arg(deviceId), diff --git a/interfaces/dbusinterfaces.h b/interfaces/dbusinterfaces.h index 69a483ef6..584420e5e 100644 --- a/interfaces/dbusinterfaces.h +++ b/interfaces/dbusinterfaces.h @@ -22,7 +22,6 @@ #include "generated/lockdeviceinterface.h" #include "generated/mprisremoteinterface.h" #include "generated/notificationinterface.h" -#include "generated/photointerface.h" #include "generated/remotecommandsinterface.h" #include "generated/remotecontrolinterface.h" #include "generated/remotekeyboardinterface.h" @@ -213,13 +212,6 @@ public: explicit ShareDbusInterface(const QString &deviceId, QObject *parent = nullptr); }; -class KDECONNECTINTERFACES_EXPORT PhotoDbusInterface : public OrgKdeKdeconnectDevicePhotoInterface -{ - Q_OBJECT -public: - explicit PhotoDbusInterface(const QString &deviceId, QObject *parent = nullptr); -}; - class KDECONNECTINTERFACES_EXPORT RemoteSystemVolumeDbusInterface : public OrgKdeKdeconnectDeviceRemotesystemvolumeInterface { Q_OBJECT diff --git a/plasmoid/package/contents/ui/DeviceDelegate.qml b/plasmoid/package/contents/ui/DeviceDelegate.qml index 06b64aa5f..978952505 100644 --- a/plasmoid/package/contents/ui/DeviceDelegate.qml +++ b/plasmoid/package/contents/ui/DeviceDelegate.qml @@ -188,27 +188,6 @@ PlasmaComponents.ListItem } } - //Photo - PlasmaComponents.MenuItem - { - FileDialog { - id: photoFileDialog - title: i18n("Save As") - folder: shortcuts.pictures - selectMultiple: false - selectExisting: false - onAccepted: { - var path = photoFileDialog.fileUrl.toString(); - photo.plugin.requestPhoto(path); - } - } - - id: takePhoto - icon: "camera-photo-symbolic" - visible: photo.available - text: i18n("Take a photo") - onClicked: photoFileDialog.open() - } //Find my phone PlasmaComponents.MenuItem @@ -447,11 +426,5 @@ PlasmaComponents.ListItem id: share device: root.device } - - // Photo - Photo { - id: photo - device: root.device - } } } diff --git a/plasmoid/package/contents/ui/Photo.qml b/plasmoid/package/contents/ui/Photo.qml deleted file mode 100644 index fa3d289b2..000000000 --- a/plasmoid/package/contents/ui/Photo.qml +++ /dev/null @@ -1,26 +0,0 @@ -/** - * SPDX-FileCopyrightText: 2022 Kareem Abduljaleel - * - * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL - */ - -import QtQuick 2.1 -import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.components 2.0 as PlasmaComponents -import org.kde.kdeconnect 1.0 - -QtObject { - - id: root - - property alias device: checker.device - readonly property alias available: checker.available - - readonly property PluginChecker pluginChecker: PluginChecker { - id: checker - pluginName: "photo" - } - - property variant plugin: available ? PhotoDbusInterfaceFactory.create(device.id()) : null -} - diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 7c8d15c56..1f6ad20b4 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -23,7 +23,6 @@ add_subdirectory(presenter) if((WIN32 AND MSVC AND (${CMAKE_SYSTEM_VERSION} VERSION_GREATER_EQUAL 10.0.17763.0)) OR (NOT WIN32 AND NOT APPLE)) add_subdirectory(mpriscontrol) endif() -add_subdirectory(photo) add_subdirectory(mprisremote) if(NOT APPLE) add_subdirectory(lockdevice) diff --git a/plugins/photo/CMakeLists.txt b/plugins/photo/CMakeLists.txt deleted file mode 100644 index 86aa350cd..000000000 --- a/plugins/photo/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -kdeconnect_add_plugin(kdeconnect_photo SOURCES photoplugin.cpp) -target_link_libraries(kdeconnect_photo - kdeconnectcore - Qt::DBus -) diff --git a/plugins/photo/kdeconnect_photo.json b/plugins/photo/kdeconnect_photo.json deleted file mode 100644 index 800ac99a4..000000000 --- a/plugins/photo/kdeconnect_photo.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "KPlugin": { - "Authors": [ - { - "Email": "nicolas.fella@gmx.de", - "Name": "Nicolas Fella", - "Name[ar]": "نيكولاس فلا", - "Name[az]": "Nicolas Fella", - "Name[bg]": "Nicolas Fella", - "Name[ca@valencia]": "Nicolas Fella", - "Name[ca]": "Nicolas Fella", - "Name[cs]": "Nicolas Fella", - "Name[da]": "Nicolas Fella", - "Name[de]": "Nicolas Fella", - "Name[el]": "Nicolas Fella", - "Name[en_GB]": "Nicolas Fella", - "Name[eo]": "Nicolas Fella", - "Name[es]": "Nicolas Fella", - "Name[et]": "Nicolas Fella", - "Name[eu]": "Nicolas Fella", - "Name[fi]": "Nicolas Fella", - "Name[fr]": "Nicolas Fella", - "Name[gl]": "Nicolas Fella", - "Name[hu]": "Nicolas Fella", - "Name[ia]": "Nicolas Fella", - "Name[id]": "Nicolas Fella", - "Name[ie]": "Nicolas Fella", - "Name[is]": "Nicolas Fella", - "Name[it]": "Nicolas Fella", - "Name[ka]": "Nicolas Fella", - "Name[ko]": "Nicolas Fella", - "Name[lt]": "Nicolas Fella", - "Name[nl]": "Nicolas Fella", - "Name[nn]": "Nicolas Fella", - "Name[pl]": "Nicolas Fella", - "Name[pt]": "Nicolas Fella", - "Name[pt_BR]": "Nicolas Fella", - "Name[ro]": "Nicolas Fella", - "Name[ru]": "Nicolas Fella", - "Name[sk]": "Nicolas Fella", - "Name[sl]": "Nicolas Fella", - "Name[sv]": "Nicolas Fella", - "Name[tr]": "Nicolas Fella", - "Name[uk]": "Nicolas Fella", - "Name[x-test]": "xxNicolas Fellaxx", - "Name[zh_CN]": "Nicolas Fella", - "Name[zh_TW]": "Nicolas Fella" - } - ], - "Description": "Use a connected device to take a photo", - "Description[ar]": "استعمل الجهاز المتصل لأخذ صورة", - "Description[az]": "Qoşulmuş cihazla şəkil çəkmək", - "Description[bg]": "Снимане с камерата на свързаното устройство", - "Description[ca@valencia]": "Utilitza un dispositiu connectat per a prendre una fotografia", - "Description[ca]": "Usa un dispositiu connectat per a prendre una fotografia", - "Description[cs]": "Použít připojené zařízení pro pořízení fotografie", - "Description[da]": "Brug en tilsluttet enhed til at tage et foto", - "Description[de]": "Ein Foto auf einem verbundenen Gerät aufnehmen", - "Description[el]": "Χρήση συνδεδεμένης συσκευής για λήψη φωτογραφίας", - "Description[en_GB]": "Use a connected device to take a photo", - "Description[eo]": "Uzi konektitan aparaton por fari foton", - "Description[es]": "Usar un dispositivo conectado para tomar una fotografía", - "Description[et]": "Ühendatud seadme kasutamine foto tegemiseks", - "Description[eu]": "Erabili konektatutako gailu bat argazki bat ateratzeko", - "Description[fi]": "Ota yhdistetyllä laitteella valokuva", - "Description[fr]": "Utiliser un périphérique connecté pour prendre une photo", - "Description[gl]": "Usar un dispositivo conectado para sacar unha foto.", - "Description[hu]": "A csatlakoztatott eszköz használata fénykép készítésére", - "Description[ia]": "Usa un dispositivo connectite pro prender un photo", - "Description[id]": "Gunakan peranti yang terhubung untuk mengambil foto", - "Description[is]": "Nota tengt tæki til að taka mynd", - "Description[it]": "Usa un dispositivo connesso per scattare una foto", - "Description[ka]": "მიერთებული მოწყობილობის სურათის გადასაღებად გამოყენება", - "Description[ko]": "연결된 장치로 사진 찍기", - "Description[lt]": "Naudoti prijungtą įrenginį, siekiant padaryti nuotrauką", - "Description[nl]": "Gebruik een verbonden apparaat om een foto te nemen", - "Description[nn]": "Bruk tilkopla eining til å ta eit bilete", - "Description[pl]": "Wykonuje zdjęcia na innym urządzeniu", - "Description[pt]": "Usar um dispositivo ligado para tirar uma fotografia", - "Description[pt_BR]": "Usa um dispositivo conectado para tirar uma foto", - "Description[ro]": "Folosiți un dispozitiv conectat pentru a face o poză", - "Description[ru]": "Использование подключённого устройства для фотографирования", - "Description[sk]": "Použitie pripojeného zariadenia na zachytenie fotografie", - "Description[sl]": "Uporabi povezano napravo za zajem fotografije", - "Description[sv]": "Använd en ansluten apparat för att ta ett foto", - "Description[tr]": "Fotoğraf çekmek için bağlı bir aygıt kullan", - "Description[uk]": "Скористатися з'єднаним пристроєм для фотографування", - "Description[x-test]": "xxUse a connected device to take a photoxx", - "Description[zh_CN]": "使用连接的设备拍照", - "Description[zh_TW]": "使用連結裝置拍照", - "EnabledByDefault": true, - "Icon": "camera-photo", - "License": "GPL", - "Name": "Photo", - "Name[ar]": "صورة", - "Name[az]": "Foto", - "Name[bg]": "Снимка", - "Name[ca@valencia]": "Fotografia", - "Name[ca]": "Fotografia", - "Name[cs]": "Fotka", - "Name[da]": "Foto", - "Name[de]": "Foto", - "Name[el]": "Φωτογραφία", - "Name[en_GB]": "Photo", - "Name[eo]": "Foto", - "Name[es]": "Fotografía", - "Name[et]": "Foto", - "Name[eu]": "Argazkia", - "Name[fi]": "Valokuva", - "Name[fr]": "Photo", - "Name[gl]": "Foto", - "Name[hu]": "Fénykép", - "Name[ia]": "Photo", - "Name[id]": "Foto", - "Name[ie]": "Foto", - "Name[is]": "Ljósmynd", - "Name[it]": "Foto", - "Name[ka]": "სურათი", - "Name[ko]": "사진", - "Name[lt]": "Nuotrauka", - "Name[nl]": "Foto", - "Name[nn]": "Foto", - "Name[pl]": "Robienie zdjęć", - "Name[pt]": "Fotografia", - "Name[pt_BR]": "Foto", - "Name[ro]": "Poză", - "Name[ru]": "Фото", - "Name[sk]": "Fotografia", - "Name[sl]": "FOtografija", - "Name[sv]": "Foto", - "Name[tg]": "Сурат", - "Name[tr]": "Fotoğraf", - "Name[uk]": "Фото", - "Name[x-test]": "xxPhotoxx", - "Name[zh_CN]": "照片", - "Name[zh_TW]": "相片" - }, - "X-KdeConnect-OutgoingPacketType": [ - "kdeconnect.photo.request" - ], - "X-KdeConnect-SupportedPacketType": [ - "kdeconnect.photo" - ] -} diff --git a/plugins/photo/photoplugin.cpp b/plugins/photo/photoplugin.cpp deleted file mode 100644 index 85264c12c..000000000 --- a/plugins/photo/photoplugin.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/** - * SPDX-FileCopyrightText: 2019 Nicolas Fella - * - * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL - */ - -#include "photoplugin.h" - -#include - -#include - -#include "plugin_photo_debug.h" -#include - -K_PLUGIN_CLASS_WITH_JSON(PhotoPlugin, "kdeconnect_photo.json") - -void PhotoPlugin::receivePacket(const NetworkPacket &np) -{ - if (np.get(QStringLiteral("cancel"))) { - requestedFiles.takeFirst(); - } - - if (requestedFiles.isEmpty() || !np.hasPayload()) { - return; - } - - const QString url = requestedFiles.takeFirst(); - FileTransferJob *job = np.createPayloadTransferJob(QUrl(url)); - connect(job, &FileTransferJob::result, this, [this, url] { - Q_EMIT photoReceived(url); - }); - job->start(); -} - -void PhotoPlugin::requestPhoto(const QString &url) -{ - requestedFiles.append(url); - NetworkPacket np(PACKET_TYPE_PHOTO_REQUEST); - sendPacket(np); -} - -QString PhotoPlugin::dbusPath() const -{ - return QLatin1String("/modules/kdeconnect/devices/%1/photo").arg(device()->id()); -} - -#include "moc_photoplugin.cpp" -#include "photoplugin.moc" diff --git a/plugins/photo/photoplugin.h b/plugins/photo/photoplugin.h deleted file mode 100644 index bf1e31bb2..000000000 --- a/plugins/photo/photoplugin.h +++ /dev/null @@ -1,35 +0,0 @@ -/** - * SPDX-FileCopyrightText: 2019 Nicolas Fella - * - * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL - */ - -#pragma once - -class QObject; - -#include - -#define PACKET_TYPE_PHOTO_REQUEST QStringLiteral("kdeconnect.photo.request") -#define PACKET_TYPE_PHOTO QStringLiteral("kdeconnect.photo") - -class PhotoPlugin : public KdeConnectPlugin -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.photo") - -public: - using KdeConnectPlugin::KdeConnectPlugin; - - Q_SCRIPTABLE void requestPhoto(const QString &url); - - void receivePacket(const NetworkPacket &np) override; - - QString dbusPath() const override; - -Q_SIGNALS: - Q_SCRIPTABLE void photoReceived(const QString &url); - -private: - QStringList requestedFiles; -};