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 Package: kylin-nm
Architecture: any Architecture: any
Depends: network-manager (>=1.2.6), Depends: network-manager (>=1.2.6),
ukui-control-center (>= 3.1.1+1103), ukui-control-center (>= 3.1.1+1216),
${shlibs:Depends}, ${shlibs:Depends},
${misc:Depends} ${misc:Depends}
Description: Gui Applet tool for display and edit network simply Description: Gui Applet tool for display and edit network simply

View File

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

View File

@ -2,8 +2,6 @@ QT += widgets network dbus gui core
TEMPLATE = lib TEMPLATE = lib
CONFIG += plugin CONFIG += plugin
include(../component/switchbutton.pri)
TARGET = $$qtLibraryTarget(mobilehotspot) TARGET = $$qtLibraryTarget(mobilehotspot)
DESTDIR = ../.. DESTDIR = ../..
target.path = $$[QT_INSTALL_LIBS]/ukui-control-center 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 = new QLabel(tr("Open"), this);
m_switchLabel->setMinimumWidth(LABLE_MIN_WIDTH); m_switchLabel->setMinimumWidth(LABLE_MIN_WIDTH);
m_switchBtn = new SwitchButton(this, false); m_switchBtn = new SwitchButton(this);
switchLayout->addSpacing(LAYOUT_LEFT_MARGINS); switchLayout->addSpacing(LAYOUT_LEFT_MARGINS);
switchLayout->addWidget(m_switchLabel); switchLayout->addWidget(m_switchLabel);
switchLayout->addStretch(); switchLayout->addStretch();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,6 +5,8 @@
#include <QPalette> #include <QPalette>
#include <QComboBox> #include <QComboBox>
#include <QAbstractItemView> #include <QAbstractItemView>
#include <QMenu>
#include <QContextMenuEvent>
#include "kywirelessnetitem.h" #include "kywirelessnetitem.h"
#include "kylinconnectresource.h" #include "kylinconnectresource.h"
#include "kylinactiveconnectresource.h" #include "kylinactiveconnectresource.h"
@ -33,6 +35,23 @@ enum TtlsInnerType
GTC_EAP 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 { class ConInfo {
public: public:
QString strConName; QString strConName;
@ -70,9 +89,10 @@ public:
}; };
static void setFramePalette(QFrame *widget, QPalette &pal) { 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) { for (int i = 0; i < lineEditList.count(); ++i) {
lineEditList.at(i)->setPalette(pal); lineEditList.at(i)->setPalette(pal);
lineEditList.at(i)->setContextMenuPolicy(Qt::DefaultContextMenu);
} }
QList<QComboBox *> comboBoxList = widget->findChildren<QComboBox *>(); QList<QComboBox *> comboBoxList = widget->findChildren<QComboBox *>();
for (int i = 0; i < comboBoxList.count(); ++i) { for (int i = 0; i < comboBoxList.count(); ++i) {

View File

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

View File

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

View File

@ -13,7 +13,7 @@ DetailPage::DetailPage(bool isWlan, bool isCreate, QWidget *parent)
this->setMaximumWidth(960); this->setMaximumWidth(960);
initUI(); initUI();
if (isCreate) { 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); // mSSID->setFocusPolicy(Qt::NoFocus);
} else { } else {
// mSSID->setStyleSheet("border-width:1px;;border-style:solid;border-color:black;border-radius:2px"); // 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->setMaximumWidth(MAX_LABEL_WIDTH);
mSSIDEdit->setAlignment(Qt::AlignRight); mSSIDEdit->setAlignment(Qt::AlignRight);
mSSIDEdit->setStyleSheet("border-top:0px solid;border-bottom:1px solid;border-left:0px solid;border-right: 0px solid;background:transparent"); 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_ipv6Widget = nullptr;
DetailWidget * m_macWidget = nullptr; DetailWidget * m_macWidget = nullptr;
QLineEdit *mSSIDEdit; LineEdit *mSSIDEdit;
FixLabel *mSSIDLabel; FixLabel *mSSIDLabel;
QLabel *mProtocol; QLabel *mProtocol;
QLabel *mSecType; QLabel *mSecType;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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