Merge branch 'up-dbus' into 'dbus-interface'

remove useless method && fix enterprise wifi connect && get ap info method &&...

See merge request kylin-desktop/kylin-nm!343
This commit is contained in:
ren peijia 2021-10-22 03:06:07 +00:00
commit 1b00ebab63
19 changed files with 228 additions and 93 deletions

View File

@ -496,6 +496,7 @@ KyApConnectItem *KyActiveConnectResourse::getApActiveConnectItem(NetworkManager:
KyApConnectItem *apConnectItem = new KyApConnectItem();
apConnectItem->m_connectName = connectPtr->name();
apConnectItem->m_connectSsid = wirelessSetting->ssid();
apConnectItem->m_connectUuid = activeConnectPtr->uuid();
apConnectItem->m_ifaceName = settingPtr->interfaceName();

View File

@ -5,6 +5,7 @@ KyApConnectItem::KyApConnectItem(QObject *parent) : QObject(parent)
{
m_connectName = "";
m_connectUuid = "";
m_connectSsid = "";
m_ifaceName = "";
m_password = "";
m_band = "";

View File

@ -13,6 +13,7 @@ public:
public:
QString m_connectName;
QString m_connectSsid;
QString m_connectUuid;
QString m_ifaceName;
QString m_password;

View File

@ -544,14 +544,23 @@ KyApConnectItem *KyConnectResourse::getApConnectItem(NetworkManager::Connection:
NetworkManager::ConnectionSettings::Ptr settingPtr = connectPtr->settings();
NetworkManager::WirelessSetting::Ptr wirelessSetting
= settingPtr->setting(NetworkManager::Setting::Wireless).dynamicCast<NetworkManager::WirelessSetting>();
QString name = wirelessSetting->ssid();
qDebug() << name << settingPtr->interfaceName();
if (NetworkManager::WirelessSetting::NetworkMode::Ap
!= wirelessSetting->mode()) {
qDebug() << "[KyConnectResourse]" <<"get ap item failed, the active connect mode is not ap.";
return nullptr;
}
KyNetworkDeviceResourse deviceResource;
if (!deviceResource.checkWirelessDeviceExist(settingPtr->interfaceName())) {
qDebug() << "[KyConnectResourse]" <<"get ap item failed, the ap device is not exist yet";
return nullptr;
}
KyApConnectItem *apConnectItem = new KyApConnectItem();
apConnectItem->m_connectName = connectPtr->name();
apConnectItem->m_connectSsid = wirelessSetting->ssid();
apConnectItem->m_connectUuid = connectPtr->uuid();
if (wirelessSetting->band() == NetworkManager::WirelessSetting::FrequencyBand::A) {
apConnectItem->m_band = str2GBand;
@ -590,6 +599,8 @@ KyApConnectItem *KyConnectResourse::getApConnectionByUuid(QString connectUuid)
void KyConnectResourse::getApConnections(QList<KyApConnectItem *> &apConnectItemList)
{
QList<KyApConnectItem *> apActiveConnectItemList;
QList<KyApConnectItem *> apDeactiveConnectItemList;
int index = 0;
NetworkManager::Connection::List connectList;
@ -615,12 +626,18 @@ void KyConnectResourse::getApConnections(QList<KyApConnectItem *> &apConnectItem
KyApConnectItem *connectItem = getApConnectItem(connectPtr);
if (nullptr != connectItem) {
apConnectItemList << connectItem;
if (connectItem->m_isActivated) {
apActiveConnectItemList << connectItem;
} else {
apDeactiveConnectItemList << connectItem;
}
}
connectPtr = nullptr;
}
apConnectItemList << apActiveConnectItemList << apDeactiveConnectItemList;
return;
}

View File

@ -331,3 +331,10 @@ void KyNetworkDeviceResourse::onDeviceUpdate(NetworkManager::Device * dev)
}
}
}
bool KyNetworkDeviceResourse::checkWirelessDeviceExist(const QString devName)
{
QStringList list;
getNetworkDeviceList(NetworkManager::Device::Type::Wifi, list);
return list.contains(devName);
}

View File

@ -38,6 +38,7 @@ public:
//void setDeviceAutoConnect();
void getDeviceActiveAPInfo(const QString devName, QString &strMac, uint &iHz, uint &iChan, QString &secuType);
int getWirelessDeviceCapability(const QString deviceName);
bool checkWirelessDeviceExist(const QString devName);
private:
KyWiredConnectOperation wiredOperation;

View File

@ -99,49 +99,49 @@ void DbusAdaptor::setDeviceEnable(QString devName, bool enable)
}
//设置默认网卡
void DbusAdaptor::setDefaultWiredDevice(QString deviceName)
{
if (!checkDeviceExist(WIRED, deviceName)) {
return;
}
setDefaultDevice(WIRED, deviceName);
parent()->setWiredDefaultDevice(deviceName);
return;
}
//void DbusAdaptor::setDefaultWiredDevice(QString deviceName)
//{
// if (!checkDeviceExist(WIRED, deviceName)) {
// return;
// }
// setDefaultDevice(WIRED, deviceName);
// parent()->setWiredDefaultDevice(deviceName);
// return;
//}
QString DbusAdaptor::getDefaultWiredDevice()
{
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
m_settings->beginGroup("DEFAULTCARD");
QString key("wired");
QString deviceName = m_settings->value(key, "").toString();
m_settings->endGroup();
delete m_settings;
m_settings = nullptr;
return deviceName;
}
//QString DbusAdaptor::getDefaultWiredDevice()
//{
// QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
// m_settings->beginGroup("DEFAULTCARD");
// QString key("wired");
// QString deviceName = m_settings->value(key, "").toString();
// m_settings->endGroup();
// delete m_settings;
// m_settings = nullptr;
// return deviceName;
//}
void DbusAdaptor::setDefaultWirelessDevice(QString deviceName)
{
if (!checkDeviceExist(WIRED, deviceName)) {
return;
}
setDefaultDevice(WIRELESS, deviceName);
parent()->setWirelessDefaultDevice(deviceName);
return;
}
//void DbusAdaptor::setDefaultWirelessDevice(QString deviceName)
//{
// if (!checkDeviceExist(WIRED, deviceName)) {
// return;
// }
// setDefaultDevice(WIRELESS, deviceName);
// parent()->setWirelessDefaultDevice(deviceName);
// return;
//}
QString DbusAdaptor::getDefaultWirelessDevice()
{
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
m_settings->beginGroup("DEFAULTCARD");
QString key("wireless");
QString deviceName = m_settings->value(key, "").toString();
m_settings->endGroup();
delete m_settings;
m_settings = nullptr;
return deviceName;
}
//QString DbusAdaptor::getDefaultWirelessDevice()
//{
// QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
// m_settings->beginGroup("DEFAULTCARD");
// QString key("wireless");
// QString deviceName = m_settings->value(key, "").toString();
// m_settings->endGroup();
// delete m_settings;
// m_settings = nullptr;
// return deviceName;
//}
//连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
void DbusAdaptor::activateConnect(int type, QString devName, QString ssid)

View File

@ -58,10 +58,10 @@ public Q_SLOTS: // METHODS
//有线网卡开关
Q_NOREPLY void setDeviceEnable(QString devName, bool enable);
//设置默认网卡
Q_NOREPLY void setDefaultWiredDevice(QString deviceName);
QString getDefaultWiredDevice();
Q_NOREPLY void setDefaultWirelessDevice(QString deviceName);
QString getDefaultWirelessDevice();
// Q_NOREPLY void setDefaultWiredDevice(QString deviceName);
// QString getDefaultWiredDevice();
// Q_NOREPLY void setDefaultWirelessDevice(QString deviceName);
// QString getDefaultWirelessDevice();
//连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
Q_NOREPLY void activateConnect(int type, QString devName, QString ssid);
//断开连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid

View File

@ -157,8 +157,10 @@ void EnterpriseWlanDialog::onBtnConnectClicked()
if (eapType == KyEapMethodType::TLS) {
m_info.tlsInfo.devIfaceName = m_deviceName;
m_securityPage->updateTlsChange(m_info.tlsInfo);
m_connectOperation->addAndActiveWirelessEnterPriseTlsConnect(m_info.tlsInfo, connetSetting, m_deviceName, false);
} else if (eapType == KyEapMethodType::PEAP) {
m_securityPage->updatePeapChange(m_info.peapInfo);
m_connectOperation->addAndActiveWirelessEnterPrisePeapConnect(m_info.peapInfo, connetSetting, m_deviceName, false);
} else if (eapType == KyEapMethodType::TTLS) {
m_securityPage->updateTtlsChange(m_info.ttlsInfo);
@ -174,21 +176,18 @@ void EnterpriseWlanDialog::onEapTypeChanged(const KyEapMethodType &type)
case KyEapMethodType::TLS:
if (!m_wirelessNetItem.m_connectUuid.isEmpty()) {
m_resource->getEnterPriseInfoTls(m_wirelessNetItem.m_connectUuid, m_info.tlsInfo);
m_securityPage->setTlsInfo(m_info.tlsInfo);
}
this->setFixedSize(MAIN_SIZE_EXPAND);
break;
case KyEapMethodType::PEAP:
if (m_wirelessNetItem.m_connectUuid.isEmpty()) {
m_resource->getEnterPriseInfoPeap(m_wirelessNetItem.m_connectUuid, m_info.peapInfo);
m_securityPage->setPeapInfo(m_info.peapInfo);
}
this->setFixedSize(MAIN_SIZE_NARROW);
break;
case KyEapMethodType::TTLS:
if (!m_wirelessNetItem.m_connectUuid.isEmpty()) {
m_resource->getEnterPriseInfoTtls(m_wirelessNetItem.m_connectUuid, m_info.ttlsInfo);
m_securityPage->setTtlsInfo(m_info.ttlsInfo);
}
this->setFixedSize(MAIN_SIZE_NARROW);
break;

View File

@ -64,7 +64,7 @@ void MainWindow::hideMainwindow()
*/
void MainWindow::setWiredDefaultDevice(QString deviceName)
{
m_lanWidget->updateDefaultDevice(deviceName);
// m_lanWidget->updateDefaultDevice(deviceName);
}
/**
@ -72,7 +72,7 @@ void MainWindow::setWiredDefaultDevice(QString deviceName)
*/
void MainWindow::setWirelessDefaultDevice(QString deviceName)
{
m_wlanWidget->updateDefaultDevice(deviceName);
// m_wlanWidget->updateDefaultDevice(deviceName);
}
/**

View File

@ -2,6 +2,8 @@
#include <QPainter>
#include <QListWidget>
#define MAX_NAME_LENGTH 32
#define MAX_LABEL_WIDTH 276
extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed);
DetailPage::DetailPage(bool isWlan, bool isCreate, QWidget *parent)
@ -11,12 +13,15 @@ DetailPage::DetailPage(bool isWlan, bool isCreate, QWidget *parent)
this->setMaximumWidth(960);
initUI();
if (isCreate) {
connect(mSSID, &QLineEdit::textEdited, this, &DetailPage::setEnableOfSaveBtn);
connect(mSSIDEdit, &QLineEdit::textEdited, this, &DetailPage::setEnableOfSaveBtn);
}
}
void DetailPage::setSSID(const QString &ssid) {
this->mSSID->setText(ssid);
if (isCreate) {
return;
}
this->mSSIDLabel->setText(ssid);
}
void DetailPage::setProtocol(const QString &protocol) {
@ -65,7 +70,11 @@ void DetailPage::setAutoConnect(bool flag)
void DetailPage::getSsid(QString &ssid)
{
ssid = mSSID->text();
if (isCreate) {
ssid = mSSIDEdit->text();
} else {
ssid = mSSIDLabel->text();
}
}
bool DetailPage::checkIsChanged(const ConInfo info)
@ -103,17 +112,24 @@ void DetailPage::initUI() {
m_listWidget->setFocusPolicy(Qt::FocusPolicy::NoFocus);
mDetailLayout->addWidget(m_listWidget);
mSSID = new QLineEdit(this);
mSSID->setAlignment(Qt::AlignRight);
if (!isCreate) {
mSSID->setStyleSheet("background:transparent;border-width:0px;border-style:none");
mSSID->setFocusPolicy(Qt::NoFocus);
mSSIDLabel = new FixLabel(this);
mSSIDLabel->setFixedWidth(MAX_LABEL_WIDTH);
mSSIDLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
m_ssidWidget = new DetailWidget(qobject_cast<QWidget *>(mSSIDLabel), m_listWidget);
// mSSID->setStyleSheet("background:transparent;border-width:0px;border-style:none");
// mSSID->setFocusPolicy(Qt::NoFocus);
} else {
// mSSID->setStyleSheet("border-width:1px;;border-style:solid;border-color:black;border-radius:2px");
mSSID->setStyleSheet("border-top:0px solid;border-bottom:1px solid;border-left:0px solid;border-right: 0px solid;");
mSSID->setPlaceholderText(tr("Please input SSID:"));
mSSIDEdit = new QLineEdit(this);
mSSIDEdit->setMaximumWidth(MAX_LABEL_WIDTH);
mSSIDEdit->setAlignment(Qt::AlignRight);
mSSIDEdit->setStyleSheet("border-top:0px solid;border-bottom:1px solid;border-left:0px solid;border-right: 0px solid;");
mSSIDEdit->setPlaceholderText(tr("Please input SSID:"));
mSSIDEdit->setMaxLength(MAX_NAME_LENGTH);
m_ssidWidget = new DetailWidget(qobject_cast<QWidget *>(mSSIDEdit), m_listWidget);
}
m_ssidWidget = new DetailWidget(qobject_cast<QWidget *>(mSSID), m_listWidget);
m_ssidWidget->setKey(tr("SSID:"));
mProtocol = new QLabel(this);
@ -194,5 +210,9 @@ void DetailPage::initUI() {
}
void DetailPage::setEnableOfSaveBtn() {
emit setDetailPageState(!mSSID->text().isEmpty());
bool saveEnable = true;
if (isCreate) {
saveEnable = !mSSIDEdit->text().isEmpty();
}
emit setDetailPageState(saveEnable);
}

View File

@ -52,7 +52,8 @@ public:
DetailWidget * m_ipv6Widget = nullptr;
DetailWidget * m_macWidget = nullptr;
QLineEdit *mSSID;
QLineEdit *mSSIDEdit;
FixLabel *mSSIDLabel;
QLabel *mProtocol;
QLabel *mSecType;
QLabel *mHz;

View File

@ -1,7 +1,43 @@
#include "detailwidget.h"
#include <QFontMetrics>
#include <QDebug>
#define ITEM_HEIGHT 36
#define ITEM_MARGINS 18,0,16,0
FixLabel::FixLabel(QWidget *parent):
QLabel(parent)
{
}
FixLabel::~FixLabel()
{
}
void FixLabel::paintEvent(QPaintEvent *event)
{
QFontMetrics fontMetrics(this->font());
int fontSize = fontMetrics.width(mStr);
if (fontSize > this->width()) {
this->setText(fontMetrics.elidedText(mStr, Qt::ElideRight, this->width()), false);
this->setToolTip(mStr);
} else {
this->setText(mStr, false);
this->setToolTip("");
}
QLabel::paintEvent(event);
}
void FixLabel::setText(const QString & text, bool saveTextFlag)
{
if (saveTextFlag) {
mStr = text;
}
QLabel::setText(text);
}
DetailWidget::DetailWidget(QWidget *valueWidget, QWidget *parent)
: m_valueWidget(valueWidget) , QWidget(parent)
{
@ -24,6 +60,7 @@ void DetailWidget::initUI()
m_mainLayout->addWidget(m_keyLabel);
m_mainLayout->addStretch();
m_mainLayout->addWidget(m_valueWidget);
// m_valueWidget->setMaximumWidth(100000000000);
}
void DetailWidget::setKey(const QString &keyLabel)

View File

@ -5,6 +5,22 @@
#include <QLabel>
#include <QHBoxLayout>
//文本长自动省略并添加悬浮
class FixLabel : public QLabel
{
Q_OBJECT
public:
FixLabel(QWidget *parent = nullptr);
~FixLabel();
void setText(const QString &text, bool saveTextFlag = true);
private:
void paintEvent(QPaintEvent *event);
private:
QString mStr;
};
class DetailWidget : public QWidget
{
Q_OBJECT

View File

@ -65,8 +65,8 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv
centerToScreen();
qDebug() << m_isCreateNet << name;
if (m_isCreateNet && !name.isEmpty()) {
m_isCreateNet = false;
if (!m_isCreateNet && name.isEmpty()) {
m_isCreateNet = true;
}
qDebug() << m_isCreateNet;
m_netDeviceResource = new KyNetworkDeviceResourse(this);
@ -139,7 +139,7 @@ void NetDetail::initUI()
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(9,9,14,24);
detailPage = new DetailPage(isWlan, m_isCreateNet, this);
detailPage = new DetailPage(isWlan, m_name.isEmpty(), this);
ipv4Page = new Ipv4Page(this);
ipv6Page = new Ipv6Page(this);
securityPage = new SecurityPage(this);
@ -432,7 +432,8 @@ void NetDetail::getBaseInfo(ConInfo &conInfo)
}
} else {
uint iHz,iChan;
m_netDeviceResource->getDeviceActiveAPInfo(m_deviceName, conInfo.strMac, iHz, iChan, conInfo.strSecType);
QString strMac;
m_netDeviceResource->getDeviceActiveAPInfo(m_deviceName, strMac, iHz, iChan, conInfo.strSecType);
conInfo.strHz = QString::number(iHz);
conInfo.strChan = QString::number(iChan);
@ -580,17 +581,21 @@ void NetDetail::initTtlsInfo(ConInfo &conInfo)
//点击了保存更改网络设置的按钮
void NetDetail::on_btnConfirm_clicked()
{
qDebug() << "on_btnConfirm_clicked";
setEnabled(false);
if (m_isCreateNet) {
if (!isWlan) {
//新建有线连接
qDebug() << "Confirm create wired connect";
if (!createWiredConnect()) {
setEnabled(true);
return;
}
} else {
//新建无线连接
qDebug() << "Confirm create wireless connect";
if (!createWirelessConnect()) {
setEnabled(true);
return;
}
}
@ -598,6 +603,7 @@ void NetDetail::on_btnConfirm_clicked()
//更新连接
qDebug() << "Confirm update connect";
if (!updateConnect()) {
setEnabled(true);
return;
}
}
@ -709,7 +715,11 @@ bool NetDetail::createWirelessConnect()
KyWirelessConnectSetting connetSetting;
//基本信息
QString ssid;
detailPage->getSsid(ssid);
if (m_name.isEmpty()) {
detailPage->getSsid(ssid);
} else {
ssid = m_name;
}
connetSetting.setConnectName(ssid);
connetSetting.setIfaceName(m_deviceName);
if (detailPage->checkIsChanged(m_info)) {
@ -786,7 +796,7 @@ bool NetDetail::createWirelessConnect()
qDebug() << "add new personal connect";
m_wirelessConnOpration->addConnect(connetSetting);
} else {
qDebug() << "addAndConnect personal connect";
qDebug() << "addAndConnect personal connect" << m_deviceName;
m_wirelessConnOpration->addAndActiveWirelessConnect(m_deviceName, connetSetting, true);
}
}
@ -847,7 +857,11 @@ bool NetDetail::updateConnect()
if (ipv4Change || ipv6Change || securityChange) {
if (isActive) {
//信息变化 断开-重连
//信息变化 断开-重连 更新需要時間 不可以立即重連
// sleep(1);
QEventLoop eventloop;
QTimer::singleShot(1000, &eventloop, SLOT(quit()));
eventloop.exec();
m_wirelessConnOpration->activateConnection(m_uuid, m_deviceName);
}
}

View File

@ -161,9 +161,11 @@ void SecurityPage::initUI()
void SecurityPage::initConnect()
{
//安全类型变化
connect(secuTypeCombox, &QComboBox::currentTextChanged, this, &SecurityPage::onSecuTypeComboxIndexChanged);
// connect(secuTypeCombox, &QComboBox::currentTextChanged, this, &SecurityPage::onSecuTypeComboxIndexChanged);
connect(secuTypeCombox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SecurityPage::onSecuTypeComboxIndexChanged);
//EAP方式变化
connect(eapTypeCombox, &QComboBox::currentTextChanged, this, &SecurityPage::onEapTypeComboxIndexChanged);
// connect(eapTypeCombox, &QComboBox::currentTextChanged, this, &SecurityPage::onEapTypeComboxIndexChanged);
connect(eapTypeCombox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SecurityPage::onEapTypeComboxIndexChanged);
connect(caNeedBox, &QCheckBox::clicked, this, &SecurityPage::onCaNeedBoxClicked);
@ -519,7 +521,7 @@ KyEapMethodTlsInfo SecurityPage::assembleTlsInfo()
info.clientCertPath = clientCertPathCombox->currentText();
info.clientPrivateKey = clientPrivateKeyCombox->currentText();
info.clientPrivateKeyPWD = clientPrivateKeyPwdEdit->text();
info.m_privateKeyPWDFlag = (privateKeyBox->isChecked() ? NetworkManager::Setting::NotSaved : NetworkManager::Setting::None);
info.m_privateKeyPWDFlag = NetworkManager::Setting::None;
return info;
}
@ -530,7 +532,7 @@ KyEapMethodPeapInfo SecurityPage::assemblePeapInfo()
info.phase2AuthMethod = (KyNoEapMethodAuth)eapMethodCombox->currentData().toInt();
info.userName = userNameEdit->text();
info.userPWD = userPwdEdit->text();
info.m_passwdFlag = (userPwdBox->isChecked() ? NetworkManager::Setting::NotSaved : NetworkManager::Setting::None);
info.m_passwdFlag = (userPwdFlagBox->isChecked() ? NetworkManager::Setting::NotSaved : NetworkManager::Setting::None);
return info;
}
@ -571,7 +573,7 @@ KyEapMethodTtlsInfo SecurityPage::assembleTtlsInfo()
}
info.userName = userNameEdit->text();
info.userPWD = userPwdEdit->text();
info.m_passwdFlag = (userPwdBox->isChecked() ? NetworkManager::Setting::NotSaved : NetworkManager::Setting::None);
info.m_passwdFlag = (userPwdFlagBox->isChecked() ? NetworkManager::Setting::NotSaved : NetworkManager::Setting::None);
return info;
}
@ -650,7 +652,6 @@ void SecurityPage::setEnableOfSaveBtn()
void SecurityPage::onSecuTypeComboxIndexChanged()
{
int index = secuTypeCombox->currentData().toInt();
qDebug() << "onSecuTypeComboxIndexChanged" << index;
if (index == WPA_AND_WPA2_PERSONAL || index == WPA3_PERSONAL) {
showPsk();
} else if (index == WPA_AND_WPA2_ENTERPRISE) {
@ -662,6 +663,7 @@ void SecurityPage::onSecuTypeComboxIndexChanged()
void SecurityPage::onEapTypeComboxIndexChanged()
{
qDebug() << "onEapTypeComboxIndexChanged";
int index = eapTypeCombox->currentData().toInt();
if (index == TLS) {
showTls();

View File

@ -102,17 +102,17 @@ void TabPage::initUI()
m_mainLayout->addWidget(m_settingsFrame);
}
void TabPage::updateDefaultDevice(QString &deviceName)
{
qDebug() << "updateDefaultDevice" << deviceName;
m_defaultDevice = deviceName;
}
//void TabPage::updateDefaultDevice(QString &deviceName)
//{
// qDebug() << "updateDefaultDevice" << deviceName;
// m_defaultDevice = deviceName;
//}
QString TabPage::getDefaultDevice()
{
qDebug() << "getDefaultDevice" << m_defaultDevice;
return m_defaultDevice;
}
//QString TabPage::getDefaultDevice()
//{
// qDebug() << "getDefaultDevice" << m_defaultDevice;
// return m_defaultDevice;
//}
void TabPage::showDesktopNotify(const QString &message)
{

View File

@ -54,8 +54,8 @@ public:
explicit TabPage(QWidget *parent = nullptr);
~TabPage();
void updateDefaultDevice(QString &deviceName);
QString getDefaultDevice();
// void updateDefaultDevice(QString &deviceName);
// QString getDefaultDevice();
static void showDesktopNotify(const QString &message);
signals:
@ -91,8 +91,6 @@ protected:
QHBoxLayout * m_settingsLayout = nullptr;
QLabel * m_settingsLabel = nullptr;
QString m_defaultDevice = "";
//临时增加的下拉框选择网卡区域
QFrame * m_deviceFrame = nullptr;
QHBoxLayout * m_deviceLayout = nullptr;

View File

@ -942,7 +942,7 @@ void WlanPage::requestScan()
void WlanPage::onHiddenWlanClicked()
{
qDebug() << "[wlanPage] AddHideWifi Clicked! " << Q_FUNC_INFO << __LINE__ ;
NetDetail *netDetail = new NetDetail(m_defaultDevice, "", "", false, true, true, this);
NetDetail *netDetail = new NetDetail(m_currentDevice, "", "", false, true, true, this);
netDetail->show();
}
@ -1125,7 +1125,7 @@ void WlanPage::getStoredApInfo(QStringList &list)
QList<KyApConnectItem *> apConnectItemList;
m_connectResource->getApConnections(apConnectItemList);
if (!apConnectItemList.isEmpty()) {
list << apConnectItemList.at(0)->m_connectName;
list << apConnectItemList.at(0)->m_connectSsid;
list << apConnectItemList.at(0)->m_password;
list << apConnectItemList.at(0)->m_ifaceName;
list << (apConnectItemList.at(0)->m_isActivated? "true":"false");
@ -1140,7 +1140,7 @@ void WlanPage::getApInfoBySsid(QString devName, QString ssid, QStringList &list)
QList<KyApConnectItem *> apConnectItemList;
m_connectResource->getApConnections(apConnectItemList);
for (int i = 0; i < apConnectItemList.size(); i++) {
if (apConnectItemList.at(i)->m_connectName == ssid
if (apConnectItemList.at(i)->m_connectSsid == ssid
&& apConnectItemList.at(i)->m_ifaceName == devName) {
list << apConnectItemList.at(i)->m_password;
list << apConnectItemList.at(i)->m_band;
@ -1162,8 +1162,28 @@ void WlanPage::activateWirelessConnection(const QString& devName, const QString&
m_wirelessConnectOpreation->activeWirelessConnect(devName, wirelessNetItem.m_connectUuid);
} else {
//todo: 显示界面输入密码 无需密码的wifi
}
# if 0
if (devName != m_currentDevice) {
//todo
} else {
QListWidgetItem *p_listWidgetItem = nullptr;
WlanListItem *p_wlanItem = nullptr;
if (m_wirelessNetItemMap.contains(ssid)) {
p_listWidgetItem = m_wirelessNetItemMap.value(ssid);
p_wlanItem = (WlanListItem*)m_inactivatedNetListWidget->itemWidget(p_listWidgetItem);
int row = m_inactivatedNetListWidget->row(p_listWidgetItem);
// m_inactivatedNetListArea->scrollToItem(p_listWidgetItem, QAbstractItemView::EnsureVisible);
m_inactivatedNetListArea->verticalScrollBar()->setValue((p_listWidgetItem->sizeHint().height()*(row+1)/m_inactivatedNetListWidget->height())*m_inactivatedNetListArea->verticalScrollBar()->maximumHeight());
bool a = true;
p_wlanItem->setExpanded(a);
emit showMainWindow();
}
}
#endif
}
return;
}