Add support for sharing text via qml
Summary: This allows you to send a text string from qml, this can be used in the plasmoid and qml app. Reviewers: nicolasfella Reviewed By: nicolasfella Subscribers: kdeconnect Tags: #kde_connect Differential Revision: https://phabricator.kde.org/D16640
This commit is contained in:
parent
276d18a02a
commit
0b72150ed8
2 changed files with 8 additions and 0 deletions
|
@ -166,6 +166,13 @@ void SharePlugin::shareUrl(const QUrl& url)
|
||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SharePlugin::shareText(const QString& text)
|
||||||
|
{
|
||||||
|
NetworkPacket packet(PACKET_TYPE_SHARE_REQUEST);
|
||||||
|
packet.set<QString>(QStringLiteral("text"), text);
|
||||||
|
sendPacket(packet);
|
||||||
|
}
|
||||||
|
|
||||||
QString SharePlugin::dbusPath() const
|
QString SharePlugin::dbusPath() const
|
||||||
{
|
{
|
||||||
return "/modules/kdeconnect/devices/" + device()->id() + "/share";
|
return "/modules/kdeconnect/devices/" + device()->id() + "/share";
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
|
|
||||||
///Helper method, QDBus won't recognize QUrl
|
///Helper method, QDBus won't recognize QUrl
|
||||||
Q_SCRIPTABLE void shareUrl(const QString& url) { shareUrl(QUrl(url)); }
|
Q_SCRIPTABLE void shareUrl(const QString& url) { shareUrl(QUrl(url)); }
|
||||||
|
Q_SCRIPTABLE void shareText(const QString& text);
|
||||||
|
|
||||||
bool receivePacket(const NetworkPacket& np) override;
|
bool receivePacket(const NetworkPacket& np) override;
|
||||||
void connected() override {}
|
void connected() override {}
|
||||||
|
|
Loading…
Reference in a new issue