diff --git a/app/qml/PluginItem.qml b/app/qml/PluginItem.qml --- a/app/qml/PluginItem.qml +++ b/app/qml/PluginItem.qml @@ -35,6 +35,7 @@ device: deviceView.currentDevice } visible: checker.available + icon: checker.iconName onClicked: { if (component === "" || !interfaceFactory) return; diff --git a/core/device.h b/core/device.h --- a/core/device.h +++ b/core/device.h @@ -120,6 +120,7 @@ Q_SCRIPTABLE void rejectPairing(); Q_SCRIPTABLE bool hasPairingRequests() const; + Q_SCRIPTABLE QString pluginIconName(const QString& pluginName); private Q_SLOTS: void privateReceivedPacket(const NetworkPacket& np); void linkDestroyed(QObject* o); diff --git a/core/device.cpp b/core/device.cpp --- a/core/device.cpp +++ b/core/device.cpp @@ -547,3 +547,10 @@ return result; } +QString Device::pluginIconName(const QString& pluginName) +{ + if (hasPlugin(pluginName)) { + return d->m_plugins[pluginName]->iconName(); + } + return QString(); +} diff --git a/core/kdeconnectplugin.h b/core/kdeconnectplugin.h --- a/core/kdeconnectplugin.h +++ b/core/kdeconnectplugin.h @@ -49,6 +49,8 @@ virtual QString dbusPath() const; + QString iconName() const; + public Q_SLOTS: /** * Returns true if it has handled the packet in some way diff --git a/core/kdeconnectplugin.cpp b/core/kdeconnectplugin.cpp --- a/core/kdeconnectplugin.cpp +++ b/core/kdeconnectplugin.cpp @@ -28,6 +28,7 @@ QString m_pluginName; QSet m_outgoingCapabilties; KdeConnectPluginConfig* m_config; + QString iconName; }; KdeConnectPlugin::KdeConnectPlugin(QObject* parent, const QVariantList& args) @@ -38,6 +39,7 @@ d->m_pluginName = args.at(1).toString(); d->m_outgoingCapabilties = args.at(2).toStringList().toSet(); d->m_config = nullptr; + d->iconName = args.at(3).toString(); } KdeConnectPluginConfig* KdeConnectPlugin::config() const @@ -80,3 +82,8 @@ { return {}; } + +QString KdeConnectPlugin::iconName() const +{ + return d->iconName; +} diff --git a/core/pluginloader.cpp b/core/pluginloader.cpp --- a/core/pluginloader.cpp +++ b/core/pluginloader.cpp @@ -76,7 +76,7 @@ QVariant deviceVariant = QVariant::fromValue(device); - ret = factory->create(device, QVariantList() << deviceVariant << pluginName << outgoingInterfaces); + ret = factory->create(device, QVariantList() << deviceVariant << pluginName << outgoingInterfaces << service.iconName()); if (!ret) { qCDebug(KDECONNECT_CORE) << "Error loading plugin"; return ret; diff --git a/declarativeplugin/qml/PluginChecker.qml b/declarativeplugin/qml/PluginChecker.qml --- a/declarativeplugin/qml/PluginChecker.qml +++ b/declarativeplugin/qml/PluginChecker.qml @@ -29,6 +29,7 @@ property alias device: conn.target property string pluginName: "" property bool available: false + property string iconName: "" readonly property Connections connection: Connections { id: conn @@ -38,13 +39,22 @@ Component.onCompleted: pluginsChanged() readonly property var v: DBusAsyncResponse { - id: response + id: availableResponse autoDelete: false onSuccess: { root.available = result; } onError: { root.available = false } } function pluginsChanged() { - response.setPendingCall(device.hasPlugin("kdeconnect_" + pluginName)) + availableResponse.setPendingCall(device.hasPlugin("kdeconnect_" + pluginName)) + iconResponse.setPendingCall(device.pluginIconName("kdeconnect_" + pluginName)) + + } + + readonly property var vv: DBusAsyncResponse { + id: iconResponse + autoDelete: false + onSuccess: { root.iconName = result; } + onError: { root.iconName = "" } } } diff --git a/plugins/lockdevice/kdeconnect_lockdevice.json b/plugins/lockdevice/kdeconnect_lockdevice.json --- a/plugins/lockdevice/kdeconnect_lockdevice.json +++ b/plugins/lockdevice/kdeconnect_lockdevice.json @@ -46,7 +46,7 @@ "Description[zh_CN]": "锁定您的系统", "Description[zh_TW]": "鎖定您的系統", "EnabledByDefault": true, - "Icon": "applications-miscelaneaous", + "Icon": "lock", "Id": "kdeconnect_lockdevice", "License": "GPL", "Name": "LockDevice", diff --git a/plugins/remotecontrol/kdeconnect_remotecontrol.json b/plugins/remotecontrol/kdeconnect_remotecontrol.json --- a/plugins/remotecontrol/kdeconnect_remotecontrol.json +++ b/plugins/remotecontrol/kdeconnect_remotecontrol.json @@ -46,7 +46,7 @@ "Description[zh_CN]": "控制远程系统", "Description[zh_TW]": "控制遠端系統", "EnabledByDefault": true, - "Icon": "applications-multimedia", + "Icon": "edit-select", "Id": "kdeconnect_remotecontrol", "License": "GPL", "Name": "RemoteControl",