Changeset View
Changeset View
Standalone View
Standalone View
core/device.cpp
Show All 29 Lines | |||||
30 | #include <KSharedConfig> | 30 | #include <KSharedConfig> | ||
31 | #include <KConfigGroup> | 31 | #include <KConfigGroup> | ||
32 | #include <KLocalizedString> | 32 | #include <KLocalizedString> | ||
33 | 33 | | |||
34 | #include "core_debug.h" | 34 | #include "core_debug.h" | ||
35 | #include "kdeconnectplugin.h" | 35 | #include "kdeconnectplugin.h" | ||
36 | #include "pluginloader.h" | 36 | #include "pluginloader.h" | ||
37 | #include "backends/devicelink.h" | 37 | #include "backends/devicelink.h" | ||
38 | #include "backends/lan/landevicelink.h" | ||||
38 | #include "backends/linkprovider.h" | 39 | #include "backends/linkprovider.h" | ||
39 | #include "networkpackage.h" | 40 | #include "networkpackage.h" | ||
40 | #include "kdeconnectconfig.h" | 41 | #include "kdeconnectconfig.h" | ||
41 | #include "daemon.h" | 42 | #include "daemon.h" | ||
42 | 43 | | |||
43 | static void warn(const QString &info) | 44 | static void warn(const QString &info) | ||
44 | { | 45 | { | ||
45 | qWarning() << "Device pairing error" << info; | 46 | qWarning() << "Device pairing error" << info; | ||
▲ Show 20 Lines • Show All 328 Lines • ▼ Show 20 Line(s) | 373 | for(int i = 0; i < m_deviceLinks.size(); ) { | |||
374 | if (!dl->linkShouldBeKeptAlive()) { | 375 | if (!dl->linkShouldBeKeptAlive()) { | ||
375 | dl->deleteLater(); | 376 | dl->deleteLater(); | ||
376 | m_deviceLinks.remove(i); | 377 | m_deviceLinks.remove(i); | ||
377 | } else { | 378 | } else { | ||
378 | i++; | 379 | i++; | ||
379 | } | 380 | } | ||
380 | } | 381 | } | ||
381 | } | 382 | } | ||
382 | 383 | | |||
albertvaka: The id parameter is redundant: All the device links for this device are gonna match the id. | |||||
384 | QHostAddress Device::getLocalIpAddress() const | ||||
385 | { | ||||
386 | for (DeviceLink* dl : m_deviceLinks) { | ||||
387 | LanDeviceLink* ldl = dynamic_cast<LanDeviceLink*>(dl); | ||||
388 | if (ldl) { | ||||
389 | return ldl->hostAddress(); | ||||
390 | } | ||||
391 | } | ||||
392 | return QHostAddress::Null; | ||||
393 | } | ||||
394 | | ||||
383 | Device::DeviceType Device::str2type(const QString &deviceType) { | 395 | Device::DeviceType Device::str2type(const QString &deviceType) { | ||
384 | if (deviceType == QLatin1String("desktop")) return Desktop; | 396 | if (deviceType == QLatin1String("desktop")) return Desktop; | ||
385 | if (deviceType == QLatin1String("laptop")) return Laptop; | 397 | if (deviceType == QLatin1String("laptop")) return Laptop; | ||
386 | if (deviceType == QLatin1String("smartphone") || deviceType == QLatin1String("phone")) return Phone; | 398 | if (deviceType == QLatin1String("smartphone") || deviceType == QLatin1String("phone")) return Phone; | ||
387 | if (deviceType == QLatin1String("tablet")) return Tablet; | 399 | if (deviceType == QLatin1String("tablet")) return Tablet; | ||
388 | return Unknown; | 400 | return Unknown; | ||
389 | } | 401 | } | ||
390 | 402 | | |||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |
The id parameter is redundant: All the device links for this device are gonna match the id.