Merge branch '1118' into 'dbus-interface'

限制热点名称长度,考虑中文情况&&新增连接和状态变化 不应判断网卡开关

See merge request kylin-desktop/kylin-nm!420
This commit is contained in:
ren peijia 2021-11-19 07:56:00 +00:00
commit 9862e745ba
3 changed files with 21 additions and 11 deletions

View File

@ -193,8 +193,26 @@ void MobileHotspotWidget::initDbusConnect()
onGsettingChanged(WIRELESS_SWITCH);
connect(m_switchGsettings, &QGSettings::changed, this, &MobileHotspotWidget::onGsettingChanged, Qt::QueuedConnection);
}
connect(m_apNameLine, &QLineEdit::textEdited, this, &MobileHotspotWidget::onApLineEditTextEdit);
}
void MobileHotspotWidget::onApLineEditTextEdit(QString text)
{
int count = 0;
int i = 0;
for ( ; i < text.length(); ++i) {
count += text.mid(i,1).toLocal8Bit().length();
if (count > AP_NAME_MAX_LENGTH) {
break;
}
}
m_apNameLine->setText(text.left(i));
}
void MobileHotspotWidget::onActiveConnectionChanged(QString deviceName, QString ssid, QString uuid, int status)
{
if(m_uuid == uuid && status == 4) {

View File

@ -112,7 +112,7 @@ private slots:
void onActiveConnectionChanged(QString deviceName, QString ssid, QString uuid, int status);
void onApLineEditTextEdit(QString text);
};

View File

@ -616,9 +616,7 @@ void NetConnect::onDeviceNameChanged(QString oldName, QString newName, int type)
getDeviceStatusMap(deviceStatusMap);
if (deviceStatusMap.contains(newName)) {
addDeviceFrame(newName);
if (deviceStatusMap[newName]) {
initNetListFromDevice(newName);
}
initNetListFromDevice(newName);
}
}
@ -634,16 +632,12 @@ void NetConnect::onLanAdd(QString deviceName, QStringList lanInfo)
QMap<QString, ItemFrame *>::iterator iter;
for (iter = deviceFrameMap.begin(); iter != deviceFrameMap.end(); iter++) {
if (deviceName.isEmpty()) {
if (deviceStatusMap[iter.key()]) {
qDebug() << "[NetConnect]onLanAdd every list" << iter.key();
addOneLanFrame(iter.value(), iter.key(), lanInfo);
}
} else if (deviceName == iter.key()) {
if (deviceStatusMap[deviceName]) {
qDebug() << "[NetConnect]onLanAdd "<< deviceName;
addOneLanFrame(iter.value(), deviceName, lanInfo);
break;
}
}
}
}
@ -784,9 +778,7 @@ void NetConnect::onActiveConnectionChanged(QString deviceName, QString uuid, int
QMap<QString, ItemFrame *>::iterator iter;
for (iter = deviceFrameMap.begin(); iter != deviceFrameMap.end(); iter++) {
if (!iter.value()->itemMap.contains(uuid)) {
if (deviceStatusMap[iter.key()]) {
addOneLanFrame(iter.value(), iter.key(), infoList);
}
addOneLanFrame(iter.value(), iter.key(), infoList);
}
}
}