diff --git a/core/backends/bluetooth/bluetoothlinkprovider.cpp b/core/backends/bluetooth/bluetoothlinkprovider.cpp index 60fd3f241..85373ea01 100644 --- a/core/backends/bluetooth/bluetoothlinkprovider.cpp +++ b/core/backends/bluetooth/bluetoothlinkprovider.cpp @@ -47,8 +47,8 @@ void BluetoothLinkProvider::onStart() mKdeconnectService = mBluetoothServer->listen(mServiceUuid, QStringLiteral("KDE Connect")); // Disabled for the moment as once the server is listening, the client will not be able to connect anyway - //mServiceDiscoveryAgent->start(); - //connectTimer->start(); + // mServiceDiscoveryAgent->start(); + // connectTimer->start(); } void BluetoothLinkProvider::onStop() @@ -105,7 +105,9 @@ void BluetoothLinkProvider::serviceDiscovered(const QBluetoothServiceInfo &old_i { qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::serviceDiscovered executed "; - qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::serviceDiscovered info: " << old_info.device().address() << old_info.serviceName() << old_info.serviceDescription() << old_info.socketProtocol() << old_info.isValid() << old_info.isComplete() << old_info.isRegistered() << old_info.serviceClassUuids(); + qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::serviceDiscovered info: " << old_info.device().address() << old_info.serviceName() + << old_info.serviceDescription() << old_info.socketProtocol() << old_info.isValid() << old_info.isComplete() + << old_info.isRegistered() << old_info.serviceClassUuids(); auto info = *(new QBluetoothServiceInfo(old_info)); info.setServiceUuid(mServiceUuid); @@ -113,7 +115,7 @@ void BluetoothLinkProvider::serviceDiscovered(const QBluetoothServiceInfo &old_i qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::serviceDiscovered sockets contains address, returning"; return; } - + qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::serviceDiscovered before creating socket"; QBluetoothSocket *socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol); @@ -134,7 +136,7 @@ void BluetoothLinkProvider::serviceDiscovered(const QBluetoothServiceInfo &old_i #endif qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::serviceDiscovered about to call connectToService"; - + socket->connectToService(info); qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider Connecting to" << info.device().address(); diff --git a/core/backends/bluetooth/connectionmultiplexer.cpp b/core/backends/bluetooth/connectionmultiplexer.cpp index 6745b5825..dfea4032c 100644 --- a/core/backends/bluetooth/connectionmultiplexer.cpp +++ b/core/backends/bluetooth/connectionmultiplexer.cpp @@ -128,13 +128,13 @@ bool ConnectionMultiplexer::tryParseMessage() uint16_t message_length = qFromBigEndian(&header.data()[1]); quint128 message_uuid_raw; - #ifndef QT_SUPPORTS_INT128 +#ifndef QT_SUPPORTS_INT128 for (int i = 0; i < 16; ++i) { message_uuid_raw.data[i] = header[3 + i]; } - #else +#else message_uuid_raw = qFromBigEndian(&header.data()[3]); - #endif +#endif QBluetoothUuid message_uuid = QBluetoothUuid(message_uuid_raw); // Check if we have the full message including its data diff --git a/core/backends/lan/mdns_wrapper.cpp b/core/backends/lan/mdns_wrapper.cpp index 20660722e..826c44a88 100644 --- a/core/backends/lan/mdns_wrapper.cpp +++ b/core/backends/lan/mdns_wrapper.cpp @@ -18,7 +18,6 @@ namespace MdnsWrapper { - const char *recordTypeToStr(int rtype) { switch (rtype) { @@ -79,10 +78,22 @@ static sockaddr_in6 qHostAddressToSockaddr6(QHostAddress hostAddress) } // Callback that handles responses to a query -static int query_callback(int sock, const struct sockaddr* from, size_t addrlen, mdns_entry_type_t entry_type, - uint16_t query_id, uint16_t record_type, uint16_t rclass, uint32_t ttl, const void* data, - size_t size, size_t name_offset, size_t name_length, size_t record_offset, - size_t record_length, void* user_data) { +static int query_callback(int sock, + const struct sockaddr *from, + size_t addrlen, + mdns_entry_type_t entry_type, + uint16_t query_id, + uint16_t record_type, + uint16_t rclass, + uint32_t ttl, + const void *data, + size_t size, + size_t name_offset, + size_t name_length, + size_t record_offset, + size_t record_length, + void *user_data) +{ Q_UNUSED(sock); Q_UNUSED(addrlen); Q_UNUSED(query_id); @@ -92,18 +103,20 @@ static int query_callback(int sock, const struct sockaddr* from, size_t addrlen, Q_UNUSED(name_offset); Q_UNUSED(name_length); - //qCDebug(KDECONNECT_CORE) << "Received DNS record of type" << recordTypeToStr(record_type) << "from socket" << sock << "with type" << entryTypeToStr(entry_type); + // qCDebug(KDECONNECT_CORE) << "Received DNS record of type" << recordTypeToStr(record_type) << "from socket" << sock << "with type" << + // entryTypeToStr(entry_type); Discoverer::MdnsService *discoveredService = (Discoverer::MdnsService *)user_data; switch (record_type) { case MDNS_RECORDTYPE_PTR: { - // We don't use mdns_record_parse_ptr() because we want to extract just the service name instead of the full "._._tcp.local." string + // We don't use mdns_record_parse_ptr() because we want to extract just the service name instead of the full + // "._._tcp.local." string mdns_string_pair_t instanceNamePos = mdns_get_next_substring(data, size, record_offset); discoveredService->name = QString::fromLatin1((char *)data + instanceNamePos.offset, instanceNamePos.length); - //static char instanceNameBuffer[256]; - //mdns_string_t instanceName = mdns_record_parse_ptr(data, size, record_offset, record_length, instanceNameBuffer, sizeof(instanceNameBuffer)); - //discoveredService->name = QString::fromLatin1(instanceName.str, instanceName.length); + // static char instanceNameBuffer[256]; + // mdns_string_t instanceName = mdns_record_parse_ptr(data, size, record_offset, record_length, instanceNameBuffer, sizeof(instanceNameBuffer)); + // discoveredService->name = QString::fromLatin1(instanceName.str, instanceName.length); if (discoveredService->address == QHostAddress::Null) { discoveredService->address = QHostAddress(from); // In case we don't receive a A record, use from as address } @@ -112,7 +125,7 @@ static int query_callback(int sock, const struct sockaddr* from, size_t addrlen, static char nameBuffer[256]; mdns_record_srv_t record = mdns_record_parse_srv(data, size, record_offset, record_length, nameBuffer, sizeof(nameBuffer)); // We can use the IP to connect so we don't need to store the ".local." address. - //discoveredService->qualifiedHostname = QString::fromLatin1(record.name.str, record.name.length); + // discoveredService->qualifiedHostname = QString::fromLatin1(record.name.str, record.name.length); discoveredService->port = record.port; } break; case MDNS_RECORDTYPE_A: { @@ -122,8 +135,8 @@ static int query_callback(int sock, const struct sockaddr* from, size_t addrlen, } break; case MDNS_RECORDTYPE_AAAA: // Ignore IPv6 for now - //sockaddr_in6 addr6; - //mdns_record_parse_aaaa(data, size, record_offset, record_length, &addr6); + // sockaddr_in6 addr6; + // mdns_record_parse_aaaa(data, size, record_offset, record_length, &addr6); break; case MDNS_RECORDTYPE_TXT: { mdns_record_txt_t records[24]; @@ -251,7 +264,8 @@ static mdns_string_t createMdnsString(const QByteArray &str) return mdns_string_t{str.constData(), (size_t)str.length()}; } -int countCommonLeadingBits(quint32 int1, quint32 int2) { +int countCommonLeadingBits(quint32 int1, quint32 int2) +{ int count = 0; while (int1 != 0 && int2 != 0) { if ((int1 & 0x80000000) == (int2 & 0x80000000)) { @@ -283,7 +297,7 @@ static QHostAddress findBestAddressMatchV4(const QVector &hostAddr QHostAddress matchingIp = hostAddresses[0]; int matchingBits = -1; quint32 rawOtherIp = otherIp.toIPv4Address(); - for (const QHostAddress& ip : hostAddresses) { + for (const QHostAddress &ip : hostAddresses) { Q_ASSERT(ip.protocol() == QAbstractSocket::IPv4Protocol); quint32 rawMyIp = ip.toIPv4Address(); // Since we don't have the network mask, we just compare the prefixes of the IPs to find the longest match @@ -299,7 +313,7 @@ static QHostAddress findBestAddressMatchV4(const QVector &hostAddr return matchingIp; } -static QHostAddress findBestAddressMatchV6(const QVector& hostAddresses, const struct sockaddr *fromAddress) +static QHostAddress findBestAddressMatchV6(const QVector &hostAddresses, const struct sockaddr *fromAddress) { Q_ASSERT(!hostAddresses.empty()); // We could do the same logic for v6 that we do for V4, but we don't care that much about IPv6 @@ -349,10 +363,22 @@ static mdns_record_t createMdnsRecord(const Announcer::AnnouncedInfo &self, } // Callback handling questions incoming on service sockets -static int service_callback(int sock, const struct sockaddr* from, size_t addrlen, mdns_entry_type_t entry_type, - uint16_t query_id, uint16_t record_type, uint16_t rclass, uint32_t ttl, const void* data, - size_t size, size_t name_offset, size_t name_length, size_t record_offset, - size_t record_length, void* user_data) { +static int service_callback(int sock, + const struct sockaddr *from, + size_t addrlen, + mdns_entry_type_t entry_type, + uint16_t query_id, + uint16_t record_type, + uint16_t rclass, + uint32_t ttl, + const void *data, + size_t size, + size_t name_offset, + size_t name_length, + size_t record_offset, + size_t record_length, + void *user_data) +{ Q_UNUSED(ttl); Q_UNUSED(name_length); Q_UNUSED(record_offset); @@ -379,9 +405,20 @@ static int service_callback(int sock, const struct sockaddr* from, size_t addrle uint16_t unicast = (rclass & MDNS_UNICAST_RESPONSE); if (unicast) { - ret = mdns_query_answer_unicast(sock, from, addrlen, sendbuffer, sizeof(sendbuffer), query_id, - (mdns_record_type_t)record_type, nameMdnsString.str, nameMdnsString.length, - answer, nullptr, 0, nullptr, 0); + ret = mdns_query_answer_unicast(sock, + from, + addrlen, + sendbuffer, + sizeof(sendbuffer), + query_id, + (mdns_record_type_t)record_type, + nameMdnsString.str, + nameMdnsString.length, + answer, + nullptr, + 0, + nullptr, + 0); } else { ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, nullptr, 0); } @@ -409,12 +446,22 @@ static int service_callback(int sock, const struct sockaddr* from, size_t addrle uint16_t unicast = (rclass & MDNS_UNICAST_RESPONSE); if (unicast) { - ret = mdns_query_answer_unicast(sock, from, addrlen, sendbuffer, sizeof(sendbuffer), query_id, - (mdns_record_type_t)record_type, nameMdnsString.str, nameMdnsString.length, - answer, nullptr, 0, additional.constData(), additional.length()); + ret = mdns_query_answer_unicast(sock, + from, + addrlen, + sendbuffer, + sizeof(sendbuffer), + query_id, + (mdns_record_type_t)record_type, + nameMdnsString.str, + nameMdnsString.length, + answer, + nullptr, + 0, + additional.constData(), + additional.length()); } else { - ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, - additional.constData(), additional.length()); + ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, additional.constData(), additional.length()); } } } else if (name == self.serviceInstance) { @@ -439,12 +486,22 @@ static int service_callback(int sock, const struct sockaddr* from, size_t addrle uint16_t unicast = (rclass & MDNS_UNICAST_RESPONSE); if (unicast) { - ret = mdns_query_answer_unicast(sock, from, addrlen, sendbuffer, sizeof(sendbuffer), query_id, - (mdns_record_type_t)record_type, nameMdnsString.str, nameMdnsString.length, - answer, nullptr, 0, additional.constData(), additional.length()); + ret = mdns_query_answer_unicast(sock, + from, + addrlen, + sendbuffer, + sizeof(sendbuffer), + query_id, + (mdns_record_type_t)record_type, + nameMdnsString.str, + nameMdnsString.length, + answer, + nullptr, + 0, + additional.constData(), + additional.length()); } else { - ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, - additional.constData(), additional.length()); + ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, additional.constData(), additional.length()); } } } else if (name == self.hostname) { @@ -465,12 +522,22 @@ static int service_callback(int sock, const struct sockaddr* from, size_t addrle uint16_t unicast = (rclass & MDNS_UNICAST_RESPONSE); if (unicast) { - ret = mdns_query_answer_unicast(sock, from, addrlen, sendbuffer, sizeof(sendbuffer), query_id, - (mdns_record_type_t)record_type, nameMdnsString.str, nameMdnsString.length, - answer, nullptr, 0, additional.constData(), additional.length()); + ret = mdns_query_answer_unicast(sock, + from, + addrlen, + sendbuffer, + sizeof(sendbuffer), + query_id, + (mdns_record_type_t)record_type, + nameMdnsString.str, + nameMdnsString.length, + answer, + nullptr, + 0, + additional.constData(), + additional.length()); } else { - ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, - additional.constData(), additional.length()); + ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, additional.constData(), additional.length()); } } else if (((record_type == MDNS_RECORDTYPE_AAAA) || (record_type == MDNS_RECORDTYPE_ANY)) && !self.addressesV6.empty()) { // The AAAA query was for our qualified hostname and we have an IPv6 address, answer with an AAAA @@ -489,12 +556,22 @@ static int service_callback(int sock, const struct sockaddr* from, size_t addrle uint16_t unicast = (rclass & MDNS_UNICAST_RESPONSE); if (unicast) { - ret = mdns_query_answer_unicast(sock, from, addrlen, sendbuffer, sizeof(sendbuffer), query_id, - (mdns_record_type_t)record_type, nameMdnsString.str, nameMdnsString.length, - answer, nullptr, 0, additional.constData(), additional.length()); + ret = mdns_query_answer_unicast(sock, + from, + addrlen, + sendbuffer, + sizeof(sendbuffer), + query_id, + (mdns_record_type_t)record_type, + nameMdnsString.str, + nameMdnsString.length, + answer, + nullptr, + 0, + additional.constData(), + additional.length()); } else { - ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, - additional.constData(), additional.length()); + ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, additional.constData(), additional.length()); } } } // else request is not for me diff --git a/core/backends/lan/mdns_wrapper.h b/core/backends/lan/mdns_wrapper.h index 4070ab498..d044ca5ed 100644 --- a/core/backends/lan/mdns_wrapper.h +++ b/core/backends/lan/mdns_wrapper.h @@ -21,7 +21,6 @@ */ namespace MdnsWrapper { - class KDECONNECTCORE_EXPORT Discoverer : public QObject { Q_OBJECT diff --git a/core/dbushelper.cpp b/core/dbushelper.cpp index a2e49770e..9a9f641f4 100644 --- a/core/dbushelper.cpp +++ b/core/dbushelper.cpp @@ -96,7 +96,7 @@ void DBusInstancePrivate::launchDBusDaemon() m_dbusProcess->setStandardOutputFile(KdeConnectConfig::instance().privateDBusAddressPath()); m_dbusProcess->setStandardErrorFile(QProcess::nullDevice()); m_dbusProcess->start(); - m_dbusProcess->waitForStarted(); // Avoid potential racing condition + m_dbusProcess->waitForStarted(); // Avoid potential racing condition #ifdef Q_OS_MAC // Set launchctl env diff --git a/core/sslhelper.cpp b/core/sslhelper.cpp index 305ed331e..e7b3f6162 100644 --- a/core/sslhelper.cpp +++ b/core/sslhelper.cpp @@ -19,7 +19,6 @@ extern "C" { namespace SslHelper { - QString getSslError() { char buf[256]; diff --git a/indicator/indicatorhelper_mac.cpp b/indicator/indicatorhelper_mac.cpp index 2beddf016..61963110f 100644 --- a/indicator/indicatorhelper_mac.cpp +++ b/indicator/indicatorhelper_mac.cpp @@ -29,16 +29,12 @@ IndicatorHelper::IndicatorHelper() // Use a hardcoded QPixmap because QIcon::fromTheme will instantiate a QPlatformTheme theme // which could try to use DBus before we have started it and cache an invalid DBus session // in QDBusConnectionManager - const QString iconPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("kdeconnect-icons"), QStandardPaths::LocateDirectory); + const QString iconPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("kdeconnect-icons"), QStandardPaths::LocateDirectory); QPixmap splashPixmap(iconPath + QStringLiteral("/hicolor/scalable/apps/kdeconnect.svg")); m_splashScreen = new QSplashScreen(splashPixmap); // Icon is white, set the text color to black - m_splashScreen->showMessage( - i18n("Launching") + QStringLiteral("\n"), - Qt::AlignHCenter | Qt::AlignBottom, - Qt::black - ); + m_splashScreen->showMessage(i18n("Launching") + QStringLiteral("\n"), Qt::AlignHCenter | Qt::AlignBottom, Qt::black); m_splashScreen->show(); } @@ -88,11 +84,7 @@ int IndicatorHelper::daemonHook(QProcess &kdeconnectd) } // Start daemon - m_splashScreen->showMessage( - i18n("Launching daemon") + QStringLiteral("\n"), - Qt::AlignHCenter | Qt::AlignBottom, - Qt::black - ); + m_splashScreen->showMessage(i18n("Launching daemon") + QStringLiteral("\n"), Qt::AlignHCenter | Qt::AlignBottom, Qt::black); // Here we will try to bring our private session D-Bus if (!hasUsableSessionBus) { @@ -101,11 +93,7 @@ int IndicatorHelper::daemonHook(QProcess &kdeconnectd) DBusHelper::launchDBusDaemon(); // Wait for dbus daemon env QProcess getLaunchdDBusEnv; - m_splashScreen->showMessage( - i18n("Waiting D-Bus") + QStringLiteral("\n"), - Qt::AlignHCenter | Qt::AlignBottom, - Qt::black - ); + m_splashScreen->showMessage(i18n("Waiting D-Bus") + QStringLiteral("\n"), Qt::AlignHCenter | Qt::AlignBottom, Qt::black); int retry = 0; getLaunchdDBusEnv.setProgram(QStringLiteral("launchctl")); getLaunchdDBusEnv.setArguments({QStringLiteral("getenv"), QStringLiteral(KDECONNECT_SESSION_DBUS_LAUNCHD_ENV)}); diff --git a/interfaces/dbusinterfaces.cpp b/interfaces/dbusinterfaces.cpp index 649dcfdc3..56fd59861 100644 --- a/interfaces/dbusinterfaces.cpp +++ b/interfaces/dbusinterfaces.cpp @@ -78,8 +78,7 @@ DeviceNotificationsDbusInterface::DeviceNotificationsDbusInterface(const QString NotificationDbusInterface::NotificationDbusInterface(const QString &deviceId, const QString ¬ificationId, QObject *parent) : OrgKdeKdeconnectDeviceNotificationsNotificationInterface(DaemonDbusInterface::activatedService(), - QLatin1String("/modules/kdeconnect/devices/%1/notifications/").arg(deviceId) - + notificationId, + QLatin1String("/modules/kdeconnect/devices/%1/notifications/").arg(deviceId) + notificationId, QDBusConnection::sessionBus(), parent) , id(notificationId) diff --git a/plugins/mpriscontrol/mpriscontrolplugin-win.cpp b/plugins/mpriscontrol/mpriscontrolplugin-win.cpp index 3c4534125..2d0218b01 100644 --- a/plugins/mpriscontrol/mpriscontrolplugin-win.cpp +++ b/plugins/mpriscontrol/mpriscontrolplugin-win.cpp @@ -26,7 +26,8 @@ K_PLUGIN_CLASS_WITH_JSON(MprisControlPlugin, "kdeconnect_mpriscontrol.json") namespace { -const QString DEFAULT_PLAYER = i18nc("@title Users select this to control the current media player when we can't detect a specific player name like VLC", "Current Player"); +const QString DEFAULT_PLAYER = + i18nc("@title Users select this to control the current media player when we can't detect a specific player name like VLC", "Current Player"); } MprisControlPlugin::MprisControlPlugin(QObject *parent, const QVariantList &args) @@ -289,8 +290,7 @@ bool MprisControlPlugin::sendAlbumArt(std::variant const void MprisControlPlugin::handleDefaultPlayer(const NetworkPacket &np) { if (np.has(QStringLiteral("action"))) { - - INPUT input={0}; + INPUT input = {0}; input.type = INPUT_KEYBOARD; input.ki.time = 0; @@ -300,28 +300,25 @@ void MprisControlPlugin::handleDefaultPlayer(const NetworkPacket &np) const QString &action = np.get(QStringLiteral("action")); - if (action == QStringLiteral("PlayPause") || (action == QStringLiteral("Play")) || (action == QStringLiteral("Pause")) ) { + if (action == QStringLiteral("PlayPause") || (action == QStringLiteral("Play")) || (action == QStringLiteral("Pause"))) { input.ki.wVk = VK_MEDIA_PLAY_PAUSE; - ::SendInput(1,&input,sizeof(INPUT)); + ::SendInput(1, &input, sizeof(INPUT)); } else if (action == QStringLiteral("Stop")) { input.ki.wVk = VK_MEDIA_STOP; - ::SendInput(1,&input,sizeof(INPUT)); - } - else if (action == QStringLiteral("Next")) { - input.ki.wVk = VK_MEDIA_NEXT_TRACK; - ::SendInput(1,&input,sizeof(INPUT)); - } - else if (action == QStringLiteral("Previous")) { + ::SendInput(1, &input, sizeof(INPUT)); + } else if (action == QStringLiteral("Next")) { + input.ki.wVk = VK_MEDIA_NEXT_TRACK; + ::SendInput(1, &input, sizeof(INPUT)); + } else if (action == QStringLiteral("Previous")) { input.ki.wVk = VK_MEDIA_PREV_TRACK; - ::SendInput(1,&input,sizeof(INPUT)); - } - else if (action == QStringLiteral("Stop")) { + ::SendInput(1, &input, sizeof(INPUT)); + } else if (action == QStringLiteral("Stop")) { input.ki.wVk = VK_MEDIA_STOP; - ::SendInput(1,&input,sizeof(INPUT)); + ::SendInput(1, &input, sizeof(INPUT)); } } - //Send something read from the mpris interface + // Send something read from the mpris interface NetworkPacket answer(PACKET_TYPE_MPRIS); answer.set(QStringLiteral("player"), DEFAULT_PLAYER); bool somethingToSend = false; diff --git a/plugins/sendnotifications/dbusnotificationslistener.cpp b/plugins/sendnotifications/dbusnotificationslistener.cpp index a2e3ac688..2c5678dc2 100644 --- a/plugins/sendnotifications/dbusnotificationslistener.cpp +++ b/plugins/sendnotifications/dbusnotificationslistener.cpp @@ -20,7 +20,8 @@ #include #include -namespace { +namespace +{ // https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html inline constexpr const char *NOTIFY_SIGNATURE = "susssasa{sv}i"; inline constexpr const char *IMAGE_DATA_SIGNATURE = "iiibiiay"; @@ -142,7 +143,6 @@ QVariant nextVariant(DBusMessageIter *iter) case DBUS_TYPE_STRING: return QVariant(QString::fromUtf8(value.str)); case DBUS_STRUCT_BEGIN_CHAR: { - } default: break; @@ -253,13 +253,13 @@ DBusNotificationsListener::~DBusNotificationsListener() } void DBusNotificationsListener::onNotify(const QString &appName, - uint replacesId, - const QString &appIcon, - const QString &summary, - const QString &body, - const QStringList &actions, - const QVariantMap &hints, - int timeout) + uint replacesId, + const QString &appIcon, + const QString &summary, + const QString &body, + const QStringList &actions, + const QVariantMap &hints, + int timeout) { Q_UNUSED(actions); @@ -330,7 +330,8 @@ void DBusNotificationsListener::onNotify(const QString &appName, auto it = hints.constFind(QStringLiteral("image-data")); if (it != hints.cend() || (it = hints.constFind(QStringLiteral("image_data"))) != hints.cend()) { iconSource = iconForImageData(it.value()); - } else if ((it = hints.constFind(QStringLiteral("image-path"))) != hints.cend() || (it = hints.constFind(QStringLiteral("image_path"))) != hints.cend()) { + } else if ((it = hints.constFind(QStringLiteral("image-path"))) != hints.cend() + || (it = hints.constFind(QStringLiteral("image_path"))) != hints.cend()) { iconSource = iconForIconName(it.value().toString()); } else if (!appIcon.isEmpty()) { iconSource = iconForIconName(appIcon); @@ -346,13 +347,13 @@ void DBusNotificationsListener::onNotify(const QString &appName, } bool DBusNotificationsListener::parseImageDataArgument(const QVariant &argument, - int &width, - int &height, - int &rowStride, - int &bitsPerSample, - int &channels, - bool &hasAlpha, - QByteArray &imageData) const + int &width, + int &height, + int &rowStride, + int &bitsPerSample, + int &channels, + bool &hasAlpha, + QByteArray &imageData) const { // FIXME // if (!argument.canConvert()) { diff --git a/tests/mdnstest.cpp b/tests/mdnstest.cpp index 7c075e0cc..374a0cb65 100644 --- a/tests/mdnstest.cpp +++ b/tests/mdnstest.cpp @@ -38,13 +38,16 @@ private Q_SLOTS: QSignalSpy spy(&discoverer, &MdnsWrapper::Discoverer::serviceFound); - connect(&discoverer, &MdnsWrapper::Discoverer::serviceFound, this, [instanceName, instancePort, txtKey, txtValue](const MdnsWrapper::Discoverer::MdnsService &service) { - QCOMPARE(instanceName, service.name); - QCOMPARE(instancePort, service.port); - QVERIFY(service.txtRecords.size() == 1); - QVERIFY(service.txtRecords.contains(txtKey)); - QCOMPARE(txtValue, service.txtRecords.value(txtKey)); - }); + connect(&discoverer, + &MdnsWrapper::Discoverer::serviceFound, + this, + [instanceName, instancePort, txtKey, txtValue](const MdnsWrapper::Discoverer::MdnsService &service) { + QCOMPARE(instanceName, service.name); + QCOMPARE(instancePort, service.port); + QVERIFY(service.txtRecords.size() == 1); + QVERIFY(service.txtRecords.contains(txtKey)); + QCOMPARE(txtValue, service.txtRecords.value(txtKey)); + }); announcer.startAnnouncing(); discoverer.startDiscovering(serviceType);