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));
|
||||
|
||||
Q_FOREACH (const QString& id, devices) {
|
||||
for (const QString& id : devices) {
|
||||
if (parser.isSet(QStringLiteral("id-only"))) {
|
||||
QTextStream(stdout) << id << endl;
|
||||
} else {
|
||||
|
|
|
@ -114,9 +114,9 @@ void BluetoothLinkProvider::addLink(BluetoothDeviceLink* deviceLink, const QStri
|
|||
//I'm the new device and I found an existing device
|
||||
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())) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -60,6 +60,23 @@ void LanDeviceLink::reset(QSslSocket* socket, ConnectionStarted connectionSource
|
|||
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()
|
||||
{
|
||||
return QStringLiteral("LanLink"); // Should be same in both android and kde version
|
||||
|
|
|
@ -54,12 +54,15 @@ public:
|
|||
|
||||
bool linkShouldBeKeptAlive() override;
|
||||
|
||||
QHostAddress hostAddress() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void dataReceived();
|
||||
|
||||
private:
|
||||
SocketLineReader* mSocketLineReader;
|
||||
ConnectionStarted mConnectionSource;
|
||||
QHostAddress mHostAddress;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -78,12 +78,12 @@ Daemon::Daemon(QObject *parent, bool testMode)
|
|||
|
||||
//Read remebered paired devices
|
||||
const QStringList& list = KdeConnectConfig::instance()->trustedDevices();
|
||||
Q_FOREACH (const QString& id, list) {
|
||||
for (const QString& id : list) {
|
||||
addDevice(new Device(this, id));
|
||||
}
|
||||
|
||||
//Listen to new devices
|
||||
Q_FOREACH (LinkProvider* a, d->mLinkProviders) {
|
||||
for (LinkProvider* a : qAsConst(d->mLinkProviders)) {
|
||||
connect(a, &LinkProvider::onConnectionReceived,
|
||||
this, &Daemon::onNewDeviceLink);
|
||||
a->onStart();
|
||||
|
@ -127,7 +127,7 @@ void Daemon::removeDevice(Device* device)
|
|||
|
||||
void Daemon::cleanDevices()
|
||||
{
|
||||
Q_FOREACH (Device* device, d->mDevices) {
|
||||
for (Device* device : qAsConst(d->mDevices)) {
|
||||
if (device->isTrusted()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -142,14 +142,14 @@ void Daemon::cleanDevices()
|
|||
void Daemon::forceOnNetworkChange()
|
||||
{
|
||||
qCDebug(KDECONNECT_CORE) << "Sending onNetworkChange to " << d->mLinkProviders.size() << " LinkProviders";
|
||||
Q_FOREACH (LinkProvider* a, d->mLinkProviders) {
|
||||
for (LinkProvider* a : qAsConst(d->mLinkProviders)) {
|
||||
a->onNetworkChange();
|
||||
}
|
||||
}
|
||||
|
||||
Device*Daemon::getDevice(const QString& deviceId)
|
||||
{
|
||||
Q_FOREACH (Device* device, d->mDevices) {
|
||||
for (Device* device : qAsConst(d->mDevices)) {
|
||||
if (device->id() == deviceId) {
|
||||
return device;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ Device*Daemon::getDevice(const QString& deviceId)
|
|||
QStringList Daemon::devices(bool onlyReachable, bool onlyTrusted) const
|
||||
{
|
||||
QStringList ret;
|
||||
Q_FOREACH (Device* device, d->mDevices) {
|
||||
for (Device* device : qAsConst(d->mDevices)) {
|
||||
if (onlyReachable && !device->isReachable()) continue;
|
||||
if (onlyTrusted && !device->isTrusted()) continue;
|
||||
ret.append(device->id());
|
||||
|
@ -244,9 +244,9 @@ bool Daemon::isDiscoveringDevices() const
|
|||
|
||||
QString Daemon::deviceIdByName(const QString &name) const
|
||||
{
|
||||
Q_FOREACH (Device* d, d->mDevices) {
|
||||
if (d->name() == name && d->isTrusted())
|
||||
return d->id();
|
||||
for (Device* device : qAsConst(d->mDevices)) {
|
||||
if (device->name() == name && device->isTrusted())
|
||||
return device->id();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "kdeconnectplugin.h"
|
||||
#include "pluginloader.h"
|
||||
#include "backends/devicelink.h"
|
||||
#include "backends/lan/landevicelink.h"
|
||||
#include "backends/linkprovider.h"
|
||||
#include "networkpackage.h"
|
||||
#include "kdeconnectconfig.h"
|
||||
|
@ -102,7 +103,7 @@ void Device::reloadPlugins()
|
|||
|
||||
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 bool pluginEnabled = isPluginEnabled(pluginName);
|
||||
|
@ -116,7 +117,7 @@ void Device::reloadPlugins()
|
|||
}
|
||||
Q_ASSERT(plugin);
|
||||
|
||||
Q_FOREACH (const QString& interface, incomingCapabilities) {
|
||||
for (const QString& interface : incomingCapabilities) {
|
||||
newPluginsByIncomingCapability.insert(interface, plugin);
|
||||
}
|
||||
|
||||
|
@ -134,7 +135,7 @@ void Device::reloadPlugins()
|
|||
m_pluginsByIncomingCapability = newPluginsByIncomingCapability;
|
||||
|
||||
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)
|
||||
plugin->connected();
|
||||
|
||||
|
@ -165,14 +166,14 @@ void Device::requestPair()
|
|||
return;
|
||||
}
|
||||
|
||||
Q_FOREACH(DeviceLink* dl, m_deviceLinks) {
|
||||
for (DeviceLink* dl : qAsConst(m_deviceLinks)) {
|
||||
dl->userRequestsPair();
|
||||
}
|
||||
}
|
||||
|
||||
void Device::unpair()
|
||||
{
|
||||
Q_FOREACH(DeviceLink* dl, m_deviceLinks) {
|
||||
for (DeviceLink* dl : qAsConst(m_deviceLinks)) {
|
||||
dl->userRequestsUnpair();
|
||||
}
|
||||
KdeConnectConfig::instance()->removeTrustedDevice(id());
|
||||
|
@ -184,7 +185,7 @@ void Device::pairStatusChanged(DeviceLink::PairStatus status)
|
|||
if (status == DeviceLink::NotPaired) {
|
||||
KdeConnectConfig::instance()->removeTrustedDevice(id());
|
||||
|
||||
Q_FOREACH(DeviceLink* dl, m_deviceLinks) {
|
||||
for (DeviceLink* dl : qAsConst(m_deviceLinks)) {
|
||||
if (dl != sender()) {
|
||||
dl->setPairStatus(DeviceLink::NotPaired);
|
||||
}
|
||||
|
@ -325,7 +326,7 @@ bool Device::sendPackage(NetworkPackage& np)
|
|||
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
|
||||
Q_FOREACH(DeviceLink* dl, m_deviceLinks) {
|
||||
for (DeviceLink* dl : qAsConst(m_deviceLinks)) {
|
||||
if (dl->sendPackage(np)) return true;
|
||||
}
|
||||
|
||||
|
@ -340,7 +341,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
|
|||
if (plugins.isEmpty()) {
|
||||
qWarning() << "discarding unsupported package" << np.type() << "for" << name();
|
||||
}
|
||||
Q_FOREACH (KdeConnectPlugin* plugin, plugins) {
|
||||
for (KdeConnectPlugin* plugin : plugins) {
|
||||
plugin->receivePackage(np);
|
||||
}
|
||||
} else {
|
||||
|
@ -359,7 +360,7 @@ QStringList Device::availableLinks() const
|
|||
{
|
||||
QStringList sl;
|
||||
sl.reserve(m_deviceLinks.size());
|
||||
Q_FOREACH(DeviceLink* dl, m_deviceLinks) {
|
||||
for (DeviceLink* dl : qAsConst(m_deviceLinks)) {
|
||||
sl.append(dl->provider()->name());
|
||||
}
|
||||
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) {
|
||||
if (deviceType == QLatin1String("desktop")) return Desktop;
|
||||
if (deviceType == QLatin1String("laptop")) return Laptop;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QSet>
|
||||
#include <QHostAddress>
|
||||
|
||||
#include "networkpackage.h"
|
||||
#include "backends/devicelink.h"
|
||||
|
@ -103,6 +104,8 @@ public:
|
|||
int protocolVersion() { return m_protocolVersion; }
|
||||
QStringList supportedPlugins() const { return m_supportedPlugins.toList(); }
|
||||
|
||||
QHostAddress getLocalIpAddress() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
///sends a @p np package to the device
|
||||
///virtual for testing purposes.
|
||||
|
|
|
@ -36,8 +36,8 @@ PluginLoader* PluginLoader::instance()
|
|||
|
||||
PluginLoader::PluginLoader()
|
||||
{
|
||||
QVector<KPluginMetaData> data = KPluginLoader::findPlugins(QStringLiteral("kdeconnect/"));
|
||||
Q_FOREACH (const KPluginMetaData& metadata, data) {
|
||||
const QVector<KPluginMetaData> data = KPluginLoader::findPlugins(QStringLiteral("kdeconnect/"));
|
||||
for (const KPluginMetaData& metadata : data) {
|
||||
plugins[metadata.pluginId()] = metadata;
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ KdeConnectPlugin* PluginLoader::instantiatePluginForDevice(const QString& plugin
|
|||
QStringList PluginLoader::incomingCapabilities() const
|
||||
{
|
||||
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();
|
||||
}
|
||||
return ret.toList();
|
||||
|
@ -95,7 +95,7 @@ QStringList PluginLoader::incomingCapabilities() const
|
|||
QStringList PluginLoader::outgoingCapabilities() const
|
||||
{
|
||||
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();
|
||||
}
|
||||
return ret.toList();
|
||||
|
@ -105,7 +105,7 @@ QSet<QString> PluginLoader::pluginsForCapabilities(const QSet<QString>& incoming
|
|||
{
|
||||
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> 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[gl]=Conectar
|
||||
X-KDE-Submenu[hu]=Csatlakozás
|
||||
X-KDE-Submenu[ia]=Connecte
|
||||
X-KDE-Submenu[it]=Connetti
|
||||
X-KDE-Submenu[ko]=연결
|
||||
X-KDE-Submenu[nl]=Verbinden
|
||||
|
|
|
@ -55,7 +55,7 @@ QList<QAction*> SendFileItemAction::actions(const KFileItemListProperties& fileI
|
|||
QDBusPendingReply<QStringList> reply = iface.devices(true, true);
|
||||
reply.waitForFinished();
|
||||
const QStringList devices = reply.value();
|
||||
Q_FOREACH (const QString& id, devices) {
|
||||
for (const QString& id : devices) {
|
||||
DeviceDbusInterface deviceIface(id);
|
||||
if (!deviceIface.isValid()) {
|
||||
continue;
|
||||
|
@ -87,9 +87,9 @@ QList<QAction*> SendFileItemAction::actions(const KFileItemListProperties& fileI
|
|||
|
||||
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();
|
||||
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"));
|
||||
msg.setArguments(QVariantList() << url.toString());
|
||||
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;
|
||||
|
||||
beginInsertRows(QModelIndex(), 0, deviceIds.count()-1);
|
||||
Q_FOREACH(const QString& id, deviceIds) {
|
||||
for (const QString& id : deviceIds) {
|
||||
appendDevice(new DeviceDbusInterface(id, this));
|
||||
}
|
||||
endInsertRows();
|
||||
|
|
|
@ -155,7 +155,7 @@ void NotificationsModel::receivedNotifications(QDBusPendingCallWatcher* watcher)
|
|||
}
|
||||
|
||||
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);
|
||||
m_notificationList.append(dbusInterface);
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ int NotificationsModel::rowCount(const QModelIndex& parent) const
|
|||
|
||||
bool NotificationsModel::isAnyDimissable() const
|
||||
{
|
||||
Q_FOREACH (NotificationDbusInterface* notification, m_notificationList) {
|
||||
for (NotificationDbusInterface* notification : qAsConst(m_notificationList)) {
|
||||
if (notification->dismissable()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ bool NotificationsModel::isAnyDimissable() const
|
|||
|
||||
void NotificationsModel::dismissAll()
|
||||
{
|
||||
Q_FOREACH (NotificationDbusInterface* notification, m_notificationList) {
|
||||
for (NotificationDbusInterface* notification : qAsConst(m_notificationList)) {
|
||||
if (notification->dismissable()) {
|
||||
notification->dismiss();
|
||||
}
|
||||
|
|
|
@ -84,9 +84,9 @@ void KioKdeconnect::listAllDevices()
|
|||
infoMessage(i18n("Listing devices..."));
|
||||
|
||||
//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);
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ void DBusAsyncResponse::onTimeout()
|
|||
|
||||
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)))
|
||||
{
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
"Name[fr]": "Moniteur de batterie",
|
||||
"Name[gl]": "Vixilante da batería",
|
||||
"Name[hu]": "Akkumulátorfigyelő",
|
||||
"Name[ia]": "Controlator de batteria",
|
||||
"Name[it]": "Monitor della batteria",
|
||||
"Name[ko]": "배터리 모니터",
|
||||
"Name[nl]": "Batterijmonitor",
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
"Name[fr]": "Presse-papiers",
|
||||
"Name[gl]": "Portapapeis",
|
||||
"Name[hu]": "Vágólap",
|
||||
"Name[ia]": "Area de transferentia",
|
||||
"Name[it]": "Appunti",
|
||||
"Name[ko]": "클립보드",
|
||||
"Name[nl]": "Klembord",
|
||||
|
|
|
@ -153,6 +153,7 @@ Name[fi]=Saapuva puhelu
|
|||
Name[fr]=Appel entrant
|
||||
Name[gl]=Chamada entrante
|
||||
Name[hu]=Bejövő hívás
|
||||
Name[ia]=Appello in arrivata
|
||||
Name[it]=Chiamata in ingresso
|
||||
Name[ko]=수신 전화
|
||||
Name[nl]=Inkomende oproep
|
||||
|
@ -366,6 +367,7 @@ Name[fi]=Akku vähissä
|
|||
Name[fr]=Batterie faible
|
||||
Name[gl]=Batería baixa
|
||||
Name[hu]=Alacsony töltöttség
|
||||
Name[ia]=Batteria basse
|
||||
Name[it]=Batteria a livello basso
|
||||
Name[ko]=배터리 부족
|
||||
Name[nl]=Batterij op laag niveau
|
||||
|
@ -579,6 +581,7 @@ Name[fi]=Tiedostonsiirto
|
|||
Name[fr]=Transfert de fichiers
|
||||
Name[gl]=Transferencia dun ficheiro
|
||||
Name[hu]=Fájlátvitel
|
||||
Name[ia]=Transferimento de file
|
||||
Name[it]=Trasferimento file
|
||||
Name[ko]=파일 전송
|
||||
Name[nl]=Bestandsoverdracht
|
||||
|
|
|
@ -48,8 +48,8 @@ MprisControlPlugin::MprisControlPlugin(QObject* parent, const QVariantList& args
|
|||
connect(QDBusConnection::sessionBus().interface(), &QDBusConnectionInterface::serviceOwnerChanged, this, &MprisControlPlugin::serviceOwnerChanged);
|
||||
|
||||
//Add existing interfaces
|
||||
QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
|
||||
Q_FOREACH (const QString& service, services) {
|
||||
const QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
|
||||
for (const QString& service : services) {
|
||||
// The string doesn't matter, it just needs to be empty/non-empty
|
||||
serviceOwnerChanged(service, QLatin1String(""), QStringLiteral("1"));
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ void NotificationsDbusInterface::processPackage(const NetworkPackage& np)
|
|||
id = id.mid(id.indexOf(QLatin1String("::")) + 2);
|
||||
removeNotification(id);
|
||||
} 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, {
|
||||
{"id", n->internalId()},
|
||||
{"appName", n->appName()},
|
||||
|
|
|
@ -90,8 +90,8 @@ bool PauseMusicPlugin::receivePackage(const NetworkPackage& np)
|
|||
|
||||
if (pause) {
|
||||
//Search for interfaces currently playing
|
||||
QStringList interfaces = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
|
||||
Q_FOREACH (const QString& iface, interfaces) {
|
||||
const QStringList interfaces = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
|
||||
for (const QString& iface : interfaces) {
|
||||
if (iface.startsWith(QLatin1String("org.mpris.MediaPlayer2"))) {
|
||||
QDBusInterface mprisInterface(iface, QStringLiteral("/org/mpris/MediaPlayer2"), QStringLiteral("org.mpris.MediaPlayer2.Player"));
|
||||
QString status = mprisInterface.property("PlaybackStatus").toString();
|
||||
|
@ -120,7 +120,7 @@ bool PauseMusicPlugin::receivePackage(const NetworkPackage& np)
|
|||
}
|
||||
|
||||
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"));
|
||||
mprisInterface.asyncCall(QStringLiteral("PlayPause"));
|
||||
}
|
||||
|
|
|
@ -70,7 +70,8 @@ void RunCommandConfig::load()
|
|||
|
||||
QJsonDocument jsonDocument = QJsonDocument::fromJson(config()->get<QByteArray>(QStringLiteral("commands"), "{}"));
|
||||
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 QString name = entry[QStringLiteral("name")].toString();
|
||||
const QString command = entry[QStringLiteral("command")].toString();
|
||||
|
|
|
@ -97,8 +97,8 @@ void NotificationsListener::setTranslatedAppName()
|
|||
void NotificationsListener::loadApplications()
|
||||
{
|
||||
applications.clear();
|
||||
QVariantList list = mPlugin->config()->getList(QStringLiteral("applications"));
|
||||
Q_FOREACH (const auto& a, list) {
|
||||
const QVariantList list = mPlugin->config()->getList(QStringLiteral("applications"));
|
||||
for (const auto& a : list) {
|
||||
NotifyingApplication app = a.value<NotifyingApplication>();
|
||||
if (!applications.contains(app.name))
|
||||
applications.insert(app.name, app);
|
||||
|
@ -204,7 +204,7 @@ uint NotificationsListener::Notify(const QString &appName, uint replacesId,
|
|||
applications.insert(app.name, app);
|
||||
// update config:
|
||||
QVariantList list;
|
||||
Q_FOREACH (const auto& a, applications)
|
||||
for (const auto& a : qAsConst(applications))
|
||||
list << QVariant::fromValue<NotifyingApplication>(a);
|
||||
mPlugin->config()->setList(QStringLiteral("applications"), list);
|
||||
//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 = '/';
|
||||
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()
|
||||
<< QStringLiteral("%1@%2:%3").arg(
|
||||
np.get<QString>(QStringLiteral("user")),
|
||||
np.get<QString>(QStringLiteral("ip")),
|
||||
ip,
|
||||
path)
|
||||
<< m_mountPoint
|
||||
<< QStringLiteral("-p") << np.get<QString>(QStringLiteral("port"))
|
||||
|
|
|
@ -48,7 +48,8 @@ class PluginLoadTest : public QObject
|
|||
void testPlugins() {
|
||||
Device* d = nullptr;
|
||||
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->isTrusted())
|
||||
id->requestPair();
|
||||
|
|
|
@ -52,7 +52,8 @@ class TestSendFile : public QObject
|
|||
void testSend() {
|
||||
mDaemon->acquireDiscoveryMode(QStringLiteral("test"));
|
||||
Device* d = nullptr;
|
||||
Q_FOREACH(Device* id, mDaemon->devicesList()) {
|
||||
const QList<Device*> devicesList = mDaemon->devicesList();
|
||||
for (Device* id : devicesList) {
|
||||
if (id->isReachable()) {
|
||||
if (!id->isTrusted())
|
||||
id->requestPair();
|
||||
|
|
|
@ -354,7 +354,8 @@ void TestNotificationListener::testNotify()
|
|||
QStringList iconPaths;
|
||||
// appIcon
|
||||
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")))
|
||||
continue;
|
||||
if (count++ > 3) // max 3 iterations
|
||||
|
|
|
@ -67,7 +67,7 @@ void TestSocketLineReader::socketLineReader()
|
|||
{
|
||||
QList<QByteArray> dataToSend;
|
||||
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->flush();
|
||||
|
|
|
@ -138,7 +138,7 @@ void TestSslSocketLineReader::testTrustedDevice()
|
|||
|
||||
QList<QByteArray> dataToSend;
|
||||
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->flush();
|
||||
|
@ -197,7 +197,7 @@ void TestSslSocketLineReader::testUntrustedDevice()
|
|||
|
||||
QList<QByteArray> dataToSend;
|
||||
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->flush();
|
||||
|
|
Loading…
Reference in a new issue