Changeset View
Changeset View
Standalone View
Standalone View
core/daemon.cpp
Context not available. | |||||
78 | 78 | | |||
---|---|---|---|---|---|
79 | //Read remebered paired devices | 79 | //Read remebered paired devices | ||
80 | const QStringList& list = KdeConnectConfig::instance()->trustedDevices(); | 80 | const QStringList& list = KdeConnectConfig::instance()->trustedDevices(); | ||
81 | Q_FOREACH (const QString& id, list) { | 81 | for (const QString& id : list) { | ||
82 | addDevice(new Device(this, id)); | 82 | addDevice(new Device(this, id)); | ||
83 | } | 83 | } | ||
84 | 84 | | |||
85 | //Listen to new devices | 85 | //Listen to new devices | ||
86 | Q_FOREACH (LinkProvider* a, d->mLinkProviders) { | 86 | for (LinkProvider* a : qAsConst(d->mLinkProviders)) { | ||
87 | connect(a, &LinkProvider::onConnectionReceived, | 87 | connect(a, &LinkProvider::onConnectionReceived, | ||
88 | this, &Daemon::onNewDeviceLink); | 88 | this, &Daemon::onNewDeviceLink); | ||
89 | a->onStart(); | 89 | a->onStart(); | ||
Context not available. | |||||
127 | 127 | | |||
128 | void Daemon::cleanDevices() | 128 | void Daemon::cleanDevices() | ||
129 | { | 129 | { | ||
130 | Q_FOREACH (Device* device, d->mDevices) { | 130 | for (Device* device : qAsConst(d->mDevices)) { | ||
131 | if (device->isTrusted()) { | 131 | if (device->isTrusted()) { | ||
132 | continue; | 132 | continue; | ||
133 | } | 133 | } | ||
Context not available. | |||||
142 | void Daemon::forceOnNetworkChange() | 142 | void Daemon::forceOnNetworkChange() | ||
143 | { | 143 | { | ||
144 | qCDebug(KDECONNECT_CORE) << "Sending onNetworkChange to " << d->mLinkProviders.size() << " LinkProviders"; | 144 | qCDebug(KDECONNECT_CORE) << "Sending onNetworkChange to " << d->mLinkProviders.size() << " LinkProviders"; | ||
145 | Q_FOREACH (LinkProvider* a, d->mLinkProviders) { | 145 | for (LinkProvider* a : qAsConst(d->mLinkProviders)) { | ||
146 | a->onNetworkChange(); | 146 | a->onNetworkChange(); | ||
147 | } | 147 | } | ||
148 | } | 148 | } | ||
149 | 149 | | |||
150 | Device*Daemon::getDevice(const QString& deviceId) | 150 | Device*Daemon::getDevice(const QString& deviceId) | ||
151 | { | 151 | { | ||
152 | Q_FOREACH (Device* device, d->mDevices) { | 152 | for (Device* device : qAsConst(d->mDevices)) { | ||
153 | if (device->id() == deviceId) { | 153 | if (device->id() == deviceId) { | ||
154 | return device; | 154 | return device; | ||
155 | } | 155 | } | ||
Context not available. | |||||
160 | QStringList Daemon::devices(bool onlyReachable, bool onlyTrusted) const | 160 | QStringList Daemon::devices(bool onlyReachable, bool onlyTrusted) const | ||
161 | { | 161 | { | ||
162 | QStringList ret; | 162 | QStringList ret; | ||
163 | Q_FOREACH (Device* device, d->mDevices) { | 163 | for (Device* device : qAsConst(d->mDevices)) { | ||
164 | if (onlyReachable && !device->isReachable()) continue; | 164 | if (onlyReachable && !device->isReachable()) continue; | ||
165 | if (onlyTrusted && !device->isTrusted()) continue; | 165 | if (onlyTrusted && !device->isTrusted()) continue; | ||
166 | ret.append(device->id()); | 166 | ret.append(device->id()); | ||
Context not available. | |||||
244 | 244 | | |||
245 | QString Daemon::deviceIdByName(const QString &name) const | 245 | QString Daemon::deviceIdByName(const QString &name) const | ||
246 | { | 246 | { | ||
247 | Q_FOREACH (Device* d, d->mDevices) { | 247 | for (Device* device : qAsConst(d->mDevices)) { | ||
248 | if (d->name() == name && d->isTrusted()) | 248 | if (device->name() == name && device->isTrusted()) | ||
249 | return d->id(); | 249 | return device->id(); | ||
250 | } | 250 | } | ||
251 | return {}; | 251 | return {}; | ||
252 | } | 252 | } | ||
Context not available. |