Merge branch '1216-main' into 'dbus-interface'

lineedit 右键菜单适配亮主题

See merge request kylin-desktop/kylin-nm!486
This commit is contained in:
赵 世旭 2021-12-17 05:38:08 +00:00
commit c479ea479e
25 changed files with 86 additions and 67 deletions

2
debian/control vendored
View File

@ -31,7 +31,7 @@ Vcs-Browser: https://github.com/ukui/kylin-nm
Package: kylin-nm
Architecture: any
Depends: network-manager (>=1.2.6),
ukui-control-center (>= 3.1.1+1103),
ukui-control-center (>= 3.1.1+1216),
${shlibs:Depends},
${misc:Depends}
Description: Gui Applet tool for display and edit network simply

View File

@ -33,7 +33,7 @@
#include <QDBusMetaType>
#include "interface.h"
#include "../component/SwitchButton/switchbutton.h"
#include "switchbutton.h"
#include "hoverbtn.h"
#include "mobilehotspotwidget.h"

View File

@ -2,8 +2,6 @@ QT += widgets network dbus gui core
TEMPLATE = lib
CONFIG += plugin
include(../component/switchbutton.pri)
TARGET = $$qtLibraryTarget(mobilehotspot)
DESTDIR = ../..
target.path = $$[QT_INSTALL_LIBS]/ukui-control-center

View File

@ -363,7 +363,7 @@ void MobileHotspotWidget::setSwitchFrame()
m_switchLabel = new QLabel(tr("Open"), this);
m_switchLabel->setMinimumWidth(LABLE_MIN_WIDTH);
m_switchBtn = new SwitchButton(this, false);
m_switchBtn = new SwitchButton(this);
switchLayout->addSpacing(LAYOUT_LEFT_MARGINS);
switchLayout->addWidget(m_switchLabel);
switchLayout->addStretch();

View File

@ -19,7 +19,7 @@
#include <QDBusReply>
#include <QDBusMetaType>
#include "../component/SwitchButton/switchbutton.h"
#include "switchbutton.h"
#include "titlelabel.h"
class MobileHotspotWidget : public QWidget

View File

@ -7,7 +7,7 @@
#include <QLabel>
#include <QTimer>
#include <QDebug>
#include "../component/SwitchButton/switchbutton.h"
#include "switchbutton.h"
#include "../component/DrownLabel/drownlabel.h"
class DeviceFrame : public QFrame

View File

@ -166,7 +166,7 @@ bool NetConnect::eventFilter(QObject *w, QEvent *e) {
}
void NetConnect::initComponent() {
wiredSwitch = new SwitchButton(pluginWidget, false);
wiredSwitch = new SwitchButton(pluginWidget);
ui->openWIifLayout->addWidget(wiredSwitch);
ui->detailLayOut->setContentsMargins(MAIN_LAYOUT_MARGINS);
ui->verticalLayout_3->setContentsMargins(NO_MARGINS);

View File

@ -48,7 +48,7 @@
#include "interface.h"
#include "addbtn.h"
#include "fixlabel.h"
#include "../component/SwitchButton/switchbutton.h"
#include "switchbutton.h"
#include "hoverbtn.h"
#include "lanitem.h"
#include "deviceframe.h"

View File

@ -2,7 +2,6 @@ QT += widgets network dbus gui core
TEMPLATE = lib
CONFIG += plugin
include(../component/switchbutton.pri)
include(../component/infobutton.pri)
include(../component/drownlabel.pri)

View File

@ -182,7 +182,7 @@ bool WlanConnect::eventFilter(QObject *w, QEvent *e) {
}
void WlanConnect::initComponent() {
m_wifiSwitch = new SwitchButton(pluginWidget, false);
m_wifiSwitch = new SwitchButton(pluginWidget);
ui->openWIifLayout->addWidget(m_wifiSwitch);
ui->detailLayOut_3->setContentsMargins(MAIN_LAYOUT_MARGINS);
ui->verticalLayout_3->setContentsMargins(NO_MARGINS);

View File

@ -42,7 +42,7 @@
#include <QDBusReply>
#include <interface.h>
#include "../component/SwitchButton/switchbutton.h"
#include "switchbutton.h"
#include "hoverbtn.h"
#include "itemframe.h"
#include "wlanitem.h"

View File

@ -2,7 +2,6 @@ QT += widgets network dbus gui core
TEMPLATE = lib
CONFIG += plugin
include(../component/switchbutton.pri)
include(../component/infobutton.pri)
include(../component/drownlabel.pri)

View File

@ -5,6 +5,8 @@
#include <QPalette>
#include <QComboBox>
#include <QAbstractItemView>
#include <QMenu>
#include <QContextMenuEvent>
#include "kywirelessnetitem.h"
#include "kylinconnectresource.h"
#include "kylinactiveconnectresource.h"
@ -33,6 +35,23 @@ enum TtlsInnerType
GTC_EAP
};
class LineEdit : public QLineEdit
{
Q_OBJECT
public:
explicit LineEdit(QWidget *parent = nullptr) : QLineEdit(parent) {}
~LineEdit() {}
protected:
void contextMenuEvent(QContextMenuEvent *event) {
QMenu *menu = createStandardContextMenu();//默认的标准右键菜单,如果不需要刻意完全自己实现
menu->setPalette(this->palette());
menu->exec(event->globalPos());
delete menu;
}
};
class ConInfo {
public:
QString strConName;
@ -70,9 +89,10 @@ public:
};
static void setFramePalette(QFrame *widget, QPalette &pal) {
QList<QLineEdit *> lineEditList = widget->findChildren<QLineEdit *>();
QList<LineEdit *> lineEditList = widget->findChildren<LineEdit *>();
for (int i = 0; i < lineEditList.count(); ++i) {
lineEditList.at(i)->setPalette(pal);
lineEditList.at(i)->setContextMenuPolicy(Qt::DefaultContextMenu);
}
QList<QComboBox *> comboBoxList = widget->findChildren<QComboBox *>();
for (int i = 0; i < comboBoxList.count(); ++i) {

View File

@ -11,14 +11,14 @@ CreatNetPage::CreatNetPage(QWidget *parent):QFrame(parent)
void CreatNetPage::initUI()
{
connNameEdit = new QLineEdit(this);
connNameEdit = new LineEdit(this);
connNameEdit->setMaxLength(MAX_NAME_LENGTH);
ipv4ConfigCombox = new QComboBox(this);
ipv4addressEdit = new QLineEdit(this);
netMaskEdit = new QLineEdit(this);
gateWayEdit = new QLineEdit(this);
firstDnsEdit = new QLineEdit(this);
secondDnsEdit = new QLineEdit(this);
ipv4addressEdit = new LineEdit(this);
netMaskEdit = new LineEdit(this);
gateWayEdit = new LineEdit(this);
firstDnsEdit = new LineEdit(this);
secondDnsEdit = new LineEdit(this);
m_connNameLabel = new QLabel(this);
m_configLabel = new QLabel(this);

View File

@ -22,13 +22,13 @@ public:
void constructIpv4Info(KyConnectSetting &setting);
private:
QLineEdit *connNameEdit;
LineEdit *connNameEdit;
QComboBox *ipv4ConfigCombox;
QLineEdit *ipv4addressEdit;
QLineEdit *netMaskEdit;
QLineEdit *gateWayEdit;
QLineEdit *firstDnsEdit;
QLineEdit *secondDnsEdit;
LineEdit *ipv4addressEdit;
LineEdit *netMaskEdit;
LineEdit *gateWayEdit;
LineEdit *firstDnsEdit;
LineEdit *secondDnsEdit;
private:
QFormLayout *m_detailLayout;

View File

@ -13,7 +13,7 @@ DetailPage::DetailPage(bool isWlan, bool isCreate, QWidget *parent)
this->setMaximumWidth(960);
initUI();
if (isCreate) {
connect(mSSIDEdit, &QLineEdit::textEdited, this, &DetailPage::setEnableOfSaveBtn);
connect(mSSIDEdit, &LineEdit::textEdited, this, &DetailPage::setEnableOfSaveBtn);
}
}
@ -122,7 +122,7 @@ void DetailPage::initUI() {
// mSSID->setFocusPolicy(Qt::NoFocus);
} else {
// mSSID->setStyleSheet("border-width:1px;;border-style:solid;border-color:black;border-radius:2px");
mSSIDEdit = new QLineEdit(this);
mSSIDEdit = new LineEdit(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;background:transparent");

View File

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

View File

@ -10,11 +10,11 @@ Ipv4Page::Ipv4Page(QWidget *parent):QFrame(parent)
void Ipv4Page::initUI() {
ipv4ConfigCombox = new QComboBox(this);
ipv4addressEdit = new QLineEdit(this);
netMaskEdit = new QLineEdit(this);
gateWayEdit = new QLineEdit(this);
firstDnsEdit = new QLineEdit(this);
secondDnsEdit = new QLineEdit(this);
ipv4addressEdit = new LineEdit(this);
netMaskEdit = new LineEdit(this);
gateWayEdit = new LineEdit(this);
firstDnsEdit = new LineEdit(this);
secondDnsEdit = new LineEdit(this);
m_configLabel = new QLabel(this);
m_addressLabel = new QLabel(this);

View File

@ -30,11 +30,11 @@ public:
bool checkIsChanged(const ConInfo info, KyConnectSetting &setting);
private:
QComboBox *ipv4ConfigCombox;
QLineEdit *ipv4addressEdit;
QLineEdit *netMaskEdit;
QLineEdit *gateWayEdit;
QLineEdit *firstDnsEdit;
QLineEdit *secondDnsEdit;
LineEdit *ipv4addressEdit;
LineEdit *netMaskEdit;
LineEdit *gateWayEdit;
LineEdit *firstDnsEdit;
LineEdit *secondDnsEdit;
private:
QFormLayout *m_detailLayout;

View File

@ -91,11 +91,11 @@ bool Ipv6Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting)
void Ipv6Page::initUI() {
ipv6ConfigCombox = new QComboBox(this);
ipv6AddressEdit = new QLineEdit(this);
lengthEdit = new QLineEdit(this);
gateWayEdit = new QLineEdit(this);
firstDnsEdit = new QLineEdit(this);
secondDnsEdit = new QLineEdit(this);
ipv6AddressEdit = new LineEdit(this);
lengthEdit = new LineEdit(this);
gateWayEdit = new LineEdit(this);
firstDnsEdit = new LineEdit(this);
secondDnsEdit = new LineEdit(this);
m_configLabel = new QLabel(this);
m_addressLabel = new QLabel(this);

View File

@ -33,11 +33,11 @@ public:
public:
QComboBox *ipv6ConfigCombox;
QLineEdit *ipv6AddressEdit;
QLineEdit *lengthEdit;
QLineEdit *gateWayEdit;
QLineEdit *firstDnsEdit;
QLineEdit *secondDnsEdit;
LineEdit *ipv6AddressEdit;
LineEdit *lengthEdit;
LineEdit *gateWayEdit;
LineEdit *firstDnsEdit;
LineEdit *secondDnsEdit;
private:
QFormLayout *m_detailLayout;
QLabel *m_configLabel;

View File

@ -8,6 +8,7 @@
#define COLOR_THEME "styleName"
#include <QEvent>
#include <QMenu>
#define WINDOW_WIDTH 520
#define WINDOW_HEIGHT 590

View File

@ -135,4 +135,7 @@ signals:
void detailPageClose(bool on);
void createPageClose(QString);
};
#endif // NETDETAIL_H

View File

@ -33,21 +33,21 @@ void SecurityPage::initUI()
userPwdFlagLabel = new QLabel(this);
secuTypeCombox = new QComboBox(this);
pwdEdit = new QLineEdit(this);
pwdEdit = new LineEdit(this);
eapTypeCombox = new QComboBox(this);
//TLS
identityEdit = new QLineEdit(this);
domainEdit = new QLineEdit(this);
identityEdit = new LineEdit(this);
domainEdit = new LineEdit(this);
caCertPathCombox = new QComboBox(this);
caNeedBox = new QCheckBox(this);
clientCertPathCombox = new QComboBox(this);
clientPrivateKeyCombox = new QComboBox(this);
clientPrivateKeyPwdEdit = new QLineEdit(this);
clientPrivateKeyPwdEdit = new LineEdit(this);
//PEAP && TTLS
eapMethodCombox = new QComboBox(this);
userNameEdit = new QLineEdit(this);
userPwdEdit = new QLineEdit(this);
userNameEdit = new LineEdit(this);
userPwdEdit = new LineEdit(this);
userPwdFlagBox = new QCheckBox(this);
@ -193,17 +193,17 @@ void SecurityPage::initConnect()
this, &SecurityPage::onClientPrivateKeyComboxIndexChanged);
connect(secuTypeCombox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
connect(pwdEdit, &QLineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
connect(pwdEdit, &LineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
connect(eapTypeCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn()));
connect(identityEdit, &QLineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
connect(identityEdit, &LineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
connect(caCertPathCombox, SIGNAL(currentTextChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
connect(caNeedBox, &QCheckBox::stateChanged, this, &SecurityPage::setEnableOfSaveBtn);
connect(clientCertPathCombox, SIGNAL(currentTextChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
connect(clientPrivateKeyCombox, SIGNAL(currentTextChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
connect(clientPrivateKeyPwdEdit, &QLineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
connect(clientPrivateKeyPwdEdit, &LineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
connect(eapMethodCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn()));
connect(userNameEdit, &QLineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
connect(userPwdEdit, &QLineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
connect(userNameEdit, &LineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
connect(userPwdEdit, &LineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
}

View File

@ -10,7 +10,6 @@
#include "coninfo.h"
class SecurityPage : public QFrame
{
Q_OBJECT
@ -57,21 +56,21 @@ private:
QLabel *userPwdFlagLabel;
QComboBox *secuTypeCombox;
QLineEdit *pwdEdit;
LineEdit *pwdEdit;
QComboBox *eapTypeCombox;
//TLS
QLineEdit *identityEdit;
QLineEdit *domainEdit;
LineEdit *identityEdit;
LineEdit *domainEdit;
QComboBox *caCertPathCombox;
QCheckBox *caNeedBox;
QComboBox *clientCertPathCombox;
QComboBox *clientPrivateKeyCombox;
QLineEdit *clientPrivateKeyPwdEdit;
LineEdit *clientPrivateKeyPwdEdit;
//PEAP && TTLS
QComboBox *eapMethodCombox;
QLineEdit *userNameEdit;
QLineEdit *userPwdEdit;
LineEdit *userNameEdit;
LineEdit *userPwdEdit;
QCheckBox *userPwdFlagBox;
QCheckBox *pwdBox;