diff --git a/plugins/component/Pages/netdetail.cpp b/plugins/component/Pages/netdetail.cpp index 220f8c21..be880ef6 100644 --- a/plugins/component/Pages/netdetail.cpp +++ b/plugins/component/Pages/netdetail.cpp @@ -334,7 +334,7 @@ void NetDetail::initUI() detailPage = new DetailPage(isWlan, m_name.isEmpty(), this); ipv4Page = new Ipv4Page(this); ipv6Page = new Ipv6Page(this); - securityPage = new SecurityPage(this); + securityPage = new SecurityPage(false, true, this); createNetPage = new CreatNetPage(this); configPage = new ConfigPage(this); diff --git a/plugins/component/Pages/securitypage.cpp b/plugins/component/Pages/securitypage.cpp index b8eb0fc5..bd909859 100644 --- a/plugins/component/Pages/securitypage.cpp +++ b/plugins/component/Pages/securitypage.cpp @@ -27,7 +27,8 @@ #define MIN_LABEL_WIDTH 146 #define MIN_EDIT_WIDTH 286 -SecurityPage::SecurityPage(bool isNetDetailPage, QWidget *parent) : isDetailPage(isNetDetailPage), QFrame(parent) +SecurityPage::SecurityPage(bool isLockScreen, bool isNetDetailPage, QWidget *parent) + : m_isLockScreen(isLockScreen), isDetailPage(isNetDetailPage), QFrame(parent) { initUI(); initConnect(); @@ -250,13 +251,18 @@ void SecurityPage::initUI() eapTypeCombox->setCurrentIndex(TLS); //TLS caCertPathCombox->addItem(tr("None"), QString(tr("None"))); //无 - caCertPathCombox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择... - clientCertPathCombox->addItem(tr("None"), QString(tr("None"))); //无 - clientCertPathCombox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择... - clientPrivateKeyCombox->addItem(tr("None"), QString(tr("None"))); //无 - clientPrivateKeyCombox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择... + if (!m_isLockScreen) { + caCertPathCombox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择... + clientCertPathCombox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择... + clientPrivateKeyCombox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择... + } + else { + caCertPathCombox->addItem(tr("Please log in to the system first."), QString(tr("Please log in to the system first."))); + clientCertPathCombox->addItem(tr("Please log in to the system first."), QString(tr("Please log in to the system first."))); + clientPrivateKeyCombox->addItem(tr("Please log in to the system first."), QString(tr("Please log in to the system first."))); + } //仅为该用户存储密码 pwdOptionCombox->addItem(tr("Store passwords only for this user"), QString(tr("Store password only for this user"))); @@ -276,7 +282,12 @@ void SecurityPage::initUI() m_pacProvisionComboBox->addItem(tr("Both"), BOTH); //两者兼用 m_pacProvisionComboBox->setCurrentIndex(0); m_pacFilePathComboBox->addItem(tr("None"), QString(tr("None"))); //无 - m_pacFilePathComboBox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择... + if (!m_isLockScreen) { + m_pacFilePathComboBox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择... + } + else { + m_pacFilePathComboBox->addItem(tr("Please log in to the system first."), QString(tr("Please log in to the system first."))); + } //禁用ClearBtn按钮 pwdEdit->setClearButtonEnabled(false); @@ -588,6 +599,17 @@ void SecurityPage::getSecuType(KySecuType &secuType, KyEapMethodType &enterprise enterpriseType = (KyEapMethodType)eapTypeCombox->currentData().toInt(); } +void SecurityPage::getEnterpriseType(KyEapMethodType &enterpriseType) +{ + enterpriseType = (KyEapMethodType)eapTypeCombox->currentData().toInt(); +} + +bool SecurityPage::getAutoConnectState() +{ + bool state = m_rememberCheckBox->isChecked(); + return state; +} + bool SecurityPage::checkIsChanged(const ConInfo info) { if (info.secType != secuTypeCombox->currentData().toInt()) { @@ -1116,6 +1138,9 @@ void SecurityPage::onPacBoxClicked() void SecurityPage::onCaCertPathComboxIndexChanged(QString str) { + if (m_isLockScreen) { + return; + } if (str.contains("Choose from file...") || str.contains("从文件选择...")) { QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///", @@ -1139,6 +1164,9 @@ void SecurityPage::onCaCertPathComboxIndexChanged(QString str) void SecurityPage::onClientCertPathComboxIndexChanged(QString str) { + if (m_isLockScreen) { + return; + } if (str.contains("Choose from file...") || str.contains("从文件选择...")) { QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///", @@ -1161,6 +1189,9 @@ void SecurityPage::onClientCertPathComboxIndexChanged(QString str) void SecurityPage::onClientPrivateKeyComboxIndexChanged(QString str) { + if (m_isLockScreen) { + return; + } if (str.contains("Choose from file...") || str.contains("从文件选择...")) { QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///", diff --git a/plugins/component/Pages/securitypage.h b/plugins/component/Pages/securitypage.h index 5d351e9b..2fa72271 100644 --- a/plugins/component/Pages/securitypage.h +++ b/plugins/component/Pages/securitypage.h @@ -38,7 +38,7 @@ class SecurityPage : public QFrame { Q_OBJECT public: - SecurityPage(bool isNetDetailPage, QWidget *parent = nullptr); + SecurityPage(bool isLockScreen, bool isNetDetailPage, QWidget *parent = nullptr); void setSecurity(KySecuType index); void setPsk(const QString &psk); @@ -60,10 +60,20 @@ public: void updateFastChange(KyEapMethodFastInfo &info); void getSecuType(KySecuType &secuType, KyEapMethodType &enterpriseType); + void getEnterpriseType(KyEapMethodType &enterpriseType); + bool getAutoConnectState(); + + KyEapMethodTlsInfo assembleTlsInfo(); + KyEapMethodPeapInfo assemblePeapInfo(); + KyEapMethodTtlsInfo assembleTtlsInfo(); + KyEapMethodLeapInfo assembleLeapInfo(); + KyEapMethodPwdInfo assemblePwdInfo(); + KyEapMethodFastInfo assembleFastInfo(); private: + bool m_isLockScreen; bool isDetailPage; -// QFormLayout *mSecuLayout; + QGridLayout *topLayout; QGridLayout *bottomLayout; QVBoxLayout *mainLayout; @@ -134,13 +144,6 @@ private: void initUI(); void initConnect(); - KyEapMethodTlsInfo assembleTlsInfo(); - KyEapMethodPeapInfo assemblePeapInfo(); - KyEapMethodTtlsInfo assembleTtlsInfo(); - KyEapMethodLeapInfo assembleLeapInfo(); - KyEapMethodPwdInfo assemblePwdInfo(); - KyEapMethodFastInfo assembleFastInfo(); - bool checkConnectBtnIsEnabled(); diff --git a/plugins/wlanconnect/hiddenwifi/enterprisewlanpage.cpp b/plugins/wlanconnect/hiddenwifi/enterprisewlanpage.cpp index 6d9997b0..97b538f8 100644 --- a/plugins/wlanconnect/hiddenwifi/enterprisewlanpage.cpp +++ b/plugins/wlanconnect/hiddenwifi/enterprisewlanpage.cpp @@ -4,13 +4,13 @@ #define MAIN_SIZE_EXPAND 480,550 #define MAIN_SIZE_NARROW 480,340 -#define PAGE_LAYOUT_MARGINS 24,0,24,0 -#define TOP_LAYOUT_MARGINS 0,14,0,0 -#define BOTTOM_LAYOUT_MARGINS 0,24,0,24 -#define LABEL_MIN_WIDTH 150 +#define PAGE_LAYOUT_MARGINS 24,14,24,24 +#define TOP_LAYOUT_MARGINS 0,0,0,0 +#define BOTTOM_LAYOUT_MARGINS 0,0,0,0 +#define LABEL_MIN_WIDTH 146 EnterpriseWlanPage::EnterpriseWlanPage(QString ssid, QString device, bool isLockScreen, QWidget *parent) - : m_ssid(ssid), m_deviceName(device), QWidget(parent) + : m_ssid(ssid), m_deviceName(device), m_isLockScreen(isLockScreen), QWidget(parent) { initUI(); initConnections(); @@ -47,7 +47,9 @@ void EnterpriseWlanPage::initUI() m_ssidTitleLabel = new QLabel(this); m_ssidTitleLabel->setMinimumWidth(LABEL_MIN_WIDTH); m_ssidLabel = new QLabel(this); - m_entSecurityWidget = new EntSecurityWidget(this); + m_entSecurityWidget = new SecurityPage(m_isLockScreen, false, this); + m_entSecurityWidget->setSecurity(KySecuType::WPA_AND_WPA2_ENTERPRISE); + m_entSecurityWidget->setSecurityVisible(false); m_cancelBtn = new QPushButton(this); m_connectBtn = new QPushButton(this); m_connectBtn->setEnabled(false); @@ -57,7 +59,7 @@ void EnterpriseWlanPage::initUI() m_mainLayout = new QVBoxLayout(this); this->setLayout(m_mainLayout); m_mainLayout->setContentsMargins(PAGE_LAYOUT_MARGINS); - m_mainLayout->setSpacing(0); + m_mainLayout->setSpacing(8); m_mainLayout->addWidget(m_ssidWidget); m_mainLayout->addWidget(m_entSecurityWidget); m_mainLayout->addStretch(); @@ -90,12 +92,12 @@ void EnterpriseWlanPage::initConnections() { connect(m_cancelBtn, &QPushButton::clicked, this, &EnterpriseWlanPage::close); connect(m_connectBtn, &QPushButton::clicked, this, &EnterpriseWlanPage::onBtnConnectClicked); - connect(m_entSecurityWidget, &EntSecurityWidget::eapTypeChanged, this, &EnterpriseWlanPage::onEapTypeChanged); - connect(m_entSecurityWidget, &EntSecurityWidget::setSecuPageState, this, [ = ](bool status) { + connect(m_entSecurityWidget, &SecurityPage::eapTypeChanged, this, &EnterpriseWlanPage::onEapTypeChanged); + connect(m_entSecurityWidget, &SecurityPage::setSecuPageState, this, [ = ](bool status) { m_connectBtn->setEnabled(status); }); - connect(m_entSecurityWidget, &EntSecurityWidget::setSecuPageState, this, [=](bool status) { + connect(m_entSecurityWidget, &SecurityPage::setSecuPageState, this, [=](bool status) { m_connectBtn->setEnabled(status); }); } @@ -118,7 +120,7 @@ void EnterpriseWlanPage::onBtnConnectClicked() connSettingInfo.m_ssid = m_ssid; connSettingInfo.setConnectName(m_ssid); connSettingInfo.setIfaceName(m_deviceName); - connSettingInfo.m_isAutoConnect = true; + connSettingInfo.m_isAutoConnect = m_entSecurityWidget->getAutoConnectState(); //ipv4 ipv6 connSettingInfo.setIpConfigType(IPADDRESS_V4, CONFIG_IP_DHCP); @@ -154,6 +156,18 @@ void EnterpriseWlanPage::onEapTypeChanged(const KyEapMethodType &type) this->setFixedSize(MAIN_SIZE_NARROW); centerToScreen(); break; + case KyEapMethodType::LEAP: + this->setFixedSize(MAIN_SIZE_NARROW); + centerToScreen(); + break; + case KyEapMethodType::PWD: + this->setFixedSize(MAIN_SIZE_NARROW); + centerToScreen(); + break; + case KyEapMethodType::FAST: + this->setFixedSize(MAIN_SIZE_EXPAND); + centerToScreen(); + break; default: break; } diff --git a/plugins/wlanconnect/hiddenwifi/enterprisewlanpage.h b/plugins/wlanconnect/hiddenwifi/enterprisewlanpage.h index 6c5b52b3..c3501562 100644 --- a/plugins/wlanconnect/hiddenwifi/enterprisewlanpage.h +++ b/plugins/wlanconnect/hiddenwifi/enterprisewlanpage.h @@ -6,7 +6,8 @@ #include #include -#include "entsecuritywidget.h" +//#include "entsecuritywidget.h" +#include "../component/Pages/securitypage.h" class EnterpriseWlanPage : public QWidget { @@ -29,13 +30,14 @@ private: QLabel *m_ssidTitleLabel; QLabel *m_ssidLabel; - EntSecurityWidget *m_entSecurityWidget = nullptr; + SecurityPage *m_entSecurityWidget = nullptr; QPushButton *m_cancelBtn; QPushButton *m_connectBtn; QWidget *m_ssidWidget; QWidget *m_btnWidget; QVBoxLayout *m_mainLayout; + bool m_isLockScreen; private Q_SLOTS: void onBtnConnectClicked(); diff --git a/plugins/wlanconnect/hiddenwifi/hiddenwifi.pri b/plugins/wlanconnect/hiddenwifi/hiddenwifi.pri index c6ec7f55..15f57dc2 100644 --- a/plugins/wlanconnect/hiddenwifi/hiddenwifi.pri +++ b/plugins/wlanconnect/hiddenwifi/hiddenwifi.pri @@ -3,10 +3,10 @@ SOURCES += \ $$PWD/enterprisewlanpage.cpp \ - $$PWD/entsecuritywidget.cpp \ +# $$PWD/entsecuritywidget.cpp \ $$PWD/hiddenwifipage.cpp \ HEADERS += \ $$PWD/enterprisewlanpage.h \ - $$PWD/entsecuritywidget.h \ +# $$PWD/entsecuritywidget.h \ $$PWD/hiddenwifipage.h \ diff --git a/plugins/wlanconnect/hiddenwifi/hiddenwifipage.cpp b/plugins/wlanconnect/hiddenwifi/hiddenwifipage.cpp index d444f1bb..0accbd6f 100644 --- a/plugins/wlanconnect/hiddenwifi/hiddenwifipage.cpp +++ b/plugins/wlanconnect/hiddenwifi/hiddenwifipage.cpp @@ -3,18 +3,19 @@ #include #define WINDOW_WIDTH 480 -#define MIN_WINDOW_HEIGHT 332 +#define MIN_WINDOW_HEIGHT 336 #define PEAP_WINDOW_HEIGHT 494 #define MAX_WINDOW_HEIGHT 540 #define PAGE_LAYOUT_MARGINS 0,0,0,0 #define TOP_LAYOUT_MARGINS 24,14,24,24 +#define CENTER_LAYOUT_MARGINS 24, 0, 24, 8 #define BOTTOM_LAYOUT_MARGINS 24,24,24,24 #define LAYOUT_SPACING 16 -#define LABEL_MIN_WIDTH 150 +#define LABEL_MIN_WIDTH 146 #define MAX_NAME_LENGTH 32 -#define PSK_SCRO_HEIGHT 182 -#define PEAP_SCRO_HEIGHT 348 -#define TLS_SCRO_HEIGHT 540 +//#define PSK_SCRO_HEIGHT 182 +//#define PEAP_SCRO_HEIGHT 348 +//#define TLS_SCRO_HEIGHT 540 #define MEDIUM_WEIGHT_VALUE 57 HiddenWiFiPage::HiddenWiFiPage(QString interface, bool isSimple, QWidget *parent) @@ -47,7 +48,9 @@ HiddenWiFiPage::~HiddenWiFiPage() void HiddenWiFiPage::getSecuType(KySecuType &secuType) { - secuType = (KySecuType)m_secuTypeCombox->currentData().toInt(); +// secuType = (KySecuType)m_secuTypeCombox->currentData().toInt(); + KyEapMethodType enterpriseType; + m_secuWidget->getSecuType(secuType, enterpriseType); } void HiddenWiFiPage::paintEvent(QPaintEvent *event) @@ -82,6 +85,212 @@ void HiddenWiFiPage::setBtnEnable(bool on) m_joinBtn->setEnabled(on); } +void HiddenWiFiPage::initUI() +{ + m_topWidget = new QWidget(this); + m_centerWidget = new QWidget(this); + m_bottomWidget = new QWidget(this); + m_secuWidget = new SecurityPage(true, false, this); + m_secuWidget->setSecurity(KySecuType::WPA_AND_WPA2_PERSONAL); + + m_descriptionLabel = new QLabel(this); + m_nameLabel = new FixLabel(this); + m_nameLabel->setFixedWidth(LABEL_MIN_WIDTH); + m_nameEdit =new LineEdit(this); + + m_bottomDivider = new Divider(this); + m_cancelBtn =new QPushButton(this); + m_joinBtn =new QPushButton(this); + + m_scrollArea = new QScrollArea(this); + m_scrollArea->setFrameShape(QFrame::NoFrame); + m_scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + QPalette pa = m_scrollArea->palette(); + pa.setBrush(QPalette::Window, Qt::transparent); + m_scrollArea->setPalette(pa); + + m_pageLayout = new QVBoxLayout(this); + m_pageLayout->setContentsMargins(0, 0, 0, 0); + m_pageLayout->setSpacing(0); + m_pageLayout->addWidget(m_topWidget); + m_pageLayout->addWidget(m_scrollArea); + m_pageLayout->addWidget(m_bottomDivider); + m_pageLayout->addWidget(m_bottomWidget); + + m_topLayout = new QHBoxLayout(m_topWidget); + m_topLayout->setContentsMargins(TOP_LAYOUT_MARGINS); + m_topLayout->setSpacing(0); + m_topLayout->addWidget(m_descriptionLabel); + m_topLayout->addStretch(); + + QWidget *ssidWidget = new QWidget(this); + QHBoxLayout *ssidLayout = new QHBoxLayout(ssidWidget); + ssidLayout->setContentsMargins(0, 0, 0, 0); + ssidLayout->setSpacing(0); + m_nameLabel->setMinimumWidth(LABEL_MIN_WIDTH); + ssidLayout->addWidget(m_nameLabel); + ssidLayout->addWidget(m_nameEdit); + + m_centerVBoxLayout = new QVBoxLayout(m_centerWidget); + m_centerVBoxLayout->setContentsMargins(CENTER_LAYOUT_MARGINS); + m_centerVBoxLayout->setSpacing(0); + m_centerVBoxLayout->addWidget(ssidWidget); + m_centerVBoxLayout->addSpacing(LAYOUT_SPACING); + m_centerVBoxLayout->addWidget(m_secuWidget); + + m_centerWidget->setFixedWidth(WINDOW_WIDTH); + m_scrollArea->setFixedWidth(WINDOW_WIDTH); + m_scrollArea->setWidget(m_centerWidget); + m_scrollArea->setWidgetResizable(true); + + //底部按钮 + m_bottomLayout = new QHBoxLayout(m_bottomWidget); + m_bottomLayout->setContentsMargins(BOTTOM_LAYOUT_MARGINS); + m_bottomLayout->setSpacing(LAYOUT_SPACING); + if (!m_isSimple) { + m_showListBtn = new KBorderlessButton(this); + m_showListBtn->setText(tr("Show Network List")); //显示网络列表 + m_bottomLayout->addWidget(m_showListBtn); + connect(m_showListBtn, SIGNAL(clicked()), this, SLOT(onBtnShowListClicked())); + } + m_bottomLayout->addStretch(); + m_bottomLayout->addWidget(m_cancelBtn); + m_bottomLayout->addWidget(m_joinBtn); + + //请输入您想要加入网络的名称和安全类型 + m_descriptionLabel->setText(tr("Please enter the network name and security type")); + QFont font = m_descriptionLabel->font(); + font.setWeight(MEDIUM_WEIGHT_VALUE); + m_descriptionLabel->setFont(font); + + m_nameLabel->setLabelText(tr("Network name(SSID)")); //网络名(SSID) + m_cancelBtn->setText(tr("Cancel")); + m_joinBtn->setText(tr("Join")); + + m_nameEdit->setMaxLength(MAX_NAME_LENGTH); + m_nameEdit->setPlaceholderText(tr("Required")); //必填 + + this->setWindowTitle(tr("Find and Join Wi-Fi")); + this->setWindowIcon(QIcon::fromTheme("kylin-network")); + this->setFixedWidth(WINDOW_WIDTH); + this->setFixedHeight(MIN_WINDOW_HEIGHT); +} + +void HiddenWiFiPage::initComponent() +{ + connect(m_cancelBtn, &QPushButton::clicked, this, [=] { + close(); + }); + + connect(m_joinBtn, SIGNAL(clicked()), this, SLOT(onBtnJoinClicked())); + + connect(m_secuWidget, &SecurityPage::secuTypeChanged, this, &HiddenWiFiPage::onSecuTypeChanged); + connect(m_secuWidget, &SecurityPage::eapTypeChanged, this, &HiddenWiFiPage::onEapTypeChanged); + connect(m_secuWidget, &SecurityPage::setSecuPageState, this, [ = ](bool status) { + m_isSecuOk = status; + setJoinBtnEnable(); + }); + connect(m_nameEdit, &LineEdit::textChanged, this, &HiddenWiFiPage::setJoinBtnEnable); +} + +void HiddenWiFiPage::setJoinBtnEnable() +{ + if (!m_nameEdit->text().isEmpty() && m_isSecuOk) { + m_isJoinBtnEnable = true; + } else { + m_isJoinBtnEnable = false; + } + m_joinBtn->setEnabled(m_isJoinBtnEnable); +} + +void HiddenWiFiPage::onBtnShowListClicked() +{ + QDBusInterface interface("com.kylin.network", + "/com/kylin/network", + "com.kylin.network", + QDBusConnection::sessionBus()); + if(interface.isValid()) { + interface.call(QStringLiteral("showKylinNM"), 1); + } +} + +void HiddenWiFiPage::onBtnJoinClicked() +{ + qDebug() << "on_btnJoin_clicked"; + + KyWirelessConnectSetting connSettingInfo; + //基本信息 + connSettingInfo.m_ssid = m_nameEdit->text(); + connSettingInfo.setConnectName(connSettingInfo.m_ssid); + connSettingInfo.setIfaceName(m_deviceName); + connSettingInfo.isHidden = true; + connSettingInfo.m_isAutoConnect = m_secuWidget->getAutoConnectState(); + connSettingInfo.m_secretFlag = 0; + + //ipv4 ipv6 + connSettingInfo.setIpConfigType(IPADDRESS_V4, CONFIG_IP_DHCP); + connSettingInfo.setIpConfigType(IPADDRESS_V6, CONFIG_IP_DHCP); + + KySecuType secuType; + KyEapMethodType eapType; + m_secuWidget->getSecuType(secuType, eapType); + + if (secuType == NONE) { + Q_EMIT connectHideNormalConnect(connSettingInfo, NONE); + } else if (secuType == WPA_AND_WPA2_PERSONAL || secuType == WPA3_PERSONAL) { + m_secuWidget->updateSecurityChange(connSettingInfo); + Q_EMIT connectHideNormalConnect(connSettingInfo, secuType); + }else if (secuType == WPA_AND_WPA2_ENTERPRISE) { + if (eapType == PEAP) { + KyEapMethodPeapInfo info = m_secuWidget->assemblePeapInfo(); + Q_EMIT connectHidePeapConnect(info, connSettingInfo); + } else if (eapType == TTLS) { + KyEapMethodTtlsInfo info = m_secuWidget->assembleTtlsInfo(); + Q_EMIT connectHideTtlsConnect(info, connSettingInfo); + } else if (eapType == LEAP) { + KyEapMethodLeapInfo info = m_secuWidget->assembleLeapInfo(); + Q_EMIT connectHideLeapConnect(info, connSettingInfo); + } else if (eapType == PWD) { + KyEapMethodPwdInfo info = m_secuWidget->assemblePwdInfo(); + Q_EMIT connectHidePwdConnect(info, connSettingInfo); + } else { + qWarning() << "unsupport now!!!"; + } + } + + close(); +} + +void HiddenWiFiPage::onSecuTypeChanged(const KySecuType &type) +{ + if (type != KySecuType::WPA_AND_WPA2_ENTERPRISE) { + this->setFixedHeight(MIN_WINDOW_HEIGHT); + } +} + +void HiddenWiFiPage::onEapTypeChanged(const KyEapMethodType &type) +{ + if (type == KyEapMethodType::TLS || type == KyEapMethodType::FAST) { + this->setFixedHeight(MAX_WINDOW_HEIGHT); + } else if (type == KyEapMethodType::PEAP || type == KyEapMethodType::TTLS || type == KyEapMethodType::LEAP || type == KyEapMethodType::PWD) { + this->setFixedHeight(PEAP_WINDOW_HEIGHT); + } +} + +void HiddenWiFiPage::centerToScreen() +{ + QDesktopWidget* m = QApplication::desktop(); + QRect desk_rect = m->screenGeometry(m->screenNumber(QCursor::pos())); + int desk_x = desk_rect.width(); + int desk_y = desk_rect.height(); + int x = this->width(); + int y = this->height(); + this->move((desk_x - x)/ 2 , (desk_y - y)/ 2); +} + + + +#if 0 void HiddenWiFiPage::initUI() { m_topWidget = new QWidget(this); @@ -212,17 +421,6 @@ void HiddenWiFiPage::initUI() showNone(); } -void HiddenWiFiPage::centerToScreen() -{ - QDesktopWidget* m = QApplication::desktop(); - QRect desk_rect = m->screenGeometry(m->screenNumber(QCursor::pos())); - int desk_x = desk_rect.width(); - int desk_y = desk_rect.height(); - int x = this->width(); - int y = this->height(); - this->move((desk_x - x)/ 2 , (desk_y - y)/ 2); -} - void HiddenWiFiPage::initComponent() { connect(m_cancelBtn, &QPushButton::clicked, this, [=] { @@ -373,14 +571,4 @@ void HiddenWiFiPage::onSecuTypeComboxIndexChanged() } centerToScreen(); } - -void HiddenWiFiPage::onBtnShowListClicked() -{ - QDBusInterface interface("com.kylin.network", - "/com/kylin/network", - "com.kylin.network", - QDBusConnection::sessionBus()); - if(interface.isValid()) { - interface.call(QStringLiteral("showKylinNM"), 1); - } -} +#endif diff --git a/plugins/wlanconnect/hiddenwifi/hiddenwifipage.h b/plugins/wlanconnect/hiddenwifi/hiddenwifipage.h index 65dff37e..ecd99252 100644 --- a/plugins/wlanconnect/hiddenwifi/hiddenwifipage.h +++ b/plugins/wlanconnect/hiddenwifi/hiddenwifipage.h @@ -16,7 +16,8 @@ #include "kwidget.h" #include "kpasswordedit.h" #include "kborderlessbutton.h" -#include "entsecuritywidget.h" +//#include "entsecuritywidget.h" +#include "../component/Pages/securitypage.h" #include "kylin-nm/depend/kywirelessconnectoperation.h" #include <../component/FixLabel/fixlabel.h> @@ -41,32 +42,32 @@ private: void centerToScreen(); void initComponent(); - void showNone(); - void showPsk(); - void showEnt(); +// void showNone(); +// void showPsk(); +// void showEnt(); void setBtnEnable(bool on); void setJoinBtnEnable(); - void setWindowWidth(KyEapMethodType eapType); +// void setWindowWidth(KyEapMethodType eapType); private: QWidget *m_topWidget; QWidget *m_centerWidget; QWidget *m_bottomWidget; - EntSecurityWidget *m_secuWidget; + SecurityPage *m_secuWidget; QLabel *m_descriptionLabel; FixLabel *m_nameLabel; - QLabel *m_secuTypeLabel; - QLabel *m_pwdLabel; - QLabel *m_emptyLabel; - QLabel *m_checkLabel; +// QLabel *m_secuTypeLabel; +// QLabel *m_pwdLabel; +// QLabel *m_emptyLabel; +// QLabel *m_checkLabel; LineEdit *m_nameEdit; - QComboBox *m_secuTypeCombox; - KPasswordEdit *m_pwdEdit = nullptr; +// QComboBox *m_secuTypeCombox; +// KPasswordEdit *m_pwdEdit = nullptr; - QCheckBox *m_rememberCheckBox = nullptr; +// QCheckBox *m_rememberCheckBox = nullptr; Divider *m_bottomDivider = nullptr; KBorderlessButton *m_showListBtn = nullptr; @@ -86,13 +87,18 @@ private: QString m_deviceName; private Q_SLOTS: - void on_btnJoin_clicked(); - void onSecuTypeComboxIndexChanged(); +// void on_btnJoin_clicked(); +// void onSecuTypeComboxIndexChanged(); void onBtnShowListClicked(); + void onBtnJoinClicked(); + void onSecuTypeChanged(const KySecuType &type); + void onEapTypeChanged(const KyEapMethodType &type); Q_SIGNALS: void connectHidePeapConnect(KyEapMethodPeapInfo info, KyWirelessConnectSetting connSettingInfo); void connectHideTtlsConnect(KyEapMethodTtlsInfo info, KyWirelessConnectSetting connSettingInfo); + void connectHideLeapConnect(KyEapMethodLeapInfo info, KyWirelessConnectSetting connSettingInfo); + void connectHidePwdConnect(KyEapMethodPwdInfo info, KyWirelessConnectSetting connSettingInfo); void connectHideNormalConnect(KyWirelessConnectSetting connSettingInfo, KySecuType type); }; #endif // HIDDENWIFIPAGE_H diff --git a/plugins/wlanconnect/itemframe.cpp b/plugins/wlanconnect/itemframe.cpp index 16e36815..4603e6de 100644 --- a/plugins/wlanconnect/itemframe.cpp +++ b/plugins/wlanconnect/itemframe.cpp @@ -112,6 +112,8 @@ void ItemFrame::showJoinPage(bool isSimple, QWidget *widget) connect(joinPage, &HiddenWiFiPage::connectHideNormalConnect, this, &ItemFrame::connectHideNormalConnect); connect(joinPage, &HiddenWiFiPage::connectHideTtlsConnect, this, &ItemFrame::connectHideTtlsConnect); connect(joinPage, &HiddenWiFiPage::connectHidePeapConnect, this, &ItemFrame::connectHidePeapConnect); + connect(joinPage, &HiddenWiFiPage::connectHideLeapConnect, this, &ItemFrame::connectHideLeapConnect); + connect(joinPage, &HiddenWiFiPage::connectHidePwdConnect, this, &ItemFrame::connectHidePwdConnect); joinPage->show(); } } diff --git a/plugins/wlanconnect/itemframe.h b/plugins/wlanconnect/itemframe.h index 616ca66c..7524b7b0 100644 --- a/plugins/wlanconnect/itemframe.h +++ b/plugins/wlanconnect/itemframe.h @@ -58,6 +58,8 @@ Q_SIGNALS: void addNetItemClick(); void connectHidePeapConnect(KyEapMethodPeapInfo info, KyWirelessConnectSetting connSettingInfo); void connectHideTtlsConnect(KyEapMethodTtlsInfo info, KyWirelessConnectSetting connSettingInfo); + void connectHideLeapConnect(KyEapMethodLeapInfo info, KyWirelessConnectSetting connSettingInfo); + void connectHidePwdConnect(KyEapMethodPwdInfo info, KyWirelessConnectSetting connSettingInfo); void connectHideNormalConnect(KyWirelessConnectSetting connSettingInfo, KySecuType type); }; diff --git a/plugins/wlanconnect/wlanconnect.cpp b/plugins/wlanconnect/wlanconnect.cpp index a82eb860..034806ea 100644 --- a/plugins/wlanconnect/wlanconnect.cpp +++ b/plugins/wlanconnect/wlanconnect.cpp @@ -795,6 +795,8 @@ void WlanConnect::addDeviceFrame(QString devName) connect(itemFrame, &ItemFrame::connectHideNormalConnect, manager, &KyNetworkManager::onAddAndActivateNormalWifi); connect(itemFrame, &ItemFrame::connectHideTtlsConnect, manager, &KyNetworkManager::onAddAndActiveWirelessEnterPriseTtlsConnect); connect(itemFrame, &ItemFrame::connectHidePeapConnect, manager, &KyNetworkManager::onAddAndActiveWirelessEnterPrisePeapConnect); + connect(itemFrame, &ItemFrame::connectHideLeapConnect, manager, &KyNetworkManager::onAddAndActiveWirelessEnterPriseLeapConnect); + connect(itemFrame, &ItemFrame::connectHidePwdConnect, manager, &KyNetworkManager::onAddAndActiveWirelessEnterPrisePwdConnect); } //减少设备