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.
This commit is contained in:
Albert Vaca Cintora 2023-09-14 08:00:19 +02:00
parent 85897fcdc3
commit cdcf44efa8
13 changed files with 0 additions and 337 deletions

View file

@ -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"),

View file

@ -82,7 +82,6 @@ void KdeConnectDeclarativePlugin::registerTypes(const char *uri)
"RemoteSystemVolumeInterface",
QStringLiteral("You're not supposed to instantiate interfaces"));
qmlRegisterUncreatableType<ShareDbusInterface>(uri, 1, 0, "ShareDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces"));
qmlRegisterUncreatableType<PhotoDbusInterface>(uri, 1, 0, "PhotoDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces"));
qmlRegisterUncreatableType<BigscreenDbusInterface>(uri, 1, 0, "BigscreenDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces"));
qmlRegisterSingletonType<DaemonDbusInterface>(uri, 1, 0, "DaemonDbusInterface", [](QQmlEngine *, QJSEngine *) -> QObject * {
return new DaemonDbusInterface;
@ -117,7 +116,6 @@ void KdeConnectDeclarativePlugin::registerTypes(const char *uri)
registerFactory<SmsDbusInterface>(uri, "SmsDbusInterfaceFactory");
registerFactory<RemoteCommandsDbusInterface>(uri, "RemoteCommandsDbusInterfaceFactory");
registerFactory<ShareDbusInterface>(uri, "ShareDbusInterfaceFactory");
registerFactory<PhotoDbusInterface>(uri, "PhotoDbusInterfaceFactory");
registerFactory<RemoteSystemVolumeDbusInterface>(uri, "RemoteSystemVolumeDbusInterfaceFactory");
registerFactory<BigscreenDbusInterface>(uri, "BigscreenDbusInterfaceFactory");
registerFactory<VirtualmonitorDbusInterface>(uri, "VirtualmonitorDbusInterfaceFactory");

View file

@ -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()) {

View file

@ -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

View file

@ -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),

View file

@ -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

View file

@ -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
}
}
}

View file

@ -1,26 +0,0 @@
/**
* SPDX-FileCopyrightText: 2022 Kareem Abduljaleel <karemjaleel34@gmail.com>
*
* 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
}

View file

@ -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)

View file

@ -1,5 +0,0 @@
kdeconnect_add_plugin(kdeconnect_photo SOURCES photoplugin.cpp)
target_link_libraries(kdeconnect_photo
kdeconnectcore
Qt::DBus
)

View file

@ -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"
]
}

View file

@ -1,49 +0,0 @@
/**
* SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "photoplugin.h"
#include <KPluginFactory>
#include <QDebug>
#include "plugin_photo_debug.h"
#include <core/filetransferjob.h>
K_PLUGIN_CLASS_WITH_JSON(PhotoPlugin, "kdeconnect_photo.json")
void PhotoPlugin::receivePacket(const NetworkPacket &np)
{
if (np.get<bool>(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"

View file

@ -1,35 +0,0 @@
/**
* SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#pragma once
class QObject;
#include <core/kdeconnectplugin.h>
#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;
};