Merge branch 'master' into 1.x
# Conflicts: # indicator/org.kde.kdeconnect.nonplasma.desktop # org.kde.kdeconnect.kcm.appdata.xml # plugins/runcommand/kdeconnect_runcommand.json # urlhandler/org.kde.kdeconnect.telhandler.desktop
This commit is contained in:
commit
ef0e80c91f
29 changed files with 105 additions and 53 deletions
|
@ -90,7 +90,7 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
const QStringList devices = blockOnReply<QStringList>(iface.devices(paired, reachable));
|
const QStringList devices = blockOnReply<QStringList>(iface.devices(paired, reachable));
|
||||||
|
|
||||||
Q_FOREACH (const QString& id, devices) {
|
for (const QString& id : devices) {
|
||||||
if (parser.isSet(QStringLiteral("id-only"))) {
|
if (parser.isSet(QStringLiteral("id-only"))) {
|
||||||
QTextStream(stdout) << id << endl;
|
QTextStream(stdout) << id << endl;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -114,9 +114,9 @@ void BluetoothLinkProvider::addLink(BluetoothDeviceLink* deviceLink, const QStri
|
||||||
//I'm the new device and I found an existing device
|
//I'm the new device and I found an existing device
|
||||||
void BluetoothLinkProvider::serviceDiscoveryFinished()
|
void BluetoothLinkProvider::serviceDiscoveryFinished()
|
||||||
{
|
{
|
||||||
QList<QBluetoothServiceInfo> services = mServiceDiscoveryAgent->discoveredServices();
|
const QList<QBluetoothServiceInfo> services = mServiceDiscoveryAgent->discoveredServices();
|
||||||
|
|
||||||
Q_FOREACH (QBluetoothServiceInfo info, services) {
|
for (QBluetoothServiceInfo info : services) {
|
||||||
if (mSockets.contains(info.device().address())) {
|
if (mSockets.contains(info.device().address())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,23 @@ void LanDeviceLink::reset(QSslSocket* socket, ConnectionStarted connectionSource
|
||||||
DeviceLink::setPairStatus(certString.isEmpty()? PairStatus::NotPaired : PairStatus::Paired);
|
DeviceLink::setPairStatus(certString.isEmpty()? PairStatus::NotPaired : PairStatus::Paired);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QHostAddress LanDeviceLink::hostAddress() const
|
||||||
|
{
|
||||||
|
if (!mSocketLineReader) {
|
||||||
|
return QHostAddress::Null;
|
||||||
|
}
|
||||||
|
QHostAddress addr = mSocketLineReader->mSocket->peerAddress();
|
||||||
|
if (addr.protocol() == QAbstractSocket::IPv6Protocol) {
|
||||||
|
bool success;
|
||||||
|
QHostAddress convertedAddr = QHostAddress(addr.toIPv4Address(&success));
|
||||||
|
if (success) {
|
||||||
|
qCDebug(KDECONNECT_CORE) << "Converting IPv6" << addr << "to IPv4" << convertedAddr;
|
||||||
|
addr = convertedAddr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return addr;
|
||||||
|
}
|
||||||
|
|
||||||
QString LanDeviceLink::name()
|
QString LanDeviceLink::name()
|
||||||
{
|
{
|
||||||
return QStringLiteral("LanLink"); // Should be same in both android and kde version
|
return QStringLiteral("LanLink"); // Should be same in both android and kde version
|
||||||
|
|
|
@ -54,12 +54,15 @@ public:
|
||||||
|
|
||||||
bool linkShouldBeKeptAlive() override;
|
bool linkShouldBeKeptAlive() override;
|
||||||
|
|
||||||
|
QHostAddress hostAddress() const;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void dataReceived();
|
void dataReceived();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SocketLineReader* mSocketLineReader;
|
SocketLineReader* mSocketLineReader;
|
||||||
ConnectionStarted mConnectionSource;
|
ConnectionStarted mConnectionSource;
|
||||||
|
QHostAddress mHostAddress;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -78,12 +78,12 @@ Daemon::Daemon(QObject *parent, bool testMode)
|
||||||
|
|
||||||
//Read remebered paired devices
|
//Read remebered paired devices
|
||||||
const QStringList& list = KdeConnectConfig::instance()->trustedDevices();
|
const QStringList& list = KdeConnectConfig::instance()->trustedDevices();
|
||||||
Q_FOREACH (const QString& id, list) {
|
for (const QString& id : list) {
|
||||||
addDevice(new Device(this, id));
|
addDevice(new Device(this, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Listen to new devices
|
//Listen to new devices
|
||||||
Q_FOREACH (LinkProvider* a, d->mLinkProviders) {
|
for (LinkProvider* a : qAsConst(d->mLinkProviders)) {
|
||||||
connect(a, &LinkProvider::onConnectionReceived,
|
connect(a, &LinkProvider::onConnectionReceived,
|
||||||
this, &Daemon::onNewDeviceLink);
|
this, &Daemon::onNewDeviceLink);
|
||||||
a->onStart();
|
a->onStart();
|
||||||
|
@ -127,7 +127,7 @@ void Daemon::removeDevice(Device* device)
|
||||||
|
|
||||||
void Daemon::cleanDevices()
|
void Daemon::cleanDevices()
|
||||||
{
|
{
|
||||||
Q_FOREACH (Device* device, d->mDevices) {
|
for (Device* device : qAsConst(d->mDevices)) {
|
||||||
if (device->isTrusted()) {
|
if (device->isTrusted()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -142,14 +142,14 @@ void Daemon::cleanDevices()
|
||||||
void Daemon::forceOnNetworkChange()
|
void Daemon::forceOnNetworkChange()
|
||||||
{
|
{
|
||||||
qCDebug(KDECONNECT_CORE) << "Sending onNetworkChange to " << d->mLinkProviders.size() << " LinkProviders";
|
qCDebug(KDECONNECT_CORE) << "Sending onNetworkChange to " << d->mLinkProviders.size() << " LinkProviders";
|
||||||
Q_FOREACH (LinkProvider* a, d->mLinkProviders) {
|
for (LinkProvider* a : qAsConst(d->mLinkProviders)) {
|
||||||
a->onNetworkChange();
|
a->onNetworkChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Device*Daemon::getDevice(const QString& deviceId)
|
Device*Daemon::getDevice(const QString& deviceId)
|
||||||
{
|
{
|
||||||
Q_FOREACH (Device* device, d->mDevices) {
|
for (Device* device : qAsConst(d->mDevices)) {
|
||||||
if (device->id() == deviceId) {
|
if (device->id() == deviceId) {
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ Device*Daemon::getDevice(const QString& deviceId)
|
||||||
QStringList Daemon::devices(bool onlyReachable, bool onlyTrusted) const
|
QStringList Daemon::devices(bool onlyReachable, bool onlyTrusted) const
|
||||||
{
|
{
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
Q_FOREACH (Device* device, d->mDevices) {
|
for (Device* device : qAsConst(d->mDevices)) {
|
||||||
if (onlyReachable && !device->isReachable()) continue;
|
if (onlyReachable && !device->isReachable()) continue;
|
||||||
if (onlyTrusted && !device->isTrusted()) continue;
|
if (onlyTrusted && !device->isTrusted()) continue;
|
||||||
ret.append(device->id());
|
ret.append(device->id());
|
||||||
|
@ -244,9 +244,9 @@ bool Daemon::isDiscoveringDevices() const
|
||||||
|
|
||||||
QString Daemon::deviceIdByName(const QString &name) const
|
QString Daemon::deviceIdByName(const QString &name) const
|
||||||
{
|
{
|
||||||
Q_FOREACH (Device* d, d->mDevices) {
|
for (Device* device : qAsConst(d->mDevices)) {
|
||||||
if (d->name() == name && d->isTrusted())
|
if (device->name() == name && device->isTrusted())
|
||||||
return d->id();
|
return device->id();
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "kdeconnectplugin.h"
|
#include "kdeconnectplugin.h"
|
||||||
#include "pluginloader.h"
|
#include "pluginloader.h"
|
||||||
#include "backends/devicelink.h"
|
#include "backends/devicelink.h"
|
||||||
|
#include "backends/lan/landevicelink.h"
|
||||||
#include "backends/linkprovider.h"
|
#include "backends/linkprovider.h"
|
||||||
#include "networkpackage.h"
|
#include "networkpackage.h"
|
||||||
#include "kdeconnectconfig.h"
|
#include "kdeconnectconfig.h"
|
||||||
|
@ -102,7 +103,7 @@ void Device::reloadPlugins()
|
||||||
|
|
||||||
PluginLoader* loader = PluginLoader::instance();
|
PluginLoader* loader = PluginLoader::instance();
|
||||||
|
|
||||||
Q_FOREACH (const QString& pluginName, m_supportedPlugins) {
|
for (const QString& pluginName : qAsConst(m_supportedPlugins)) {
|
||||||
const KPluginMetaData service = loader->getPluginInfo(pluginName);
|
const KPluginMetaData service = loader->getPluginInfo(pluginName);
|
||||||
|
|
||||||
const bool pluginEnabled = isPluginEnabled(pluginName);
|
const bool pluginEnabled = isPluginEnabled(pluginName);
|
||||||
|
@ -116,7 +117,7 @@ void Device::reloadPlugins()
|
||||||
}
|
}
|
||||||
Q_ASSERT(plugin);
|
Q_ASSERT(plugin);
|
||||||
|
|
||||||
Q_FOREACH (const QString& interface, incomingCapabilities) {
|
for (const QString& interface : incomingCapabilities) {
|
||||||
newPluginsByIncomingCapability.insert(interface, plugin);
|
newPluginsByIncomingCapability.insert(interface, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +135,7 @@ void Device::reloadPlugins()
|
||||||
m_pluginsByIncomingCapability = newPluginsByIncomingCapability;
|
m_pluginsByIncomingCapability = newPluginsByIncomingCapability;
|
||||||
|
|
||||||
QDBusConnection bus = QDBusConnection::sessionBus();
|
QDBusConnection bus = QDBusConnection::sessionBus();
|
||||||
Q_FOREACH(KdeConnectPlugin* plugin, m_plugins) {
|
for (KdeConnectPlugin* plugin : qAsConst(m_plugins)) {
|
||||||
//TODO: see how it works in Android (only done once, when created)
|
//TODO: see how it works in Android (only done once, when created)
|
||||||
plugin->connected();
|
plugin->connected();
|
||||||
|
|
||||||
|
@ -165,14 +166,14 @@ void Device::requestPair()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_FOREACH(DeviceLink* dl, m_deviceLinks) {
|
for (DeviceLink* dl : qAsConst(m_deviceLinks)) {
|
||||||
dl->userRequestsPair();
|
dl->userRequestsPair();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Device::unpair()
|
void Device::unpair()
|
||||||
{
|
{
|
||||||
Q_FOREACH(DeviceLink* dl, m_deviceLinks) {
|
for (DeviceLink* dl : qAsConst(m_deviceLinks)) {
|
||||||
dl->userRequestsUnpair();
|
dl->userRequestsUnpair();
|
||||||
}
|
}
|
||||||
KdeConnectConfig::instance()->removeTrustedDevice(id());
|
KdeConnectConfig::instance()->removeTrustedDevice(id());
|
||||||
|
@ -184,7 +185,7 @@ void Device::pairStatusChanged(DeviceLink::PairStatus status)
|
||||||
if (status == DeviceLink::NotPaired) {
|
if (status == DeviceLink::NotPaired) {
|
||||||
KdeConnectConfig::instance()->removeTrustedDevice(id());
|
KdeConnectConfig::instance()->removeTrustedDevice(id());
|
||||||
|
|
||||||
Q_FOREACH(DeviceLink* dl, m_deviceLinks) {
|
for (DeviceLink* dl : qAsConst(m_deviceLinks)) {
|
||||||
if (dl != sender()) {
|
if (dl != sender()) {
|
||||||
dl->setPairStatus(DeviceLink::NotPaired);
|
dl->setPairStatus(DeviceLink::NotPaired);
|
||||||
}
|
}
|
||||||
|
@ -325,7 +326,7 @@ bool Device::sendPackage(NetworkPackage& np)
|
||||||
Q_ASSERT(isTrusted());
|
Q_ASSERT(isTrusted());
|
||||||
|
|
||||||
//Maybe we could block here any package that is not an identity or a pairing package to prevent sending non encrypted data
|
//Maybe we could block here any package that is not an identity or a pairing package to prevent sending non encrypted data
|
||||||
Q_FOREACH(DeviceLink* dl, m_deviceLinks) {
|
for (DeviceLink* dl : qAsConst(m_deviceLinks)) {
|
||||||
if (dl->sendPackage(np)) return true;
|
if (dl->sendPackage(np)) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,7 +341,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
|
||||||
if (plugins.isEmpty()) {
|
if (plugins.isEmpty()) {
|
||||||
qWarning() << "discarding unsupported package" << np.type() << "for" << name();
|
qWarning() << "discarding unsupported package" << np.type() << "for" << name();
|
||||||
}
|
}
|
||||||
Q_FOREACH (KdeConnectPlugin* plugin, plugins) {
|
for (KdeConnectPlugin* plugin : plugins) {
|
||||||
plugin->receivePackage(np);
|
plugin->receivePackage(np);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -359,7 +360,7 @@ QStringList Device::availableLinks() const
|
||||||
{
|
{
|
||||||
QStringList sl;
|
QStringList sl;
|
||||||
sl.reserve(m_deviceLinks.size());
|
sl.reserve(m_deviceLinks.size());
|
||||||
Q_FOREACH(DeviceLink* dl, m_deviceLinks) {
|
for (DeviceLink* dl : qAsConst(m_deviceLinks)) {
|
||||||
sl.append(dl->provider()->name());
|
sl.append(dl->provider()->name());
|
||||||
}
|
}
|
||||||
return sl;
|
return sl;
|
||||||
|
@ -380,6 +381,17 @@ void Device::cleanUnneededLinks() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QHostAddress Device::getLocalIpAddress() const
|
||||||
|
{
|
||||||
|
for (DeviceLink* dl : m_deviceLinks) {
|
||||||
|
LanDeviceLink* ldl = dynamic_cast<LanDeviceLink*>(dl);
|
||||||
|
if (ldl) {
|
||||||
|
return ldl->hostAddress();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QHostAddress::Null;
|
||||||
|
}
|
||||||
|
|
||||||
Device::DeviceType Device::str2type(const QString &deviceType) {
|
Device::DeviceType Device::str2type(const QString &deviceType) {
|
||||||
if (deviceType == QLatin1String("desktop")) return Desktop;
|
if (deviceType == QLatin1String("desktop")) return Desktop;
|
||||||
if (deviceType == QLatin1String("laptop")) return Laptop;
|
if (deviceType == QLatin1String("laptop")) return Laptop;
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
#include <QHostAddress>
|
||||||
|
|
||||||
#include "networkpackage.h"
|
#include "networkpackage.h"
|
||||||
#include "backends/devicelink.h"
|
#include "backends/devicelink.h"
|
||||||
|
@ -103,6 +104,8 @@ public:
|
||||||
int protocolVersion() { return m_protocolVersion; }
|
int protocolVersion() { return m_protocolVersion; }
|
||||||
QStringList supportedPlugins() const { return m_supportedPlugins.toList(); }
|
QStringList supportedPlugins() const { return m_supportedPlugins.toList(); }
|
||||||
|
|
||||||
|
QHostAddress getLocalIpAddress() const;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
///sends a @p np package to the device
|
///sends a @p np package to the device
|
||||||
///virtual for testing purposes.
|
///virtual for testing purposes.
|
||||||
|
|
|
@ -36,8 +36,8 @@ PluginLoader* PluginLoader::instance()
|
||||||
|
|
||||||
PluginLoader::PluginLoader()
|
PluginLoader::PluginLoader()
|
||||||
{
|
{
|
||||||
QVector<KPluginMetaData> data = KPluginLoader::findPlugins(QStringLiteral("kdeconnect/"));
|
const QVector<KPluginMetaData> data = KPluginLoader::findPlugins(QStringLiteral("kdeconnect/"));
|
||||||
Q_FOREACH (const KPluginMetaData& metadata, data) {
|
for (const KPluginMetaData& metadata : data) {
|
||||||
plugins[metadata.pluginId()] = metadata;
|
plugins[metadata.pluginId()] = metadata;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ KdeConnectPlugin* PluginLoader::instantiatePluginForDevice(const QString& plugin
|
||||||
QStringList PluginLoader::incomingCapabilities() const
|
QStringList PluginLoader::incomingCapabilities() const
|
||||||
{
|
{
|
||||||
QSet<QString> ret;
|
QSet<QString> ret;
|
||||||
Q_FOREACH (const KPluginMetaData& service, plugins) {
|
for (const KPluginMetaData& service : qAsConst(plugins)) {
|
||||||
ret += KPluginMetaData::readStringList(service.rawData(), QStringLiteral("X-KdeConnect-SupportedPackageType")).toSet();
|
ret += KPluginMetaData::readStringList(service.rawData(), QStringLiteral("X-KdeConnect-SupportedPackageType")).toSet();
|
||||||
}
|
}
|
||||||
return ret.toList();
|
return ret.toList();
|
||||||
|
@ -95,7 +95,7 @@ QStringList PluginLoader::incomingCapabilities() const
|
||||||
QStringList PluginLoader::outgoingCapabilities() const
|
QStringList PluginLoader::outgoingCapabilities() const
|
||||||
{
|
{
|
||||||
QSet<QString> ret;
|
QSet<QString> ret;
|
||||||
Q_FOREACH (const KPluginMetaData& service, plugins) {
|
for (const KPluginMetaData& service : qAsConst(plugins)) {
|
||||||
ret += KPluginMetaData::readStringList(service.rawData(), QStringLiteral("X-KdeConnect-OutgoingPackageType")).toSet();
|
ret += KPluginMetaData::readStringList(service.rawData(), QStringLiteral("X-KdeConnect-OutgoingPackageType")).toSet();
|
||||||
}
|
}
|
||||||
return ret.toList();
|
return ret.toList();
|
||||||
|
@ -105,7 +105,7 @@ QSet<QString> PluginLoader::pluginsForCapabilities(const QSet<QString>& incoming
|
||||||
{
|
{
|
||||||
QSet<QString> ret;
|
QSet<QString> ret;
|
||||||
|
|
||||||
Q_FOREACH (const KPluginMetaData& service, plugins) {
|
for (const KPluginMetaData& service : qAsConst(plugins)) {
|
||||||
const QSet<QString> pluginIncomingCapabilities = KPluginMetaData::readStringList(service.rawData(), QStringLiteral("X-KdeConnect-SupportedPackageType")).toSet();
|
const QSet<QString> pluginIncomingCapabilities = KPluginMetaData::readStringList(service.rawData(), QStringLiteral("X-KdeConnect-SupportedPackageType")).toSet();
|
||||||
const QSet<QString> pluginOutgoingCapabilities = KPluginMetaData::readStringList(service.rawData(), QStringLiteral("X-KdeConnect-OutgoingPackageType")).toSet();
|
const QSet<QString> pluginOutgoingCapabilities = KPluginMetaData::readStringList(service.rawData(), QStringLiteral("X-KdeConnect-OutgoingPackageType")).toSet();
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ X-KDE-Submenu[fi]=Yhdistä
|
||||||
X-KDE-Submenu[fr]=Connecter
|
X-KDE-Submenu[fr]=Connecter
|
||||||
X-KDE-Submenu[gl]=Conectar
|
X-KDE-Submenu[gl]=Conectar
|
||||||
X-KDE-Submenu[hu]=Csatlakozás
|
X-KDE-Submenu[hu]=Csatlakozás
|
||||||
|
X-KDE-Submenu[ia]=Connecte
|
||||||
X-KDE-Submenu[it]=Connetti
|
X-KDE-Submenu[it]=Connetti
|
||||||
X-KDE-Submenu[ko]=연결
|
X-KDE-Submenu[ko]=연결
|
||||||
X-KDE-Submenu[nl]=Verbinden
|
X-KDE-Submenu[nl]=Verbinden
|
||||||
|
|
|
@ -55,7 +55,7 @@ QList<QAction*> SendFileItemAction::actions(const KFileItemListProperties& fileI
|
||||||
QDBusPendingReply<QStringList> reply = iface.devices(true, true);
|
QDBusPendingReply<QStringList> reply = iface.devices(true, true);
|
||||||
reply.waitForFinished();
|
reply.waitForFinished();
|
||||||
const QStringList devices = reply.value();
|
const QStringList devices = reply.value();
|
||||||
Q_FOREACH (const QString& id, devices) {
|
for (const QString& id : devices) {
|
||||||
DeviceDbusInterface deviceIface(id);
|
DeviceDbusInterface deviceIface(id);
|
||||||
if (!deviceIface.isValid()) {
|
if (!deviceIface.isValid()) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -87,9 +87,9 @@ QList<QAction*> SendFileItemAction::actions(const KFileItemListProperties& fileI
|
||||||
|
|
||||||
void SendFileItemAction::sendFile()
|
void SendFileItemAction::sendFile()
|
||||||
{
|
{
|
||||||
QList<QUrl> urls = sender()->property("urls").value<QList<QUrl>>();
|
const QList<QUrl> urls = sender()->property("urls").value<QList<QUrl>>();
|
||||||
QString id = sender()->property("id").toString();
|
QString id = sender()->property("id").toString();
|
||||||
Q_FOREACH (const QUrl& url, urls) {
|
for (const QUrl& url : urls) {
|
||||||
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+id+"/share", QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrl"));
|
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+id+"/share", QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrl"));
|
||||||
msg.setArguments(QVariantList() << url.toString());
|
msg.setArguments(QVariantList() << url.toString());
|
||||||
QDBusConnection::sessionBus().call(msg);
|
QDBusConnection::sessionBus().call(msg);
|
||||||
|
|
0
indicator/org.kde.kdeconnect.nonplasma.desktop
Executable file → Normal file
0
indicator/org.kde.kdeconnect.nonplasma.desktop
Executable file → Normal file
|
@ -203,7 +203,7 @@ void DevicesModel::receivedDeviceList(QDBusPendingCallWatcher* watcher)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
beginInsertRows(QModelIndex(), 0, deviceIds.count()-1);
|
beginInsertRows(QModelIndex(), 0, deviceIds.count()-1);
|
||||||
Q_FOREACH(const QString& id, deviceIds) {
|
for (const QString& id : deviceIds) {
|
||||||
appendDevice(new DeviceDbusInterface(id, this));
|
appendDevice(new DeviceDbusInterface(id, this));
|
||||||
}
|
}
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
|
@ -155,7 +155,7 @@ void NotificationsModel::receivedNotifications(QDBusPendingCallWatcher* watcher)
|
||||||
}
|
}
|
||||||
|
|
||||||
beginInsertRows(QModelIndex(), 0, notificationIds.size() - 1);
|
beginInsertRows(QModelIndex(), 0, notificationIds.size() - 1);
|
||||||
Q_FOREACH (const QString& notificationId, notificationIds) {
|
for (const QString& notificationId : notificationIds) {
|
||||||
NotificationDbusInterface* dbusInterface = new NotificationDbusInterface(m_deviceId, notificationId, this);
|
NotificationDbusInterface* dbusInterface = new NotificationDbusInterface(m_deviceId, notificationId, this);
|
||||||
m_notificationList.append(dbusInterface);
|
m_notificationList.append(dbusInterface);
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ int NotificationsModel::rowCount(const QModelIndex& parent) const
|
||||||
|
|
||||||
bool NotificationsModel::isAnyDimissable() const
|
bool NotificationsModel::isAnyDimissable() const
|
||||||
{
|
{
|
||||||
Q_FOREACH (NotificationDbusInterface* notification, m_notificationList) {
|
for (NotificationDbusInterface* notification : qAsConst(m_notificationList)) {
|
||||||
if (notification->dismissable()) {
|
if (notification->dismissable()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ bool NotificationsModel::isAnyDimissable() const
|
||||||
|
|
||||||
void NotificationsModel::dismissAll()
|
void NotificationsModel::dismissAll()
|
||||||
{
|
{
|
||||||
Q_FOREACH (NotificationDbusInterface* notification, m_notificationList) {
|
for (NotificationDbusInterface* notification : qAsConst(m_notificationList)) {
|
||||||
if (notification->dismissable()) {
|
if (notification->dismissable()) {
|
||||||
notification->dismiss();
|
notification->dismiss();
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,9 +84,9 @@ void KioKdeconnect::listAllDevices()
|
||||||
infoMessage(i18n("Listing devices..."));
|
infoMessage(i18n("Listing devices..."));
|
||||||
|
|
||||||
//TODO: Change to all devices and show different icons for connected and disconnected?
|
//TODO: Change to all devices and show different icons for connected and disconnected?
|
||||||
QStringList devices = m_dbusInterface->devices(true, true);
|
const QStringList devices = m_dbusInterface->devices(true, true);
|
||||||
|
|
||||||
Q_FOREACH(const QString& deviceId, devices) {
|
for (const QString& deviceId : devices) {
|
||||||
|
|
||||||
DeviceDbusInterface interface(deviceId);
|
DeviceDbusInterface interface(deviceId);
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ void DBusAsyncResponse::onTimeout()
|
||||||
|
|
||||||
const QDBusPendingCall* DBusResponseWaiter::extractPendingCall(QVariant& variant) const
|
const QDBusPendingCall* DBusResponseWaiter::extractPendingCall(QVariant& variant) const
|
||||||
{
|
{
|
||||||
Q_FOREACH(int type, m_registered)
|
for (int type : qAsConst(m_registered))
|
||||||
{
|
{
|
||||||
if (variant.canConvert(QVariant::Type(type)))
|
if (variant.canConvert(QVariant::Type(type)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
"Name[fr]": "Moniteur de batterie",
|
"Name[fr]": "Moniteur de batterie",
|
||||||
"Name[gl]": "Vixilante da batería",
|
"Name[gl]": "Vixilante da batería",
|
||||||
"Name[hu]": "Akkumulátorfigyelő",
|
"Name[hu]": "Akkumulátorfigyelő",
|
||||||
|
"Name[ia]": "Controlator de batteria",
|
||||||
"Name[it]": "Monitor della batteria",
|
"Name[it]": "Monitor della batteria",
|
||||||
"Name[ko]": "배터리 모니터",
|
"Name[ko]": "배터리 모니터",
|
||||||
"Name[nl]": "Batterijmonitor",
|
"Name[nl]": "Batterijmonitor",
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
"Name[fr]": "Presse-papiers",
|
"Name[fr]": "Presse-papiers",
|
||||||
"Name[gl]": "Portapapeis",
|
"Name[gl]": "Portapapeis",
|
||||||
"Name[hu]": "Vágólap",
|
"Name[hu]": "Vágólap",
|
||||||
|
"Name[ia]": "Area de transferentia",
|
||||||
"Name[it]": "Appunti",
|
"Name[it]": "Appunti",
|
||||||
"Name[ko]": "클립보드",
|
"Name[ko]": "클립보드",
|
||||||
"Name[nl]": "Klembord",
|
"Name[nl]": "Klembord",
|
||||||
|
|
|
@ -153,6 +153,7 @@ Name[fi]=Saapuva puhelu
|
||||||
Name[fr]=Appel entrant
|
Name[fr]=Appel entrant
|
||||||
Name[gl]=Chamada entrante
|
Name[gl]=Chamada entrante
|
||||||
Name[hu]=Bejövő hívás
|
Name[hu]=Bejövő hívás
|
||||||
|
Name[ia]=Appello in arrivata
|
||||||
Name[it]=Chiamata in ingresso
|
Name[it]=Chiamata in ingresso
|
||||||
Name[ko]=수신 전화
|
Name[ko]=수신 전화
|
||||||
Name[nl]=Inkomende oproep
|
Name[nl]=Inkomende oproep
|
||||||
|
@ -366,6 +367,7 @@ Name[fi]=Akku vähissä
|
||||||
Name[fr]=Batterie faible
|
Name[fr]=Batterie faible
|
||||||
Name[gl]=Batería baixa
|
Name[gl]=Batería baixa
|
||||||
Name[hu]=Alacsony töltöttség
|
Name[hu]=Alacsony töltöttség
|
||||||
|
Name[ia]=Batteria basse
|
||||||
Name[it]=Batteria a livello basso
|
Name[it]=Batteria a livello basso
|
||||||
Name[ko]=배터리 부족
|
Name[ko]=배터리 부족
|
||||||
Name[nl]=Batterij op laag niveau
|
Name[nl]=Batterij op laag niveau
|
||||||
|
@ -579,6 +581,7 @@ Name[fi]=Tiedostonsiirto
|
||||||
Name[fr]=Transfert de fichiers
|
Name[fr]=Transfert de fichiers
|
||||||
Name[gl]=Transferencia dun ficheiro
|
Name[gl]=Transferencia dun ficheiro
|
||||||
Name[hu]=Fájlátvitel
|
Name[hu]=Fájlátvitel
|
||||||
|
Name[ia]=Transferimento de file
|
||||||
Name[it]=Trasferimento file
|
Name[it]=Trasferimento file
|
||||||
Name[ko]=파일 전송
|
Name[ko]=파일 전송
|
||||||
Name[nl]=Bestandsoverdracht
|
Name[nl]=Bestandsoverdracht
|
||||||
|
|
|
@ -48,8 +48,8 @@ MprisControlPlugin::MprisControlPlugin(QObject* parent, const QVariantList& args
|
||||||
connect(QDBusConnection::sessionBus().interface(), &QDBusConnectionInterface::serviceOwnerChanged, this, &MprisControlPlugin::serviceOwnerChanged);
|
connect(QDBusConnection::sessionBus().interface(), &QDBusConnectionInterface::serviceOwnerChanged, this, &MprisControlPlugin::serviceOwnerChanged);
|
||||||
|
|
||||||
//Add existing interfaces
|
//Add existing interfaces
|
||||||
QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
|
const QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
|
||||||
Q_FOREACH (const QString& service, services) {
|
for (const QString& service : services) {
|
||||||
// The string doesn't matter, it just needs to be empty/non-empty
|
// The string doesn't matter, it just needs to be empty/non-empty
|
||||||
serviceOwnerChanged(service, QLatin1String(""), QStringLiteral("1"));
|
serviceOwnerChanged(service, QLatin1String(""), QStringLiteral("1"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ void NotificationsDbusInterface::processPackage(const NetworkPackage& np)
|
||||||
id = id.mid(id.indexOf(QLatin1String("::")) + 2);
|
id = id.mid(id.indexOf(QLatin1String("::")) + 2);
|
||||||
removeNotification(id);
|
removeNotification(id);
|
||||||
} else if (np.get<bool>(QStringLiteral("isRequest"))) {
|
} else if (np.get<bool>(QStringLiteral("isRequest"))) {
|
||||||
Q_FOREACH (const auto& n, mNotifications) {
|
for (const auto& n : qAsConst(mNotifications)) {
|
||||||
NetworkPackage np(PACKAGE_TYPE_NOTIFICATION_REQUEST, {
|
NetworkPackage np(PACKAGE_TYPE_NOTIFICATION_REQUEST, {
|
||||||
{"id", n->internalId()},
|
{"id", n->internalId()},
|
||||||
{"appName", n->appName()},
|
{"appName", n->appName()},
|
||||||
|
|
|
@ -90,8 +90,8 @@ bool PauseMusicPlugin::receivePackage(const NetworkPackage& np)
|
||||||
|
|
||||||
if (pause) {
|
if (pause) {
|
||||||
//Search for interfaces currently playing
|
//Search for interfaces currently playing
|
||||||
QStringList interfaces = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
|
const QStringList interfaces = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
|
||||||
Q_FOREACH (const QString& iface, interfaces) {
|
for (const QString& iface : interfaces) {
|
||||||
if (iface.startsWith(QLatin1String("org.mpris.MediaPlayer2"))) {
|
if (iface.startsWith(QLatin1String("org.mpris.MediaPlayer2"))) {
|
||||||
QDBusInterface mprisInterface(iface, QStringLiteral("/org/mpris/MediaPlayer2"), QStringLiteral("org.mpris.MediaPlayer2.Player"));
|
QDBusInterface mprisInterface(iface, QStringLiteral("/org/mpris/MediaPlayer2"), QStringLiteral("org.mpris.MediaPlayer2.Player"));
|
||||||
QString status = mprisInterface.property("PlaybackStatus").toString();
|
QString status = mprisInterface.property("PlaybackStatus").toString();
|
||||||
|
@ -120,7 +120,7 @@ bool PauseMusicPlugin::receivePackage(const NetworkPackage& np)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pause && !pausedSources.empty()) {
|
if (pause && !pausedSources.empty()) {
|
||||||
Q_FOREACH (const QString& iface, pausedSources) {
|
for (const QString& iface : qAsConst(pausedSources)) {
|
||||||
QDBusInterface mprisInterface(iface, QStringLiteral("/org/mpris/MediaPlayer2"), QStringLiteral("org.mpris.MediaPlayer2.Player"));
|
QDBusInterface mprisInterface(iface, QStringLiteral("/org/mpris/MediaPlayer2"), QStringLiteral("org.mpris.MediaPlayer2.Player"));
|
||||||
mprisInterface.asyncCall(QStringLiteral("PlayPause"));
|
mprisInterface.asyncCall(QStringLiteral("PlayPause"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,8 @@ void RunCommandConfig::load()
|
||||||
|
|
||||||
QJsonDocument jsonDocument = QJsonDocument::fromJson(config()->get<QByteArray>(QStringLiteral("commands"), "{}"));
|
QJsonDocument jsonDocument = QJsonDocument::fromJson(config()->get<QByteArray>(QStringLiteral("commands"), "{}"));
|
||||||
QJsonObject jsonConfig = jsonDocument.object();
|
QJsonObject jsonConfig = jsonDocument.object();
|
||||||
Q_FOREACH (const QString &key, jsonConfig.keys()) {
|
const QStringList keys = jsonConfig.keys();
|
||||||
|
for (const QString& key : keys) {
|
||||||
const QJsonObject entry = jsonConfig[key].toObject();
|
const QJsonObject entry = jsonConfig[key].toObject();
|
||||||
const QString name = entry[QStringLiteral("name")].toString();
|
const QString name = entry[QStringLiteral("name")].toString();
|
||||||
const QString command = entry[QStringLiteral("command")].toString();
|
const QString command = entry[QStringLiteral("command")].toString();
|
||||||
|
|
|
@ -97,8 +97,8 @@ void NotificationsListener::setTranslatedAppName()
|
||||||
void NotificationsListener::loadApplications()
|
void NotificationsListener::loadApplications()
|
||||||
{
|
{
|
||||||
applications.clear();
|
applications.clear();
|
||||||
QVariantList list = mPlugin->config()->getList(QStringLiteral("applications"));
|
const QVariantList list = mPlugin->config()->getList(QStringLiteral("applications"));
|
||||||
Q_FOREACH (const auto& a, list) {
|
for (const auto& a : list) {
|
||||||
NotifyingApplication app = a.value<NotifyingApplication>();
|
NotifyingApplication app = a.value<NotifyingApplication>();
|
||||||
if (!applications.contains(app.name))
|
if (!applications.contains(app.name))
|
||||||
applications.insert(app.name, app);
|
applications.insert(app.name, app);
|
||||||
|
@ -204,7 +204,7 @@ uint NotificationsListener::Notify(const QString &appName, uint replacesId,
|
||||||
applications.insert(app.name, app);
|
applications.insert(app.name, app);
|
||||||
// update config:
|
// update config:
|
||||||
QVariantList list;
|
QVariantList list;
|
||||||
Q_FOREACH (const auto& a, applications)
|
for (const auto& a : qAsConst(applications))
|
||||||
list << QVariant::fromValue<NotifyingApplication>(a);
|
list << QVariant::fromValue<NotifyingApplication>(a);
|
||||||
mPlugin->config()->setList(QStringLiteral("applications"), list);
|
mPlugin->config()->setList(QStringLiteral("applications"), list);
|
||||||
//qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Added new application to config:" << app;
|
//qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Added new application to config:" << app;
|
||||||
|
|
|
@ -113,10 +113,17 @@ void Mounter::onPakcageReceived(const NetworkPackage& np)
|
||||||
if (np.has(QStringLiteral("multiPaths"))) path = '/';
|
if (np.has(QStringLiteral("multiPaths"))) path = '/';
|
||||||
else path = np.get<QString>(QStringLiteral("path"));
|
else path = np.get<QString>(QStringLiteral("path"));
|
||||||
|
|
||||||
|
QHostAddress addr = m_sftp->device()->getLocalIpAddress();
|
||||||
|
if (addr == QHostAddress::Null) {
|
||||||
|
qCDebug(KDECONNECT_PLUGIN_SFTP) << "Device doesn't have a LanDeviceLink, unable to get IP address";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QString ip = addr.toString();
|
||||||
|
|
||||||
const QStringList arguments = QStringList()
|
const QStringList arguments = QStringList()
|
||||||
<< QStringLiteral("%1@%2:%3").arg(
|
<< QStringLiteral("%1@%2:%3").arg(
|
||||||
np.get<QString>(QStringLiteral("user")),
|
np.get<QString>(QStringLiteral("user")),
|
||||||
np.get<QString>(QStringLiteral("ip")),
|
ip,
|
||||||
path)
|
path)
|
||||||
<< m_mountPoint
|
<< m_mountPoint
|
||||||
<< QStringLiteral("-p") << np.get<QString>(QStringLiteral("port"))
|
<< QStringLiteral("-p") << np.get<QString>(QStringLiteral("port"))
|
||||||
|
|
|
@ -48,7 +48,8 @@ class PluginLoadTest : public QObject
|
||||||
void testPlugins() {
|
void testPlugins() {
|
||||||
Device* d = nullptr;
|
Device* d = nullptr;
|
||||||
mDaemon->acquireDiscoveryMode(QStringLiteral("plugintest"));
|
mDaemon->acquireDiscoveryMode(QStringLiteral("plugintest"));
|
||||||
Q_FOREACH(Device* id, mDaemon->devicesList()) {
|
const QList<Device*> devicesList = mDaemon->devicesList();
|
||||||
|
for (Device* id : devicesList) {
|
||||||
if (id->isReachable()) {
|
if (id->isReachable()) {
|
||||||
if (!id->isTrusted())
|
if (!id->isTrusted())
|
||||||
id->requestPair();
|
id->requestPair();
|
||||||
|
|
|
@ -52,7 +52,8 @@ class TestSendFile : public QObject
|
||||||
void testSend() {
|
void testSend() {
|
||||||
mDaemon->acquireDiscoveryMode(QStringLiteral("test"));
|
mDaemon->acquireDiscoveryMode(QStringLiteral("test"));
|
||||||
Device* d = nullptr;
|
Device* d = nullptr;
|
||||||
Q_FOREACH(Device* id, mDaemon->devicesList()) {
|
const QList<Device*> devicesList = mDaemon->devicesList();
|
||||||
|
for (Device* id : devicesList) {
|
||||||
if (id->isReachable()) {
|
if (id->isReachable()) {
|
||||||
if (!id->isTrusted())
|
if (!id->isTrusted())
|
||||||
id->requestPair();
|
id->requestPair();
|
||||||
|
|
|
@ -354,7 +354,8 @@ void TestNotificationListener::testNotify()
|
||||||
QStringList iconPaths;
|
QStringList iconPaths;
|
||||||
// appIcon
|
// appIcon
|
||||||
int count = 0;
|
int count = 0;
|
||||||
Q_FOREACH (const auto& iconName, KIconLoader::global()->queryIcons(-KIconLoader::SizeEnormous, KIconLoader::Application)) {
|
const QStringList icons = KIconLoader::global()->queryIcons(-KIconLoader::SizeEnormous, KIconLoader::Application);
|
||||||
|
for (const auto& iconName : icons) {
|
||||||
if (!iconName.endsWith(QLatin1String(".png")))
|
if (!iconName.endsWith(QLatin1String(".png")))
|
||||||
continue;
|
continue;
|
||||||
if (count++ > 3) // max 3 iterations
|
if (count++ > 3) // max 3 iterations
|
||||||
|
|
|
@ -67,7 +67,7 @@ void TestSocketLineReader::socketLineReader()
|
||||||
{
|
{
|
||||||
QList<QByteArray> dataToSend;
|
QList<QByteArray> dataToSend;
|
||||||
dataToSend << "foobar\n" << "barfoo\n" << "foobar?\n" << "\n" << "barfoo!\n" << "panda\n";
|
dataToSend << "foobar\n" << "barfoo\n" << "foobar?\n" << "\n" << "barfoo!\n" << "panda\n";
|
||||||
Q_FOREACH(const QByteArray &line, dataToSend) {
|
for (const QByteArray& line : dataToSend) {
|
||||||
mConn->write(line);
|
mConn->write(line);
|
||||||
}
|
}
|
||||||
mConn->flush();
|
mConn->flush();
|
||||||
|
|
|
@ -138,7 +138,7 @@ void TestSslSocketLineReader::testTrustedDevice()
|
||||||
|
|
||||||
QList<QByteArray> dataToSend;
|
QList<QByteArray> dataToSend;
|
||||||
dataToSend << "foobar\n" << "barfoo\n" << "foobar?\n" << "\n" << "barfoo!\n" << "panda\n";
|
dataToSend << "foobar\n" << "barfoo\n" << "foobar?\n" << "\n" << "barfoo!\n" << "panda\n";
|
||||||
Q_FOREACH(const QByteArray &line, dataToSend) {
|
for (const QByteArray &line : dataToSend) {
|
||||||
mClientSocket->write(line);
|
mClientSocket->write(line);
|
||||||
}
|
}
|
||||||
mClientSocket->flush();
|
mClientSocket->flush();
|
||||||
|
@ -197,7 +197,7 @@ void TestSslSocketLineReader::testUntrustedDevice()
|
||||||
|
|
||||||
QList<QByteArray> dataToSend;
|
QList<QByteArray> dataToSend;
|
||||||
dataToSend << "foobar\n" << "barfoo\n" << "foobar?\n" << "\n" << "barfoo!\n" << "panda\n";
|
dataToSend << "foobar\n" << "barfoo\n" << "foobar?\n" << "\n" << "barfoo!\n" << "panda\n";
|
||||||
Q_FOREACH(const QByteArray &line, dataToSend) {
|
for (const QByteArray &line : dataToSend) {
|
||||||
mClientSocket->write(line);
|
mClientSocket->write(line);
|
||||||
}
|
}
|
||||||
mClientSocket->flush();
|
mClientSocket->flush();
|
||||||
|
|
Loading…
Reference in a new issue