Merge branch 'zdbus-ui-bysdk' into 'dbus-interface'
将目前实现的ui替换为sdk See merge request kylin-desktop/kylin-nm!595
This commit is contained in:
commit
efb08d43c8
|
@ -174,7 +174,7 @@ void WlanListItem::leaveEvent(QEvent *event)
|
|||
|
||||
bool WlanListItem::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (watched == m_showPwdButton || watched == m_autoConnectCheckBox) {
|
||||
if (watched == m_autoConnectCheckBox) {
|
||||
if (event->type() == QEvent::FocusIn) {
|
||||
m_pwdLineEdit->setFocus();
|
||||
}
|
||||
|
@ -230,10 +230,11 @@ void WlanListItem::initWlanUI()
|
|||
m_pwdFrameLyt->setSpacing(FRAME_SPACING);
|
||||
m_pwdFrame->setLayout(m_pwdFrameLyt);
|
||||
|
||||
m_pwdLineEdit = new QLineEdit(m_pwdFrame);
|
||||
m_pwdLineEdit = new KPasswordEdit(m_pwdFrame);
|
||||
m_pwdLineEdit->setFixedWidth(LINEEDIT_WIDTH);
|
||||
m_pwdLineEdit->setClearButtonEnabled(false); //禁用ClearBtn按钮
|
||||
// m_pwdLineEdit->setAttribute(Qt::WA_InputMethodEnabled, false);
|
||||
m_pwdLineEdit->setContextMenuPolicy(Qt::NoContextMenu);
|
||||
// m_pwdLineEdit->setContextMenuPolicy(Qt::NoContextMenu);
|
||||
|
||||
QRegExp rx("^[A-Za-z0-9`~!@#$%^&*()_-+=<>,.\\\/]+$");
|
||||
QRegExpValidator *latitude = new QRegExpValidator(rx, this);
|
||||
|
@ -242,24 +243,8 @@ void WlanListItem::initWlanUI()
|
|||
m_pwdLineEdit->installEventFilter(this);
|
||||
connect(m_pwdLineEdit, &QLineEdit::textChanged, this, &WlanListItem::onPwdEditorTextChanged);
|
||||
m_pwdLineEdit->setFixedHeight(PWD_AREA_HEIGHT);
|
||||
m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Password);
|
||||
m_pwdLineEdit->setTextMargins(PWD_CONTENT_MARGINS);
|
||||
m_pwdFrameLyt->addWidget(m_pwdLineEdit);
|
||||
|
||||
m_pwdLineEditLyt = new QHBoxLayout(m_pwdLineEdit);
|
||||
m_pwdLineEditLyt->setContentsMargins(PWD_LAYOUT_MARGINS);
|
||||
m_pwdLineEdit->setLayout(m_pwdLineEditLyt);
|
||||
|
||||
m_showPwdButton = new QPushButton(m_pwdLineEdit);
|
||||
m_showPwdButton->setFlat(true); //去除边框
|
||||
m_showPwdButton->installEventFilter(this);
|
||||
m_showPwdButton->setFixedSize(SHOW_PWD_BUTTON_SIZE);
|
||||
m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-hidden-symbolic"));
|
||||
m_showPwdButton->setCursor(Qt::PointingHandCursor);
|
||||
connect(m_showPwdButton, &QPushButton::clicked, this, &WlanListItem::onShowPwdButtonClicked);
|
||||
m_pwdLineEditLyt->addStretch();
|
||||
m_pwdLineEditLyt->addWidget(m_showPwdButton);
|
||||
|
||||
m_connectButton = new QPushButton(m_pwdFrame);
|
||||
m_connectButton->setFixedSize(CONNECT_BUTTON_WIDTH, PWD_AREA_HEIGHT);
|
||||
m_connectButton->setText(tr("Connect"));
|
||||
|
@ -512,24 +497,6 @@ void WlanListItem::onPwdEditorTextChanged()
|
|||
return;
|
||||
}
|
||||
|
||||
void WlanListItem::onShowPwdButtonClicked()
|
||||
{
|
||||
qDebug()<< LOG_FLAG << "onShowPwdButtonClicked";
|
||||
if (!m_pwdLineEdit) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_pwdLineEdit->echoMode() == QLineEdit::EchoMode::Password) {
|
||||
m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-display-symbolic"));
|
||||
m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Normal);
|
||||
} else {
|
||||
m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-hidden-symbolic"));
|
||||
m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Password);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void WlanListItem::onConnectButtonClicked()
|
||||
{
|
||||
qDebug()<< LOG_FLAG << "onConnectButtonClicked";
|
||||
|
|
|
@ -12,6 +12,11 @@
|
|||
|
||||
#include <networkmanagerqt/wirelesssecuritysetting.h>
|
||||
|
||||
#include "kwidget.h"
|
||||
#include "kpasswordedit.h"
|
||||
|
||||
using namespace kdk;
|
||||
|
||||
#define PSK_SETTING_NAME "802-11-wireless-security"
|
||||
|
||||
#define NORMAL_HEIGHT 48
|
||||
|
@ -81,10 +86,7 @@ private:
|
|||
//密码输入区域的UI
|
||||
QFrame *m_pwdFrame = nullptr;
|
||||
QHBoxLayout *m_pwdFrameLyt = nullptr;
|
||||
|
||||
QLineEdit * m_pwdLineEdit = nullptr;
|
||||
QHBoxLayout *m_pwdLineEditLyt = nullptr;
|
||||
QPushButton *m_showPwdButton = nullptr;
|
||||
KPasswordEdit *m_pwdLineEdit = nullptr;
|
||||
QPushButton *m_connectButton = nullptr;
|
||||
|
||||
//自动连接选择区域UI
|
||||
|
@ -105,7 +107,6 @@ protected slots:
|
|||
private slots:
|
||||
void onNetButtonClicked();
|
||||
void onPwdEditorTextChanged();
|
||||
void onShowPwdButtonClicked();
|
||||
void onConnectButtonClicked();
|
||||
void onMenuTriggered(QAction *action);
|
||||
void onEnterpriseWlanDialogClose(bool isShow);
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#define SECURITY_PAGE_NUM 3
|
||||
#define CREATE_NET_PAGE_NUM 4
|
||||
#define PAGE_MIN_HEIGHT 40
|
||||
#define LAN_TAB_WIDTH 300
|
||||
#define WLAN_TAB_WIDTH 400
|
||||
|
||||
//extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed);
|
||||
|
||||
|
@ -162,6 +164,14 @@ void NetDetail::onPaletteChanged()
|
|||
delete styleGsettings;
|
||||
styleGsettings = nullptr;
|
||||
}
|
||||
|
||||
QColor colorTabBar = pal.color(QPalette::Disabled, QPalette::Highlight);
|
||||
m_netTabBar->setBackgroundColor(colorTabBar);
|
||||
}
|
||||
|
||||
void NetDetail::currentRowChangeSlot(int row)
|
||||
{
|
||||
stackWidget->setCurrentIndex(row);
|
||||
}
|
||||
|
||||
void NetDetail::paintEvent(QPaintEvent *event)
|
||||
|
@ -217,42 +227,29 @@ void NetDetail::initUI()
|
|||
bottomWidget->setMinimumHeight(PAGE_MIN_HEIGHT);
|
||||
|
||||
pageFrame = new QFrame(this);
|
||||
|
||||
QHBoxLayout *pageLayout = new QHBoxLayout(pageFrame);
|
||||
pageLayout->setSpacing(PAGE_LAYOUT_SPACING);
|
||||
|
||||
detailBtn = new QPushButton(this);
|
||||
detailBtn->setText(tr("Detail"));
|
||||
detailBtn->setCheckable(true);
|
||||
detailBtn->setChecked(true);
|
||||
|
||||
ipv4Btn = new QPushButton(this);
|
||||
ipv4Btn->setText(tr("Ipv4"));
|
||||
ipv4Btn->setCheckable(true);
|
||||
|
||||
ipv6Btn = new QPushButton(this);
|
||||
ipv6Btn->setText(tr("Ipv6"));
|
||||
ipv6Btn->setCheckable(true);
|
||||
|
||||
securityBtn = new QPushButton(this);
|
||||
securityBtn->setText(tr("Security"));
|
||||
securityBtn->setCheckable(true);
|
||||
|
||||
m_group = new QButtonGroup(this);
|
||||
m_group->addButton(detailBtn);
|
||||
m_group->addButton(ipv4Btn);
|
||||
m_group->addButton(ipv6Btn);
|
||||
// TabBar
|
||||
m_netTabBar = new KTabBar(KTabBarStyle::SegmentDark, this);
|
||||
m_netTabBar->addTab(tr("Detail")); //详情
|
||||
m_netTabBar->addTab(tr("Ipv4"));//Ipv4
|
||||
m_netTabBar->addTab(tr("Ipv6"));//Ipv6
|
||||
if (isWlan) {
|
||||
m_group->addButton(securityBtn);
|
||||
m_netTabBar->addTab(tr("Security"));//安全
|
||||
m_netTabBar->setFixedWidth(WLAN_TAB_WIDTH);
|
||||
} else {
|
||||
m_netTabBar->setFixedWidth(LAN_TAB_WIDTH);
|
||||
}
|
||||
|
||||
pageLayout->addStretch();
|
||||
pageLayout->addWidget(detailBtn);
|
||||
pageLayout->addWidget(ipv4Btn);
|
||||
pageLayout->addWidget(ipv6Btn);
|
||||
pageLayout->addWidget(securityBtn);
|
||||
pageLayout->addWidget(m_netTabBar);
|
||||
pageLayout->addStretch();
|
||||
|
||||
// TabBar关联选项卡页面
|
||||
connect(m_netTabBar, SIGNAL(currentChanged(int)), this, SLOT(currentRowChangeSlot(int)));
|
||||
|
||||
|
||||
confimBtn = new QPushButton(this);
|
||||
confimBtn->setText(tr("Confirm"));
|
||||
|
||||
|
@ -281,7 +278,7 @@ void NetDetail::initUI()
|
|||
// pal.setColor(QPalette::Background, qApp->palette().base().color());
|
||||
this->setAutoFillBackground(true);
|
||||
// this->setPalette(pal);
|
||||
onPaletteChanged();
|
||||
onPaletteChanged();
|
||||
}
|
||||
|
||||
void NetDetail::loadPage()
|
||||
|
@ -294,13 +291,8 @@ void NetDetail::loadPage()
|
|||
} else {
|
||||
stackWidget->setCurrentIndex(DETAIL_PAGE_NUM);
|
||||
this->setWindowTitle(m_name);
|
||||
if (!isWlan) {
|
||||
securityBtn->hide();
|
||||
} else {
|
||||
securityBtn->show();
|
||||
if (m_name.isEmpty()) {
|
||||
this->setWindowTitle(tr("connect hiddin wlan"));
|
||||
}
|
||||
if (isWlan && m_name.isEmpty()) {
|
||||
this->setWindowTitle(tr("connect hiddin wlan"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -310,18 +302,7 @@ void NetDetail::initComponent()
|
|||
connect(cancelBtn, &QPushButton::clicked, this, [=] {
|
||||
close();
|
||||
});
|
||||
connect(detailBtn, &QPushButton::clicked, this, [=] {
|
||||
stackWidget->setCurrentIndex(DETAIL_PAGE_NUM);
|
||||
});
|
||||
connect(ipv4Btn, &QPushButton::clicked, this, [=] {
|
||||
stackWidget->setCurrentIndex(IPV4_PAGE_NUM);
|
||||
});
|
||||
connect(ipv6Btn, &QPushButton::clicked, this, [=] {
|
||||
stackWidget->setCurrentIndex(IPV6_PAGE_NUM);
|
||||
});
|
||||
connect(securityBtn, &QPushButton::clicked, this, [=] {
|
||||
stackWidget->setCurrentIndex(SECURITY_PAGE_NUM);
|
||||
});
|
||||
|
||||
connect(confimBtn, SIGNAL(clicked()), this, SLOT(on_btnConfirm_clicked()));
|
||||
if (isWlan && !m_uuid.isEmpty()) {
|
||||
forgetBtn->show();
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QSettings>
|
||||
#include <QButtonGroup>
|
||||
|
||||
#include <QDBusMessage>
|
||||
#include <QDBusObjectPath>
|
||||
|
@ -28,6 +27,10 @@
|
|||
#include "creatnetpage.h"
|
||||
#include "coninfo.h"
|
||||
#include "tab-pages/tabpage.h"
|
||||
#include "kwidget.h"
|
||||
#include "ktabbar.h"
|
||||
|
||||
using namespace kdk;
|
||||
|
||||
class NetDetail : public QWidget
|
||||
{
|
||||
|
@ -100,11 +103,8 @@ private:
|
|||
QPushButton * forgetBtn;
|
||||
QPushButton * confimBtn;
|
||||
|
||||
QPushButton * detailBtn;
|
||||
QPushButton * ipv4Btn;
|
||||
QPushButton * ipv6Btn;
|
||||
QPushButton * securityBtn;
|
||||
QFrame * pageFrame;
|
||||
KTabBar *m_netTabBar = nullptr;
|
||||
|
||||
QString m_name;
|
||||
QString m_uuid;
|
||||
|
@ -124,16 +124,18 @@ private:
|
|||
|
||||
ConInfo m_info;
|
||||
|
||||
QButtonGroup *m_group;
|
||||
|
||||
private slots:
|
||||
void on_btnConfirm_clicked();
|
||||
void on_btnForget_clicked();
|
||||
void onPaletteChanged();
|
||||
|
||||
protected slots:
|
||||
void currentRowChangeSlot(int row);
|
||||
|
||||
signals:
|
||||
void detailPageClose(bool on);
|
||||
void createPageClose(QString);
|
||||
void currentChanged(int);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ void SecurityPage::initUI()
|
|||
userPwdFlagLabel = new QLabel(this);
|
||||
|
||||
secuTypeCombox = new QComboBox(this);
|
||||
pwdEdit = new LineEdit(this);
|
||||
pwdEdit = new KPasswordEdit(this);
|
||||
eapTypeCombox = new QComboBox(this);
|
||||
//TLS
|
||||
identityEdit = new LineEdit(this);
|
||||
|
@ -42,12 +42,12 @@ void SecurityPage::initUI()
|
|||
caNeedBox = new QCheckBox(this);
|
||||
clientCertPathCombox = new QComboBox(this);
|
||||
clientPrivateKeyCombox = new QComboBox(this);
|
||||
clientPrivateKeyPwdEdit = new LineEdit(this);
|
||||
clientPrivateKeyPwdEdit = new KPasswordEdit(this);
|
||||
|
||||
//PEAP && TTLS
|
||||
eapMethodCombox = new QComboBox(this);
|
||||
userNameEdit = new LineEdit(this);
|
||||
userPwdEdit = new LineEdit(this);
|
||||
userPwdEdit = new KPasswordEdit(this);
|
||||
userPwdFlagBox = new QCheckBox(this);
|
||||
|
||||
|
||||
|
@ -106,59 +106,10 @@ void SecurityPage::initUI()
|
|||
clientPrivateKeyCombox->addItem(tr("None"), QString(tr("None"))); //无
|
||||
clientPrivateKeyCombox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择...
|
||||
|
||||
pwdBox = new QCheckBox(this);
|
||||
pwdBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
|
||||
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
|
||||
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
|
||||
pwdBox->setCursor(Qt::PointingHandCursor);
|
||||
pwdBox->setFixedSize(30, pwdEdit->height());
|
||||
//防止文本框输入内容位于按钮之下
|
||||
QMargins margins = pwdEdit->textMargins();
|
||||
pwdEdit->setTextMargins(margins.left(), margins.top(), pwdBox->width(), margins.bottom());
|
||||
QHBoxLayout *pPwdLayout = new QHBoxLayout();
|
||||
pPwdLayout->addStretch();
|
||||
pPwdLayout->addWidget(pwdBox);
|
||||
pPwdLayout->setSpacing(0);
|
||||
pPwdLayout->setContentsMargins(0, 0, 0, 0);
|
||||
pwdEdit->setLayout(pPwdLayout);
|
||||
pwdEdit->setEchoMode(QLineEdit::Password);
|
||||
|
||||
userPwdBox = new QCheckBox(this);
|
||||
userPwdBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
|
||||
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
|
||||
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
|
||||
userPwdBox->setCursor(Qt::PointingHandCursor);
|
||||
userPwdBox->setFixedSize(30, userPwdEdit->height());
|
||||
userPwdBox->setFocusPolicy(Qt::NoFocus);
|
||||
//防止文本框输入内容位于按钮之下
|
||||
userPwdEdit->setTextMargins(margins.left(), margins.top(), userPwdBox->width(), margins.bottom());
|
||||
QHBoxLayout *puserPwdLayout = new QHBoxLayout();
|
||||
puserPwdLayout->addStretch();
|
||||
puserPwdLayout->addWidget(userPwdBox);
|
||||
puserPwdLayout->setSpacing(0);
|
||||
puserPwdLayout->setContentsMargins(0, 0, 0, 0);
|
||||
userPwdEdit->setLayout(puserPwdLayout);
|
||||
userPwdEdit->setEchoMode(QLineEdit::Password);
|
||||
|
||||
privateKeyBox = new QCheckBox(this);
|
||||
privateKeyBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
|
||||
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
|
||||
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
|
||||
privateKeyBox->setCursor(Qt::PointingHandCursor);
|
||||
privateKeyBox->setFixedSize(30, clientPrivateKeyPwdEdit->height());
|
||||
//防止文本框输入内容位于按钮之下
|
||||
clientPrivateKeyPwdEdit->setTextMargins(margins.left(), margins.top(), privateKeyBox->width(), margins.bottom());
|
||||
QHBoxLayout *pPrivateKeyPwdLayout = new QHBoxLayout();
|
||||
pPrivateKeyPwdLayout->addStretch();
|
||||
pPrivateKeyPwdLayout->addWidget(privateKeyBox);
|
||||
pPrivateKeyPwdLayout->setSpacing(0);
|
||||
pPrivateKeyPwdLayout->setContentsMargins(0, 0, 0, 0);
|
||||
clientPrivateKeyPwdEdit->setLayout(pPrivateKeyPwdLayout);
|
||||
clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Password);
|
||||
|
||||
pwdEdit->setContextMenuPolicy(Qt::NoContextMenu);
|
||||
clientPrivateKeyPwdEdit->setContextMenuPolicy(Qt::NoContextMenu);
|
||||
userPwdEdit->setContextMenuPolicy(Qt::NoContextMenu);
|
||||
//禁用ClearBtn按钮
|
||||
pwdEdit->setClearButtonEnabled(false);
|
||||
clientPrivateKeyPwdEdit->setClearButtonEnabled(false);
|
||||
userPwdEdit->setClearButtonEnabled(false);
|
||||
|
||||
QRegExp rx("^[A-Za-z0-9`~!@#$%^&*()_-+=<>,.\\\/]+$");
|
||||
QRegExpValidator *latitude = new QRegExpValidator(rx, this);
|
||||
|
@ -180,10 +131,6 @@ void SecurityPage::initConnect()
|
|||
|
||||
connect(caNeedBox, &QCheckBox::clicked, this, &SecurityPage::onCaNeedBoxClicked);
|
||||
|
||||
connect(pwdBox, &QCheckBox::clicked, this, &SecurityPage::onPwdBoxClicked);
|
||||
connect(userPwdBox, &QCheckBox::clicked, this, &SecurityPage::onUserPwdBox);
|
||||
connect(privateKeyBox, &QCheckBox::clicked, this, &SecurityPage::onPrivateKeyBoxClicked);
|
||||
|
||||
connect(caCertPathCombox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &SecurityPage::onCaCertPathComboxIndexChanged);
|
||||
|
||||
|
@ -731,40 +678,6 @@ void SecurityPage::onCaNeedBoxClicked()
|
|||
}
|
||||
}
|
||||
|
||||
void SecurityPage::onPwdBoxClicked()
|
||||
{
|
||||
if (pwdEdit->echoMode() == QLineEdit::Password) {
|
||||
pwdBox->setChecked(true);
|
||||
pwdEdit->setEchoMode(QLineEdit::Normal);
|
||||
} else {
|
||||
pwdBox->setChecked(false);
|
||||
pwdEdit->setEchoMode(QLineEdit::Password);
|
||||
}
|
||||
}
|
||||
|
||||
void SecurityPage::onUserPwdBox()
|
||||
{
|
||||
if (userPwdEdit->echoMode() == QLineEdit::Password) {
|
||||
userPwdBox->setChecked(true);
|
||||
userPwdEdit->setEchoMode(QLineEdit::Normal);
|
||||
} else {
|
||||
userPwdBox->setChecked(false);
|
||||
userPwdEdit->setEchoMode(QLineEdit::Password);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SecurityPage::onPrivateKeyBoxClicked()
|
||||
{
|
||||
if (clientPrivateKeyPwdEdit->echoMode() == QLineEdit::Password) {
|
||||
privateKeyBox->setChecked(true);
|
||||
clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Normal);
|
||||
} else {
|
||||
privateKeyBox->setChecked(false);
|
||||
clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Password);
|
||||
}
|
||||
}
|
||||
|
||||
void SecurityPage::onCaCertPathComboxIndexChanged(QString str)
|
||||
{
|
||||
if (str.contains("Choose from file...") || str.contains("从文件选择..."))
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
#include <QCheckBox>
|
||||
|
||||
#include "coninfo.h"
|
||||
#include "kwidget.h"
|
||||
#include "kpasswordedit.h"
|
||||
|
||||
using namespace kdk;
|
||||
|
||||
class SecurityPage : public QFrame
|
||||
{
|
||||
|
@ -56,7 +60,7 @@ private:
|
|||
QLabel *userPwdFlagLabel;
|
||||
|
||||
QComboBox *secuTypeCombox;
|
||||
LineEdit *pwdEdit;
|
||||
KPasswordEdit *pwdEdit = nullptr;
|
||||
QComboBox *eapTypeCombox;
|
||||
//TLS
|
||||
LineEdit *identityEdit;
|
||||
|
@ -65,18 +69,14 @@ private:
|
|||
QCheckBox *caNeedBox;
|
||||
QComboBox *clientCertPathCombox;
|
||||
QComboBox *clientPrivateKeyCombox;
|
||||
LineEdit *clientPrivateKeyPwdEdit;
|
||||
KPasswordEdit *clientPrivateKeyPwdEdit = nullptr;
|
||||
|
||||
//PEAP && TTLS
|
||||
QComboBox *eapMethodCombox;
|
||||
LineEdit *userNameEdit;
|
||||
LineEdit *userPwdEdit;
|
||||
KPasswordEdit *userPwdEdit = nullptr;
|
||||
QCheckBox *userPwdFlagBox;
|
||||
|
||||
QCheckBox *pwdBox;
|
||||
QCheckBox *userPwdBox;
|
||||
QCheckBox *privateKeyBox;
|
||||
|
||||
void showNone();
|
||||
void showPsk();
|
||||
void showTls();
|
||||
|
@ -97,9 +97,6 @@ private slots:
|
|||
void setEnableOfSaveBtn();
|
||||
|
||||
void onCaNeedBoxClicked();
|
||||
void onPwdBoxClicked();
|
||||
void onUserPwdBox();
|
||||
void onPrivateKeyBoxClicked();
|
||||
|
||||
void onCaCertPathComboxIndexChanged(QString str);
|
||||
void onClientCertPathComboxIndexChanged(QString str);
|
||||
|
|
|
@ -120,7 +120,7 @@ void LanPage::initLanDeviceState()
|
|||
}
|
||||
|
||||
KyWiredConnectOperation wiredOperation;
|
||||
if (m_wiredSwitch) {
|
||||
if (m_netSwitch->isChecked()) {
|
||||
for (int index = 0; index < disableDeviceList.count(); ++index) {
|
||||
wiredOperation.closeWiredNetworkWithDevice(disableDeviceList.at(index));
|
||||
}
|
||||
|
@ -135,12 +135,12 @@ void LanPage::initLanDeviceState()
|
|||
|
||||
void LanPage::initNetSwitch()
|
||||
{
|
||||
m_wiredSwitch = true;
|
||||
bool wiredSwitch = true;
|
||||
|
||||
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) {
|
||||
m_switchGsettings = new QGSettings(GSETTINGS_SCHEMA);
|
||||
if (m_switchGsettings->keys().contains(WIRED_SWITCH)) {
|
||||
m_wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool();
|
||||
wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool();
|
||||
connect(m_switchGsettings, &QGSettings::changed, this, &LanPage::onSwithGsettingsChanged);
|
||||
}
|
||||
} else {
|
||||
|
@ -149,16 +149,13 @@ void LanPage::initNetSwitch()
|
|||
|
||||
if (m_devList.count() == 0) {
|
||||
qDebug() << "[wiredSwitch]:init not enable when no device";
|
||||
m_wiredSwitch = false;
|
||||
m_netSwitch->setSwitchStatus(m_wiredSwitch);
|
||||
m_netSwitch->setEnabled(false);
|
||||
m_netSwitch->setChecked(false);
|
||||
m_netSwitch->setCheckable(false);
|
||||
}
|
||||
|
||||
qDebug() << "[wiredSwitch]:init state:" << m_wiredSwitch;
|
||||
qDebug() << "[wiredSwitch]:init state:" << wiredSwitch;
|
||||
|
||||
m_netSwitch->setSwitchStatus(m_wiredSwitch);
|
||||
|
||||
connect(m_netSwitch, &SwitchButton::clicked, this, &LanPage::onLanSwitchClicked);
|
||||
m_netSwitch->setChecked(wiredSwitch);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -166,13 +163,16 @@ void LanPage::initNetSwitch()
|
|||
void LanPage::onSwithGsettingsChanged(const QString &key)
|
||||
{
|
||||
if (key == WIRED_SWITCH) {
|
||||
m_netSwitch->blockSignals(true);
|
||||
|
||||
m_wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool();
|
||||
qDebug()<<"[LanPage] SwitchButton statue changed to:" << m_wiredSwitch;
|
||||
bool wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool();
|
||||
qDebug()<<"[LanPage] SwitchButton statue changed to:" << wiredSwitch << m_netSwitch->isChecked();
|
||||
|
||||
if (wiredSwitch == m_netSwitch->isChecked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
KyWiredConnectOperation wiredOperation;
|
||||
if (m_wiredSwitch) {
|
||||
if (wiredSwitch) {
|
||||
for (int index = 0; index < m_enableDeviceList.size(); ++index) {
|
||||
qDebug()<<"[LanPage] open wired device "<< m_enableDeviceList.at(index);
|
||||
wiredOperation.openWiredNetworkWithDevice(m_enableDeviceList.at(index));
|
||||
|
@ -184,30 +184,10 @@ void LanPage::onSwithGsettingsChanged(const QString &key)
|
|||
}
|
||||
}
|
||||
|
||||
m_netSwitch->setChecked(wiredSwitch);
|
||||
|
||||
initDeviceCombox();
|
||||
initLanArea();
|
||||
|
||||
m_netSwitch->setSwitchStatus(m_wiredSwitch);
|
||||
|
||||
m_netSwitch->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
void LanPage::onLanSwitchClicked()
|
||||
{
|
||||
qDebug()<<"[LanPage] On lan switch button clicked! Status:" <<m_netSwitch->getSwitchStatus()
|
||||
<<"devices count:"<<m_devList.count();
|
||||
|
||||
if (m_devList.count() == 0) {
|
||||
this->showDesktopNotify(tr("No ethernet device avaliable"), "networkwrong");
|
||||
} else {
|
||||
if (m_netSwitch->getSwitchStatus()) {
|
||||
//qDebug() << "[wiredSwitch]set true after clicked";
|
||||
m_switchGsettings->set(WIRED_SWITCH, true);
|
||||
} else {
|
||||
//qDebug() << "[wiredSwitch]set false after clicked";
|
||||
m_switchGsettings->set(WIRED_SWITCH,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,7 +246,7 @@ void LanPage::initDeviceCombox()
|
|||
|
||||
m_deviceComboBox->clear();
|
||||
|
||||
if (m_wiredSwitch) {
|
||||
if (m_netSwitch->isChecked()) {
|
||||
int enableDeviceCount = m_enableDeviceList.count();
|
||||
if (enableDeviceCount > 1) {
|
||||
for (int index = 0; index < enableDeviceCount; ++index) {
|
||||
|
@ -426,7 +406,7 @@ void LanPage::constructConnectionArea()
|
|||
|
||||
void LanPage::initLanArea()
|
||||
{
|
||||
if (!m_wiredSwitch || m_currentDeviceName.isEmpty()) {
|
||||
if (!m_netSwitch->isChecked() || m_currentDeviceName.isEmpty()) {
|
||||
m_activatedNetDivider->hide();
|
||||
m_activatedNetFrame->hide();
|
||||
|
||||
|
@ -526,7 +506,7 @@ void LanPage::addDeviceForCombox(QString deviceName)
|
|||
disconnect(m_deviceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &LanPage::onDeviceComboxIndexChanged);
|
||||
|
||||
if (m_wiredSwitch) {
|
||||
if (m_netSwitch->isChecked()) {
|
||||
if (1 == m_enableDeviceList.count()) {
|
||||
//1、从无到有添加第一块有线网卡
|
||||
//2、有多快网卡,但是没有使能
|
||||
|
@ -564,9 +544,9 @@ void LanPage::onDeviceAdd(QString deviceName, NetworkManager::Device::Type devic
|
|||
}
|
||||
|
||||
if (m_devList.count() == 0) {// 有线网卡从无到有,打开开关
|
||||
m_netSwitch->setEnabled(true);
|
||||
m_wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool();
|
||||
m_netSwitch->setSwitchStatus(m_wiredSwitch);
|
||||
bool wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool();
|
||||
m_netSwitch->setCheckable(true);
|
||||
m_netSwitch->setChecked(wiredSwitch);
|
||||
}
|
||||
|
||||
qDebug() << "[LanPage] Begin add device:" << deviceName;
|
||||
|
@ -590,7 +570,7 @@ void LanPage::deleteDeviceFromCombox(QString deviceName)
|
|||
disconnect(m_deviceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &LanPage::onDeviceComboxIndexChanged);
|
||||
|
||||
if (m_wiredSwitch) {
|
||||
if (m_netSwitch->isChecked()) {
|
||||
if (0 == m_enableDeviceList.count()) {
|
||||
//1、没有使能任何网卡
|
||||
goto l_out;
|
||||
|
@ -649,9 +629,8 @@ void LanPage::onDeviceRemove(QString deviceName)
|
|||
|
||||
m_devList.removeOne(deviceName);
|
||||
if (m_devList.count() == 0) {
|
||||
m_wiredSwitch = false;
|
||||
m_netSwitch->setSwitchStatus(m_wiredSwitch);
|
||||
m_netSwitch->setEnabled(false);
|
||||
m_netSwitch->setCheckable(false);
|
||||
m_netSwitch->setChecked(false);
|
||||
qDebug() << "[wiredSwitch]set not enable after device remove";
|
||||
}
|
||||
|
||||
|
@ -727,7 +706,7 @@ void LanPage::onDeviceActiveChanage(QString deviceName, bool deviceActive)
|
|||
}
|
||||
|
||||
if (deviceActive) {
|
||||
if (!m_wiredSwitch || !m_enableDeviceList.contains(deviceName)) {
|
||||
if (!m_netSwitch->isChecked() || !m_enableDeviceList.contains(deviceName)) {
|
||||
qDebug()<< LOG_FLAG << "close disabled device";
|
||||
m_wiredConnectOperation->closeWiredNetworkWithDevice(deviceName);
|
||||
}
|
||||
|
@ -780,7 +759,8 @@ void LanPage::initUI()
|
|||
m_activatedLanListWidget->setPalette(pal);
|
||||
m_inactivatedLanListWidget->setPalette(pal);
|
||||
|
||||
m_settingsLabel->installEventFilter(this);
|
||||
m_settingsBtn->installEventFilter(this);
|
||||
m_netSwitch->installEventFilter(this);
|
||||
}
|
||||
|
||||
QListWidgetItem *LanPage::insertNewItem(KyConnectItem *itemData, QListWidget *listWidget)
|
||||
|
@ -1192,10 +1172,30 @@ void LanPage::setWiredDeviceEnable(const QString& devName, bool enable)
|
|||
|
||||
bool LanPage::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (watched == m_settingsLabel) {
|
||||
if (watched == m_settingsBtn) {
|
||||
if (event->type() == QEvent::MouseButtonRelease) {
|
||||
onShowControlCenter();
|
||||
}
|
||||
} else if(watched == m_netSwitch){
|
||||
if (event->type() == QEvent::MouseButtonRelease) {
|
||||
qDebug()<<"[LanPage] On lan switch button clicked! Status:" <<m_netSwitch->isChecked()
|
||||
<<"devices count:"<<m_devList.count();
|
||||
|
||||
if (m_devList.count() == 0) {
|
||||
this->showDesktopNotify(tr("No ethernet device avaliable"), "networkwrong");
|
||||
m_netSwitch->setCheckable(false);
|
||||
m_netSwitch->setChecked(false);
|
||||
} else {
|
||||
m_netSwitch->setCheckable(true);
|
||||
if (m_netSwitch->isChecked()) {
|
||||
m_switchGsettings->set(WIRED_SWITCH, false);
|
||||
} else {
|
||||
m_switchGsettings->set(WIRED_SWITCH,true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(watched, event);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define LANPAGE_H
|
||||
|
||||
#include "divider.h"
|
||||
#include "switchbutton.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
|
@ -98,7 +97,6 @@ private slots:
|
|||
void onUpdateConnection(QString uuid);
|
||||
|
||||
void onSwithGsettingsChanged(const QString &key);
|
||||
void onLanSwitchClicked();
|
||||
|
||||
void onDeviceAdd(QString deviceName, NetworkManager::Device::Type deviceType);
|
||||
void onDeviceRemove(QString deviceName);
|
||||
|
@ -129,7 +127,6 @@ private:
|
|||
|
||||
QGSettings *m_switchGsettings = nullptr;
|
||||
|
||||
bool m_wiredSwitch = true;
|
||||
};
|
||||
|
||||
#endif // LANPAGE_H
|
||||
|
|
|
@ -29,7 +29,7 @@ void TabPage::initUI()
|
|||
m_titleLayout = new QHBoxLayout(m_titleFrame);
|
||||
m_titleLayout->setContentsMargins(TITLE_LAYOUT_MARGINS);
|
||||
m_titleLabel = new QLabel(m_titleFrame);
|
||||
m_netSwitch = new SwitchButton(m_titleFrame);
|
||||
m_netSwitch = new KSwitchButton(m_titleFrame);
|
||||
m_titleLayout->addWidget(m_titleLabel);
|
||||
m_titleLayout->addStretch();
|
||||
m_titleLayout->addWidget(m_netSwitch);
|
||||
|
@ -94,12 +94,11 @@ void TabPage::initUI()
|
|||
|
||||
m_settingsLayout = new QHBoxLayout(m_settingsFrame);
|
||||
m_settingsLayout->setContentsMargins(SETTINGS_LAYOUT_MARGINS);
|
||||
m_settingsLabel = new KyLable(m_settingsFrame);
|
||||
m_settingsLabel->setCursor(Qt::PointingHandCursor);
|
||||
m_settingsLabel->setText(tr("Settings"));
|
||||
m_settingsLabel->setScaledContents(true);
|
||||
|
||||
m_settingsLayout->addWidget(m_settingsLabel);
|
||||
m_settingsBtn = new KBorderlessButton(m_settingsFrame);
|
||||
m_settingsBtn->setText(tr("Settings"));
|
||||
|
||||
m_settingsLayout->addWidget(m_settingsBtn);
|
||||
m_settingsLayout->addStretch();
|
||||
m_settingsFrame->setLayout(m_settingsLayout);
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
#define TABPAGE_H
|
||||
|
||||
#include "divider.h"
|
||||
#include "switchbutton.h"
|
||||
#include "kylable.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
|
@ -15,6 +13,11 @@
|
|||
#include <QProcess>
|
||||
#include <QDebug>
|
||||
#include "kylinnetworkdeviceresource.h"
|
||||
#include "kwidget.h"
|
||||
#include "kswitchbutton.h"
|
||||
#include "kborderlessbutton.h"
|
||||
|
||||
using namespace kdk;
|
||||
|
||||
#define MAIN_LAYOUT_MARGINS 0,0,0,0
|
||||
#define MAIN_LAYOUT_SPACING 0
|
||||
|
@ -93,7 +96,7 @@ protected:
|
|||
QFrame * m_titleFrame = nullptr;
|
||||
QHBoxLayout * m_titleLayout = nullptr;
|
||||
QLabel * m_titleLabel = nullptr;
|
||||
SwitchButton * m_netSwitch = nullptr;
|
||||
KSwitchButton * m_netSwitch = nullptr;
|
||||
Divider * m_titleDivider = nullptr;
|
||||
|
||||
QFrame * m_activatedNetFrame = nullptr;
|
||||
|
@ -111,7 +114,7 @@ protected:
|
|||
|
||||
QFrame * m_settingsFrame = nullptr;
|
||||
QHBoxLayout * m_settingsLayout = nullptr;
|
||||
KyLable * m_settingsLabel = nullptr;
|
||||
KBorderlessButton *m_settingsBtn = nullptr;
|
||||
|
||||
//临时增加的下拉框选择网卡区域
|
||||
QFrame * m_deviceFrame = nullptr;
|
||||
|
@ -120,8 +123,6 @@ protected:
|
|||
QComboBox * m_deviceComboBox = nullptr;
|
||||
QLabel * m_tipsLabel = nullptr;
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
virtual void onDeviceComboxIndexChanged(int currentIndex) = 0;
|
||||
void onPaletteChanged();
|
||||
|
|
|
@ -59,10 +59,20 @@ WlanPage::WlanPage(QWidget *parent) : TabPage(parent)
|
|||
bool WlanPage::eventFilter(QObject *w, QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::MouseButtonRelease) {
|
||||
if (w == m_settingsLabel) {
|
||||
if (w == m_settingsBtn) {
|
||||
//ZJP_TODO 打开控制面板
|
||||
qDebug() << LOG_FLAG <<"recive event show control center";
|
||||
showControlCenter();
|
||||
} else if (w == m_netSwitch) {
|
||||
if (m_devList.isEmpty()) {
|
||||
showDesktopNotify(tr("No wireless network card detected"), "networkwrong");
|
||||
//检测不到无线网卡不再触发click信号
|
||||
m_netSwitch->setCheckable(false);
|
||||
m_netSwitch->setChecked(false);
|
||||
} else {
|
||||
m_wirelessConnectOpreation->setWirelessEnabled(!m_netSwitch->isChecked());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +111,8 @@ void WlanPage::initWlanUI()
|
|||
m_activatedNetListWidget->setPalette(pal);
|
||||
m_inactivatedNetListWidget->setPalette(pal);
|
||||
|
||||
m_settingsLabel->installEventFilter(this);
|
||||
m_settingsBtn->installEventFilter(this);
|
||||
m_netSwitch->installEventFilter(this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -110,7 +121,9 @@ void WlanPage::onWlanSwithGsettingsChanged(const QString &key)
|
|||
if (key == WIRELESS_SWITCH) {
|
||||
m_wlanSwitchEnable = m_switchGsettings->get(WIRELESS_SWITCH).toBool();
|
||||
qDebug() << LOG_FLAG << "wlan switch state" << m_wlanSwitchEnable;
|
||||
m_netSwitch->setSwitchStatus(m_wlanSwitchEnable);
|
||||
|
||||
m_netSwitch->setChecked(m_wlanSwitchEnable);
|
||||
|
||||
initDeviceCombox();
|
||||
initWlanArea();
|
||||
}
|
||||
|
@ -118,57 +131,26 @@ void WlanPage::onWlanSwithGsettingsChanged(const QString &key)
|
|||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief WlanPage::onWlanSwitchClicked 点击无线网开关
|
||||
*/
|
||||
void WlanPage::onWlanSwitchClicked()
|
||||
{
|
||||
if (m_devList.isEmpty()) {
|
||||
showDesktopNotify(tr("No wireless network card detected"), "networkwrong");
|
||||
//检测不到无线网卡不再触发click信号
|
||||
m_netSwitch->setSwitchStatus(false);
|
||||
m_netSwitch->setEnabled(false);
|
||||
} else {
|
||||
bool switchEnable = m_netSwitch->getSwitchStatus();
|
||||
if (m_wlanSwitchEnable != switchEnable) {
|
||||
qDebug()<< LOG_FLAG << "wlan switch state " << switchEnable;
|
||||
m_wirelessConnectOpreation->setWirelessEnabled(switchEnable);
|
||||
if (!switchEnable) {
|
||||
m_netSwitch->setEnabled(false);
|
||||
m_activatedNetFrame->hide();
|
||||
m_activatedNetDivider->hide();
|
||||
m_inactivatedNetFrame->hide();
|
||||
m_deviceFrame->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void WlanPage::initWlanSwitchState()
|
||||
{
|
||||
m_wlanSwitchEnable = m_wirelessConnectOpreation->getWirelessEnabled();
|
||||
|
||||
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) {
|
||||
m_switchGsettings = new QGSettings(GSETTINGS_SCHEMA);
|
||||
if (m_switchGsettings->keys().contains(WIRELESS_SWITCH)) {
|
||||
if (m_devList.isEmpty()) {
|
||||
m_wlanSwitchEnable = false;
|
||||
m_netSwitch->setSwitchStatus(m_wlanSwitchEnable);
|
||||
m_netSwitch->setEnabled(false);
|
||||
m_netSwitch->setCheckable(false);
|
||||
m_netSwitch->setChecked(false);
|
||||
} else {
|
||||
m_wlanSwitchEnable = m_switchGsettings->get(WIRELESS_SWITCH).toBool();
|
||||
bool wiredGsetting = m_switchGsettings->get(WIRELESS_SWITCH).toBool();
|
||||
if (m_wirelessConnectOpreation->getWirelessEnabled()
|
||||
!= wiredGsetting) {
|
||||
//以gsetting为准
|
||||
m_wirelessConnectOpreation->setWirelessEnabled(wiredGsetting);
|
||||
}
|
||||
m_netSwitch->setChecked(wiredGsetting);
|
||||
}
|
||||
connect(m_switchGsettings, &QGSettings::changed, this, &WlanPage::onWlanSwithGsettingsChanged);
|
||||
}
|
||||
}
|
||||
m_netSwitch->setSwitchStatus(m_wlanSwitchEnable);
|
||||
|
||||
|
||||
connect(m_netSwitch, &SwitchButton::clicked, this, &WlanPage::onWlanSwitchClicked);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void WlanPage::initTimer()
|
||||
|
@ -200,7 +182,7 @@ void WlanPage::initDeviceCombox()
|
|||
this, &WlanPage::onDeviceComboxIndexChanged);
|
||||
m_deviceComboBox->clear();
|
||||
|
||||
if (m_wlanSwitchEnable) {
|
||||
if (m_netSwitch->isChecked()) {
|
||||
if (0 == m_devList.count()) {
|
||||
m_deviceFrame->show();
|
||||
m_tipsLabel->show();
|
||||
|
@ -472,7 +454,7 @@ void WlanPage::constructWirelessNetArea()
|
|||
|
||||
void WlanPage::initWlanArea()
|
||||
{
|
||||
if (m_wlanSwitchEnable) {
|
||||
if (m_netSwitch->isChecked()) {
|
||||
m_activatedNetFrame->show();
|
||||
m_activatedNetDivider->show();
|
||||
constructActivateConnectionArea();
|
||||
|
@ -634,7 +616,7 @@ void WlanPage::addDeviceToCombox(QString deviceName)
|
|||
{
|
||||
disconnect(m_deviceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &WlanPage::onDeviceComboxIndexChanged);
|
||||
if (m_wlanSwitchEnable) {
|
||||
if (m_netSwitch->isChecked()) {
|
||||
if (m_currentDevice.isEmpty()){
|
||||
m_deviceFrame->hide();
|
||||
m_currentDevice = deviceName;
|
||||
|
@ -667,9 +649,9 @@ void WlanPage::onDeviceAdd(QString deviceName, NetworkManager::Device::Type devi
|
|||
}
|
||||
|
||||
if (m_devList.isEmpty()) {
|
||||
m_wlanSwitchEnable = m_switchGsettings->get(WIRELESS_SWITCH).toBool();
|
||||
m_netSwitch->setEnabled(true);
|
||||
m_netSwitch->setSwitchStatus(m_wlanSwitchEnable);
|
||||
bool wlanSwitch = m_switchGsettings->get(WIRELESS_SWITCH).toBool();
|
||||
m_netSwitch->setCheckable(true);
|
||||
m_netSwitch->setChecked(wlanSwitch);
|
||||
}
|
||||
|
||||
m_devList << deviceName;
|
||||
|
@ -688,7 +670,7 @@ void WlanPage::deleteDeviceFromCombox(QString deviceName)
|
|||
disconnect(m_deviceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &WlanPage::onDeviceComboxIndexChanged);
|
||||
|
||||
if (m_wlanSwitchEnable) {
|
||||
if (m_netSwitch->isChecked()) {
|
||||
if (0 == m_devList.count()) {
|
||||
m_deviceFrame->hide();
|
||||
//m_tipsLabel->show();
|
||||
|
@ -729,9 +711,8 @@ void WlanPage::onDeviceRemove(QString deviceName)
|
|||
deleteDeviceFromCombox(deviceName);
|
||||
|
||||
if (m_devList.isEmpty()) {
|
||||
m_wlanSwitchEnable = false;
|
||||
m_netSwitch->setSwitchStatus(m_wlanSwitchEnable);
|
||||
m_netSwitch->setEnabled(false);
|
||||
m_netSwitch->setCheckable(false);
|
||||
m_netSwitch->setChecked(false);
|
||||
}
|
||||
|
||||
if (originalDeviceName == deviceName) {
|
||||
|
@ -1043,8 +1024,8 @@ void WlanPage::onWifiEnabledChanged(bool isWifiOn)
|
|||
if (m_wlanSwitchEnable == isWifiOn) {
|
||||
return;
|
||||
} else {
|
||||
if (!m_netSwitch->getEnabled()) {
|
||||
m_netSwitch->setEnabled(true);
|
||||
if (!m_netSwitch->isChecked()) {
|
||||
m_netSwitch->setChecked(true);
|
||||
}
|
||||
m_switchGsettings->set(WIRELESS_SWITCH, isWifiOn);
|
||||
}
|
||||
|
@ -1404,12 +1385,13 @@ void WlanPage::setWirelessSwitchEnable(bool enable)
|
|||
if (m_devList.isEmpty()) {
|
||||
qDebug() << "have no device to use " << Q_FUNC_INFO << __LINE__;
|
||||
//检测不到无线网卡不再触发click信号
|
||||
m_netSwitch->setSwitchStatus(false);
|
||||
//m_netSwitch->setEnabled(false);
|
||||
// m_netSwitch->setSwitchStatus(false);
|
||||
m_netSwitch->setEnabled(false);
|
||||
}else{
|
||||
m_wirelessConnectOpreation->setWirelessEnabled(enable);
|
||||
if (!enable) {
|
||||
m_netSwitch->setEnabled(false);
|
||||
// m_netSwitch->setEnabled(false);
|
||||
m_netSwitch->setChecked(false);
|
||||
m_activatedNetFrame->hide();
|
||||
m_activatedNetDivider->hide();
|
||||
m_inactivatedNetFrame->hide();
|
||||
|
|
|
@ -93,7 +93,6 @@ private slots:
|
|||
NetworkManager::ActiveConnection::Reason reason);
|
||||
void onItemHeightChanged(const bool isExpanded, const QString &ssid);
|
||||
|
||||
void onWlanSwitchClicked();
|
||||
void onWlanSwithGsettingsChanged(const QString &key);
|
||||
|
||||
void onDeviceComboxIndexChanged(int currentIndex);
|
||||
|
|
Loading…
Reference in New Issue