Merge branch 'ipConflict-1' into 'yhkylin/v101'

ip冲突通知

See merge request kylinos-src/kylin-nm!191
This commit is contained in:
赵世旭 2023-06-25 10:24:05 +00:00
commit d373a1820b
9 changed files with 73 additions and 36 deletions

View File

@ -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()

View File

@ -87,6 +87,8 @@ Q_SIGNALS:
void connectionRemove(QString path);
void connectivityChanged(NetworkManager::Connectivity connectivity);
void needShowDesktop(QString);
private:
KyNetworkResourceManager *m_networkResourceInstance = nullptr;
};

View File

@ -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()

View File

@ -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();

View File

@ -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);

View File

@ -458,43 +458,48 @@
<context>
<name>LanPage</name>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1183"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1187"/>
<source>No ethernet device avaliable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="740"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="744"/>
<source>LAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="742"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="67"/>
<source>conflict, unable to connect to the network normally!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="746"/>
<source>Activated LAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="752"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="756"/>
<source>Inactivated LAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1227"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1231"/>
<source>Wired Device not carried</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1321"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1329"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1325"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1333"/>
<source>Connected: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1321"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1325"/>
<source>(Limited)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1323"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1327"/>
<source>Not Connected</source>
<translation type="unfinished"></translation>
</message>

View File

@ -786,22 +786,27 @@
<context>
<name>LanPage</name>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1183"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1187"/>
<source>No ethernet device avaliable</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="740"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="744"/>
<source>LAN</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="742"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="67"/>
<source>conflict, unable to connect to the network normally!</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="746"/>
<source>Activated LAN</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="752"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="756"/>
<source>Inactivated LAN</source>
<translation></translation>
</message>
@ -810,7 +815,7 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1227"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1231"/>
<source>Wired Device not carried</source>
<translation></translation>
</message>
@ -819,18 +824,18 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1321"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1329"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1325"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1333"/>
<source>Connected: </source>
<translation>: </translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1323"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1327"/>
<source>Not Connected</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1321"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1325"/>
<source>(Limited)</source>
<translation>()</translation>
</message>

View File

@ -1484,43 +1484,48 @@
<context>
<name>LanPage</name>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1183"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1187"/>
<source>No ethernet device avaliable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="740"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="744"/>
<source>LAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="742"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="67"/>
<source>conflict, unable to connect to the network normally!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="746"/>
<source>Activated LAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="752"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="756"/>
<source>Inactivated LAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1227"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1231"/>
<source>Wired Device not carried</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1321"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1329"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1325"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1333"/>
<source>Connected: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1321"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1325"/>
<source>(Limited)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1323"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1327"/>
<source>Not Connected</source>
<translation type="unfinished"></translation>
</message>

View File

@ -786,22 +786,27 @@
<context>
<name>LanPage</name>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1183"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1187"/>
<source>No ethernet device avaliable</source>
<translation>线</translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="740"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="744"/>
<source>LAN</source>
<translation>线</translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="742"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="67"/>
<source>conflict, unable to connect to the network normally!</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="746"/>
<source>Activated LAN</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="752"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="756"/>
<source>Inactivated LAN</source>
<translation></translation>
</message>
@ -810,7 +815,7 @@
<translation type="vanished">线</translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1227"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1231"/>
<source>Wired Device not carried</source>
<translation>线</translation>
</message>
@ -819,18 +824,18 @@
<translation type="vanished">线</translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1321"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1329"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1325"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1333"/>
<source>Connected: </source>
<translation>: </translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1323"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1327"/>
<source>Not Connected</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1321"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1325"/>
<source>(Limited)</source>
<translation>()</translation>
</message>