Merge branch '93818' into 'dbus-interface'

93818

See merge request kylin-desktop/kylin-nm!432
This commit is contained in:
ren peijia 2021-11-30 06:55:38 +00:00
commit 62b99acdbe
4 changed files with 36 additions and 9 deletions

View File

@ -68,6 +68,7 @@ void Ipv4Page::initComponent() {
connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(configChanged(int)));
connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn()));
connect(ipv4addressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));

View File

@ -143,6 +143,7 @@ void Ipv6Page::initComponent() {
connect(ipv6ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(configChanged(int)));
connect(ipv6ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn()));
connect(ipv6AddressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
connect(lengthEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));

View File

@ -1,7 +1,9 @@
#include "netdetail.h"
#include "backend/kylinipv4arping.h"
#include "backend/kylinipv6arping.h"
#include "xatom/xatom-helper.h"
//#include "xatom/xatom-helper.h"
#include <QEvent>
#define WINDOW_WIDTH 520
#define WINDOW_HEIGHT 590
@ -48,15 +50,15 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv
QDialog(parent)
{
//设置窗口无边框,阴影
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
MotifWmHints window_hints;
window_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
window_hints.functions = MWM_FUNC_ALL;
window_hints.decorations = MWM_DECOR_BORDER;
XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), window_hints);
#else
//#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
// MotifWmHints window_hints;
// window_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
// window_hints.functions = MWM_FUNC_ALL;
// window_hints.decorations = MWM_DECOR_BORDER;
// XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), window_hints);
//#else
this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
#endif
//#endif
// this->setProperty("useStyleWindowManager", false); //禁用拖动
// setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint );
// setAttribute(Qt::WA_TranslucentBackground);
@ -146,6 +148,12 @@ void NetDetail::initUI()
securityPage = new SecurityPage(this);
createNetPage = new CreatNetPage(this);
detailPage->installEventFilter(this);
ipv4Page->installEventFilter(this);
ipv6Page->installEventFilter(this);
securityPage->installEventFilter(this);
createNetPage->installEventFilter(this);
titleWidget = new QWidget(this);
centerWidget = new QWidget(this);
bottomWidget = new QWidget(this);
@ -918,3 +926,19 @@ bool NetDetail::checkWirelessSecurity(KySecuType secuType)
}
return true;
}
bool NetDetail::eventFilter(QObject *w, QEvent *event)
{
// 回车键触发确定按钮点击事件
if (event->type() == QEvent::KeyPress) {
QKeyEvent *mEvent = static_cast<QKeyEvent *>(event);
if (mEvent->key() == Qt::Key_Enter || mEvent->key() == Qt::Key_Return) {
if (confimBtn->isEnabled()) {
emit confimBtn->clicked();
}
return true;
}
}
return QDialog::eventFilter(w, event);
}

View File

@ -39,6 +39,7 @@ public:
protected:
void paintEvent(QPaintEvent *event);
void closeEvent(QCloseEvent *event);
bool eventFilter(QObject *w, QEvent *event);
private:
void initUI();