diff --git a/plugins/mobilehotspot/connectdevpage.cpp b/plugins/mobilehotspot/connectdevpage.cpp index 15f0d56f..e4c0fde5 100644 --- a/plugins/mobilehotspot/connectdevpage.cpp +++ b/plugins/mobilehotspot/connectdevpage.cpp @@ -65,17 +65,18 @@ QFrame* ConnectdevPage::myLine() void ConnectdevPage::getConnectStaDevice(QMap &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 &staMap) staMap[macList.at(index)] = hostNameList.at(index); } } + } void ConnectdevPage::initStaDev() diff --git a/plugins/mobilehotspot/connectdevpage.h b/plugins/mobilehotspot/connectdevpage.h index 147cab36..f4324ae2 100644 --- a/plugins/mobilehotspot/connectdevpage.h +++ b/plugins/mobilehotspot/connectdevpage.h @@ -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 m_staMap; - QDBusInterface *m_avtivePathInterface = nullptr; + QDBusInterface *m_activePathInterface = nullptr; void getConnectStaDevice(QMap &blacklistMap); bool removeStaFromBlacklist(QString staMac); diff --git a/plugins/mobilehotspot/mobilehotspotwidget.cpp b/plugins/mobilehotspot/mobilehotspotwidget.cpp index 17684fbb..61d987b6 100644 --- a/plugins/mobilehotspot/mobilehotspotwidget.cpp +++ b/plugins/mobilehotspot/mobilehotspotwidget.cpp @@ -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 >>(); 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(); } diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index ca85f1df..b6fe0785 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -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();