diff --git a/debian/control b/debian/control index 0825be62..6e7441e4 100644 --- a/debian/control +++ b/debian/control @@ -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 diff --git a/plugins/mobilehotspot/mobilehotspot.h b/plugins/mobilehotspot/mobilehotspot.h index 1ac3b3b1..7bb3cb63 100644 --- a/plugins/mobilehotspot/mobilehotspot.h +++ b/plugins/mobilehotspot/mobilehotspot.h @@ -33,7 +33,7 @@ #include #include "interface.h" -#include "../component/SwitchButton/switchbutton.h" +#include "switchbutton.h" #include "hoverbtn.h" #include "mobilehotspotwidget.h" diff --git a/plugins/mobilehotspot/mobilehotspot.pro b/plugins/mobilehotspot/mobilehotspot.pro index 474596e2..a9fde8d3 100644 --- a/plugins/mobilehotspot/mobilehotspot.pro +++ b/plugins/mobilehotspot/mobilehotspot.pro @@ -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 diff --git a/plugins/mobilehotspot/mobilehotspotwidget.cpp b/plugins/mobilehotspot/mobilehotspotwidget.cpp index 641a1b94..f1225361 100644 --- a/plugins/mobilehotspot/mobilehotspotwidget.cpp +++ b/plugins/mobilehotspot/mobilehotspotwidget.cpp @@ -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(); diff --git a/plugins/mobilehotspot/mobilehotspotwidget.h b/plugins/mobilehotspot/mobilehotspotwidget.h index 5cf62e83..3a70ed2d 100644 --- a/plugins/mobilehotspot/mobilehotspotwidget.h +++ b/plugins/mobilehotspot/mobilehotspotwidget.h @@ -19,7 +19,7 @@ #include #include -#include "../component/SwitchButton/switchbutton.h" +#include "switchbutton.h" #include "titlelabel.h" class MobileHotspotWidget : public QWidget diff --git a/plugins/netconnect/deviceframe.h b/plugins/netconnect/deviceframe.h index 3ad4bf2c..5834b62c 100644 --- a/plugins/netconnect/deviceframe.h +++ b/plugins/netconnect/deviceframe.h @@ -7,7 +7,7 @@ #include #include #include -#include "../component/SwitchButton/switchbutton.h" +#include "switchbutton.h" #include "../component/DrownLabel/drownlabel.h" class DeviceFrame : public QFrame diff --git a/plugins/netconnect/netconnect.cpp b/plugins/netconnect/netconnect.cpp index 062720c6..304609f9 100644 --- a/plugins/netconnect/netconnect.cpp +++ b/plugins/netconnect/netconnect.cpp @@ -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); diff --git a/plugins/netconnect/netconnect.h b/plugins/netconnect/netconnect.h index 5e722cfc..2126c399 100644 --- a/plugins/netconnect/netconnect.h +++ b/plugins/netconnect/netconnect.h @@ -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" diff --git a/plugins/netconnect/netconnect.pro b/plugins/netconnect/netconnect.pro index 77461449..874174fa 100644 --- a/plugins/netconnect/netconnect.pro +++ b/plugins/netconnect/netconnect.pro @@ -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) diff --git a/plugins/wlanconnect/wlanconnect.cpp b/plugins/wlanconnect/wlanconnect.cpp index 5d7e071d..7e022766 100644 --- a/plugins/wlanconnect/wlanconnect.cpp +++ b/plugins/wlanconnect/wlanconnect.cpp @@ -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); diff --git a/plugins/wlanconnect/wlanconnect.h b/plugins/wlanconnect/wlanconnect.h index 9deb23ef..12550bbe 100644 --- a/plugins/wlanconnect/wlanconnect.h +++ b/plugins/wlanconnect/wlanconnect.h @@ -42,7 +42,7 @@ #include #include -#include "../component/SwitchButton/switchbutton.h" +#include "switchbutton.h" #include "hoverbtn.h" #include "itemframe.h" #include "wlanitem.h" diff --git a/plugins/wlanconnect/wlanconnect.pro b/plugins/wlanconnect/wlanconnect.pro index 5fff685c..c30cba96 100644 --- a/plugins/wlanconnect/wlanconnect.pro +++ b/plugins/wlanconnect/wlanconnect.pro @@ -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) diff --git a/src/frontend/netdetails/coninfo.h b/src/frontend/netdetails/coninfo.h index 068070d1..af4e128a 100644 --- a/src/frontend/netdetails/coninfo.h +++ b/src/frontend/netdetails/coninfo.h @@ -5,6 +5,8 @@ #include #include #include +#include +#include #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 lineEditList = widget->findChildren(); + QList lineEditList = widget->findChildren(); for (int i = 0; i < lineEditList.count(); ++i) { lineEditList.at(i)->setPalette(pal); + lineEditList.at(i)->setContextMenuPolicy(Qt::DefaultContextMenu); } QList comboBoxList = widget->findChildren(); for (int i = 0; i < comboBoxList.count(); ++i) { diff --git a/src/frontend/netdetails/creatnetpage.cpp b/src/frontend/netdetails/creatnetpage.cpp index 365acaa4..6034c50a 100644 --- a/src/frontend/netdetails/creatnetpage.cpp +++ b/src/frontend/netdetails/creatnetpage.cpp @@ -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); diff --git a/src/frontend/netdetails/creatnetpage.h b/src/frontend/netdetails/creatnetpage.h index ad76910e..b0809ba0 100644 --- a/src/frontend/netdetails/creatnetpage.h +++ b/src/frontend/netdetails/creatnetpage.h @@ -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; diff --git a/src/frontend/netdetails/detailpage.cpp b/src/frontend/netdetails/detailpage.cpp index 8526b0e3..004895d6 100644 --- a/src/frontend/netdetails/detailpage.cpp +++ b/src/frontend/netdetails/detailpage.cpp @@ -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"); diff --git a/src/frontend/netdetails/detailpage.h b/src/frontend/netdetails/detailpage.h index 851ccffa..fe662876 100644 --- a/src/frontend/netdetails/detailpage.h +++ b/src/frontend/netdetails/detailpage.h @@ -52,7 +52,7 @@ public: DetailWidget * m_ipv6Widget = nullptr; DetailWidget * m_macWidget = nullptr; - QLineEdit *mSSIDEdit; + LineEdit *mSSIDEdit; FixLabel *mSSIDLabel; QLabel *mProtocol; QLabel *mSecType; diff --git a/src/frontend/netdetails/ipv4page.cpp b/src/frontend/netdetails/ipv4page.cpp index 65edd71f..7cc11f58 100644 --- a/src/frontend/netdetails/ipv4page.cpp +++ b/src/frontend/netdetails/ipv4page.cpp @@ -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); diff --git a/src/frontend/netdetails/ipv4page.h b/src/frontend/netdetails/ipv4page.h index a55b5c91..25ef07aa 100644 --- a/src/frontend/netdetails/ipv4page.h +++ b/src/frontend/netdetails/ipv4page.h @@ -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; diff --git a/src/frontend/netdetails/ipv6page.cpp b/src/frontend/netdetails/ipv6page.cpp index 9691b827..d7453bec 100644 --- a/src/frontend/netdetails/ipv6page.cpp +++ b/src/frontend/netdetails/ipv6page.cpp @@ -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); diff --git a/src/frontend/netdetails/ipv6page.h b/src/frontend/netdetails/ipv6page.h index 45530a34..5e8d430d 100644 --- a/src/frontend/netdetails/ipv6page.h +++ b/src/frontend/netdetails/ipv6page.h @@ -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; diff --git a/src/frontend/netdetails/netdetail.cpp b/src/frontend/netdetails/netdetail.cpp index 4604d6e2..9f50a64f 100644 --- a/src/frontend/netdetails/netdetail.cpp +++ b/src/frontend/netdetails/netdetail.cpp @@ -8,6 +8,7 @@ #define COLOR_THEME "styleName" #include +#include #define WINDOW_WIDTH 520 #define WINDOW_HEIGHT 590 diff --git a/src/frontend/netdetails/netdetail.h b/src/frontend/netdetails/netdetail.h index 1c79e6ab..710e5ed3 100644 --- a/src/frontend/netdetails/netdetail.h +++ b/src/frontend/netdetails/netdetail.h @@ -135,4 +135,7 @@ signals: void detailPageClose(bool on); void createPageClose(QString); }; + + + #endif // NETDETAIL_H diff --git a/src/frontend/netdetails/securitypage.cpp b/src/frontend/netdetails/securitypage.cpp index a0588bab..649089d5 100644 --- a/src/frontend/netdetails/securitypage.cpp +++ b/src/frontend/netdetails/securitypage.cpp @@ -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); } diff --git a/src/frontend/netdetails/securitypage.h b/src/frontend/netdetails/securitypage.h index aec1504b..462b920d 100644 --- a/src/frontend/netdetails/securitypage.h +++ b/src/frontend/netdetails/securitypage.h @@ -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;