Merge branch 'dbus-interface-fork' into 'dbus-interface'

解决部分热点管控、无线网络BUG,热点管控代码增加宏开关

See merge request kylin-desktop/kylin-nm!663
This commit is contained in:
赵世旭 2022-07-15 05:48:41 +00:00
commit 675ac0c5e3
4 changed files with 24 additions and 9 deletions

View File

@ -65,17 +65,18 @@ QFrame* ConnectdevPage::myLine()
void ConnectdevPage::getConnectStaDevice(QMap<QString, QString> &staMap)
{
staMap.clear();
if (m_avtivePathInterface == nullptr || !m_avtivePathInterface->isValid()) {
qDebug() << "dbus interface m_avtivePathInterface is invaild";
if (m_activePathInterface == nullptr || !m_activePathInterface->isValid()) {
qDebug() << "dbus interface m_activePathInterface is invaild";
return;
}
QDBusMessage reply = m_avtivePathInterface->call("Getstainfo");
QDBusMessage reply = m_activePathInterface->call("Getstainfo");
if(reply.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "[mobilehotspot]Getstainfo error:" << reply.errorMessage();
return;
}
if (reply.arguments().isEmpty()
|| reply.arguments().at(0).toString() == ""
|| reply.arguments().at(0).toString() == "[Invalid UTF-8]"
@ -91,6 +92,7 @@ void ConnectdevPage::getConnectStaDevice(QMap<QString, QString> &staMap)
staMap[macList.at(index)] = hostNameList.at(index);
}
}
}
void ConnectdevPage::initStaDev()

View File

@ -44,7 +44,7 @@ public:
void refreshStalist();
inline void setInterface(QDBusInterface *activeInterface) {
m_avtivePathInterface = activeInterface;
m_activePathInterface = activeInterface;
}
private:
@ -54,7 +54,7 @@ private:
QVBoxLayout *m_staListLayout = nullptr;
QMap<QString, QString> m_staMap;
QDBusInterface *m_avtivePathInterface = nullptr;
QDBusInterface *m_activePathInterface = nullptr;
void getConnectStaDevice(QMap<QString, QString> &blacklistMap);
bool removeStaFromBlacklist(QString staMac);

View File

@ -67,6 +67,8 @@ void MobileHotspotWidget::showDesktopNotify(const QString &message)
iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args);
}
//#define HOTSPOT_CONTROL
MobileHotspotWidget::MobileHotspotWidget(QWidget *parent) : QWidget(parent)
{
m_Vlayout = new QVBoxLayout(this);
@ -79,8 +81,11 @@ MobileHotspotWidget::MobileHotspotWidget(QWidget *parent) : QWidget(parent)
qDBusRegisterMetaType<QMap<QString, QVector<QStringList> >>();
initUI();
#ifdef HOTSPOT_CONTROL
initConnectDevPage();
initBlackListPage();
#endif
m_switchBtn->installEventFilter(this);
m_interface = new QDBusInterface("com.kylin.network", "/com/kylin/network",
@ -99,7 +104,9 @@ MobileHotspotWidget::MobileHotspotWidget(QWidget *parent) : QWidget(parent)
initInterfaceInfo();
getApInfo();
#ifdef HOTSPOT_CONTROL
initNmDbus();
#endif
this->setLayout(m_Vlayout);
m_Vlayout->addStretch();
@ -110,8 +117,10 @@ MobileHotspotWidget::MobileHotspotWidget(QWidget *parent) : QWidget(parent)
updateBandCombox();
});
#ifdef HOTSPOT_CONTROL
m_connectDevPage->refreshStalist();
m_blacklistPage->refreshBlacklist();
#endif
this->update();
}
@ -255,9 +264,9 @@ void MobileHotspotWidget::initDbusConnect()
}
connect(m_apNameLine, &QLineEdit::textEdited, this, &MobileHotspotWidget::onApLineEditTextEdit);
#ifdef HOTSPOT_CONTROL
connect(m_connectDevPage, SIGNAL(setStaIntoBlacklist(QString)), m_blacklistPage, SLOT(onsetStaIntoBlacklist(QString)));
#endif
connect(m_pwdNameLine, SIGNAL(textChanged(QString)), this, SLOT(onPwdTextChanged()));
}
@ -415,6 +424,7 @@ void MobileHotspotWidget::getApInfo()
} else {
m_switchBtn->setChecked(false);
setUiEnabled(false);
m_uuid = apInfo.at(4);
}
} else {
qDebug() << "no such interface " << apInfo.at(2);
@ -594,10 +604,12 @@ void MobileHotspotWidget::onDeviceNameChanged(QString oldName, QString newName,
//热点断开
void MobileHotspotWidget::onHotspotDeactivated(QString devName, QString ssid)
{
#ifdef HOTSPOT_CONTROL
deleteActivePathInterface();
m_connectDevPage->setInterface(nullptr);
m_connectDevPage->refreshStalist();
m_blacklistPage->refreshBlacklist();
#endif
this->update();
if (!m_switchBtn->isChecked()) {
@ -618,7 +630,7 @@ void MobileHotspotWidget::onHotspotActivated(QString devName, QString ssid, QStr
if (m_switchBtn->isChecked()) {
return;
}
#ifdef HOTSPOT_CONTROL
if (activePath != nullptr) {
deleteActivePathInterface();
initActivePathInterface(activePath);
@ -630,6 +642,7 @@ void MobileHotspotWidget::onHotspotActivated(QString devName, QString ssid, QStr
m_connectDevPage->refreshStalist();
m_blacklistPage->refreshBlacklist();
#endif
this->update();
if (devName == m_interfaceComboBox->currentText() && ssid == m_apNameLine->text()) {
@ -780,6 +793,7 @@ QString MobileHotspotWidget::getSettingPathByUuid()
if (!reply.isValid()) {
return nullptr;
}
return reply.value();
}

View File

@ -1437,7 +1437,6 @@ void WlanPage::setWirelessSwitchEnable(bool enable)
m_wirelessConnectOpreation->setWirelessEnabled(enable);
if (!enable) {
m_netSwitch->setChecked(false);
m_netSwitch->setCheckable(false);
m_activatedNetFrame->hide();
m_activatedNetDivider->hide();
m_inactivatedNetFrame->hide();