diff --git a/dcc-network/operation/dccnetwork.cpp b/dcc-network/operation/dccnetwork.cpp index 217226fb..644a1cf3 100644 --- a/dcc-network/operation/dccnetwork.cpp +++ b/dcc-network/operation/dccnetwork.cpp @@ -6,6 +6,7 @@ #include "dde-control-center/dccfactory.h" #include "netitemmodel.h" #include "netmanager.h" +#include "networkconst.h" #include @@ -78,7 +79,7 @@ void DccNetwork::exec(NetManager::CmdType cmd, const QString &id, const QVariant dns.append(addr.toIPv4Address()); } else if (addr.protocol() == QAbstractSocket::IPv6Protocol) { // IPv6地址转换为128位表示(当前系统可能不支持,先跳过) - qWarning() << "IPv6 DNS not fully implemented in backend, DNS:" << dnsStr; + qCWarning(DNC()) << "IPv6 DNS not fully implemented in backend, DNS:" << dnsStr; // 这里需要实现IPv6 DNS的完整支持 } } @@ -90,7 +91,7 @@ void DccNetwork::exec(NetManager::CmdType cmd, const QString &id, const QVariant } if (param.contains("ipv6")) { QVariantMap ipv6Data = param.value("ipv6").toMap(); - + // 处理IPv6地址 if (ipv6Data.contains("address-data")) { const QVariantList &addressData = ipv6Data.value("address-data").toList(); @@ -111,7 +112,7 @@ void DccNetwork::exec(NetManager::CmdType cmd, const QString &id, const QVariant } ipv6Data["addresses"] = QVariant::fromValue(ipv6AddressList); } - + // 处理IPv6 DNS if (ipv6Data.contains("dns")) { const QVariantList &dnsData = ipv6Data.value("dns").toList(); @@ -133,7 +134,7 @@ void DccNetwork::exec(NetManager::CmdType cmd, const QString &id, const QVariant for (const QHostAddress &addr : ipv6DnsAddresses) { ipv6DnsStrings.append(addr.toString()); } - + // 使用字符串列表格式保存IPv6 DNS ipv6Data["dns"] = ipv6DnsStrings; ipv6Data["ignore-auto-dns"] = true; @@ -143,13 +144,13 @@ void DccNetwork::exec(NetManager::CmdType cmd, const QString &id, const QVariant ipv6Data.remove("dns"); ipv6Data.remove("ignore-auto-dns"); } - + // 确保IPv6设置存在,即使没有DNS也要设置,以便被正确处理 if (ipv6Data.isEmpty()) { - ipv6Data["method"] = "auto"; // 至少设置一个值确保IPv6部分存在 + ipv6Data["method"] = "auto"; // 至少设置一个值确保IPv6部分存在 } } - + tmpParam["ipv6"] = QVariant::fromValue(ipv6Data); } m_manager->exec(cmd, id, tmpParam); @@ -170,7 +171,7 @@ bool DccNetwork::netCheckAvailable() if (!m_manager) { return false; } - + return m_manager->netCheckAvailable(); } diff --git a/dcc-network/qml/NetUtils.js b/dcc-network/qml/NetUtils.js index 3a362e24..ac45fcb6 100644 --- a/dcc-network/qml/NetUtils.js +++ b/dcc-network/qml/NetUtils.js @@ -1,3 +1,4 @@ +.pragma library // SPDX-FileCopyrightText: 2024 - 2027 UnionTech Software Technology Co., Ltd. // SPDX-License-Identifier: GPL-3.0-or-later const VpnTypeEnum = Object.freeze({ diff --git a/dss-network-plugin/networkmodule.cpp b/dss-network-plugin/networkmodule.cpp index e8f64c4e..2817b1ea 100644 --- a/dss-network-plugin/networkmodule.cpp +++ b/dss-network-plugin/networkmodule.cpp @@ -290,7 +290,7 @@ QString NetworkPlugin::message(const QString &msgData) QJsonDocument json = QJsonDocument::fromJson(msgData.toLatin1()); QJsonObject jsonObject = json.object(); if (!jsonObject.contains("data")) { - qWarning() << "msgData don't containt data" << msgData; + qCWarning(DNC()) << "msgData don't containt data" << msgData; QJsonDocument jsonResult; QJsonObject resultObject; resultObject.insert("data", QString("msgData don't containt data %1").arg(msgData)); @@ -308,7 +308,7 @@ QString NetworkPlugin::message(const QString &msgData) QDBusPendingCall reply = dbusInter.asyncCall("UpdateLanguage", locale); reply.waitForFinished(); } else { - qWarning() << networkService << "don't start, wait for it start"; + qCWarning(DNC()) << networkService << "don't start, wait for it start"; QDBusServiceWatcher *serviceWatcher = new QDBusServiceWatcher(this); serviceWatcher->setConnection(QDBusConnection::systemBus()); serviceWatcher->addWatchedService(networkService); diff --git a/dss-network-plugin/notification/bubblemanager.cpp b/dss-network-plugin/notification/bubblemanager.cpp index 76d0ccfa..272cd0ec 100644 --- a/dss-network-plugin/notification/bubblemanager.cpp +++ b/dss-network-plugin/notification/bubblemanager.cpp @@ -48,14 +48,12 @@ void BubbleManager::CloseNotification(uint id) if (bubble->entity()->replacesId() == str_id) { bubble->close(); m_bubbleList.removeOne(bubble); - qDebug() << "CloseNotification : id" << str_id; } } foreach (auto notify, m_oldEntities) { if (notify->replacesId() == str_id) { m_oldEntities.removeOne(notify); - qDebug() << "CloseNotification : id" << str_id; } } } diff --git a/network-service-plugin/src/system/networkinitialization.cpp b/network-service-plugin/src/system/networkinitialization.cpp index 6426c4cb..57265b96 100755 --- a/network-service-plugin/src/system/networkinitialization.cpp +++ b/network-service-plugin/src/system/networkinitialization.cpp @@ -403,7 +403,7 @@ static QString getLocaleValue(const QString &filePath, const QStringList &keys, { QFile file(filePath); if (!file.open(QFile::ReadOnly | QFile::Text)) { - qWarning() << "Failed to open locale file:" << filePath << "-" << file.errorString(); + qCWarning(DSM) << "Failed to open locale file:" << filePath << "-" << file.errorString(); return QString(); } diff --git a/network-service-plugin/src/utils/constants.cpp b/network-service-plugin/src/utils/constants.cpp index 8c4e92a8..23a8cdac 100644 --- a/network-service-plugin/src/utils/constants.cpp +++ b/network-service-plugin/src/utils/constants.cpp @@ -16,15 +16,14 @@ void dbusDebug(const QString &service, const QString &funName, const QDBusConnec msg << service; QDBusPendingReply reply = dbusConnection.asyncCall(msg); if (reply.isError()) { - qWarning() << "API" << funName << "is called by" << service; - qWarning() << funName << "error:" << reply.error(); + qCWarning(DSM) << "API" << funName << "is called by" << service << "error:" << reply.error(); return; } uint pid = reply.value(); QFile file(QString("/proc/%1/cmdline").arg(pid)); if (file.open(QFile::ReadOnly)) { QByteArray cmd = file.readAll(); - qWarning() << "API" << funName << "is called by" << service << "(" << cmd.split('\0').join(" ") << ")"; + qCWarning(DSM) << "API" << funName << "is called by" << service << "(" << cmd.split('\0').join(" ") << ")"; } } } // namespace service diff --git a/src/dbus/proxychains.cpp b/src/dbus/proxychains.cpp index abb5215c..5d87e603 100644 --- a/src/dbus/proxychains.cpp +++ b/src/dbus/proxychains.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later #include "proxychains.h" +#include "networkconst.h" /* * Implementation of interface class __ProxyChains @@ -112,7 +113,7 @@ void ProxyChains::onPropertyChanged(const QString &propName, const QVariant &val return; } - qWarning() << "On property changed,property not handle: " << propName; + qCWarning(DNC()) << "On property changed,property not handle: " << propName; return; } diff --git a/src/networkcontroller.cpp b/src/networkcontroller.cpp index 2f072eb1..f8c3a899 100644 --- a/src/networkcontroller.cpp +++ b/src/networkcontroller.cpp @@ -18,8 +18,6 @@ #include "wirelessdevice.h" #include "connectivityhandler.h" -#include - // const static QString networkService = "org.deepin.dde.Network1"; // const static QString networkPath = "/org/deepin/dde/Network1"; static QString localeName; @@ -42,7 +40,6 @@ NetworkController::NetworkController() , m_hotspotController(Q_NULLPTR) , m_connectivityHandler(new ConnectivityHandler(this)) { - Dtk::Core::loggerInstance()->setDefaultCategory(DNC().categoryName()); retranslate(QLocale().name()); if (ConfigSetting::instance()->serviceFromNetworkManager()) { @@ -152,9 +149,9 @@ void NetworkController::installTranslator(const QString &locale) } if (m_translator->load(QLocale(localeName), "dde-network-core", "_", "/usr/share/dde-network-core/translations")) { QCoreApplication::installTranslator(m_translator); - qInfo() << "Loaded translation file for dde-network-core:" << m_translator->filePath(); + qCInfo(DNC()) << "Loaded translation file for dde-network-core:" << m_translator->filePath(); } else { - qWarning() << "Failed to load translation file for dde-network-core"; + qCWarning(DNC()) << "Failed to load translation file for dde-network-core"; m_translator->deleteLater(); m_translator = nullptr; }