From eaf3589844c3aabba2c7cbd574531dc66110bef7 Mon Sep 17 00:00:00 2001 From: jzxc95 <907297917@qq.com> Date: Sun, 25 Jun 2023 18:23:46 +0800 Subject: [PATCH] =?UTF-8?q?ip=E5=86=B2=E7=AA=81=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dbus-interface/kylinconnectresource.cpp | 2 ++ .../dbus-interface/kylinconnectresource.h | 2 ++ .../kylinnetworkresourcemanager.cpp | 8 +++++++ .../kylinnetworkresourcemanager.h | 1 + src/frontend/tab-pages/lanpage.cpp | 4 ++++ src/translations/kylin-nm_bo.ts | 23 +++++++++++-------- src/translations/kylin-nm_bo_CN.ts | 23 +++++++++++-------- src/translations/kylin-nm_tr.ts | 23 +++++++++++-------- src/translations/kylin-nm_zh_CN.ts | 23 +++++++++++-------- 9 files changed, 73 insertions(+), 36 deletions(-) diff --git a/src/backend/dbus-interface/kylinconnectresource.cpp b/src/backend/dbus-interface/kylinconnectresource.cpp index c6958a84..dea6d572 100644 --- a/src/backend/dbus-interface/kylinconnectresource.cpp +++ b/src/backend/dbus-interface/kylinconnectresource.cpp @@ -80,6 +80,8 @@ KyConnectResourse::KyConnectResourse(QObject *parent) : QObject(parent) connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionRemove, this, &KyConnectResourse::connectionRemove); connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionUpdate, this, &KyConnectResourse::connectionUpdate); connect(m_networkResourceInstance, &KyNetworkResourceManager::connectivityChanged, this, &KyConnectResourse::connectivityChanged); + + connect(m_networkResourceInstance, &KyNetworkResourceManager::needShowDesktop, this, &KyConnectResourse::needShowDesktop); } KyConnectResourse::~KyConnectResourse() diff --git a/src/backend/dbus-interface/kylinconnectresource.h b/src/backend/dbus-interface/kylinconnectresource.h index 8c1228a2..3ab29bd2 100644 --- a/src/backend/dbus-interface/kylinconnectresource.h +++ b/src/backend/dbus-interface/kylinconnectresource.h @@ -87,6 +87,8 @@ Q_SIGNALS: void connectionRemove(QString path); void connectivityChanged(NetworkManager::Connectivity connectivity); + void needShowDesktop(QString); + private: KyNetworkResourceManager *m_networkResourceInstance = nullptr; }; diff --git a/src/backend/dbus-interface/kylinnetworkresourcemanager.cpp b/src/backend/dbus-interface/kylinnetworkresourcemanager.cpp index d38ee6d2..aec3e24a 100644 --- a/src/backend/dbus-interface/kylinnetworkresourcemanager.cpp +++ b/src/backend/dbus-interface/kylinnetworkresourcemanager.cpp @@ -228,6 +228,10 @@ void KyNetworkResourceManager::removeDevice(int pos) { //connections signals NetworkManager::Device::Ptr device = m_devices.takeAt(pos); + QDBusConnection::systemBus().disconnect(QString("org.freedesktop.NetworkManager"), + device.data()->uni(), + QString("org.freedesktop.NetworkManager.Device"), + QString("AcdIpProbed"), this, SIGNAL(needShowDesktop(QString))); device->disconnect(this); } @@ -303,6 +307,10 @@ void KyNetworkResourceManager::addDevice(NetworkManager::Device::Ptr device) //TODO: other device types! break; } + QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), + device.data()->uni(), + QString("org.freedesktop.NetworkManager.Device"), + QString("AcdIpProbed"), this, SIGNAL(needShowDesktop(QString))); } void KyNetworkResourceManager::insertDevices() diff --git a/src/backend/dbus-interface/kylinnetworkresourcemanager.h b/src/backend/dbus-interface/kylinnetworkresourcemanager.h index b43b0dcf..9cf59896 100644 --- a/src/backend/dbus-interface/kylinnetworkresourcemanager.h +++ b/src/backend/dbus-interface/kylinnetworkresourcemanager.h @@ -144,6 +144,7 @@ Q_SIGNALS: void connectivityChanged(NetworkManager::Connectivity connectivity); void stateChanged(NetworkManager::Device::State newstate, NetworkManager::Device::State oldstate, NetworkManager::Device::StateChangeReason reason); + void needShowDesktop(QString); public Q_SLOTS: void onInitNetwork(); diff --git a/src/frontend/tab-pages/lanpage.cpp b/src/frontend/tab-pages/lanpage.cpp index c0e94dc6..3faf0681 100644 --- a/src/frontend/tab-pages/lanpage.cpp +++ b/src/frontend/tab-pages/lanpage.cpp @@ -63,6 +63,10 @@ LanPage::LanPage(QWidget *parent) : TabPage(parent) connect(m_connectResourse, &KyConnectResourse::connectionRemove, this, &LanPage::onRemoveConnection); connect(m_connectResourse, &KyConnectResourse::connectionUpdate, this, &LanPage::onUpdateConnection); + connect(m_connectResourse, &KyConnectResourse::needShowDesktop, this, [=](QString ip) { + this->showDesktopNotify(ip + tr("conflict, unable to connect to the network normally!"), QString()); + }); + connect(m_deviceResource, &KyNetworkDeviceResourse::deviceAdd, this, &LanPage::onDeviceAdd); connect(m_deviceResource, &KyNetworkDeviceResourse::deviceRemove, this, &LanPage::onDeviceRemove); connect(m_deviceResource, &KyNetworkDeviceResourse::deviceNameUpdate, this, &LanPage::onDeviceNameUpdate); diff --git a/src/translations/kylin-nm_bo.ts b/src/translations/kylin-nm_bo.ts index 40b15e51..48e6ce40 100644 --- a/src/translations/kylin-nm_bo.ts +++ b/src/translations/kylin-nm_bo.ts @@ -458,43 +458,48 @@ LanPage - + No ethernet device avaliable - + LAN - + + conflict, unable to connect to the network normally! + + + + Activated LAN - + Inactivated LAN - + Wired Device not carried - - + + Connected: - + (Limited) - + Not Connected diff --git a/src/translations/kylin-nm_bo_CN.ts b/src/translations/kylin-nm_bo_CN.ts index b4518d95..2f4710e1 100644 --- a/src/translations/kylin-nm_bo_CN.ts +++ b/src/translations/kylin-nm_bo_CN.ts @@ -786,22 +786,27 @@ LanPage - + No ethernet device avaliable ཨེ་ཙི་དྲ་རྒྱའི་སྒྲིག་ཆས་ལ་བཙན་འཛུལ་བྱས་མི་ཆོག། - + LAN སྐུད་ཡོད་དྲ་བ། - + + conflict, unable to connect to the network normally! + གདོང་གཏུག་རྒྱུན་ལྡན་ལྟར་དྲ་རྒྱ་དང་འབྲེལ་མཐུད་བྱེད་ཐབས་བྲལ་བ་རེད།! + + + Activated LAN ངའི་དྲ་རྒྱ། - + Inactivated LAN དྲ་བ་གཞན་དག @@ -810,7 +815,7 @@ སྐུད་ཡོད་དྲ་བ་ཆད་སོང་། - + Wired Device not carried སྐུད་ཡོད་སྒྲིག་ཆས་འཁྱེར་མེད་པ། @@ -819,18 +824,18 @@ སྐུད་ཡོད་དྲ་བ་སྦྲེལ་ཡོད། - - + + Connected: འབྲེལ་མཐུད་བྱུང་ཡོད།: - + Not Connected འབྲེལ་མཐུད་མ་བྱས་པ། - + (Limited) (དྲ་བར་ཚོད་འཛིན་ཐེབས་པ་རེད།) diff --git a/src/translations/kylin-nm_tr.ts b/src/translations/kylin-nm_tr.ts index 46024123..e3728d73 100644 --- a/src/translations/kylin-nm_tr.ts +++ b/src/translations/kylin-nm_tr.ts @@ -1484,43 +1484,48 @@ LanPage - + No ethernet device avaliable - + LAN - + + conflict, unable to connect to the network normally! + + + + Activated LAN - + Inactivated LAN - + Wired Device not carried - - + + Connected: - + (Limited) - + Not Connected diff --git a/src/translations/kylin-nm_zh_CN.ts b/src/translations/kylin-nm_zh_CN.ts index 326e35a6..e0d79c9e 100644 --- a/src/translations/kylin-nm_zh_CN.ts +++ b/src/translations/kylin-nm_zh_CN.ts @@ -786,22 +786,27 @@ LanPage - + No ethernet device avaliable 未检测到有线设备 - + LAN 有线网络 - + + conflict, unable to connect to the network normally! + 冲突,无法正常连接到网络! + + + Activated LAN 我的网络 - + Inactivated LAN 其他网络 @@ -810,7 +815,7 @@ 有线网络已断开 - + Wired Device not carried 未插入网线 @@ -819,18 +824,18 @@ 有线网络已连接 - - + + Connected: 已连接: - + Not Connected 未连接 - + (Limited) (网络受限)