import 2303
This commit is contained in:
parent
21cad20648
commit
ad8c64db66
|
@ -12,3 +12,12 @@ TRANSLATIONS += \
|
|||
translations/kylin-nm_tr.ts \
|
||||
translations/kylin-nm_bo.ts \
|
||||
translations/kylin-nm_bo_CN.ts
|
||||
|
||||
CONFIG(release, debug|release) {
|
||||
!system($$PWD/translate_generation.sh): error("Failed to generate translation")
|
||||
}
|
||||
|
||||
qm_files.path = $${PREFIX}/share/kylin-nm/kylin-nm/
|
||||
qm_files.files = translations/*.qm
|
||||
|
||||
INSTALLS += qm_files \
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
<file>res/h/right-pwd.png</file>
|
||||
<file>res/h/show-pwd.png</file>
|
||||
<file>res/h/no-pwd-wifi.png</file>
|
||||
<file>translations/kylin-nm_bo.qm</file>
|
||||
<file>translations/kylin-nm_tr.qm</file>
|
||||
<file>translations/kylin-nm_zh_CN.qm</file>
|
||||
<file>res/x/fly-mode-off.svg</file>
|
||||
<file>res/x/fly-mode-on.svg</file>
|
||||
<file>res/x/hot-spot-off.svg</file>
|
||||
|
@ -128,6 +125,5 @@
|
|||
<file>res/s/conning-b/10.png</file>
|
||||
<file>res/s/conning-b/11.png</file>
|
||||
<file>res/s/conning-b/12.png</file>
|
||||
<file>translations/kylin-nm_bo_CN.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "addnetbtn.h"
|
||||
#include <QEvent>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QVariant>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
|
@ -33,15 +34,11 @@ AddNetBtn::AddNetBtn(bool isWlan, QWidget *parent) : QPushButton(parent)
|
|||
this->setMaximumSize(QSize(16777215, 60));
|
||||
this->setProperty("useButtonPalette", true);
|
||||
this->setFlat(true);
|
||||
QPalette pal = this->palette();
|
||||
QColor color = pal.color(QPalette::Button);
|
||||
color.setAlphaF(0.5);
|
||||
pal.setColor(QPalette::Button, color);
|
||||
this->setPalette(pal);
|
||||
QHBoxLayout *addLyt = new QHBoxLayout(this);
|
||||
|
||||
QLabel *iconLabel = new QLabel(this);
|
||||
textLabel = new QLabel(this);
|
||||
QHBoxLayout *addLyt = new QHBoxLayout;
|
||||
|
||||
QLabel *iconLabel = new QLabel();
|
||||
QLabel *textLabel = new QLabel();
|
||||
|
||||
if (isWlan) {
|
||||
textLabel->setText(tr("Add Others"));
|
||||
|
@ -51,8 +48,8 @@ AddNetBtn::AddNetBtn(bool isWlan, QWidget *parent) : QPushButton(parent)
|
|||
textLabel->setText(tr("Add WiredNetork"));
|
||||
QIcon mAddIcon = QIcon::fromTheme("list-add-symbolic");
|
||||
iconLabel->setPixmap(mAddIcon.pixmap(mAddIcon.actualSize(QSize(24, 24))));
|
||||
iconLabel->setProperty("useIconHighlightEffect", true);
|
||||
iconLabel->setProperty("iconHighlightEffectMode", 1);
|
||||
iconLabel->setProperty("useIconHighlightEffect", 0x2);
|
||||
// iconLabel->setProperty("iconHighlightEffectMode", 1);
|
||||
|
||||
addLyt->addStretch();
|
||||
addLyt->addWidget(iconLabel);
|
||||
|
@ -61,7 +58,6 @@ AddNetBtn::AddNetBtn(bool isWlan, QWidget *parent) : QPushButton(parent)
|
|||
|
||||
addLyt->addStretch();
|
||||
this->setLayout(addLyt);
|
||||
|
||||
}
|
||||
|
||||
AddNetBtn::~AddNetBtn()
|
||||
|
@ -83,12 +79,17 @@ void AddNetBtn::leaveEvent(QEvent *event){
|
|||
|
||||
void AddNetBtn::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPalette pal = this->palette();
|
||||
QPalette pal = qApp->palette();
|
||||
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.setBrush(pal.color(QPalette::Base));
|
||||
painter.setBrush(this->palette().base().color());
|
||||
|
||||
QColor color = pal.color(QPalette::Button);
|
||||
color.setAlphaF(0.5);
|
||||
pal.setColor(QPalette::Button, color);
|
||||
this->setPalette(pal);
|
||||
|
||||
QRect rect = this->rect();
|
||||
QPainterPath path;
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <QPushButton>
|
||||
#include <QTranslator>
|
||||
#include <QApplication>
|
||||
#include <QLabel>
|
||||
|
||||
class AddNetBtn : public QPushButton
|
||||
{
|
||||
|
@ -34,18 +33,11 @@ public:
|
|||
AddNetBtn(bool isWlan, QWidget *parent = nullptr);
|
||||
~AddNetBtn();
|
||||
|
||||
void setTextLabel(QString str) {
|
||||
textLabel->setText(str);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void leaveEvent(QEvent * event);
|
||||
virtual void enterEvent(QEvent * event);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
private:
|
||||
QLabel* textLabel;
|
||||
|
||||
Q_SIGNALS:
|
||||
void enterWidget();
|
||||
void leaveWidget();
|
||||
|
|
|
@ -34,12 +34,12 @@ BlacklistPage::BlacklistPage(QWidget *parent) : QWidget(parent)
|
|||
Vlayout->setContentsMargins(CONTENTS_MARGINS);
|
||||
Vlayout->setSpacing(0);
|
||||
|
||||
QFrame *blacklistFrame = new QFrame(this);
|
||||
blacklistFrame->setMinimumSize(FRAME_MIN_SIZE);
|
||||
blacklistFrame->setMaximumSize(FRAME_MAX_SIZE);
|
||||
blacklistFrame->setFrameShape(QFrame::Box);
|
||||
m_blacklistFrame = new QFrame(this);
|
||||
m_blacklistFrame->setMinimumSize(FRAME_MIN_SIZE);
|
||||
m_blacklistFrame->setMaximumSize(FRAME_MAX_SIZE);
|
||||
m_blacklistFrame->setFrameShape(QFrame::Box);
|
||||
|
||||
m_blacklistLayout = new QVBoxLayout(blacklistFrame);
|
||||
m_blacklistLayout = new QVBoxLayout(m_blacklistFrame);
|
||||
m_blacklistLayout->setContentsMargins(0, 0, 0, 0);
|
||||
m_blacklistLayout->setSpacing(0);
|
||||
|
||||
|
@ -48,7 +48,7 @@ BlacklistPage::BlacklistPage(QWidget *parent) : QWidget(parent)
|
|||
|
||||
Vlayout->addWidget(m_titleLabel);
|
||||
Vlayout->addSpacing(8);
|
||||
Vlayout->addWidget(blacklistFrame);
|
||||
Vlayout->addWidget(m_blacklistFrame);
|
||||
}
|
||||
|
||||
QFrame* BlacklistPage::myLine()
|
||||
|
@ -87,7 +87,7 @@ void BlacklistPage::getBlacklistDevice(QMap<QString, QString> &blacklistMap)
|
|||
for (int index = 0; index < macList.count() && macList.at(index) != nullptr; index ++) {
|
||||
QString macTemp = macList.at(index);
|
||||
macTemp = macTemp.trimmed();
|
||||
if (!blacklistMap.contains(macTemp)) {
|
||||
if (!blacklistMap.contains(macTemp) && hostNameList.at(index) != nullptr) {
|
||||
blacklistMap[macTemp] = hostNameList.at(index);
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ void BlacklistPage::resetLayoutHight()
|
|||
height += w->height();
|
||||
}
|
||||
}
|
||||
this->setFixedHeight(height + m_titleLabel->height() + 8);
|
||||
m_blacklistFrame->setFixedHeight(height);
|
||||
|
||||
if (m_blacklistMap.isEmpty()) {
|
||||
this->hide();
|
||||
|
|
|
@ -49,15 +49,8 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
|
||||
QFrame* myLine();
|
||||
|
||||
TitleLabel *m_titleLabel = nullptr;
|
||||
QVBoxLayout *m_blacklistLayout = nullptr;
|
||||
QMap<QString, QString> m_blacklistMap;
|
||||
|
||||
QDBusInterface *m_settingPathInterface = nullptr;
|
||||
|
||||
void getBlacklistDevice(QMap<QString, QString> &blacklistMap);
|
||||
bool removeStaFromBlacklist(QString staMac, QString staName);
|
||||
void initBlacklistDev();
|
||||
|
@ -65,6 +58,14 @@ private:
|
|||
void clearBlacklistLayout();
|
||||
void resetLayoutHight();
|
||||
|
||||
private:
|
||||
QFrame *m_blacklistFrame = nullptr;
|
||||
TitleLabel *m_titleLabel = nullptr;
|
||||
QVBoxLayout *m_blacklistLayout = nullptr;
|
||||
QMap<QString, QString> m_blacklistMap;
|
||||
|
||||
QDBusInterface *m_settingPathInterface = nullptr;
|
||||
|
||||
private slots:
|
||||
void onsetStaIntoBlacklist(QString staMac, QString staName);
|
||||
void onRemoveFromBlacklistBtnClicked(QString staMac, QString staName);
|
||||
|
|
|
@ -35,12 +35,12 @@ ConnectdevPage::ConnectdevPage(QWidget *parent) :
|
|||
Vlayout->setContentsMargins(CONTENTS_MARGINS);
|
||||
Vlayout->setSpacing(0);
|
||||
|
||||
QFrame *staistFrame = new QFrame(this);
|
||||
staistFrame->setMinimumSize(FRAME_MIN_SIZE);
|
||||
staistFrame->setMaximumSize(FRAME_MAX_SIZE);
|
||||
staistFrame->setFrameShape(QFrame::Box);
|
||||
m_staistFrame = new QFrame(this);
|
||||
m_staistFrame->setMinimumSize(FRAME_MIN_SIZE);
|
||||
m_staistFrame->setMaximumSize(FRAME_MAX_SIZE);
|
||||
m_staistFrame->setFrameShape(QFrame::Box);
|
||||
|
||||
m_staListLayout = new QVBoxLayout(staistFrame);
|
||||
m_staListLayout = new QVBoxLayout(m_staistFrame);
|
||||
m_staListLayout->setContentsMargins(0, 0, 0, 0);
|
||||
m_staListLayout->setSpacing(0);
|
||||
|
||||
|
@ -49,7 +49,7 @@ ConnectdevPage::ConnectdevPage(QWidget *parent) :
|
|||
|
||||
Vlayout->addWidget(m_titleLabel);
|
||||
Vlayout->addSpacing(8);
|
||||
Vlayout->addWidget(staistFrame);
|
||||
Vlayout->addWidget(m_staistFrame);
|
||||
}
|
||||
|
||||
QFrame* ConnectdevPage::myLine()
|
||||
|
@ -90,7 +90,7 @@ void ConnectdevPage::getConnectStaDevice(QMap<QString, QString> &staMap)
|
|||
QStringList macList = reply.arguments().at(0).toString().split(";");
|
||||
QStringList hostNameList = reply.arguments().at(1).toString().split(";");
|
||||
for (int index = 0; index < macList.count() && macList.at(index) != nullptr; index ++) {
|
||||
if (!staMap.contains(macList.at(index))) {
|
||||
if (!staMap.contains(macList.at(index)) && hostNameList.at(index) != nullptr) {
|
||||
staMap[macList.at(index)] = hostNameList.at(index);
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ void ConnectdevPage::resetLayoutHight()
|
|||
height += w->height();
|
||||
}
|
||||
}
|
||||
this->setFixedHeight(height + m_titleLabel->height() + 8);
|
||||
m_staistFrame->setFixedHeight(height);
|
||||
|
||||
if (m_staMap.isEmpty()) {
|
||||
this->hide();
|
||||
|
|
|
@ -50,12 +50,6 @@ public:
|
|||
private:
|
||||
QFrame* myLine();
|
||||
|
||||
TitleLabel *m_titleLabel = nullptr;
|
||||
QVBoxLayout *m_staListLayout = nullptr;
|
||||
QMap<QString, QString> m_staMap;
|
||||
|
||||
QDBusInterface *m_activePathInterface = nullptr;
|
||||
|
||||
void getConnectStaDevice(QMap<QString, QString> &blacklistMap);
|
||||
bool removeStaFromBlacklist(QString staMac);
|
||||
void initStaDev();
|
||||
|
@ -67,6 +61,15 @@ private:
|
|||
void onStaDevChanged(bool istrue, QString staMac, QString staName);
|
||||
void resetLayoutHight();
|
||||
|
||||
private:
|
||||
QFrame *m_staistFrame = nullptr;
|
||||
|
||||
TitleLabel *m_titleLabel = nullptr;
|
||||
QVBoxLayout *m_staListLayout = nullptr;
|
||||
QMap<QString, QString> m_staMap;
|
||||
|
||||
QDBusInterface *m_activePathInterface = nullptr;
|
||||
|
||||
signals:
|
||||
void setStaIntoBlacklist(QString staMac, QString staName);
|
||||
|
||||
|
|
|
@ -49,4 +49,5 @@ TRANSLATIONS += \
|
|||
translations/zh_CN.ts \
|
||||
translations/tr.ts \
|
||||
translations/bo.ts\
|
||||
translations/bo_CN.ts
|
||||
translations/bo_CN.ts \
|
||||
translations/en_US.ts
|
||||
|
|
|
@ -264,13 +264,10 @@ void MobileHotspotWidget::initDbusConnect()
|
|||
connect(m_interface,SIGNAL(hotspotActivated(QString, QString, QString, QString, QString)), this, SLOT(onHotspotActivated(QString, QString, QString, QString, QString)), Qt::QueuedConnection);
|
||||
|
||||
connect(m_interface, SIGNAL(wlanactiveConnectionStateChanged(QString, QString, QString, int)), this, SLOT(onActiveConnectionChanged(QString, QString, QString, int)), Qt::QueuedConnection);
|
||||
|
||||
connect(m_interface, SIGNAL(wirelessSwitchBtnChanged(bool)), this, SLOT(onWirelessBtnChanged(bool)), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) {
|
||||
m_switchGsettings = new QGSettings(GSETTINGS_SCHEMA);
|
||||
onGsettingChanged(WIRELESS_SWITCH);
|
||||
connect(m_switchGsettings, &QGSettings::changed, this, &MobileHotspotWidget::onGsettingChanged, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
connect(m_apNameLine, &QLineEdit::textEdited, this, &MobileHotspotWidget::onApLineEditTextEdit);
|
||||
#ifdef HOTSPOT_CONTROL
|
||||
|
@ -317,18 +314,15 @@ void MobileHotspotWidget::onActiveConnectionChanged(QString deviceName, QString
|
|||
}
|
||||
}
|
||||
|
||||
void MobileHotspotWidget::onGsettingChanged(const QString &key)
|
||||
void MobileHotspotWidget::onWirelessBtnChanged(bool state)
|
||||
{
|
||||
if (key == WIRELESS_SWITCH) {
|
||||
bool status = m_switchGsettings->get(WIRELESS_SWITCH).toBool();
|
||||
if (!status) {
|
||||
m_switchBtn->setChecked(status);
|
||||
if (!state) {
|
||||
m_switchBtn->setChecked(state);
|
||||
m_uuid.clear();
|
||||
m_switchBtn->setCheckable(false);
|
||||
} else {
|
||||
m_switchBtn->setCheckable(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MobileHotspotWidget::initInterfaceInfo()
|
||||
|
@ -720,7 +714,9 @@ void MobileHotspotWidget::setWidgetHidden(bool isHidden)
|
|||
m_uuid = "";
|
||||
} else {
|
||||
m_switchBtn->setCheckable(true);
|
||||
onGsettingChanged(WIRELESS_SWITCH);
|
||||
QDBusReply<bool> reply = m_interface->call("getWirelessSwitchBtnState");
|
||||
bool state = reply.value();
|
||||
onWirelessBtnChanged(state);
|
||||
}
|
||||
resetFrameSize();
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ private slots:
|
|||
//热点连接
|
||||
void onHotspotActivated(QString devName, QString ssid, QString uuid, QString activePath, QString settingPath);
|
||||
|
||||
void onGsettingChanged(const QString &key);
|
||||
void onWirelessBtnChanged(bool state);
|
||||
|
||||
void onActiveConnectionChanged(QString deviceName, QString ssid, QString uuid, int status);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<context>
|
||||
<name>BlacklistItem</name>
|
||||
<message>
|
||||
<location filename="../blacklistitem.cpp" line="49"/>
|
||||
<location filename="../blacklistitem.cpp" line="50"/>
|
||||
<source>Remove</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<context>
|
||||
<name>BlacklistPage</name>
|
||||
<message>
|
||||
<location filename="../blacklistpage.cpp" line="45"/>
|
||||
<location filename="../blacklistpage.cpp" line="47"/>
|
||||
<source>Blacklist</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<context>
|
||||
<name>ConnectDevListItem</name>
|
||||
<message>
|
||||
<location filename="../connectdevlistitem.cpp" line="49"/>
|
||||
<location filename="../connectdevlistitem.cpp" line="50"/>
|
||||
<source>drag into blacklist</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -28,7 +28,7 @@
|
|||
<context>
|
||||
<name>ConnectdevPage</name>
|
||||
<message>
|
||||
<location filename="../connectdevpage.cpp" line="46"/>
|
||||
<location filename="../connectdevpage.cpp" line="48"/>
|
||||
<source>Connect device</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -56,79 +56,69 @@
|
|||
<context>
|
||||
<name>MobileHotspotWidget</name>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="59"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="61"/>
|
||||
<source>ukui control center</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="62"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="64"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="138"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="149"/>
|
||||
<source>wirless switch is close or no wireless device</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="142"/>
|
||||
<source>start to close hotspot</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="151"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="169"/>
|
||||
<source>hotpots name or device is invalid</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="158"/>
|
||||
<source>start to open hotspot </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="489"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="490"/>
|
||||
<source>Contains at least 8 characters</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="205"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="223"/>
|
||||
<source>Hotspot</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="295"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="610"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="310"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="605"/>
|
||||
<source>hotspot already close</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="435"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="436"/>
|
||||
<source>Open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="456"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="457"/>
|
||||
<source>Wi-Fi Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="477"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="478"/>
|
||||
<source>Password</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="518"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="519"/>
|
||||
<source>Frequency band</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="544"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="545"/>
|
||||
<source>Net card</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="639"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="647"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="635"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="643"/>
|
||||
<source>hotspot already open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<context>
|
||||
<name>BlacklistItem</name>
|
||||
<message>
|
||||
<location filename="../blacklistitem.cpp" line="49"/>
|
||||
<location filename="../blacklistitem.cpp" line="50"/>
|
||||
<source>Remove</source>
|
||||
<translation>སྤོ་སྐྱོད་བྱས་པ།</translation>
|
||||
</message>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<context>
|
||||
<name>BlacklistPage</name>
|
||||
<message>
|
||||
<location filename="../blacklistpage.cpp" line="45"/>
|
||||
<location filename="../blacklistpage.cpp" line="47"/>
|
||||
<source>Blacklist</source>
|
||||
<translation>སྒྲིག་ཆས་ཀྱི་མིང་ཐོ་ནག་པོ།</translation>
|
||||
</message>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<context>
|
||||
<name>ConnectDevListItem</name>
|
||||
<message>
|
||||
<location filename="../connectdevlistitem.cpp" line="49"/>
|
||||
<location filename="../connectdevlistitem.cpp" line="50"/>
|
||||
<source>drag into blacklist</source>
|
||||
<translation>མིང་ཐོ་ནག་པོའི་ཁ་སྣོན་རྒྱག་པ།</translation>
|
||||
</message>
|
||||
|
@ -28,7 +28,7 @@
|
|||
<context>
|
||||
<name>ConnectdevPage</name>
|
||||
<message>
|
||||
<location filename="../connectdevpage.cpp" line="46"/>
|
||||
<location filename="../connectdevpage.cpp" line="48"/>
|
||||
<source>Connect device</source>
|
||||
<translation>འབྲེལ་མཐུད་སྒྲིག་ཆས།</translation>
|
||||
</message>
|
||||
|
@ -56,27 +56,26 @@
|
|||
<context>
|
||||
<name>MobileHotspotWidget</name>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="59"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="61"/>
|
||||
<source>ukui control center</source>
|
||||
<translation>ཝུའུ་ཁི་ལན་གྱི་ཚོད་འཛིན་ལྟེ་གནས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="62"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="64"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation>ukui ཚོད་འཛིན་ལྟེ་གནས་ཀྱི་ཅོག་ངོས་ཆ་འཕྲིན།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="138"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="149"/>
|
||||
<source>wirless switch is close or no wireless device</source>
|
||||
<translation>སྐུད་མེད་གློག་སྒོ་རྒྱག་པའམ་ཡང་ན་སྐུད་མེད་སྒྲིག་ཆས་མེད་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="142"/>
|
||||
<source>start to close hotspot</source>
|
||||
<translation>སྒོ་རྒྱག་འགོ་བརྩམས།</translation>
|
||||
<translation type="vanished">སྒོ་རྒྱག་འགོ་བརྩམས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="151"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="169"/>
|
||||
<source>hotpots name or device is invalid</source>
|
||||
<translation>ཚ་བ་ཆེ་བའི་མིང་ངམ་སྒྲིག་ཆས་ལ་ནུས་པ་མེད།</translation>
|
||||
</message>
|
||||
|
@ -85,54 +84,53 @@
|
|||
<translation type="vanished">གསང་གྲངས་ཀྱི་རིང་ཚད་ནི་གླེང་མང་བའི་གནད་དོན་བརྒྱད་ལས་ཆུང་བ་བྱེད་མི་རུང་།!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="158"/>
|
||||
<source>start to open hotspot </source>
|
||||
<translation>ཀུན་གྱིས་དོ་སྣང་བྱེད་ཡུལ་གསར་སྐྲུན་བྱེད་འགོ་ </translation>
|
||||
<translation type="vanished">ཀུན་གྱིས་དོ་སྣང་བྱེད་ཡུལ་གསར་སྐྲུན་བྱེད་འགོ་ </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="489"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="490"/>
|
||||
<source>Contains at least 8 characters</source>
|
||||
<translation>མ་མཐར་ཡང་ཡིག་རྟགས་བརྒྱད་འདུས་ཡོད།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="205"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="223"/>
|
||||
<source>Hotspot</source>
|
||||
<translation>ཚ་བ་ཆེ་བ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="295"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="610"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="310"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="605"/>
|
||||
<source>hotspot already close</source>
|
||||
<translation>ཚ་བ་ཆེ་བའི་གནད་དོན་ཐག་ཉེ་རུ་སོང་ཡོད།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="435"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="436"/>
|
||||
<source>Open</source>
|
||||
<translation>སྒོ་ཕྱེ་བ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="456"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="457"/>
|
||||
<source>Wi-Fi Name</source>
|
||||
<translation>Wi-Fiཡི་མིང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="477"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="478"/>
|
||||
<source>Password</source>
|
||||
<translation>གསང་གྲངས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="518"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="519"/>
|
||||
<source>Frequency band</source>
|
||||
<translation>ཐེངས་གྲངས་ཀྱི་རོལ་ཆའི་རུ་ཁག</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="544"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="545"/>
|
||||
<source>Net card</source>
|
||||
<translation>དྲ་རྒྱའི་བྱང་བུ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="639"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="647"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="635"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="643"/>
|
||||
<source>hotspot already open</source>
|
||||
<translation>ཚ་བ་ཆེ་བའི་གནད་དོན་དེ་སྒོ་ཕྱེ་ཟིན།</translation>
|
||||
</message>
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="en">
|
||||
<context>
|
||||
<name>BlacklistItem</name>
|
||||
<message>
|
||||
<location filename="../blacklistitem.cpp" line="50"/>
|
||||
<source>Remove</source>
|
||||
<translation>Remove</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BlacklistPage</name>
|
||||
<message>
|
||||
<location filename="../blacklistpage.cpp" line="47"/>
|
||||
<source>Blacklist</source>
|
||||
<translation>Blacklist</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ConnectDevListItem</name>
|
||||
<message>
|
||||
<location filename="../connectdevlistitem.cpp" line="50"/>
|
||||
<source>drag into blacklist</source>
|
||||
<translation>drag into blacklist</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ConnectdevPage</name>
|
||||
<message>
|
||||
<location filename="../connectdevpage.cpp" line="48"/>
|
||||
<source>Connect device</source>
|
||||
<translation>Connect device</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MobileHotspot</name>
|
||||
<message>
|
||||
<location filename="../mobilehotspot.cpp" line="35"/>
|
||||
<source>MobileHotspot</source>
|
||||
<translation>MobileHotspot</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspot.cpp" line="101"/>
|
||||
<source>mobilehotspot</source>
|
||||
<translation>mobilehotspot</translation>
|
||||
<extra-contents_path>/mobilehotspot/mobilehotspot</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspot.cpp" line="103"/>
|
||||
<source>mobilehotspot open</source>
|
||||
<translation>mobilehotspot open</translation>
|
||||
<extra-contents_path>/mobilehotspot/mobilehotspot open</extra-contents_path>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MobileHotspotWidget</name>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="61"/>
|
||||
<source>ukui control center</source>
|
||||
<translation>ukui control center</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="64"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation>ukui control center desktop message</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="149"/>
|
||||
<source>wirless switch is close or no wireless device</source>
|
||||
<translation>wirless switch is close or no wireless device</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="169"/>
|
||||
<source>hotpots name or device is invalid</source>
|
||||
<translation>hotpots name or device is invalid</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="223"/>
|
||||
<source>Hotspot</source>
|
||||
<translation>Hotspot</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="310"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="605"/>
|
||||
<source>hotspot already close</source>
|
||||
<translation>hotspot already close</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="436"/>
|
||||
<source>Open</source>
|
||||
<translation>Open</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="457"/>
|
||||
<source>Wi-Fi Name</source>
|
||||
<translation>Wi-Fi Name</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="478"/>
|
||||
<source>Password</source>
|
||||
<translation>Password</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="490"/>
|
||||
<source>Contains at least 8 characters</source>
|
||||
<translation>Contains at least 8 characters</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="519"/>
|
||||
<source>Frequency band</source>
|
||||
<translation>Frequency band</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="545"/>
|
||||
<source>Net card</source>
|
||||
<translation>Net card</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="635"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="643"/>
|
||||
<source>hotspot already open</source>
|
||||
<translation>hotspot already open</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -4,7 +4,7 @@
|
|||
<context>
|
||||
<name>BlacklistItem</name>
|
||||
<message>
|
||||
<location filename="../blacklistitem.cpp" line="49"/>
|
||||
<location filename="../blacklistitem.cpp" line="50"/>
|
||||
<source>Remove</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<context>
|
||||
<name>BlacklistPage</name>
|
||||
<message>
|
||||
<location filename="../blacklistpage.cpp" line="45"/>
|
||||
<location filename="../blacklistpage.cpp" line="47"/>
|
||||
<source>Blacklist</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<context>
|
||||
<name>ConnectDevListItem</name>
|
||||
<message>
|
||||
<location filename="../connectdevlistitem.cpp" line="49"/>
|
||||
<location filename="../connectdevlistitem.cpp" line="50"/>
|
||||
<source>drag into blacklist</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -28,7 +28,7 @@
|
|||
<context>
|
||||
<name>ConnectdevPage</name>
|
||||
<message>
|
||||
<location filename="../connectdevpage.cpp" line="46"/>
|
||||
<location filename="../connectdevpage.cpp" line="48"/>
|
||||
<source>Connect device</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -56,79 +56,69 @@
|
|||
<context>
|
||||
<name>MobileHotspotWidget</name>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="59"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="61"/>
|
||||
<source>ukui control center</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="62"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="64"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="138"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="149"/>
|
||||
<source>wirless switch is close or no wireless device</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="142"/>
|
||||
<source>start to close hotspot</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="151"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="169"/>
|
||||
<source>hotpots name or device is invalid</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="158"/>
|
||||
<source>start to open hotspot </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="489"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="490"/>
|
||||
<source>Contains at least 8 characters</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="205"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="223"/>
|
||||
<source>Hotspot</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="295"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="610"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="310"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="605"/>
|
||||
<source>hotspot already close</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="435"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="436"/>
|
||||
<source>Open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="456"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="457"/>
|
||||
<source>Wi-Fi Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="477"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="478"/>
|
||||
<source>Password</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="518"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="519"/>
|
||||
<source>Frequency band</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="544"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="545"/>
|
||||
<source>Net card</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="639"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="647"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="635"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="643"/>
|
||||
<source>hotspot already open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<context>
|
||||
<name>BlacklistItem</name>
|
||||
<message>
|
||||
<location filename="../blacklistitem.cpp" line="49"/>
|
||||
<location filename="../blacklistitem.cpp" line="50"/>
|
||||
<source>Remove</source>
|
||||
<translation>移出</translation>
|
||||
</message>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<context>
|
||||
<name>BlacklistPage</name>
|
||||
<message>
|
||||
<location filename="../blacklistpage.cpp" line="45"/>
|
||||
<location filename="../blacklistpage.cpp" line="47"/>
|
||||
<source>Blacklist</source>
|
||||
<translation>设备黑名单</translation>
|
||||
</message>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<context>
|
||||
<name>ConnectDevListItem</name>
|
||||
<message>
|
||||
<location filename="../connectdevlistitem.cpp" line="49"/>
|
||||
<location filename="../connectdevlistitem.cpp" line="50"/>
|
||||
<source>drag into blacklist</source>
|
||||
<translation>添加进黑名单</translation>
|
||||
</message>
|
||||
|
@ -28,7 +28,7 @@
|
|||
<context>
|
||||
<name>ConnectdevPage</name>
|
||||
<message>
|
||||
<location filename="../connectdevpage.cpp" line="46"/>
|
||||
<location filename="../connectdevpage.cpp" line="48"/>
|
||||
<source>Connect device</source>
|
||||
<translation>连接设备</translation>
|
||||
</message>
|
||||
|
@ -56,27 +56,26 @@
|
|||
<context>
|
||||
<name>MobileHotspotWidget</name>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="59"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="61"/>
|
||||
<source>ukui control center</source>
|
||||
<translation>控制面板</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="62"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="64"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation>控制面板桌面通知</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="138"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="149"/>
|
||||
<source>wirless switch is close or no wireless device</source>
|
||||
<translation>无线开关已关闭或不存在有热点功能的无线网卡</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="142"/>
|
||||
<source>start to close hotspot</source>
|
||||
<translation>开始关闭热点</translation>
|
||||
<translation type="vanished">开始关闭热点</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="151"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="169"/>
|
||||
<source>hotpots name or device is invalid</source>
|
||||
<translation>热点名称或设备错误</translation>
|
||||
</message>
|
||||
|
@ -85,54 +84,53 @@
|
|||
<translation type="vanished">不能创建密码长度小于八位的热点!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="158"/>
|
||||
<source>start to open hotspot </source>
|
||||
<translation>开始创建热点</translation>
|
||||
<translation type="vanished">开始创建热点</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="489"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="490"/>
|
||||
<source>Contains at least 8 characters</source>
|
||||
<translation>至少包含8个字符</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="205"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="223"/>
|
||||
<source>Hotspot</source>
|
||||
<translation>移动热点</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="295"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="610"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="310"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="605"/>
|
||||
<source>hotspot already close</source>
|
||||
<translation>热点已关闭</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="435"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="436"/>
|
||||
<source>Open</source>
|
||||
<translation>开启</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="456"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="457"/>
|
||||
<source>Wi-Fi Name</source>
|
||||
<translation>Wi-Fi名称</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="477"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="478"/>
|
||||
<source>Password</source>
|
||||
<translation>网络密码</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="518"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="519"/>
|
||||
<source>Frequency band</source>
|
||||
<translation>网络频带</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="544"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="545"/>
|
||||
<source>Net card</source>
|
||||
<translation>共享网卡端口</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="639"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="647"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="635"/>
|
||||
<location filename="../mobilehotspotwidget.cpp" line="643"/>
|
||||
<source>hotspot already open</source>
|
||||
<translation>热点已开启</translation>
|
||||
</message>
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*
|
||||
*/
|
||||
#include "lanitem.h"
|
||||
#include <QApplication>
|
||||
|
||||
#define FRAME_SPEED 150
|
||||
#define LIMIT_TIME 60*1000
|
||||
#define TOTAL_PAGE 8
|
||||
|
@ -31,11 +33,6 @@ LanItem::LanItem(bool isAcitve, QWidget *parent)
|
|||
this->setMinimumSize(550, 58);
|
||||
this->setProperty("useButtonPalette", true);
|
||||
this->setFlat(true);
|
||||
QPalette pal = this->palette();
|
||||
QColor color = pal.color(QPalette::Button);
|
||||
color.setAlphaF(0.5);
|
||||
pal.setColor(QPalette::Button, color);
|
||||
this->setPalette(pal);
|
||||
// setStyleSheet("QPushButton:!checked{background-color: palette(base)}");
|
||||
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
|
||||
mLanLyt->setContentsMargins(16,0,16,0);
|
||||
|
@ -44,31 +41,15 @@ LanItem::LanItem(bool isAcitve, QWidget *parent)
|
|||
iconLabel->setProperty("useIconHighlightEffect", 0x2);
|
||||
titileLabel = new FixLabel(this);
|
||||
statusLabel = new QLabel(this);
|
||||
statusLabel->setProperty("useIconHighlightEffect", 0x2);
|
||||
statusLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
// statusLabel->setMinimumSize(36,36);
|
||||
infoLabel = new GrayInfoButton(this);
|
||||
|
||||
//【更多】菜单
|
||||
m_moreButton = new QToolButton(this);
|
||||
m_moreButton->setProperty("useButtonPalette", true);
|
||||
m_moreButton->setPopupMode(QToolButton::InstantPopup);
|
||||
m_moreButton->setAutoRaise(true);
|
||||
m_moreButton->setIcon(QIcon::fromTheme("view-more-horizontal-symbolic"));
|
||||
m_moreMenu = new QMenu(m_moreButton);
|
||||
m_connectAction = new QAction(m_moreMenu);
|
||||
m_deleteAction = new QAction(tr("Delete"), m_moreMenu);
|
||||
setConnectActionText(isAcitve);
|
||||
|
||||
m_moreMenu->addAction(m_connectAction);
|
||||
m_moreMenu->addAction(m_deleteAction);
|
||||
m_moreButton->setMenu(m_moreMenu);
|
||||
|
||||
mLanLyt->addWidget(iconLabel);
|
||||
mLanLyt->addWidget(titileLabel,Qt::AlignLeft);
|
||||
mLanLyt->addStretch();
|
||||
mLanLyt->addWidget(statusLabel);
|
||||
mLanLyt->addWidget(infoLabel);
|
||||
mLanLyt->addWidget(m_moreButton);
|
||||
|
||||
loadIcons.append(QIcon::fromTheme("ukui-loading-1-symbolic"));
|
||||
loadIcons.append(QIcon::fromTheme("ukui-loading-2-symbolic"));
|
||||
|
@ -79,10 +60,6 @@ LanItem::LanItem(bool isAcitve, QWidget *parent)
|
|||
loadIcons.append(QIcon::fromTheme("ukui-loading-7-symbolic"));
|
||||
waitTimer = new QTimer(this);
|
||||
connect(waitTimer, &QTimer::timeout, this, &LanItem::updateIcon);
|
||||
|
||||
connect(m_connectAction, &QAction::triggered, this, &LanItem::onConnectTriggered);
|
||||
connect(m_deleteAction, &QAction::triggered, this, &LanItem::onDeletetTriggered);
|
||||
m_moreMenu->installEventFilter(this);
|
||||
}
|
||||
|
||||
LanItem::~LanItem()
|
||||
|
@ -110,48 +87,19 @@ void LanItem::stopLoading(){
|
|||
loading = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief LanItem::setConnectActionText
|
||||
* 【更多】菜单状态切换 连接/断开
|
||||
* @param isAcitve
|
||||
*/
|
||||
void LanItem::setConnectActionText(bool isAcitve)
|
||||
{
|
||||
if (isAcitve) {
|
||||
m_connectAction->setText(tr("Disconnect"));
|
||||
} else {
|
||||
m_connectAction->setText(tr("Connect"));
|
||||
}
|
||||
}
|
||||
|
||||
void LanItem::onConnectTriggered()
|
||||
{
|
||||
if (!m_connectAction) {
|
||||
return;
|
||||
}
|
||||
if (m_connectAction->text() == tr("Connect")) {
|
||||
Q_EMIT connectActionTriggered();
|
||||
} else if (m_connectAction->text() == tr("Disconnect")) {
|
||||
Q_EMIT disconnectActionTriggered();
|
||||
}
|
||||
}
|
||||
|
||||
void LanItem::onDeletetTriggered()
|
||||
{
|
||||
if (!m_deleteAction) {
|
||||
return;
|
||||
}
|
||||
Q_EMIT deleteActionTriggered();
|
||||
}
|
||||
|
||||
void LanItem::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPalette pal = this->palette();
|
||||
QPalette pal = qApp->palette();
|
||||
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.setBrush(pal.color(QPalette::Base));
|
||||
painter.setBrush(this->palette().base().color());
|
||||
|
||||
QColor color = pal.color(QPalette::Button);
|
||||
color.setAlphaF(0.5);
|
||||
pal.setColor(QPalette::Button, color);
|
||||
this->setPalette(pal);
|
||||
|
||||
QRect rect = this->rect();
|
||||
|
||||
|
@ -159,18 +107,3 @@ void LanItem::paintEvent(QPaintEvent *event)
|
|||
QPushButton::paintEvent(event);
|
||||
}
|
||||
|
||||
bool LanItem::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
//菜单右边界与按钮右边界对齐
|
||||
if (event->type() == QEvent::Show && watched == m_moreMenu) {
|
||||
int menuXPos = m_moreMenu->pos().x();
|
||||
int menuWidth = m_moreMenu->size().width();
|
||||
int btnWidth = m_moreButton->size().width();
|
||||
|
||||
QPoint pos = QPoint (menuXPos - menuWidth + btnWidth, m_moreMenu->pos().y());
|
||||
m_moreMenu->move(pos);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,16 +29,12 @@
|
|||
#include <QDebug>
|
||||
#include <QImage>
|
||||
#include <QPainter>
|
||||
#include <QToolButton>
|
||||
#include <QMenu>
|
||||
#include <QEvent>
|
||||
#include "fixlabel.h"
|
||||
//#include "infobutton.h"
|
||||
#include "../component/AddBtn/grayinfobutton.h"
|
||||
|
||||
class LanItem : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LanItem(bool isAcitve, QWidget *parent = nullptr);
|
||||
~LanItem();
|
||||
|
@ -47,15 +43,10 @@ public:
|
|||
GrayInfoButton * infoLabel = nullptr;
|
||||
FixLabel * titileLabel = nullptr;
|
||||
QLabel * statusLabel = nullptr;
|
||||
QToolButton* m_moreButton = nullptr;
|
||||
QMenu* m_moreMenu = nullptr;
|
||||
QAction* m_connectAction = nullptr;
|
||||
QAction* m_deleteAction = nullptr;
|
||||
|
||||
public:
|
||||
void startLoading();
|
||||
void stopLoading();
|
||||
void setConnectActionText(bool isAcitve);
|
||||
|
||||
bool loading = false;
|
||||
bool isAcitve = false;
|
||||
|
@ -65,7 +56,6 @@ public:
|
|||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private:
|
||||
QTimer *waitTimer = nullptr;
|
||||
|
@ -75,13 +65,6 @@ private:
|
|||
|
||||
private slots:
|
||||
void updateIcon();
|
||||
void onConnectTriggered();
|
||||
void onDeletetTriggered();
|
||||
|
||||
Q_SIGNALS:
|
||||
void connectActionTriggered();
|
||||
void disconnectActionTriggered();
|
||||
void deleteActionTriggered();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -32,9 +32,6 @@
|
|||
#define ITEMHEIGH 50
|
||||
#define LAN_TYPE 0
|
||||
#define CONTROL_CENTER_WIFI "org.ukui.control-center.wifi.switch"
|
||||
#define KYLIN_APP_MANAGER_NAME "com.kylin.AppManager"
|
||||
#define KYLIN_APP_MANAGER_PATH "/com/kylin/AppManager"
|
||||
#define KYLIN_APP_MANAGER_INTERFACE "com.kylin.AppManager"
|
||||
|
||||
const QString KLanSymbolic = "network-wired-connected-symbolic";
|
||||
const QString NoNetSymbolic = "network-wired-disconnected-symbolic";
|
||||
|
@ -81,7 +78,7 @@ NetConnect::NetConnect() : mFirstLoad(true) {
|
|||
translator->load("/usr/share/kylin-nm/netconnect/" + QLocale::system().name());
|
||||
QApplication::installTranslator(translator);
|
||||
|
||||
pluginName = tr("WiredConnect");
|
||||
pluginName = tr("LAN");
|
||||
pluginType = NETWORK;
|
||||
}
|
||||
|
||||
|
@ -153,7 +150,7 @@ QString NetConnect::translationPath() const
|
|||
void NetConnect::initSearchText() {
|
||||
//~ contents_path /netconnect/Advanced settings"
|
||||
ui->detailBtn->setText(tr("Advanced settings"));
|
||||
ui->titleLabel->setText(tr("Wired Network"));
|
||||
ui->titleLabel->setText(tr("LAN"));
|
||||
//~ contents_path /netconnect/open
|
||||
ui->openLabel->setText(tr("open"));
|
||||
}
|
||||
|
@ -171,7 +168,9 @@ bool NetConnect::eventFilter(QObject *w, QEvent *e) {
|
|||
if (!wiredSwitch->isCheckable()) {
|
||||
showDesktopNotify(tr("No ethernet device avaliable"));
|
||||
} else {
|
||||
if (m_interface != nullptr && m_interface->isValid()) {
|
||||
m_interface->call(QStringLiteral("setWiredSwitchEnable"), !wiredSwitch->isChecked());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -245,7 +244,7 @@ void NetConnect::initComponent() {
|
|||
//获取网卡列表
|
||||
void NetConnect::getDeviceStatusMap(QMap<QString, bool> &map)
|
||||
{
|
||||
if (!m_interface->isValid()) {
|
||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||
return;
|
||||
}
|
||||
qDebug() << "[NetConnect]call getDeviceListAndEnabled" << __LINE__;
|
||||
|
@ -353,22 +352,16 @@ void NetConnect::initNet()
|
|||
}
|
||||
|
||||
void NetConnect::runExternalApp() {
|
||||
// QString cmd = "nm-connection-editor";
|
||||
// QProcess process(this);
|
||||
// process.startDetached(cmd);
|
||||
LaunchApp("nm-connection-editor.desktop");
|
||||
}
|
||||
|
||||
//刪除
|
||||
void NetConnect::deleteOneLan(QString ssid, int type)
|
||||
{
|
||||
qDebug() << "[NetConnect]call deleteConnect" << __LINE__;
|
||||
m_interface->call(QStringLiteral("deleteConnect"), type, ssid);
|
||||
qDebug() << "[NetConnect]call deleteConnect respond" << __LINE__;
|
||||
QString cmd = "nm-connection-editor";
|
||||
QProcess process(this);
|
||||
process.startDetached(cmd);
|
||||
}
|
||||
|
||||
//激活
|
||||
void NetConnect::activeConnect(QString ssid, QString deviceName, int type) {
|
||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||
return;
|
||||
}
|
||||
qDebug() << "[NetConnect]call activateConnect" << __LINE__;
|
||||
m_interface->call(QStringLiteral("activateConnect"),type, deviceName, ssid);
|
||||
qDebug() << "[NetConnect]call activateConnect respond" << __LINE__;
|
||||
|
@ -376,6 +369,9 @@ void NetConnect::activeConnect(QString ssid, QString deviceName, int type) {
|
|||
|
||||
//断开
|
||||
void NetConnect::deActiveConnect(QString ssid, QString deviceName, int type) {
|
||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||
return;
|
||||
}
|
||||
qDebug() << "[NetConnect]call deActivateConnect" << __LINE__;
|
||||
m_interface->call(QStringLiteral("deActivateConnect"),type, deviceName, ssid);
|
||||
qDebug() << "[NetConnect]call deActivateConnect respond" << __LINE__;
|
||||
|
@ -389,7 +385,7 @@ void NetConnect::initNetListFromDevice(QString deviceName)
|
|||
qDebug() << "[NetConnect]initNetListFromDevice " << deviceName << " not exist";
|
||||
return;
|
||||
}
|
||||
if (!m_interface->isValid()) {
|
||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||
return;
|
||||
}
|
||||
qDebug() << "[NetConnect]call getWiredList" << __LINE__;
|
||||
|
@ -435,12 +431,12 @@ void NetConnect::addLanItem(ItemFrame *frame, QString devName, QStringList infoL
|
|||
return;
|
||||
}
|
||||
|
||||
LanItem * lanItem = new LanItem(isActived, pluginWidget);
|
||||
LanItem * lanItem = new LanItem(pluginWidget);
|
||||
QString iconPath = KLanSymbolic;
|
||||
if (isActived) {
|
||||
lanItem->statusLabel->setText(tr("connected"));
|
||||
} else {
|
||||
lanItem->statusLabel->setText(tr("not connected"));
|
||||
lanItem->statusLabel->setText("");
|
||||
}
|
||||
QIcon searchIcon = QIcon::fromTheme(iconPath);
|
||||
// if (iconPath != KLanSymbolic && iconPath != NoNetSymbolic) {
|
||||
|
@ -454,7 +450,7 @@ void NetConnect::addLanItem(ItemFrame *frame, QString devName, QStringList infoL
|
|||
|
||||
connect(lanItem->infoLabel, &GrayInfoButton::clicked, this, [=]{
|
||||
// open landetail page
|
||||
if (!m_interface->isValid()) {
|
||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||
return;
|
||||
}
|
||||
qDebug() << "[NetConnect]call showPropertyWidget" << __LINE__;
|
||||
|
@ -463,7 +459,6 @@ void NetConnect::addLanItem(ItemFrame *frame, QString devName, QStringList infoL
|
|||
});
|
||||
|
||||
lanItem->isAcitve = isActived;
|
||||
lanItem->setConnectActionText(lanItem->isAcitve);
|
||||
|
||||
connect(lanItem, &QPushButton::clicked, this, [=] {
|
||||
if (lanItem->isAcitve || lanItem->loading) {
|
||||
|
@ -473,16 +468,6 @@ void NetConnect::addLanItem(ItemFrame *frame, QString devName, QStringList infoL
|
|||
}
|
||||
});
|
||||
|
||||
connect(lanItem, &LanItem::connectActionTriggered, this, [=] {
|
||||
activeConnect(lanItem->uuid, devName, WIRED_TYPE);
|
||||
});
|
||||
connect(lanItem, &LanItem::disconnectActionTriggered, this, [=] {
|
||||
deActiveConnect(lanItem->uuid, devName, WIRED_TYPE);
|
||||
});
|
||||
connect(lanItem, &LanItem::deleteActionTriggered, this, [=] {
|
||||
deleteOneLan(lanItem->uuid, WIRED_TYPE);
|
||||
});
|
||||
|
||||
//记录到deviceFrame的itemMap中
|
||||
deviceFrameMap[devName]->itemMap.insert(infoList.at(1), lanItem);
|
||||
qDebug()<<"insert " << infoList.at(1) << " to " << devName << " list";
|
||||
|
@ -492,6 +477,9 @@ void NetConnect::addLanItem(ItemFrame *frame, QString devName, QStringList infoL
|
|||
//增加设备
|
||||
void NetConnect::addDeviceFrame(QString devName)
|
||||
{
|
||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||
return;
|
||||
}
|
||||
qDebug() << "[NetConnect]addDeviceFrame " << devName;
|
||||
|
||||
qDebug() << "[NetConnect]call getDeviceListAndEnabled" << __LINE__;
|
||||
|
@ -538,18 +526,20 @@ void NetConnect::addDeviceFrame(QString devName)
|
|||
qDebug() << "[NetConnect]set " << devName << "status" << true;
|
||||
itemFrame->lanItemFrame->show();
|
||||
itemFrame->deviceFrame->dropDownLabel->show();
|
||||
itemFrame->addLanWidget->show();
|
||||
itemFrame->deviceFrame->dropDownLabel->setDropDownStatus(true);
|
||||
deviceStatusMap[devName] = true;
|
||||
} else {
|
||||
qDebug() << "[NetConnect]set " << devName << "status" << false;
|
||||
itemFrame->lanItemFrame->hide();
|
||||
itemFrame->deviceFrame->dropDownLabel->hide();
|
||||
itemFrame->addLanWidget->hide();
|
||||
deviceStatusMap[devName] = false;
|
||||
}
|
||||
});
|
||||
|
||||
connect(itemFrame->addLanWidget, &AddNetBtn::clicked, this, [=](){
|
||||
if (m_interface->isValid()) {
|
||||
if (m_interface != nullptr && m_interface->isValid()) {
|
||||
qDebug() << "[NetConnect]call showCreateWiredConnectWidget" << devName << __LINE__;
|
||||
m_interface->call(QStringLiteral("showCreateWiredConnectWidget"), devName);
|
||||
qDebug() << "[NetConnect]call setDeviceEnable Respond" << __LINE__;
|
||||
|
@ -732,7 +722,7 @@ void NetConnect::addOneLanFrame(ItemFrame *frame, QString deviceName, QStringLis
|
|||
|
||||
QString iconPath;
|
||||
iconPath = KLanSymbolic;
|
||||
lanItem->statusLabel->setText(tr("not connected"));
|
||||
lanItem->statusLabel->setText("");
|
||||
|
||||
QIcon searchIcon = QIcon::fromTheme(iconPath);
|
||||
// if (iconPath != KLanSymbolic && iconPath != NoNetSymbolic) {
|
||||
|
@ -746,7 +736,7 @@ void NetConnect::addOneLanFrame(ItemFrame *frame, QString deviceName, QStringLis
|
|||
|
||||
connect(lanItem->infoLabel, &GrayInfoButton::clicked, this, [=]{
|
||||
// open landetail page
|
||||
if (!m_interface->isValid()) {
|
||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||
return;
|
||||
}
|
||||
qDebug() << "[NetConnect]call showPropertyWidget" << deviceName << connUuid << __LINE__;
|
||||
|
@ -755,7 +745,6 @@ void NetConnect::addOneLanFrame(ItemFrame *frame, QString deviceName, QStringLis
|
|||
});
|
||||
|
||||
lanItem->isAcitve = false;
|
||||
lanItem->setConnectActionText(lanItem->isAcitve);
|
||||
|
||||
connect(lanItem, &QPushButton::clicked, this, [=] {
|
||||
if (lanItem->isAcitve || lanItem->loading) {
|
||||
|
@ -765,16 +754,6 @@ void NetConnect::addOneLanFrame(ItemFrame *frame, QString deviceName, QStringLis
|
|||
}
|
||||
});
|
||||
|
||||
connect(lanItem, &LanItem::connectActionTriggered, this, [=] {
|
||||
activeConnect(lanItem->uuid, deviceName, WIRED_TYPE);
|
||||
});
|
||||
connect(lanItem, &LanItem::disconnectActionTriggered, this, [=] {
|
||||
deActiveConnect(lanItem->uuid, deviceName, WIRED_TYPE);
|
||||
});
|
||||
connect(lanItem, &LanItem::deleteActionTriggered, this, [=] {
|
||||
deleteOneLan(lanItem->uuid, WIRED_TYPE);
|
||||
});
|
||||
|
||||
//记录到deviceFrame的itemMap中
|
||||
deviceFrameMap[deviceName]->itemMap.insert(connUuid, lanItem);
|
||||
int index = getInsertPos(connName, deviceName);
|
||||
|
@ -889,9 +868,7 @@ void NetConnect::itemActiveConnectionStatusChanged(LanItem *item, int status)
|
|||
item->statusLabel->setMaximumSize(16777215,16777215);
|
||||
item->statusLabel->clear();
|
||||
item->isAcitve = false;
|
||||
item->statusLabel->setText(tr("not connected"));
|
||||
}
|
||||
item->setConnectActionText(item->isAcitve);
|
||||
|
||||
// QIcon searchIcon = QIcon::fromTheme(iconPath);
|
||||
// item->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(24, 24))));
|
||||
|
@ -901,7 +878,7 @@ int NetConnect::getInsertPos(QString connName, QString deviceName)
|
|||
{
|
||||
qDebug() << "[NetConnect]getInsertPos" << connName << deviceName;
|
||||
int index = 0;
|
||||
if(!m_interface->isValid()) {
|
||||
if(m_interface == nullptr || !m_interface->isValid()) {
|
||||
index = 0;
|
||||
} else {
|
||||
qDebug() << "[NetConnect]call getWiredList" << __LINE__;
|
||||
|
@ -932,19 +909,3 @@ int NetConnect::getInsertPos(QString connName, QString deviceName)
|
|||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
bool NetConnect::LaunchApp(QString desktopFile)
|
||||
{
|
||||
QDBusInterface m_appManagerDbusInterface(KYLIN_APP_MANAGER_NAME,
|
||||
KYLIN_APP_MANAGER_PATH,
|
||||
KYLIN_APP_MANAGER_INTERFACE,
|
||||
QDBusConnection::sessionBus());//局部变量
|
||||
|
||||
if (!m_appManagerDbusInterface.isValid()) {
|
||||
qWarning()<<"m_appManagerDbusInterface init error";
|
||||
return false;
|
||||
} else {
|
||||
QDBusReply<bool> reply =m_appManagerDbusInterface.call("LaunchApp",desktopFile);
|
||||
return reply;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ private:
|
|||
int getInsertPos(QString connName, QString deviceName);
|
||||
|
||||
|
||||
void deleteOneLan(QString ssid, int type);
|
||||
void deleteOneLan(QString ssid);
|
||||
void activeConnect(QString ssid, QString deviceName, int type);
|
||||
void deActiveConnect(QString ssid, QString deviceName, int type);
|
||||
|
||||
|
@ -123,7 +123,6 @@ private:
|
|||
//单个lan连接状态变化
|
||||
void itemActiveConnectionStatusChanged(LanItem *item, int status);
|
||||
|
||||
bool LaunchApp(QString desktopFile);
|
||||
protected:
|
||||
bool eventFilter(QObject *w,QEvent *e);
|
||||
|
||||
|
@ -153,7 +152,6 @@ private slots:
|
|||
|
||||
void onDeviceStatusChanged();
|
||||
void onDeviceNameChanged(QString, QString, int);
|
||||
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QList<QDBusObjectPath>);
|
||||
|
|
|
@ -51,4 +51,5 @@ TRANSLATIONS += \
|
|||
translations/zh_CN.ts \
|
||||
translations/tr.ts \
|
||||
translations/bo.ts \
|
||||
translations/bo_CN.ts
|
||||
translations/bo_CN.ts \
|
||||
translations/en_US.ts
|
||||
|
|
|
@ -4,7 +4,12 @@
|
|||
<context>
|
||||
<name>AddNetBtn</name>
|
||||
<message>
|
||||
<location filename="../addnetbtn.cpp" line="22"/>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="44"/>
|
||||
<source>Add Others</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="48"/>
|
||||
<source>Add WiredNetork</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -13,52 +18,52 @@
|
|||
<name>NetConnect</name>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="50"/>
|
||||
<location filename="../netconnect.cpp" line="152"/>
|
||||
<source>Wired Network</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="112"/>
|
||||
<location filename="../netconnect.cpp" line="154"/>
|
||||
<location filename="../netconnect.cpp" line="155"/>
|
||||
<source>open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<extra-contents_path>/netconnect/open</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="198"/>
|
||||
<location filename="../netconnect.cpp" line="151"/>
|
||||
<location filename="../netconnect.cpp" line="152"/>
|
||||
<source>Advanced settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<extra-contents_path>/netconnect/Advanced settings"</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="63"/>
|
||||
<location filename="../netconnect.cpp" line="64"/>
|
||||
<source>ukui control center</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="66"/>
|
||||
<location filename="../netconnect.cpp" line="67"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="80"/>
|
||||
<source>WiredConnect</source>
|
||||
<location filename="../netconnect.cpp" line="81"/>
|
||||
<location filename="../netconnect.cpp" line="153"/>
|
||||
<source>LAN</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="177"/>
|
||||
<location filename="../netconnect.cpp" line="169"/>
|
||||
<source>No ethernet device avaliable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="426"/>
|
||||
<location filename="../netconnect.cpp" line="833"/>
|
||||
<location filename="../netconnect.cpp" line="429"/>
|
||||
<location filename="../netconnect.cpp" line="850"/>
|
||||
<source>connected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="490"/>
|
||||
<location filename="../netconnect.cpp" line="493"/>
|
||||
<source>card</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
Binary file not shown.
|
@ -4,41 +4,20 @@
|
|||
<context>
|
||||
<name>AddNetBtn</name>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="48"/>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="44"/>
|
||||
<source>Add Others</source>
|
||||
<translation>དྲ་རྒྱ་གཞན་དག་ལ་ཞུགས་།</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="52"/>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="48"/>
|
||||
<source>Add WiredNetork</source>
|
||||
<translation>སྐུད་ཡོད་བརྙན་འཕྲིན་ཁ་སྣོན་བྱས་ཡོད།</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LanItem</name>
|
||||
<message>
|
||||
<location filename="../lanitem.cpp" line="59"/>
|
||||
<source>Delete</source>
|
||||
<translation>མེད་པར་བཟོ་བ་</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../lanitem.cpp" line="121"/>
|
||||
<location filename="../lanitem.cpp" line="134"/>
|
||||
<source>Disconnect</source>
|
||||
<translation>གཅོད་པ་</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../lanitem.cpp" line="123"/>
|
||||
<location filename="../lanitem.cpp" line="132"/>
|
||||
<source>Connect</source>
|
||||
<translation>སྦྲེལ་བ་</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>NetConnect</name>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="50"/>
|
||||
<location filename="../netconnect.cpp" line="153"/>
|
||||
<source>Wired Network</source>
|
||||
<translation>སྐུད་ཡོད་བརྙན་འཕྲིན་དྲ་བ།</translation>
|
||||
</message>
|
||||
|
@ -67,9 +46,14 @@
|
|||
<translation>ukui ཚོད་འཛིན་ལྟེ་གནས་ཀྱི་ཅོག་ངོས་ཆ་འཕྲིན།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="81"/>
|
||||
<source>WiredConnect</source>
|
||||
<translation>སྐུད་ཡོད་སྦྲེལ་མཐུད།</translation>
|
||||
<translation type="vanished">སྐུད་ཡོད་སྦྲེལ་མཐུད།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="81"/>
|
||||
<location filename="../netconnect.cpp" line="153"/>
|
||||
<source>LAN</source>
|
||||
<translation>སྐུད་ཡོད་དྲ་བ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="169"/>
|
||||
|
@ -77,21 +61,15 @@
|
|||
<translation>ཨེ་ཙི་དྲ་རྒྱའི་སྒྲིག་ཆས་ལ་བཙན་འཛུལ་བྱས་མི་ཆོག།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="437"/>
|
||||
<location filename="../netconnect.cpp" line="866"/>
|
||||
<location filename="../netconnect.cpp" line="429"/>
|
||||
<location filename="../netconnect.cpp" line="850"/>
|
||||
<source>connected</source>
|
||||
<translation>འབྲེལ་མཐུད་བྱེད་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="512"/>
|
||||
<location filename="../netconnect.cpp" line="493"/>
|
||||
<source>card</source>
|
||||
<translation>བྱང་བུ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="439"/>
|
||||
<location filename="../netconnect.cpp" line="876"/>
|
||||
<source>not connected</source>
|
||||
<translation>མ་སྦྲེལ་བ་</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="en">
|
||||
<context>
|
||||
<name>AddNetBtn</name>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="44"/>
|
||||
<source>Add Others</source>
|
||||
<translation>Add Others</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="48"/>
|
||||
<source>Add WiredNetork</source>
|
||||
<translation>Add WiredNetork</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>NetConnect</name>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="50"/>
|
||||
<source>Wired Network</source>
|
||||
<translation>Wired Network</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="112"/>
|
||||
<location filename="../netconnect.cpp" line="155"/>
|
||||
<source>open</source>
|
||||
<translation>open</translation>
|
||||
<extra-contents_path>/netconnect/open</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="198"/>
|
||||
<location filename="../netconnect.cpp" line="152"/>
|
||||
<source>Advanced settings</source>
|
||||
<translation>Advanced settings</translation>
|
||||
<extra-contents_path>/netconnect/Advanced settings"</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="64"/>
|
||||
<source>ukui control center</source>
|
||||
<translation>ukui control center</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="67"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation>ukui control center desktop message</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="81"/>
|
||||
<location filename="../netconnect.cpp" line="153"/>
|
||||
<source>LAN</source>
|
||||
<translation>LAN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="169"/>
|
||||
<source>No ethernet device avaliable</source>
|
||||
<translation>No ethernet device avaliable</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="429"/>
|
||||
<location filename="../netconnect.cpp" line="850"/>
|
||||
<source>connected</source>
|
||||
<translation>connected</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="493"/>
|
||||
<source>card</source>
|
||||
<translation>card</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -4,7 +4,12 @@
|
|||
<context>
|
||||
<name>AddNetBtn</name>
|
||||
<message>
|
||||
<location filename="../addnetbtn.cpp" line="22"/>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="44"/>
|
||||
<source>Add Others</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="48"/>
|
||||
<source>Add WiredNetork</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -13,52 +18,52 @@
|
|||
<name>NetConnect</name>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="50"/>
|
||||
<location filename="../netconnect.cpp" line="152"/>
|
||||
<source>Wired Network</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="112"/>
|
||||
<location filename="../netconnect.cpp" line="154"/>
|
||||
<location filename="../netconnect.cpp" line="155"/>
|
||||
<source>open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<extra-contents_path>/netconnect/open</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="198"/>
|
||||
<location filename="../netconnect.cpp" line="151"/>
|
||||
<location filename="../netconnect.cpp" line="152"/>
|
||||
<source>Advanced settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<extra-contents_path>/netconnect/Advanced settings"</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="63"/>
|
||||
<location filename="../netconnect.cpp" line="64"/>
|
||||
<source>ukui control center</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="66"/>
|
||||
<location filename="../netconnect.cpp" line="67"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="80"/>
|
||||
<source>WiredConnect</source>
|
||||
<location filename="../netconnect.cpp" line="81"/>
|
||||
<location filename="../netconnect.cpp" line="153"/>
|
||||
<source>LAN</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="177"/>
|
||||
<location filename="../netconnect.cpp" line="169"/>
|
||||
<source>No ethernet device avaliable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="426"/>
|
||||
<location filename="../netconnect.cpp" line="833"/>
|
||||
<location filename="../netconnect.cpp" line="429"/>
|
||||
<location filename="../netconnect.cpp" line="850"/>
|
||||
<source>connected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="490"/>
|
||||
<location filename="../netconnect.cpp" line="493"/>
|
||||
<source>card</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
Binary file not shown.
|
@ -4,41 +4,20 @@
|
|||
<context>
|
||||
<name>AddNetBtn</name>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="48"/>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="44"/>
|
||||
<source>Add Others</source>
|
||||
<translation>加入其它网络</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="52"/>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="48"/>
|
||||
<source>Add WiredNetork</source>
|
||||
<translation>添加有线网络</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LanItem</name>
|
||||
<message>
|
||||
<location filename="../lanitem.cpp" line="59"/>
|
||||
<source>Delete</source>
|
||||
<translation>删除</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../lanitem.cpp" line="121"/>
|
||||
<location filename="../lanitem.cpp" line="134"/>
|
||||
<source>Disconnect</source>
|
||||
<translation>断开</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../lanitem.cpp" line="123"/>
|
||||
<location filename="../lanitem.cpp" line="132"/>
|
||||
<source>Connect</source>
|
||||
<translation>连接</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>NetConnect</name>
|
||||
<message>
|
||||
<location filename="../netconnect.ui" line="50"/>
|
||||
<location filename="../netconnect.cpp" line="153"/>
|
||||
<source>Wired Network</source>
|
||||
<translation>有线网络</translation>
|
||||
</message>
|
||||
|
@ -67,8 +46,13 @@
|
|||
<translation>控制面板桌面通知</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="81"/>
|
||||
<source>WiredConnect</source>
|
||||
<translation type="vanished">有线网络</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="81"/>
|
||||
<location filename="../netconnect.cpp" line="153"/>
|
||||
<source>LAN</source>
|
||||
<translation>有线网络</translation>
|
||||
</message>
|
||||
<message>
|
||||
|
@ -77,21 +61,15 @@
|
|||
<translation>未检测到有线设备</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="437"/>
|
||||
<location filename="../netconnect.cpp" line="866"/>
|
||||
<location filename="../netconnect.cpp" line="429"/>
|
||||
<location filename="../netconnect.cpp" line="850"/>
|
||||
<source>connected</source>
|
||||
<translation>已连接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="512"/>
|
||||
<location filename="../netconnect.cpp" line="493"/>
|
||||
<source>card</source>
|
||||
<translation>网卡</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../netconnect.cpp" line="439"/>
|
||||
<location filename="../netconnect.cpp" line="876"/>
|
||||
<source>not connected</source>
|
||||
<translation>未连接</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
|
@ -3,5 +3,4 @@ SUBDIRS = \
|
|||
netconnect \
|
||||
wlanconnect \
|
||||
mobilehotspot \
|
||||
proxy \
|
||||
vpn
|
||||
proxy
|
||||
|
|
|
@ -29,7 +29,7 @@ AppListWidget::AppListWidget(QString path, QWidget *parent)
|
|||
|
||||
AppListWidget::~AppListWidget()
|
||||
{
|
||||
|
||||
delete m_dbusInterface;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,8 +79,9 @@ void AppListWidget::onAppCheckStateChanged()
|
|||
*/
|
||||
void AppListWidget::AddAppProxyConfig()
|
||||
{
|
||||
if(!m_dbusInterface->isValid()) {
|
||||
if(m_dbusInterface == nullptr || !m_dbusInterface->isValid()) {
|
||||
qWarning ()<< "init AppProxy dbus error";
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "call QDBusInterface addAppIntoProxy";
|
||||
|
@ -93,8 +94,9 @@ void AppListWidget::AddAppProxyConfig()
|
|||
*/
|
||||
void AppListWidget::RemoveAppProxyConfig()
|
||||
{
|
||||
if(!m_dbusInterface->isValid()) {
|
||||
if(m_dbusInterface == nullptr || !m_dbusInterface->isValid()) {
|
||||
qWarning ()<< "init AppProxy dbus error";
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "call QDBusInterface delAppIntoProxy";
|
||||
|
@ -116,7 +118,6 @@ void AppListWidget::initUI()
|
|||
mainLayout->setContentsMargins(17, 0, 17, 0);
|
||||
mainLayout->setSpacing(8);
|
||||
m_checkBox = new QCheckBox(this);
|
||||
m_checkBox->setFixedSize(16, 16);
|
||||
m_checkBox->setAttribute(Qt::WA_TransparentForMouseEvents, true); //m_checkBox不响应鼠标事件,将其传递给父窗口
|
||||
m_iconLabel = new QLabel(this);
|
||||
m_iconLabel->setFixedSize(24, 24);
|
||||
|
@ -135,4 +136,7 @@ void AppListWidget::initDbus()
|
|||
"/org/ukui/SettingsDaemon/AppProxy",
|
||||
"org.ukui.SettingsDaemon.AppProxy",
|
||||
QDBusConnection::sessionBus());
|
||||
if(!m_dbusInterface->isValid()) {
|
||||
qWarning() << qPrintable(QDBusConnection::sessionBus().lastError().message());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,14 +22,14 @@ AptProxyDialog::~AptProxyDialog()
|
|||
void AptProxyDialog::initUi()
|
||||
{
|
||||
setWindowTitle(tr("Set Apt Proxy"));
|
||||
this->setFixedSize(480, 204);
|
||||
this->setFixedSize(480, 200);
|
||||
|
||||
QVBoxLayout *mAptProxyLyt = new QVBoxLayout(this);
|
||||
mAptProxyLyt->setContentsMargins(24, 24, 24, 24);
|
||||
mAptProxyLyt->setSpacing(8);
|
||||
mAptProxyLyt->setSpacing(16);
|
||||
|
||||
QFrame *mHostFrame = new QFrame(this);
|
||||
mHostFrame->setFixedWidth(432);
|
||||
mHostFrame->setFixedSize(432, 36);
|
||||
mHostFrame->setFrameShape(QFrame::NoFrame);
|
||||
|
||||
QHBoxLayout *mLyt_1= new QHBoxLayout(mHostFrame);
|
||||
|
@ -37,19 +37,19 @@ void AptProxyDialog::initUi()
|
|||
mLyt_1->setSpacing(8);
|
||||
|
||||
FixLabel *mSetHostLabel = new FixLabel(mHostFrame);
|
||||
mSetHostLabel->setFixedWidth(92);
|
||||
mSetHostLabel->setFixedSize(92, 36);
|
||||
mSetHostLabel->setText(tr("Server Address"));
|
||||
|
||||
mHostEdit = new QLineEdit(mHostFrame);
|
||||
mHostEdit->setAttribute(Qt::WA_InputMethodEnabled, false); //限制中文输入法
|
||||
mHostEdit->setFixedWidth(332);
|
||||
mHostEdit->setFixedSize(332, 36);
|
||||
mHostEdit->installEventFilter(this);
|
||||
|
||||
mLyt_1->addWidget(mSetHostLabel);
|
||||
mLyt_1->addWidget(mHostEdit);
|
||||
|
||||
QFrame *mPortFrame = new QFrame(this);
|
||||
mPortFrame->setFixedWidth(432);
|
||||
mPortFrame->setFixedSize(432, 36);
|
||||
mPortFrame->setFrameShape(QFrame::NoFrame);
|
||||
|
||||
QHBoxLayout *mLyt_2= new QHBoxLayout(mPortFrame);
|
||||
|
@ -57,11 +57,11 @@ void AptProxyDialog::initUi()
|
|||
mLyt_2->setSpacing(8);
|
||||
|
||||
QLabel *mSetPortLabel = new QLabel(tr("Port") ,mPortFrame);
|
||||
mSetPortLabel->setFixedWidth(92);
|
||||
mSetPortLabel->setFixedSize(92, 36);
|
||||
|
||||
mPortEdit = new QLineEdit(mPortFrame);
|
||||
mPortEdit->setAttribute(Qt::WA_InputMethodEnabled, false); //限制中文输入法
|
||||
mPortEdit->setFixedWidth(332);
|
||||
mPortEdit->setFixedSize(332, 36);
|
||||
mPortEdit->installEventFilter(this);
|
||||
|
||||
mLyt_2->addWidget(mSetPortLabel);
|
||||
|
@ -76,9 +76,11 @@ void AptProxyDialog::initUi()
|
|||
mLyt_3->setSpacing(16);
|
||||
|
||||
mCancelBtn = new QPushButton(mChooseFrame);
|
||||
mCancelBtn->setMinimumWidth(96);
|
||||
mCancelBtn->setText(tr("Cancel"));
|
||||
|
||||
mConfirmBtn = new QPushButton(mChooseFrame);
|
||||
mConfirmBtn->setMinimumWidth(96);
|
||||
mConfirmBtn->setText(tr("Confirm"));
|
||||
|
||||
mLyt_3->addStretch();
|
||||
|
@ -87,7 +89,7 @@ void AptProxyDialog::initUi()
|
|||
|
||||
mAptProxyLyt->addWidget(mHostFrame);
|
||||
mAptProxyLyt->addWidget(mPortFrame);
|
||||
mAptProxyLyt->addStretch();
|
||||
mAptProxyLyt->addSpacing(16);
|
||||
mAptProxyLyt->addWidget(mChooseFrame);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,11 +45,11 @@
|
|||
|
||||
#define PROXY_HOST_KEY "host"
|
||||
#define PROXY_PORT_KEY "port"
|
||||
|
||||
#define THEME_SCHAME "org.ukui.style"
|
||||
#define FRAME_LAYOUT_MARGINS 16,0,16,0
|
||||
#define FRAME_LAYOUT_SPACING 8
|
||||
#define LABEL_WIDTH 136
|
||||
#define IP_FRAME_MAX_HEIGHT 76
|
||||
#define LINE_EDIT_HEIGHT 36
|
||||
|
||||
Proxy::Proxy() : mFirstLoad(true)
|
||||
{
|
||||
|
@ -68,6 +68,7 @@ Proxy::~Proxy()
|
|||
{
|
||||
if (!mFirstLoad) {
|
||||
plugin_leave();
|
||||
delete m_appProxyDbus;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,6 +163,11 @@ QIcon Proxy::icon() const
|
|||
return QIcon::fromTheme("ukui-network-agent-symbolic");
|
||||
}
|
||||
|
||||
QString Proxy::translationPath() const
|
||||
{
|
||||
return "/usr/share/kylin-nm/proxy/%1.ts";
|
||||
}
|
||||
|
||||
bool Proxy::isEnable() const
|
||||
{
|
||||
return true;
|
||||
|
@ -233,6 +239,7 @@ void Proxy::initUi(QWidget *widget)
|
|||
mUrlLabel->setFixedWidth(136);
|
||||
|
||||
mUrlLineEdit = new QLineEdit(mUrlFrame);
|
||||
mUrlLineEdit->setFixedHeight(36);
|
||||
|
||||
mUrlLayout->addWidget(mUrlLabel);
|
||||
mUrlLayout->addWidget(mUrlLineEdit);
|
||||
|
@ -254,6 +261,7 @@ void Proxy::initUi(QWidget *widget)
|
|||
mHTTPLineEdit_1 = new QLineEdit(mHTTPFrame);
|
||||
mHTTPLineEdit_1->resize(300, 36);
|
||||
mHTTPLineEdit_2 = new QLineEdit(mHTTPFrame);
|
||||
mHTTPLineEdit_2->setFixedHeight(36);
|
||||
mHTTPLineEdit_2->setValidator(new QRegExpValidator(QRegExp("[0-9]*") , this));
|
||||
mHTTPLayout_1->addWidget(mHTTPLabel);
|
||||
mHTTPLayout_1->addWidget(mHTTPLineEdit_1);
|
||||
|
@ -276,6 +284,7 @@ void Proxy::initUi(QWidget *widget)
|
|||
mHTTPSLineEdit_1 = new QLineEdit(mHTTPSFrame);
|
||||
mHTTPSLineEdit_1->resize(300, 36);
|
||||
mHTTPSLineEdit_2 = new QLineEdit(mHTTPSFrame);
|
||||
mHTTPSLineEdit_2->setFixedHeight(36);
|
||||
mHTTPSLineEdit_2->setValidator(new QRegExpValidator(QRegExp("[0-9]*") , this));
|
||||
mHTTPSLayout->addWidget(mHTTPSLabel);
|
||||
mHTTPSLayout->addWidget(mHTTPSLineEdit_1);
|
||||
|
@ -298,6 +307,7 @@ void Proxy::initUi(QWidget *widget)
|
|||
mFTPLineEdit_1 = new QLineEdit(mFTPFrame);
|
||||
mFTPLineEdit_1->resize(300, 36);
|
||||
mFTPLineEdit_2 = new QLineEdit(mFTPFrame);
|
||||
mFTPLineEdit_2->setFixedHeight(36);
|
||||
mFTPLineEdit_2->setValidator(new QRegExpValidator(QRegExp("[0-9]*") , this));
|
||||
mFTPLayout->addWidget(mFTPLabel);
|
||||
mFTPLayout->addWidget(mFTPLineEdit_1);
|
||||
|
@ -320,6 +330,7 @@ void Proxy::initUi(QWidget *widget)
|
|||
mSOCKSLineEdit_1 = new QLineEdit(mSOCKSFrame);
|
||||
mSOCKSLineEdit_1->resize(300, 36);
|
||||
mSOCKSLineEdit_2 = new QLineEdit(mSOCKSFrame);
|
||||
mSOCKSLineEdit_2->setFixedHeight(36);
|
||||
mSOCKSLineEdit_2->setValidator(new QRegExpValidator(QRegExp("[0-9]*") , this));
|
||||
mSOCKSLayout->addWidget(mSOCKSLabel);
|
||||
mSOCKSLayout->addWidget(mSOCKSLineEdit_1);
|
||||
|
@ -697,6 +708,9 @@ void Proxy::initDbus()
|
|||
"/org/ukui/SettingsDaemon/AppProxy",
|
||||
"org.ukui.SettingsDaemon.AppProxy",
|
||||
QDBusConnection::sessionBus());
|
||||
if(!m_appProxyDbus->isValid()) {
|
||||
qWarning() << qPrintable(QDBusConnection::sessionBus().lastError().message());
|
||||
}
|
||||
}
|
||||
|
||||
void Proxy::initAppProxyStatus()
|
||||
|
@ -747,8 +761,11 @@ void Proxy::setAptProxy(QString host, QString port, bool status)
|
|||
"/",
|
||||
"com.control.center.interface",
|
||||
QDBusConnection::systemBus());
|
||||
if (mAptproxyDbus->isValid())
|
||||
if (mAptproxyDbus->isValid()) {
|
||||
QDBusReply<bool> reply = mAptproxyDbus->call("setaptproxy", host, port , status);
|
||||
}
|
||||
delete mAptproxyDbus;
|
||||
mAptproxyDbus = nullptr;
|
||||
}
|
||||
|
||||
QHash<QString, QVariant> Proxy::getAptProxy()
|
||||
|
@ -781,6 +798,8 @@ QHash<QString, QVariant> Proxy::getAptProxy()
|
|||
mAptInfo.insert(it.arg, it.out.variant());
|
||||
}
|
||||
}
|
||||
delete mAptproxyDbus;
|
||||
mAptproxyDbus = nullptr;
|
||||
return mAptInfo;
|
||||
}
|
||||
|
||||
|
@ -809,8 +828,9 @@ void Proxy::reboot()
|
|||
"/org/gnome/SessionManager",
|
||||
"org.gnome.SessionManager",
|
||||
QDBusConnection::sessionBus());
|
||||
|
||||
if (rebootDbus->isValid()) {
|
||||
rebootDbus->call("reboot");
|
||||
}
|
||||
delete rebootDbus;
|
||||
rebootDbus = nullptr;
|
||||
}
|
||||
|
@ -836,8 +856,9 @@ QFrame *Proxy::setLine(QFrame *frame)
|
|||
bool Proxy::getAppProxyState()
|
||||
{
|
||||
bool state = true;
|
||||
if(!m_appProxyDbus->isValid()) {
|
||||
if(m_appProxyDbus == nullptr || !m_appProxyDbus->isValid()) {
|
||||
qWarning ()<< "init AppProxy dbus error";
|
||||
return false;
|
||||
}
|
||||
|
||||
//获取应用代理开启状态
|
||||
|
@ -854,7 +875,7 @@ bool Proxy::getAppProxyState()
|
|||
|
||||
void Proxy::setAppProxyState(bool state)
|
||||
{
|
||||
if(!m_appProxyDbus->isValid()) {
|
||||
if(m_appProxyDbus == nullptr || !m_appProxyDbus->isValid()) {
|
||||
qWarning ()<< "init AppProxy dbus error";
|
||||
return;
|
||||
}
|
||||
|
@ -876,6 +897,7 @@ QStringList Proxy::getAppProxyConf()
|
|||
|
||||
if(!dbusInterface.isValid()) {
|
||||
qWarning ()<< "init AppProxy dbus error";
|
||||
return info;
|
||||
}
|
||||
|
||||
//获取应用代理配置信息
|
||||
|
@ -898,11 +920,12 @@ QStringList Proxy::getAppProxyConf()
|
|||
|
||||
void Proxy::setAppProxyConf(QStringList list)
|
||||
{
|
||||
//AppProxyConf 必填项数量为3
|
||||
if (list.count() < 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!m_appProxyDbus->isValid()) {
|
||||
if(m_appProxyDbus == nullptr || !m_appProxyDbus->isValid()) {
|
||||
qWarning ()<< "init AppProxy dbus error";
|
||||
return;
|
||||
}
|
||||
|
@ -1003,23 +1026,27 @@ void Proxy::setAppProxyFrameUi(QWidget *widget)
|
|||
//IP地址ui布局
|
||||
m_ipAddressFrame = new QFrame(m_appProxyFrame);
|
||||
m_ipAddressFrame->setMinimumSize(QSize(550, 60));
|
||||
m_ipAddressFrame->setMaximumSize(QSize(16777215, IP_FRAME_MAX_HEIGHT));
|
||||
m_ipAddressFrame->setMaximumSize(QSize(16777215, 88));
|
||||
m_ipAddressFrame->setFrameShape(QFrame::NoFrame);
|
||||
m_ipAddressLabel = new QLabel(tr("IP address"), m_ipAddressFrame);
|
||||
m_ipAddressLabel->setFixedWidth(LABEL_WIDTH);
|
||||
m_ipHintsLabel = new QLabel(m_ipAddressFrame);
|
||||
m_ipHintsLabel->setFixedHeight(20);
|
||||
m_ipHintsLabel->setContentsMargins(8, 0, 0, 0);
|
||||
m_ipAddressLineEdit = new QLineEdit(m_ipAddressFrame);
|
||||
m_ipAddressLineEdit->setMinimumHeight(36);
|
||||
m_ipAddressLineEdit->setFixedHeight(LINE_EDIT_HEIGHT);
|
||||
m_ipAddressLineEdit->setPlaceholderText(tr("Required")); //必填
|
||||
|
||||
QGridLayout *ipAddressLayout = new QGridLayout(m_ipAddressFrame);
|
||||
ipAddressLayout->setContentsMargins(16, 0, 16, 0);
|
||||
ipAddressLayout->setVerticalSpacing(0);
|
||||
ipAddressLayout->addWidget(m_ipAddressLabel, 0, 0);
|
||||
ipAddressLayout->addWidget(m_ipAddressLineEdit, 0, 1);
|
||||
ipAddressLayout->addWidget(m_ipHintsLabel, 1, 1);
|
||||
QWidget *ipInputWidget = new QWidget(m_ipAddressFrame);
|
||||
QVBoxLayout *ipVLayout = new QVBoxLayout(ipInputWidget);
|
||||
ipVLayout->setContentsMargins(0, 0, 0, 0);
|
||||
ipVLayout->setSpacing(3);
|
||||
ipVLayout->addWidget(m_ipAddressLineEdit);
|
||||
ipVLayout->addWidget(m_ipHintsLabel);
|
||||
|
||||
QFormLayout *ipAddressLayout = new QFormLayout(m_ipAddressFrame);
|
||||
ipAddressLayout->setContentsMargins(16, 12, 16, 12);
|
||||
ipAddressLayout->setSpacing(FRAME_LAYOUT_SPACING);
|
||||
ipAddressLayout->addRow(m_ipAddressLabel, ipInputWidget);
|
||||
|
||||
// IP的正则格式限制
|
||||
QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
|
||||
|
@ -1151,18 +1178,22 @@ void Proxy::setAppListFrameUi(QWidget *widget)
|
|||
m_allowAppProxyLabel->setText(tr("The following applications are allowed to use this configuration:")); //允许以下应用使用该配置:
|
||||
m_appListWidget = new QListWidget(m_appListFrame);
|
||||
m_appListWidget->setMinimumHeight(240);
|
||||
m_appListWidget->setBackgroundRole(QPalette::Base);
|
||||
m_appListWidget->setFocusPolicy(Qt::FocusPolicy::NoFocus);
|
||||
m_appListWidget->setFrameShape(QFrame::Shape::Panel);
|
||||
|
||||
appListLayout->addWidget(m_allowAppProxyLabel);
|
||||
appListLayout->addWidget(m_appListWidget);
|
||||
|
||||
QPalette mpal(m_appListWidget->palette());
|
||||
mpal.setColor(QPalette::Base, qApp->palette().base().color());
|
||||
mpal.setColor(QPalette::AlternateBase, qApp->palette().alternateBase().color());
|
||||
m_appListWidget->setAlternatingRowColors(true);
|
||||
m_appListWidget->setPalette(mpal);
|
||||
onPaletteChanged();
|
||||
const QByteArray style_id(THEME_SCHAME);
|
||||
if (QGSettings::isSchemaInstalled(style_id)) {
|
||||
QGSettings * styleGsettings = new QGSettings(style_id, QByteArray(), this);
|
||||
connect(styleGsettings, &QGSettings::changed, this, [=](QString key){
|
||||
if ("styleName" == key) {
|
||||
onPaletteChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void Proxy::appProxyInfoPadding()
|
||||
|
@ -1219,7 +1250,7 @@ bool Proxy::getipEditState(QString text)
|
|||
void Proxy::onipEditStateChanged()
|
||||
{
|
||||
if (!getipEditState(m_ipAddressLineEdit->text())) {
|
||||
m_ipAddressFrame->setFixedHeight(IP_FRAME_MAX_HEIGHT);
|
||||
m_ipAddressFrame->setFixedHeight(88);
|
||||
m_ipHintsLabel->show();
|
||||
} else {
|
||||
m_ipHintsLabel->hide();
|
||||
|
@ -1231,7 +1262,6 @@ void Proxy::onAppProxyConfChanged()
|
|||
{
|
||||
if (!getipEditState(m_ipAddressLineEdit->text()) || m_portLineEdit->text().isEmpty()) {
|
||||
return;
|
||||
qDebug() << "onAppProxyConfChanged return";
|
||||
}
|
||||
|
||||
if (m_ipAddressLineEdit->text().isEmpty()) {
|
||||
|
@ -1248,8 +1278,6 @@ void Proxy::onAppProxyConfChanged()
|
|||
m_appProxyInfo.append("");
|
||||
m_appProxyInfo.append("");
|
||||
}
|
||||
|
||||
qDebug() << m_appProxyInfo << Q_FUNC_INFO << __LINE__;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1260,6 +1288,16 @@ void Proxy::onAppProxyConfEditFinished()
|
|||
}
|
||||
}
|
||||
|
||||
void Proxy::onPaletteChanged()
|
||||
{
|
||||
QPalette mpal(m_appListWidget->palette());
|
||||
mpal.setColor(QPalette::Base, qApp->palette().base().color());
|
||||
mpal.setColor(QPalette::AlternateBase, qApp->palette().alternateBase().color());
|
||||
m_appListWidget->setBackgroundRole(QPalette::Base);
|
||||
m_appListWidget->setAlternatingRowColors(true);
|
||||
m_appListWidget->setPalette(mpal);
|
||||
}
|
||||
|
||||
void Proxy::onappProxyEnableChanged(bool enable)
|
||||
{
|
||||
m_proxyTypeFrame->setVisible(enable);
|
||||
|
|
|
@ -103,6 +103,7 @@ public:
|
|||
bool isShowOnHomePage() const Q_DECL_OVERRIDE;
|
||||
QIcon icon() const Q_DECL_OVERRIDE;
|
||||
bool isEnable() const Q_DECL_OVERRIDE;
|
||||
QString translationPath() const Q_DECL_OVERRIDE;
|
||||
|
||||
public:
|
||||
void initUi(QWidget *widget);
|
||||
|
@ -262,8 +263,8 @@ private:
|
|||
QFileSystemWatcher *mfileWatch_1;
|
||||
QFileSystemWatcher *mfileWatch_2;
|
||||
|
||||
QDBusInterface *mAptproxyDbus;
|
||||
QDBusInterface *m_appProxyDbus;
|
||||
// QDBusInterface *mAptproxyDbus;
|
||||
QDBusInterface *m_appProxyDbus = nullptr;
|
||||
|
||||
bool isExistSettings = false;
|
||||
bool settingsCreate;
|
||||
|
@ -277,6 +278,7 @@ private slots:
|
|||
void onipEditStateChanged(); //IP地址无效提示
|
||||
void onAppProxyConfChanged(); //应用代理配置信息变化
|
||||
void onAppProxyConfEditFinished();
|
||||
void onPaletteChanged();
|
||||
// void onCancelBtnClicked();
|
||||
// void onSaveBtnClicked();
|
||||
// void setBtnEnable();
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
<context>
|
||||
<name>AddNetBtn</name>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="24"/>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="44"/>
|
||||
<source>Add Others</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="27"/>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="48"/>
|
||||
<source>Add WiredNetork</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -18,12 +18,12 @@
|
|||
<name>WlanConnect</name>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="14"/>
|
||||
<location filename="../wlanconnect.cpp" line="140"/>
|
||||
<source>WlanConnect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="35"/>
|
||||
<location filename="../wlanconnect.cpp" line="140"/>
|
||||
<location filename="../wlanconnect.cpp" line="211"/>
|
||||
<source>WLAN</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -58,14 +58,14 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="374"/>
|
||||
<location filename="../wlanconnect.cpp" line="1022"/>
|
||||
<location filename="../wlanconnect.cpp" line="1084"/>
|
||||
<location filename="../wlanconnect.cpp" line="362"/>
|
||||
<location filename="../wlanconnect.cpp" line="1028"/>
|
||||
<location filename="../wlanconnect.cpp" line="1090"/>
|
||||
<source>connected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="959"/>
|
||||
<location filename="../wlanconnect.cpp" line="965"/>
|
||||
<source>card</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
<context>
|
||||
<name>AddNetBtn</name>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="43"/>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="44"/>
|
||||
<source>Add Others</source>
|
||||
<translation>དྲ་རྒྱ་གཞན་དག་ནང་ཞུགས་དགོས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="47"/>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="48"/>
|
||||
<source>Add WiredNetork</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -18,12 +18,12 @@
|
|||
<name>WlanConnect</name>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="14"/>
|
||||
<location filename="../wlanconnect.cpp" line="140"/>
|
||||
<source>WlanConnect</source>
|
||||
<translation>ཝུའུ་ལན་འབྲེལ་མཐུད།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="35"/>
|
||||
<location filename="../wlanconnect.cpp" line="140"/>
|
||||
<location filename="../wlanconnect.cpp" line="211"/>
|
||||
<source>WLAN</source>
|
||||
<translation>སྐུད་མེད་ཅུས་ཁོངས་ཀྱི་དྲ་བ།</translation>
|
||||
|
@ -58,14 +58,14 @@
|
|||
<translation>སྐུད་མེད་དྲ་རྒྱའི་བྱང་བུ་མ་རྙེད་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="374"/>
|
||||
<location filename="../wlanconnect.cpp" line="1022"/>
|
||||
<location filename="../wlanconnect.cpp" line="1084"/>
|
||||
<location filename="../wlanconnect.cpp" line="362"/>
|
||||
<location filename="../wlanconnect.cpp" line="1028"/>
|
||||
<location filename="../wlanconnect.cpp" line="1090"/>
|
||||
<source>connected</source>
|
||||
<translation>འབྲེལ་མཐུད་བྱེད་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="959"/>
|
||||
<location filename="../wlanconnect.cpp" line="965"/>
|
||||
<source>card</source>
|
||||
<translation>བྱང་བུ།</translation>
|
||||
</message>
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="zh_CN">
|
||||
<context>
|
||||
<name>AddNetBtn</name>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="44"/>
|
||||
<source>Add Others</source>
|
||||
<translation>Add Others</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="48"/>
|
||||
<source>Add WiredNetork</source>
|
||||
<translation>Add WiredNetork</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WlanConnect</name>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="14"/>
|
||||
<source>WlanConnect</source>
|
||||
<translation>WlanConnect</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="35"/>
|
||||
<location filename="../wlanconnect.cpp" line="140"/>
|
||||
<location filename="../wlanconnect.cpp" line="211"/>
|
||||
<source>WLAN</source>
|
||||
<translation>WLAN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="94"/>
|
||||
<location filename="../wlanconnect.cpp" line="213"/>
|
||||
<source>open</source>
|
||||
<translation>open</translation>
|
||||
<extra-contents_path>/wlanconnect/open</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="147"/>
|
||||
<location filename="../wlanconnect.cpp" line="210"/>
|
||||
<source>Advanced settings</source>
|
||||
<translation>Advanced settings</translation>
|
||||
<extra-contents_path>/wlanconnect/Advanced settings"</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="123"/>
|
||||
<source>ukui control center</source>
|
||||
<translation>ukui control center</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="126"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation>ukui control center desktop message</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="228"/>
|
||||
<source>No wireless network card detected</source>
|
||||
<translation>No wireless network card detected</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="362"/>
|
||||
<location filename="../wlanconnect.cpp" line="1028"/>
|
||||
<location filename="../wlanconnect.cpp" line="1090"/>
|
||||
<source>connected</source>
|
||||
<translation>connected</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="965"/>
|
||||
<source>card</source>
|
||||
<translation>card</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -4,12 +4,12 @@
|
|||
<context>
|
||||
<name>AddNetBtn</name>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="24"/>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="44"/>
|
||||
<source>Add Others</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="27"/>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="48"/>
|
||||
<source>Add WiredNetork</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -18,12 +18,12 @@
|
|||
<name>WlanConnect</name>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="14"/>
|
||||
<location filename="../wlanconnect.cpp" line="140"/>
|
||||
<source>WlanConnect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="35"/>
|
||||
<location filename="../wlanconnect.cpp" line="140"/>
|
||||
<location filename="../wlanconnect.cpp" line="211"/>
|
||||
<source>WLAN</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -58,14 +58,14 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="374"/>
|
||||
<location filename="../wlanconnect.cpp" line="1022"/>
|
||||
<location filename="../wlanconnect.cpp" line="1084"/>
|
||||
<location filename="../wlanconnect.cpp" line="362"/>
|
||||
<location filename="../wlanconnect.cpp" line="1028"/>
|
||||
<location filename="../wlanconnect.cpp" line="1090"/>
|
||||
<source>connected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="959"/>
|
||||
<location filename="../wlanconnect.cpp" line="965"/>
|
||||
<source>card</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
<context>
|
||||
<name>AddNetBtn</name>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="24"/>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="44"/>
|
||||
<source>Add Others</source>
|
||||
<translation>加入其它网络</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="27"/>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="48"/>
|
||||
<source>Add WiredNetork</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -18,12 +18,12 @@
|
|||
<name>WlanConnect</name>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="14"/>
|
||||
<location filename="../wlanconnect.cpp" line="140"/>
|
||||
<source>WlanConnect</source>
|
||||
<translation>无线局域网</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="35"/>
|
||||
<location filename="../wlanconnect.cpp" line="140"/>
|
||||
<location filename="../wlanconnect.cpp" line="211"/>
|
||||
<source>WLAN</source>
|
||||
<translation>无线局域网</translation>
|
||||
|
@ -58,14 +58,14 @@
|
|||
<translation>未检测到无线网卡</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="374"/>
|
||||
<location filename="../wlanconnect.cpp" line="1022"/>
|
||||
<location filename="../wlanconnect.cpp" line="1084"/>
|
||||
<location filename="../wlanconnect.cpp" line="362"/>
|
||||
<location filename="../wlanconnect.cpp" line="1028"/>
|
||||
<location filename="../wlanconnect.cpp" line="1090"/>
|
||||
<source>connected</source>
|
||||
<translation>已连接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="959"/>
|
||||
<location filename="../wlanconnect.cpp" line="965"/>
|
||||
<source>card</source>
|
||||
<translation>网卡</translation>
|
||||
</message>
|
||||
|
|
|
@ -99,9 +99,6 @@ const QString KApSymbolic = "network-wireless-hotspot-symbolic";
|
|||
|
||||
const QString IsApConnection = "1";
|
||||
|
||||
#define KYLIN_APP_MANAGER_NAME "com.kylin.AppManager"
|
||||
#define KYLIN_APP_MANAGER_PATH "/com/kylin/AppManager"
|
||||
#define KYLIN_APP_MANAGER_INTERFACE "com.kylin.AppManager"
|
||||
|
||||
#define ACTIVATING 1
|
||||
#define ACTIVATED 2
|
||||
|
@ -140,7 +137,7 @@ WlanConnect::WlanConnect() : m_firstLoad(true) {
|
|||
translator->load("/usr/share/kylin-nm/wlanconnect/" + QLocale::system().name());
|
||||
QApplication::installTranslator(translator);
|
||||
|
||||
pluginName = tr("WlanConnect");
|
||||
pluginName = tr("WLAN");
|
||||
pluginType = NETWORK;
|
||||
}
|
||||
|
||||
|
@ -230,7 +227,9 @@ bool WlanConnect::eventFilter(QObject *w, QEvent *e) {
|
|||
if (!getSwitchBtnEnable()) {
|
||||
showDesktopNotify(tr("No wireless network card detected"));
|
||||
} else {
|
||||
if (m_interface != nullptr && m_interface->isValid()) {
|
||||
m_interface->call(QStringLiteral("setWirelessSwitchEnable"), !getSwitchBtnState());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +300,7 @@ void WlanConnect::initComponent() {
|
|||
void WlanConnect::reScan()
|
||||
{
|
||||
qDebug() << "time to rescan wifi";
|
||||
if (m_interface->isValid()) {
|
||||
if (m_interface != nullptr && m_interface->isValid()) {
|
||||
qDebug() << "[WlanConnect]call reScan" << __LINE__;
|
||||
m_interface->call("reScan");
|
||||
qDebug() << "[WlanConnect]call reScan respond" << __LINE__;
|
||||
|
@ -315,7 +314,7 @@ void WlanConnect::updateList()
|
|||
return;
|
||||
}
|
||||
qDebug() << "update list";
|
||||
if(m_interface->isValid()) {
|
||||
if(m_interface != nullptr && m_interface->isValid()) {
|
||||
qDebug() << "[WlanConnect]call getWirelessList" << __LINE__;
|
||||
QDBusMessage result = m_interface->call(QStringLiteral("getWirelessList"));
|
||||
qDebug() << "[WlanConnect]call getWirelessList respond" << __LINE__;
|
||||
|
@ -429,9 +428,9 @@ void WlanConnect::updateIcon(WlanItem *item, QString signalStrength, QString sec
|
|||
iconamePath = wifiIcon(isLock, sign, category);
|
||||
}
|
||||
QIcon searchIcon = QIcon::fromTheme(iconamePath);
|
||||
if (iconamePath != KLanSymbolic && iconamePath != NoNetSymbolic) {
|
||||
item->iconLabel->setProperty("useIconHighlightEffect", 0x10);
|
||||
}
|
||||
// if (iconamePath != KLanSymbolic && iconamePath != NoNetSymbolic) {
|
||||
// item->iconLabel->setProperty("useIconHighlightEffect", 0x10);
|
||||
// }
|
||||
item->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(ICON_SIZE))));
|
||||
qDebug() << "updateIcon" << item->titileLabel->text() << " finish";
|
||||
}
|
||||
|
@ -522,6 +521,12 @@ void WlanConnect::onDeviceStatusChanged()
|
|||
setSwitchBtnEnable(true);
|
||||
initSwtichState();
|
||||
}
|
||||
|
||||
if (!getSwitchBtnState()) {
|
||||
hideLayout(ui->availableLayout);
|
||||
} else {
|
||||
showLayout(ui->availableLayout);
|
||||
}
|
||||
}
|
||||
|
||||
void WlanConnect::onDeviceNameChanged(QString oldName, QString newName, int type)
|
||||
|
@ -554,7 +559,7 @@ void WlanConnect::onSwitchBtnChanged(bool state)
|
|||
if (getSwitchBtnState() == state) {
|
||||
return;
|
||||
}
|
||||
|
||||
setSwitchBtnEnable(true);
|
||||
setSwitchBtnState(state);
|
||||
if (!getSwitchBtnState()) {
|
||||
hideLayout(ui->availableLayout);
|
||||
|
@ -681,7 +686,7 @@ void WlanConnect::onNetworkRemove(QString deviceName, QString wlannName)
|
|||
//获取设备列表=======================================================
|
||||
void WlanConnect::getDeviceList(QStringList &list)
|
||||
{
|
||||
if (!m_interface->isValid()) {
|
||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||
return;
|
||||
}
|
||||
qDebug() << "[WlanConnect]call getDeviceListAndEnabled" << __LINE__;
|
||||
|
@ -700,7 +705,7 @@ void WlanConnect::getDeviceList(QStringList &list)
|
|||
|
||||
void WlanConnect::initSwtichState()
|
||||
{
|
||||
if (!m_interface->isValid()) {
|
||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -713,25 +718,10 @@ void WlanConnect::initSwtichState()
|
|||
}
|
||||
|
||||
bool state = result.arguments().at(0).toBool();
|
||||
setSwitchBtnEnable(true);
|
||||
setSwitchBtnState(state);
|
||||
}
|
||||
|
||||
bool WlanConnect::LaunchApp(QString desktopFile)
|
||||
{
|
||||
QDBusInterface m_appManagerDbusInterface(KYLIN_APP_MANAGER_NAME,
|
||||
KYLIN_APP_MANAGER_PATH,
|
||||
KYLIN_APP_MANAGER_INTERFACE,
|
||||
QDBusConnection::sessionBus());//局部变量
|
||||
|
||||
if (!m_appManagerDbusInterface.isValid()) {
|
||||
qWarning()<<"m_appManagerDbusInterface init error";
|
||||
return false;
|
||||
} else {
|
||||
QDBusReply<bool> reply =m_appManagerDbusInterface.call("LaunchApp",desktopFile);
|
||||
return reply;
|
||||
}
|
||||
}
|
||||
|
||||
//初始化整体列表和单设备列表
|
||||
void WlanConnect::initNet() {
|
||||
// int count = 1;
|
||||
|
@ -757,7 +747,7 @@ void WlanConnect::initNetListFromDevice(QString deviceName)
|
|||
qDebug() << "[WlanConnect]initNetListFromDevice " << deviceName << " not exist";
|
||||
return;
|
||||
}
|
||||
if (!m_interface->isValid()) {
|
||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||
return;
|
||||
}
|
||||
qDebug() << "[WlanConnect]call getWirelessList" << __LINE__;
|
||||
|
@ -795,10 +785,9 @@ void WlanConnect::initNetListFromDevice(QString deviceName)
|
|||
|
||||
//高级设置
|
||||
void WlanConnect::runExternalApp() {
|
||||
// QString cmd = "nm-connection-editor";
|
||||
// QProcess process(this);
|
||||
// process.startDetached(cmd);
|
||||
LaunchApp("nm-connection-editor.desktop");
|
||||
QString cmd = "nm-connection-editor";
|
||||
QProcess process(this);
|
||||
process.startDetached(cmd);
|
||||
}
|
||||
|
||||
//根据信号强度分级+安全性分图标
|
||||
|
@ -891,6 +880,9 @@ void WlanConnect::showLayout(QVBoxLayout * layout) {
|
|||
//获取应该插入哪个位置
|
||||
int WlanConnect::sortWlanNet(QString deviceName, QString name, QString signal)
|
||||
{
|
||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||
return 0;
|
||||
}
|
||||
qDebug() << "[WlanConnect]call getWirelessList" << __LINE__;
|
||||
QDBusMessage result = m_interface->call(QStringLiteral("getWirelessList"));
|
||||
qDebug() << "[WlanConnect]call getWirelessList respond" << __LINE__;
|
||||
|
@ -917,7 +909,7 @@ int WlanConnect::sortWlanNet(QString deviceName, QString name, QString signal)
|
|||
}
|
||||
|
||||
void WlanConnect::activeConnect(QString netName, QString deviceName, int type) {
|
||||
if (!m_interface->isValid()) {
|
||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||
return;
|
||||
}
|
||||
qDebug() << "[WlanConnect]call activateConnect" << __LINE__;
|
||||
|
@ -926,7 +918,7 @@ void WlanConnect::activeConnect(QString netName, QString deviceName, int type) {
|
|||
}
|
||||
|
||||
void WlanConnect::deActiveConnect(QString netName, QString deviceName, int type) {
|
||||
if (!m_interface->isValid()) {
|
||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||
return;
|
||||
}
|
||||
qDebug() << "[WlanConnect]call deActivateConnect" << __LINE__;
|
||||
|
@ -979,7 +971,7 @@ void WlanConnect::addDeviceFrame(QString devName)
|
|||
deviceFrameMap.insert(devName, itemFrame);
|
||||
|
||||
connect(itemFrame->addWlanWidget, &AddNetBtn::clicked, this, [=](){
|
||||
if (m_interface->isValid()) {
|
||||
if (m_interface != nullptr && m_interface->isValid()) {
|
||||
qDebug() << "[NetConnect]call showAddOtherWlanWidget" << devName << __LINE__;
|
||||
m_interface->call(QStringLiteral("showAddOtherWlanWidget"), devName);
|
||||
qDebug() << "[NetConnect]call setDeviceEnable Respond" << __LINE__;
|
||||
|
@ -1031,9 +1023,9 @@ void WlanConnect::addOneWlanFrame(ItemFrame *frame, QString deviceName, QString
|
|||
} else {
|
||||
iconamePath = wifiIcon(isLock, sign, category);
|
||||
}
|
||||
if (iconamePath != KLanSymbolic && iconamePath != NoNetSymbolic) {
|
||||
wlanItem->iconLabel->setProperty("useIconHighlightEffect", 0x10);
|
||||
}
|
||||
// if (iconamePath != KLanSymbolic && iconamePath != NoNetSymbolic) {
|
||||
// wlanItem->iconLabel->setProperty("useIconHighlightEffect", 0x10);
|
||||
// }
|
||||
QIcon searchIcon = QIcon::fromTheme(iconamePath);
|
||||
wlanItem->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(ICON_SIZE))));
|
||||
wlanItem->titileLabel->setText(name);
|
||||
|
@ -1047,7 +1039,7 @@ void WlanConnect::addOneWlanFrame(ItemFrame *frame, QString deviceName, QString
|
|||
|
||||
connect(wlanItem->infoLabel, &GrayInfoButton::clicked, this, [=]{
|
||||
// open detail page
|
||||
if (!m_interface->isValid()) {
|
||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||
return;
|
||||
}
|
||||
qDebug() << "[WlanConnect]call showPropertyWidget" << __LINE__;
|
||||
|
|
|
@ -127,12 +127,12 @@ private:
|
|||
void initSwtichState();
|
||||
inline void setSwitchBtnEnable(bool state) {
|
||||
if (m_wifiSwitch != nullptr) {
|
||||
m_wifiSwitch->setCheckable(state);
|
||||
m_wifiSwitch->setEnabled(state);
|
||||
}
|
||||
}
|
||||
inline bool getSwitchBtnEnable() {
|
||||
if (m_wifiSwitch != nullptr) {
|
||||
return m_wifiSwitch->isCheckable();
|
||||
return m_wifiSwitch->isEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,6 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
bool LaunchApp(QString desktopFile);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *w,QEvent *e);
|
||||
|
|
|
@ -51,4 +51,5 @@ TRANSLATIONS += \
|
|||
translations/zh_CN.ts \
|
||||
translations/tr.ts \
|
||||
translations/bo.ts \
|
||||
translations/bo_CN.ts
|
||||
translations/bo_CN.ts \
|
||||
translations/en_US.ts
|
||||
|
|
|
@ -184,7 +184,7 @@
|
|||
<customwidget>
|
||||
<class>TitleLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header location="global">titlelabel.h</header>
|
||||
<header>titlelabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
#include "wlanitem.h"
|
||||
#include <QPainter>
|
||||
#include <QApplication>
|
||||
#define FRAME_SPEED 150
|
||||
#define LIMIT_TIME 60*1000
|
||||
#define TOTAL_PAGE 8
|
||||
|
@ -33,17 +34,15 @@ WlanItem::WlanItem(bool bAcitve, bool isLock, QWidget *parent)
|
|||
this->setMinimumSize(550, 58);
|
||||
this->setProperty("useButtonPalette", true);
|
||||
this->setFlat(true);
|
||||
QPalette pal = this->palette();
|
||||
QColor color = pal.color(QPalette::Button);
|
||||
color.setAlphaF(0.5);
|
||||
pal.setColor(QPalette::Button, color);
|
||||
this->setPalette(pal);
|
||||
|
||||
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
|
||||
mLanLyt->setContentsMargins(16,0,16,0);
|
||||
mLanLyt->setSpacing(16);
|
||||
iconLabel = new QLabel(this);
|
||||
iconLabel->setProperty("useIconHighlightEffect", 0x2);
|
||||
titileLabel = new FixLabel(this);
|
||||
statusLabel = new QLabel(this);
|
||||
statusLabel->setProperty("useIconHighlightEffect", 0x2);
|
||||
statusLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
// statusLabel->setMinimumSize(36,36);
|
||||
infoLabel = new GrayInfoButton(this);
|
||||
|
@ -63,7 +62,6 @@ WlanItem::WlanItem(bool bAcitve, bool isLock, QWidget *parent)
|
|||
|
||||
waitTimer = new QTimer(this);
|
||||
connect(waitTimer, &QTimer::timeout, this, &WlanItem::updateIcon);
|
||||
|
||||
}
|
||||
|
||||
WlanItem::~WlanItem()
|
||||
|
@ -93,12 +91,17 @@ void WlanItem::stopLoading(){
|
|||
|
||||
void WlanItem::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPalette pal = this->palette();
|
||||
QPalette pal = qApp->palette();
|
||||
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.setBrush(pal.color(QPalette::Base));
|
||||
painter.setBrush(this->palette().base().color());
|
||||
|
||||
QColor color = pal.color(QPalette::Button);
|
||||
color.setAlphaF(0.5);
|
||||
pal.setColor(QPalette::Button, color);
|
||||
this->setPalette(pal);
|
||||
|
||||
QRect rect = this->rect();
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ include(dbus-interface/dbus-interface.pri)
|
|||
|
||||
HEADERS += \
|
||||
$$PWD/dbusadaptor.h \
|
||||
$$PWD/vpndbusadaptor.h \
|
||||
$$PWD/kylinarping.h \
|
||||
$$PWD/kylinipv4arping.h \
|
||||
$$PWD/kylinipv6arping.h \
|
||||
|
@ -14,7 +13,6 @@ HEADERS += \
|
|||
|
||||
SOURCES += \
|
||||
$$PWD/dbusadaptor.cpp \
|
||||
$$PWD/vpndbusadaptor.cpp \
|
||||
$$PWD/kylinipv4arping.cpp \
|
||||
$$PWD/kylinipv6arping.cpp \
|
||||
$$PWD/sysdbusregister.cpp \
|
||||
|
|
|
@ -747,3 +747,35 @@ QString KyActiveConnectResourse::getAcitveConnectionPathByUuid(QString connectUu
|
|||
|
||||
return activeAonnectPtr->path();
|
||||
}
|
||||
|
||||
int KyActiveConnectResourse::getAcivateWifiSignal()
|
||||
{
|
||||
int signalStrength = 0;
|
||||
KyNetworkDeviceResourse devResource;
|
||||
QStringList devList;
|
||||
devResource.getNetworkDeviceList(NetworkManager::Device::Type::Wifi, devList);
|
||||
|
||||
for (int i = 0; i < devList.size(); ++i) {
|
||||
|
||||
NetworkManager::Device::Ptr connectDevice =
|
||||
m_networkResourceInstance->findDeviceInterface(devList.at(i));
|
||||
|
||||
if (nullptr == connectDevice || !connectDevice->isValid()) {
|
||||
qWarning()<< LOG_FLAG <<"getDeviceActiveAPInfo failed, the device" << devList.at(i) << "is not existed";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (connectDevice->type() == NetworkManager::Device::Wifi) {
|
||||
NetworkManager::WirelessDevice *wirelessDevicePtr =
|
||||
qobject_cast<NetworkManager::WirelessDevice *>(connectDevice.data());
|
||||
NetworkManager::AccessPoint::Ptr apPtr = wirelessDevicePtr->activeAccessPoint();
|
||||
if (apPtr.isNull()) {
|
||||
continue;
|
||||
}
|
||||
signalStrength = apPtr->signalStrength();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return signalStrength;
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
bool wiredConnectIsActived();
|
||||
bool checkWirelessStatus(NetworkManager::ActiveConnection::State state);
|
||||
QString getAcitveConnectionPathByUuid(QString uuid);
|
||||
int getAcivateWifiSignal();
|
||||
|
||||
private:
|
||||
void getActiveConnectIp(NetworkManager::ActiveConnection::Ptr activeConnectPtr,
|
||||
|
|
|
@ -212,6 +212,14 @@ wifi_get_secrets (SecretsRequest *req, GError **error)
|
|||
|
||||
g_return_val_if_fail (!info->dialog, FALSE);
|
||||
|
||||
#if GTK_CHECK_VERSION(3,90,0)
|
||||
gtk_init ();
|
||||
#else
|
||||
int argc = 0;
|
||||
char ***argv = NULL;
|
||||
gtk_init (&argc, &argv);
|
||||
#endif
|
||||
|
||||
NMClient *nm_client = nm_client_new (NULL, NULL);
|
||||
if (!nm_client) {
|
||||
g_set_error (error,
|
||||
|
@ -401,14 +409,6 @@ void agent_init()
|
|||
GError *error = NULL;
|
||||
kylinAgent = applet_agent_new (&error);
|
||||
|
||||
#if GTK_CHECK_VERSION(3,90,0)
|
||||
gtk_init ();
|
||||
#else
|
||||
int argc = 0;
|
||||
char ***argv = NULL;
|
||||
gtk_init (&argc, &argv);
|
||||
#endif
|
||||
|
||||
g_signal_connect (kylinAgent, APPLET_AGENT_GET_SECRETS,
|
||||
G_CALLBACK (applet_agent_get_secrets_cb), NULL);
|
||||
g_signal_connect (kylinAgent, APPLET_AGENT_CANCEL_SECRETS,
|
||||
|
|
|
@ -42,36 +42,11 @@ static bool subLanListSort(const KyConnectItem* info1, const KyConnectItem* info
|
|||
return result;
|
||||
}
|
||||
|
||||
static bool subVpnListSort(const KyConnectItem* info1, const KyConnectItem* info2)
|
||||
{
|
||||
if (info1->m_connectState != info2->m_connectState) {
|
||||
if (info1->m_connectState == 2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (info2->m_connectState == 2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
QString name1 = info1->m_connectName;
|
||||
QString name2 = info2->m_connectName;
|
||||
bool result = true;
|
||||
if (QString::compare(name1, name2, Qt::CaseInsensitive) > 0) {
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static void lanListSort(QList<KyConnectItem *> &list)
|
||||
{
|
||||
qSort(list.begin(), list.end(), subLanListSort);
|
||||
}
|
||||
|
||||
static void vpnListSort(QList<KyConnectItem *> &list)
|
||||
{
|
||||
qSort(list.begin(), list.end(), subVpnListSort);
|
||||
}
|
||||
|
||||
KyConnectResourse::KyConnectResourse(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_networkResourceInstance = KyNetworkResourceManager::getInstance();
|
||||
|
@ -225,61 +200,6 @@ KyConnectItem * KyConnectResourse::getConnectionItemByUuid(QString connectUuid,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void KyConnectResourse::getVpnAndVirtualConnections(QList<KyConnectItem *> &connectItemList)
|
||||
{
|
||||
int index = 0;
|
||||
NetworkManager::Connection::List connectList;
|
||||
|
||||
qDebug()<<"[KyConnectResourse]"<<"get vpn && virtual connections";
|
||||
|
||||
connectList.clear();
|
||||
connectList = m_networkResourceInstance->getConnectList();
|
||||
|
||||
if (connectList.empty()) {
|
||||
qWarning()<<"[KyConnectResourse]"<<"get vpn connections failed, the connect list is empty";
|
||||
return;
|
||||
}
|
||||
|
||||
NetworkManager::Connection::Ptr connectPtr = nullptr;
|
||||
for (index = 0; index < connectList.size(); index++) {
|
||||
connectPtr = connectList.at(index);
|
||||
if (connectPtr.isNull()) {
|
||||
continue;
|
||||
}
|
||||
if (NetworkManager::ConnectionSettings::ConnectionType::Vpn != connectPtr->settings()->connectionType()
|
||||
&& NetworkManager::ConnectionSettings::ConnectionType::Bond != connectPtr->settings()->connectionType()
|
||||
&& NetworkManager::ConnectionSettings::ConnectionType::Bridge != connectPtr->settings()->connectionType()
|
||||
&& NetworkManager::ConnectionSettings::ConnectionType::Vlan != connectPtr->settings()->connectionType()
|
||||
&& NetworkManager::ConnectionSettings::ConnectionType::Team != connectPtr->settings()->connectionType()
|
||||
&& NetworkManager::ConnectionSettings::ConnectionType::IpTunnel != connectPtr->settings()->connectionType()
|
||||
&& NetworkManager::ConnectionSettings::ConnectionType::Wired != connectPtr->settings()->connectionType()) {
|
||||
continue;
|
||||
}
|
||||
NetworkManager::Device::Ptr devicePtr = nullptr;
|
||||
devicePtr = m_networkResourceInstance->findDeviceInterface(connectPtr->settings()->interfaceName());
|
||||
if (NetworkManager::ConnectionSettings::ConnectionType::Wired == connectPtr->settings()->connectionType()) {
|
||||
if (devicePtr == nullptr || !devicePtr->udi().startsWith("/sys/devices/virtual/net")) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
QString devName = "";
|
||||
if (!devicePtr.isNull()) {
|
||||
devName = devicePtr->interfaceName();
|
||||
}
|
||||
|
||||
KyConnectItem *connectItem = getConnectionItem(connectPtr, devName);
|
||||
if (nullptr != connectItem) {
|
||||
connectItemList << connectItem;
|
||||
}
|
||||
|
||||
connectPtr = nullptr;
|
||||
}
|
||||
|
||||
if (connectItemList.size() > 1) {
|
||||
vpnListSort(connectItemList);
|
||||
}
|
||||
}
|
||||
|
||||
void KyConnectResourse::getConnectionList(QString deviceName,
|
||||
NetworkManager::ConnectionSettings::ConnectionType connectionType,
|
||||
QList<KyConnectItem *> &connectItemList)
|
||||
|
@ -721,11 +641,13 @@ KyApConnectItem *KyConnectResourse::getApConnectItem(NetworkManager::Connection:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef CHECKDEVICE
|
||||
KyNetworkDeviceResourse deviceResource;
|
||||
if (!deviceResource.wirelessDeviceIsExist(settingPtr->interfaceName())) {
|
||||
qDebug() << "[KyConnectResourse]" <<"get ap item failed, the ap device is not exist yet";
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
QByteArray rawSsid = wirelessSetting->ssid();
|
||||
|
||||
|
@ -824,35 +746,6 @@ void KyConnectResourse::getApConnections(QList<KyApConnectItem *> &apConnectItem
|
|||
return;
|
||||
}
|
||||
|
||||
bool KyConnectResourse::isVirtualConncection(QString uuid)
|
||||
{
|
||||
NetworkManager::Connection::Ptr connectPtr = nullptr;
|
||||
|
||||
connectPtr = m_networkResourceInstance->getConnect(uuid);
|
||||
if (nullptr == connectPtr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (NetworkManager::ConnectionSettings::ConnectionType::Vpn == connectPtr->settings()->connectionType()
|
||||
||NetworkManager::ConnectionSettings::ConnectionType::Bond == connectPtr->settings()->connectionType()
|
||||
||NetworkManager::ConnectionSettings::ConnectionType::Bridge == connectPtr->settings()->connectionType()
|
||||
||NetworkManager::ConnectionSettings::ConnectionType::Vlan == connectPtr->settings()->connectionType()
|
||||
||NetworkManager::ConnectionSettings::ConnectionType::Team == connectPtr->settings()->connectionType()
|
||||
||NetworkManager::ConnectionSettings::ConnectionType::IpTunnel == connectPtr->settings()->connectionType()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
NetworkManager::Device::Ptr devicePtr = nullptr;
|
||||
devicePtr = m_networkResourceInstance->findDeviceInterface(connectPtr->settings()->interfaceName());
|
||||
if (devicePtr.isNull()) {
|
||||
return false;
|
||||
}
|
||||
if (devicePtr->udi().startsWith("/sys/devices/virtual/net")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool KyConnectResourse::isWiredConnection(QString uuid)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,6 @@ public:
|
|||
KyConnectItem *getConnectionItemByUuid(QString connectUuid);
|
||||
KyConnectItem *getConnectionItemByUuidWithoutActivateChecking(QString connectUuid);
|
||||
KyConnectItem *getConnectionItemByUuid(QString connectUuid, QString deviceName);
|
||||
void getVpnAndVirtualConnections(QList<KyConnectItem *> &connectItemList);
|
||||
void getConnectionList(QString deviceName,
|
||||
NetworkManager::ConnectionSettings::ConnectionType connectionType,
|
||||
QList<KyConnectItem *> &connectItemList);
|
||||
|
@ -56,7 +55,6 @@ public:
|
|||
bool getInterfaceByUuid(QString &deviceName, const QString connUuid);
|
||||
void getConnectivity(NetworkManager::Connectivity &connectivity);
|
||||
|
||||
bool isVirtualConncection(QString uuid);
|
||||
bool isWiredConnection(QString uuid);
|
||||
bool isWirelessConnection(QString uuid);
|
||||
bool isActivatedConnection(QString uuid);
|
||||
|
|
|
@ -36,14 +36,14 @@ KyNetworkDeviceResourse::KyNetworkDeviceResourse(QObject *parent) : QObject(pare
|
|||
initDeviceMap();
|
||||
|
||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceAdd,
|
||||
this, &KyNetworkDeviceResourse::onDeviceAdd, Qt::ConnectionType::DirectConnection);
|
||||
this, &KyNetworkDeviceResourse::onDeviceAdd/*, Qt::ConnectionType::DirectConnection*/);
|
||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceRemove,
|
||||
this, &KyNetworkDeviceResourse::onDeviceRemove, Qt::ConnectionType::DirectConnection);
|
||||
this, &KyNetworkDeviceResourse::onDeviceRemove/*, Qt::ConnectionType::DirectConnection*/);
|
||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceUpdate,
|
||||
this, &KyNetworkDeviceResourse::onDeviceUpdate, Qt::ConnectionType::DirectConnection);
|
||||
this, &KyNetworkDeviceResourse::onDeviceUpdate/*, Qt::ConnectionType::DirectConnection*/);
|
||||
|
||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::stateChanged,
|
||||
this, &KyNetworkDeviceResourse::stateChanged, Qt::ConnectionType::DirectConnection);
|
||||
this, &KyNetworkDeviceResourse::stateChanged/*, Qt::ConnectionType::DirectConnection*/);
|
||||
|
||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceCarrierChanage,
|
||||
this, &KyNetworkDeviceResourse::carrierChanage);
|
||||
|
@ -213,6 +213,42 @@ void KyNetworkDeviceResourse::setDeviceRefreshRate(QString deviceName, int ms)
|
|||
return;
|
||||
}
|
||||
|
||||
qulonglong KyNetworkDeviceResourse::getDeviceRxRefreshRate(QString deviceName)
|
||||
{
|
||||
NetworkManager::Device::Ptr connectDevice =
|
||||
m_networkResourceInstance->findDeviceInterface(deviceName);
|
||||
if (connectDevice->isValid()) {
|
||||
NetworkManager::DeviceStatistics::Ptr deviceStatistics = connectDevice->deviceStatistics();
|
||||
qulonglong rx = 0;
|
||||
rx = deviceStatistics->rxBytes();
|
||||
if (rx != 0) {
|
||||
return rx;
|
||||
} else {
|
||||
qDebug() << "connectDevice is invalid we do not get rxrate";
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
qulonglong KyNetworkDeviceResourse::getDeviceTxRefreshRate(QString deviceName)
|
||||
{
|
||||
NetworkManager::Device::Ptr connectDevice =
|
||||
m_networkResourceInstance->findDeviceInterface(deviceName);
|
||||
if (connectDevice->isValid()) {
|
||||
NetworkManager::DeviceStatistics::Ptr deviceStatistics = connectDevice->deviceStatistics();
|
||||
qulonglong tx = 0;
|
||||
tx = deviceStatistics->txBytes();
|
||||
if (tx != 0){
|
||||
return tx;
|
||||
} else {
|
||||
qDebug() << "connectDevice is invalid we do not get txrate";
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool KyNetworkDeviceResourse::getActiveConnectionInfo(const QString devName, int &signalStrength, QString &uni, QString &secuType)
|
||||
{
|
||||
signalStrength = 0;
|
||||
|
@ -385,7 +421,7 @@ bool KyNetworkDeviceResourse::getDeviceManaged(QString deviceName)
|
|||
{
|
||||
NetworkManager::Device::Ptr connectDevice =
|
||||
m_networkResourceInstance->findDeviceInterface(deviceName);
|
||||
if (connectDevice->isValid()) {
|
||||
if (connectDevice != nullptr && connectDevice->isValid()) {
|
||||
return connectDevice->managed();
|
||||
} else {
|
||||
qWarning()<<"[KyNetworkDeviceResourse] can not find device " << deviceName;
|
||||
|
|
|
@ -69,6 +69,9 @@ public:
|
|||
void setDeviceManaged(QString devName, bool managed);
|
||||
bool getDeviceManaged(QString devName);
|
||||
|
||||
qulonglong getDeviceRxRefreshRate(QString deviceName);
|
||||
qulonglong getDeviceTxRefreshRate(QString deviceName);
|
||||
|
||||
private:
|
||||
KyWiredConnectOperation wiredOperation;
|
||||
KyNetworkResourceManager *m_networkResourceInstance = nullptr;
|
||||
|
|
|
@ -26,6 +26,32 @@
|
|||
|
||||
#define LOG_FLAG "[KyNetworkResourceManager]"
|
||||
|
||||
|
||||
QString enumToQstring(NetworkManager::AccessPoint::Capabilities cap, NetworkManager::AccessPoint::WpaFlags wpa_flags,NetworkManager::AccessPoint::WpaFlags rsn_flags)
|
||||
{
|
||||
QString out;
|
||||
if ( (cap & NM_802_11_AP_FLAGS_PRIVACY)
|
||||
&& (wpa_flags == NM_802_11_AP_SEC_NONE)
|
||||
&& (rsn_flags == NM_802_11_AP_SEC_NONE)) {
|
||||
out += "WEP ";
|
||||
}
|
||||
if (wpa_flags != NM_802_11_AP_SEC_NONE) {
|
||||
out += "WPA1 ";
|
||||
}
|
||||
if ((rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_PSK)
|
||||
|| (rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)) {
|
||||
out += "WPA2 ";
|
||||
}
|
||||
if (rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_SAE) {
|
||||
out += "WPA3 ";
|
||||
}
|
||||
if ( (wpa_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)
|
||||
|| (rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)) {
|
||||
out += "802.1X ";
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
KyNetworkResourceManager* KyNetworkResourceManager::m_pInstance = nullptr;
|
||||
|
||||
KyNetworkResourceManager* KyNetworkResourceManager::getInstance()
|
||||
|
@ -52,8 +78,6 @@ KyNetworkResourceManager::KyNetworkResourceManager(QObject *parent) : QObject(pa
|
|||
qRegisterMetaType<NetworkManager::Device::Type>("NetworkManager::Device::Type");
|
||||
qRegisterMetaType<NetworkManager::Device::State>("NetworkManager::Device::State");
|
||||
qRegisterMetaType<NetworkManager::Device::StateChangeReason>("NetworkManager::Device::StateChangeReason");
|
||||
qRegisterMetaType<NetworkManager::VpnConnection::State>("NetworkManager::VpnConnection::State");
|
||||
qRegisterMetaType<NetworkManager::VpnConnection::StateChangeReason>("NetworkManager::VpnConnection::StateChangeReason");
|
||||
|
||||
QDBusConnection::systemBus().connect(QString("org.freedesktop.DBus"),
|
||||
QString("/org/freedesktop/DBus"),
|
||||
|
@ -780,10 +804,6 @@ void KyNetworkResourceManager::onWifiNetworkUpdate(NetworkManager::WirelessNetwo
|
|||
return;
|
||||
}
|
||||
|
||||
auto index = std::find(m_wifiNets.cbegin(), m_wifiNets.cend(), net);
|
||||
if (m_wifiNets.cend() != index) {
|
||||
if (net->accessPoints().isEmpty()) {
|
||||
//Q_EMIT
|
||||
bool bFlag = false;
|
||||
QString devIface;
|
||||
NetworkManager::Device::Ptr dev = findDeviceUni(net->device());
|
||||
|
@ -793,24 +813,37 @@ void KyNetworkResourceManager::onWifiNetworkUpdate(NetworkManager::WirelessNetwo
|
|||
} else {
|
||||
devIface = dev->interfaceName();
|
||||
}
|
||||
|
||||
//remove
|
||||
auto pos = index - m_wifiNets.cbegin();
|
||||
removeWifiNetwork(pos);
|
||||
if(bFlag) {
|
||||
//device invalid
|
||||
qDebug() << LOG_FLAG << "wifiNetworkDeviceDisappear";
|
||||
Q_EMIT wifiNetworkDeviceDisappear();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
auto index = std::find(m_wifiNets.cbegin(), m_wifiNets.cend(), net);
|
||||
if (m_wifiNets.cend() != index) {
|
||||
if (net->accessPoints().isEmpty()) {
|
||||
//remove
|
||||
auto pos = index - m_wifiNets.cbegin();
|
||||
removeWifiNetwork(pos);
|
||||
qDebug()<< LOG_FLAG << "wifiNetwork disappear" << net << net->ssid();
|
||||
NetworkManager::AccessPoint::Ptr accessPoitPtr = net->referenceAccessPoint();
|
||||
QByteArray rawSsid = accessPoitPtr->rawSsid();
|
||||
QString wifiSsid = getSsidFromByteArray(rawSsid);
|
||||
Q_EMIT wifiNetworkRemoved(devIface, wifiSsid);
|
||||
}
|
||||
} else {
|
||||
qDebug()<< LOG_FLAG << "wifiNetworkPropertyChange " << net << net->ssid();
|
||||
Q_EMIT wifiNetworkPropertyChange(net);
|
||||
NetworkManager::AccessPoint::Ptr accessPointPtr = net->referenceAccessPoint();
|
||||
if (accessPointPtr.isNull()) {
|
||||
return;
|
||||
}
|
||||
QByteArray rawSsid = accessPointPtr->rawSsid();
|
||||
QString wifiSsid = getSsidFromByteArray(rawSsid);
|
||||
QString bssid = accessPointPtr->hardwareAddress();
|
||||
QString secuType = enumToQstring(accessPointPtr->capabilities(),
|
||||
accessPointPtr->wpaFlags(),
|
||||
accessPointPtr->rsnFlags());
|
||||
Q_EMIT wifiNetworkPropertyChange(devIface, wifiSsid, net->signalStrength(), bssid, secuType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
#include <QInputDialog>
|
||||
#include <QMetaEnum>
|
||||
|
||||
QString enumToQstring(NetworkManager::AccessPoint::Capabilities cap, NetworkManager::AccessPoint::WpaFlags wpa_flags,NetworkManager::AccessPoint::WpaFlags rsn_flags);
|
||||
|
||||
class KyNetworkResourceManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -122,7 +124,7 @@ Q_SIGNALS:
|
|||
//to KyWirelessNetResource
|
||||
void wifiNetworkRemoved(QString, QString);
|
||||
void wifiNetworkAdded(QString, QString);
|
||||
void wifiNetworkPropertyChange(NetworkManager::WirelessNetwork * net);
|
||||
void wifiNetworkPropertyChange(QString, QString, int, QString, QString);
|
||||
void wifiNetworkSecuChange(NetworkManager::AccessPoint *);
|
||||
void wifiNetworkDeviceDisappear();
|
||||
void wifiEnabledChanged(bool);
|
||||
|
|
|
@ -826,6 +826,40 @@ NetworkManager::ConnectionSettings::Ptr
|
|||
return connectionSettings;
|
||||
}
|
||||
|
||||
QStringList KyWirelessConnectOperation::getBlackListHostName(QString apConnectPath)
|
||||
{
|
||||
QStringList blackList;
|
||||
blackList.clear();
|
||||
|
||||
QDBusInterface dbusInterface("org.freedesktop.NetworkManager",
|
||||
apConnectPath,
|
||||
"org.freedesktop.NetworkManager.Settings.Connection",
|
||||
QDBusConnection::systemBus());
|
||||
if (!dbusInterface.isValid()) {
|
||||
qWarning()<<Q_FUNC_INFO<<__LINE__<<"dbusInterface error! apConnectPath:"<<apConnectPath;
|
||||
return blackList;
|
||||
}
|
||||
|
||||
QDBusMessage result = dbusInterface.call("GetSettings");
|
||||
const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value<QDBusArgument>();
|
||||
QMap<QString, QMap<QString, QVariant>> map;
|
||||
dbusArg1st >> map;
|
||||
if (map.isEmpty()) {
|
||||
qWarning() << Q_FUNC_INFO << __LINE__ <<"map is empty!";
|
||||
return blackList;
|
||||
}
|
||||
|
||||
QMap<QString,QVariant> wirelessMap = map.value(KEY_802_11_WIRELESS);
|
||||
if (wirelessMap.isEmpty()) {
|
||||
qWarning() << Q_FUNC_INFO << __LINE__ <<"wirelessMap is empty!";
|
||||
return blackList;
|
||||
}
|
||||
if (wirelessMap.contains(KEY_BLACKLIST_HOSTNAME)) {
|
||||
blackList = wirelessMap.value(KEY_BLACKLIST_HOSTNAME).toStringList();
|
||||
}
|
||||
return blackList;
|
||||
}
|
||||
|
||||
void KyWirelessConnectOperation::updateWirelessApSetting(
|
||||
NetworkManager::Connection::Ptr apConnectPtr,
|
||||
const QString apName, const QString apPassword,
|
||||
|
@ -850,7 +884,6 @@ void KyWirelessConnectOperation::updateWirelessApSetting(
|
|||
wirelessSetting->setBand(NetworkManager::WirelessSetting::FrequencyBand::Automatic);
|
||||
}
|
||||
|
||||
|
||||
NetworkManager::WirelessSecuritySetting::Ptr wirelessSecuritySetting
|
||||
= apConnectSettingPtr->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast<NetworkManager::WirelessSecuritySetting>();
|
||||
if (apPassword.isEmpty()) {
|
||||
|
@ -861,7 +894,12 @@ void KyWirelessConnectOperation::updateWirelessApSetting(
|
|||
wirelessSecuritySetting->setPsk(apPassword);
|
||||
}
|
||||
|
||||
apConnectPtr->update(apConnectSettingPtr->toMap());
|
||||
QStringList blackList = getBlackListHostName(apConnectPtr->path());
|
||||
NMVariantMapMap newMap = apConnectSettingPtr->toMap();
|
||||
if (newMap.contains(KEY_802_11_WIRELESS)) {
|
||||
newMap[KEY_802_11_WIRELESS].insert(KEY_BLACKLIST_HOSTNAME, blackList);
|
||||
}
|
||||
apConnectPtr->update(newMap);
|
||||
}
|
||||
|
||||
void KyWirelessConnectOperation::activeWirelessAp(const QString apUuid, const QString apName,
|
||||
|
@ -999,7 +1037,7 @@ void KyWirelessConnectOperation::activateApConnectionByUuid(const QString apUuid
|
|||
QString connectPath = "";
|
||||
QString deviceIdentifier = "";
|
||||
QString connectName = "";
|
||||
QString specificObject = "";
|
||||
QString specificObject = "/";
|
||||
|
||||
qDebug()<<"it will activate hotspot connect"<<apUuid;
|
||||
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
#include "kylinconnectoperation.h"
|
||||
#include "kyenterpricesettinginfo.h"
|
||||
|
||||
#define KEY_802_11_WIRELESS "802-11-wireless"
|
||||
#define KEY_BLACKLIST_HOSTNAME "blacklist-hostname"
|
||||
|
||||
const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.switch";
|
||||
const QString WIRELESS_SWITCH = "wirelessswitch";
|
||||
|
||||
|
@ -142,6 +145,8 @@ private:
|
|||
const QString apPassword,
|
||||
const QString apDevice,
|
||||
const QString wirelessBand);
|
||||
QStringList getBlackListHostName(QString apConnectPath);
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void wifiEnabledChanged(bool);
|
||||
|
|
|
@ -25,30 +25,7 @@ const QString ENTERPRICE_TYPE = "802.1X";
|
|||
const QString WPA1_AND_WPA2 = "WPA";
|
||||
const QString WPA3 = "WPA3";
|
||||
|
||||
QString enumToQstring(NetworkManager::AccessPoint::Capabilities cap, NetworkManager::AccessPoint::WpaFlags wpa_flags,NetworkManager::AccessPoint::WpaFlags rsn_flags)
|
||||
{
|
||||
QString out;
|
||||
if ( (cap & NM_802_11_AP_FLAGS_PRIVACY)
|
||||
&& (wpa_flags == NM_802_11_AP_SEC_NONE)
|
||||
&& (rsn_flags == NM_802_11_AP_SEC_NONE)) {
|
||||
out += "WEP ";
|
||||
}
|
||||
if (wpa_flags != NM_802_11_AP_SEC_NONE) {
|
||||
out += "WPA1 ";
|
||||
}
|
||||
if ((rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_PSK)
|
||||
|| (rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)) {
|
||||
out += "WPA2 ";
|
||||
}
|
||||
if (rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_SAE) {
|
||||
out += "WPA3 ";
|
||||
}
|
||||
if ( (wpa_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)
|
||||
|| (rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)) {
|
||||
out += "802.1X ";
|
||||
}
|
||||
return out;
|
||||
}
|
||||
#define FREQ_5GHZ 5000
|
||||
|
||||
KyWirelessNetItem::KyWirelessNetItem(NetworkManager::WirelessNetwork::Ptr net)
|
||||
{
|
||||
|
@ -63,6 +40,7 @@ KyWirelessNetItem::KyWirelessNetItem(NetworkManager::WirelessNetwork::Ptr net)
|
|||
m_kySecuType = NONE;
|
||||
m_device = "";
|
||||
m_channel = 0;
|
||||
m_isMix = false;
|
||||
|
||||
init(net);
|
||||
}
|
||||
|
@ -100,6 +78,59 @@ void KyWirelessNetItem::init(NetworkManager::WirelessNetwork::Ptr net)
|
|||
m_bssid = net->referenceAccessPoint()->hardwareAddress();
|
||||
m_device = net->device();
|
||||
m_uni = net->referenceAccessPoint()->uni();
|
||||
|
||||
NetworkManager::Device::Ptr devicePtr = nullptr;
|
||||
devicePtr = m_networkResourceInstance->findDeviceInterface(m_device);
|
||||
if (!devicePtr.isNull()) {
|
||||
QString devUni = devicePtr->uni();
|
||||
NetworkManager::WirelessNetwork::Ptr wirelessPtr = nullptr;
|
||||
wirelessPtr = m_networkResourceInstance->findWifiNetwork(m_NetSsid, devUni);
|
||||
if (!wirelessPtr.isNull()) {
|
||||
NetworkManager::AccessPoint::List apList = wirelessPtr->accessPoints();
|
||||
bool b2G = false;
|
||||
bool b5G = false;
|
||||
if (!apList.empty()) {
|
||||
for (int i = 0; i < apList.count(); ++i) {
|
||||
if (apList.at(i)->frequency() < FREQ_5GHZ) {
|
||||
b2G = true;
|
||||
}
|
||||
if (apList.at(i)->frequency() >= FREQ_5GHZ) {
|
||||
b5G = true;
|
||||
}
|
||||
if (b2G && b5G) {
|
||||
m_isMix = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
devicePtr = m_networkResourceInstance->findDeviceInterface(m_device);
|
||||
if (!devicePtr.isNull()) {
|
||||
QString devUni = devicePtr->uni();
|
||||
NetworkManager::WirelessNetwork::Ptr wirelessPtr = nullptr;
|
||||
wirelessPtr = m_networkResourceInstance->findWifiNetwork(m_NetSsid, devUni);
|
||||
if (!wirelessPtr.isNull()) {
|
||||
NetworkManager::AccessPoint::List apList = wirelessPtr->accessPoints();
|
||||
bool b2G = false;
|
||||
bool b5G = false;
|
||||
if (!apList.empty()) {
|
||||
for (int i = 0; i < apList.count(); ++i) {
|
||||
if (apList.at(i)->frequency() < FREQ_5GHZ) {
|
||||
b2G = true;
|
||||
}
|
||||
if (apList.at(i)->frequency() >= FREQ_5GHZ) {
|
||||
b5G = true;
|
||||
}
|
||||
if (b2G && b5G) {
|
||||
m_isMix = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
initInfoBySsid();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
#include "kylinnetworkresourcemanager.h"
|
||||
#include "kywirelessconnectoperation.h"
|
||||
|
||||
QString enumToQstring(NetworkManager::AccessPoint::Capabilities, NetworkManager::AccessPoint::WpaFlags, NetworkManager::AccessPoint::WpaFlags);
|
||||
|
||||
class KyWirelessNetItem
|
||||
{
|
||||
public:
|
||||
|
@ -47,6 +45,7 @@ public:
|
|||
QString m_secuType;
|
||||
KySecuType m_kySecuType;
|
||||
QString m_uni;
|
||||
bool m_isMix;
|
||||
|
||||
//only for m_isConfiged = true
|
||||
bool m_isConfigured;
|
||||
|
|
|
@ -61,15 +61,15 @@ KyWirelessNetResource::KyWirelessNetResource(QObject *parent)
|
|||
|
||||
//TODO:connect device signal
|
||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkAdded,
|
||||
this, &KyWirelessNetResource::onWifiNetworkAdded, Qt::ConnectionType::DirectConnection);
|
||||
this, &KyWirelessNetResource::onWifiNetworkAdded/*, Qt::ConnectionType::DirectConnection*/);
|
||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkRemoved,
|
||||
this, &KyWirelessNetResource::onWifiNetworkRemoved, Qt::ConnectionType::DirectConnection);
|
||||
this, &KyWirelessNetResource::onWifiNetworkRemoved/*, Qt::ConnectionType::DirectConnection*/);
|
||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkPropertyChange,
|
||||
this, &KyWirelessNetResource::onWifiNetworkPropertyChange, Qt::ConnectionType::DirectConnection);
|
||||
this, &KyWirelessNetResource::onWifiNetworkPropertyChange/*, Qt::ConnectionType::DirectConnection*/);
|
||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkSecuChange,
|
||||
this, &KyWirelessNetResource::onWifiNetworkSecuChange, Qt::ConnectionType::DirectConnection);
|
||||
this, &KyWirelessNetResource::onWifiNetworkSecuChange/*, Qt::ConnectionType::DirectConnection*/);
|
||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkDeviceDisappear,
|
||||
this, &KyWirelessNetResource::onWifiNetworkDeviceDisappear, Qt::ConnectionType::DirectConnection);
|
||||
this, &KyWirelessNetResource::onWifiNetworkDeviceDisappear/*, Qt::ConnectionType::DirectConnection*/);
|
||||
|
||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionAdd,
|
||||
this, &KyWirelessNetResource::onConnectionAdd);
|
||||
|
@ -457,48 +457,34 @@ void KyWirelessNetResource::onWifiNetworkSecuChange(NetworkManager::AccessPoint
|
|||
|
||||
}
|
||||
|
||||
void KyWirelessNetResource::onWifiNetworkPropertyChange(NetworkManager::WirelessNetwork * net)
|
||||
void KyWirelessNetResource::onWifiNetworkPropertyChange(QString interface, QString ssid, int signal, QString bssid, QString sec)
|
||||
{
|
||||
if (nullptr == net) {
|
||||
return;
|
||||
|
||||
if (m_WifiNetworkList.contains(interface)) {
|
||||
QList<KyWirelessNetItem>::iterator iter = m_WifiNetworkList[interface].begin();
|
||||
while (iter != m_WifiNetworkList[interface].end()) {
|
||||
qDebug() << iter->m_NetSsid;
|
||||
if (iter->m_NetSsid == ssid) {
|
||||
// qDebug()<< LOG_FLAG <<"recive properity changed signal, sender is" << iter->m_NetSsid;
|
||||
if (iter->m_signalStrength != signal) {
|
||||
iter->m_signalStrength = signal;
|
||||
Q_EMIT signalStrengthChange(interface, ssid, iter->m_signalStrength);
|
||||
}
|
||||
|
||||
qDebug() << "onWifiNetworkPropertyChange" << net->ssid();
|
||||
NetworkManager::AccessPoint::Ptr accessPointPtr = net->referenceAccessPoint();
|
||||
QByteArray rawSsid = accessPointPtr->rawSsid();
|
||||
QString wifiSsid = getSsidFromByteArray(rawSsid);
|
||||
|
||||
if (net->device().isEmpty()) {
|
||||
return;
|
||||
if (iter->m_bssid != bssid) {
|
||||
qDebug() << "bssid";
|
||||
iter->m_bssid = bssid;
|
||||
Q_EMIT bssidChange(interface, ssid, iter->m_bssid);
|
||||
}
|
||||
|
||||
QString devIface = m_networkResourceInstance->findDeviceUni(net->device())->interfaceName();
|
||||
if (m_WifiNetworkList.contains(devIface)) {
|
||||
QList<KyWirelessNetItem>::iterator iter = m_WifiNetworkList[devIface].begin();
|
||||
while (iter != m_WifiNetworkList[devIface].end()) {
|
||||
if (iter->m_NetSsid == wifiSsid) {
|
||||
// qDebug()<< LOG_FLAG <<"recive properity changed signal, sender is" << iter->m_NetSsid;
|
||||
if (iter->m_signalStrength != net->signalStrength()) {
|
||||
iter->m_signalStrength = net->signalStrength();
|
||||
Q_EMIT signalStrengthChange(devIface, wifiSsid, iter->m_signalStrength);
|
||||
}
|
||||
|
||||
if (iter->m_bssid != accessPointPtr->hardwareAddress()) {
|
||||
iter->m_bssid = accessPointPtr->hardwareAddress();
|
||||
Q_EMIT bssidChange(devIface, wifiSsid, iter->m_bssid);
|
||||
}
|
||||
|
||||
QString secuType = enumToQstring(accessPointPtr->capabilities(),
|
||||
accessPointPtr->wpaFlags(),
|
||||
accessPointPtr->rsnFlags());
|
||||
if (iter->m_secuType != secuType) {
|
||||
//qDebug() << "!!!!secuTypeChange" << wifiSsid << iter->m_secuType << "change to " << secuType;
|
||||
iter->setKySecuType(secuType);
|
||||
Q_EMIT secuTypeChange(devIface, wifiSsid, secuType);
|
||||
if (iter->m_secuType != sec) {
|
||||
iter->setKySecuType(sec);
|
||||
Q_EMIT secuTypeChange(interface, ssid, sec);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ private:
|
|||
public Q_SLOTS:
|
||||
void onWifiNetworkAdded(QString, QString);
|
||||
void onWifiNetworkRemoved(QString, QString);
|
||||
void onWifiNetworkPropertyChange(NetworkManager::WirelessNetwork * net);
|
||||
void onWifiNetworkPropertyChange(QString interface, QString ssid, int signal, QString bssid, QString sec);
|
||||
void onWifiNetworkSecuChange(NetworkManager::AccessPoint *accessPointPtr);
|
||||
void onWifiNetworkDeviceDisappear();
|
||||
|
||||
|
|
|
@ -147,18 +147,6 @@ void DbusAdaptor::setDeviceEnable(QString devName, bool enable)
|
|||
// return deviceName;
|
||||
//}
|
||||
|
||||
//删除
|
||||
void DbusAdaptor::deleteConnect(int type, QString ssid)
|
||||
{
|
||||
if (type == WIRED) {
|
||||
parent()->deleteWired(ssid);
|
||||
} else if (type == WIRELESS) {
|
||||
//待实现
|
||||
} else {
|
||||
qDebug() << "[DbusAdaptor] deleteConnect type is invalid";
|
||||
}
|
||||
}
|
||||
|
||||
//连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
|
||||
void DbusAdaptor::activateConnect(int type, QString devName, QString ssid)
|
||||
{
|
||||
|
|
|
@ -62,8 +62,6 @@ public Q_SLOTS: // METHODS
|
|||
// QString getDefaultWiredDevice();
|
||||
// Q_NOREPLY void setDefaultWirelessDevice(QString deviceName);
|
||||
// QString getDefaultWirelessDevice();
|
||||
//刪除 根据网络名称 参数1 0:lan 1:wlan 参数2 为ssid/uuid
|
||||
Q_NOREPLY void deleteConnect(int type, QString ssid);
|
||||
//连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
|
||||
Q_NOREPLY void activateConnect(int type, QString devName, QString ssid);
|
||||
//断开连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
|
||||
|
|
|
@ -187,6 +187,18 @@ int KyIpv6Arping::parseIpv6Packet(const uint8_t *buf, size_t len, const struct s
|
|||
/* looks for Target Link-layer address option */
|
||||
ptr = buf + sizeof (struct nd_neighbor_advert);
|
||||
|
||||
int index;
|
||||
char macAddress[64] = {0};
|
||||
uint8_t hw_addr[6] = {0};
|
||||
getLocalMacAddress(m_ifaceName.toUtf8().constData(), hw_addr);
|
||||
for (index = 0; index < 6; index++) {
|
||||
snprintf(&macAddress[strlen(macAddress)], sizeof(macAddress) - strlen(macAddress), "%02X", hw_addr[index]);
|
||||
if (index != 5) {
|
||||
snprintf(&macAddress[strlen(macAddress)], sizeof(macAddress) - strlen(macAddress), "%s", ":");
|
||||
}
|
||||
}
|
||||
QString localAddr(macAddress);
|
||||
|
||||
while (len >= 8)
|
||||
{
|
||||
uint16_t optlen;
|
||||
|
@ -212,6 +224,9 @@ int KyIpv6Arping::parseIpv6Packet(const uint8_t *buf, size_t len, const struct s
|
|||
optlen -= 2;
|
||||
|
||||
saveMacAddress (ptr, optlen);
|
||||
if (!localAddr.isEmpty() && getConflictMacAddress() == localAddr) {
|
||||
break;
|
||||
}
|
||||
setIpv6ConflictFlag(true);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
#include "xatom-helper.h"
|
||||
#define MAIN_SIZE_EXPAND 480,580
|
||||
#define MAIN_SIZE_NARROW 480,484
|
||||
#define SCROAREA_WIDTH 480
|
||||
#define PEAP_SCRO_HEIGHT 390
|
||||
#define TLS_SCRO_HEIGHT 590
|
||||
#define MAIN_LAYOUT_MARGINS 0,0,0,0
|
||||
#define CENTER_LAYOUT_MARGINS 24, 16, 24, 8
|
||||
#define BUTTON_LAYOUT_MARGINS 24, 24, 24, 24
|
||||
|
@ -81,11 +82,11 @@ void EnterpriseWlanDialog::closeEvent(QCloseEvent *event)
|
|||
|
||||
void EnterpriseWlanDialog::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPalette pal = qApp->palette();
|
||||
QPainter painter(this);
|
||||
painter.setBrush(pal.color(QPalette::Base));
|
||||
painter.drawRect(this->rect());
|
||||
painter.fillRect(rect(), QBrush(pal.color(QPalette::Base)));
|
||||
// QPalette pal = qApp->palette();
|
||||
// QPainter painter(this);
|
||||
// painter.setBrush(pal.color(QPalette::Base));
|
||||
// painter.drawRect(this->rect());
|
||||
// painter.fillRect(rect(), QBrush(pal.color(QPalette::Base)));
|
||||
|
||||
return QWidget::paintEvent(event);
|
||||
}
|
||||
|
@ -126,15 +127,11 @@ void EnterpriseWlanDialog::initUI()
|
|||
m_enterWlanScrollArea = new QScrollArea(this);
|
||||
m_enterWlanScrollArea->setFrameShape(QFrame::NoFrame);
|
||||
m_enterWlanScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
m_centerWidget->setFixedWidth(SCROAREA_WIDTH);
|
||||
m_enterWlanScrollArea->setFixedWidth(SCROAREA_WIDTH);
|
||||
m_enterWlanScrollArea->setWidget(m_centerWidget);
|
||||
m_enterWlanScrollArea->setWidgetResizable(true);
|
||||
|
||||
QPalette pal = m_enterWlanScrollArea->palette();
|
||||
pal.setBrush(QPalette::Window, Qt::transparent);
|
||||
pal.setBrush(QPalette::Base, QColor(0,0,0,0));
|
||||
m_enterWlanScrollArea->setPalette(pal);
|
||||
m_enterWlanScrollArea->setWidgetResizable(true);
|
||||
|
||||
m_bottomDivider = new Divider(this);
|
||||
|
||||
|
@ -199,19 +196,24 @@ void EnterpriseWlanDialog::onPaletteChanged()
|
|||
{
|
||||
QPalette pal = qApp->palette();
|
||||
|
||||
// QGSettings * styleGsettings = nullptr;
|
||||
// const QByteArray style_id(THEME_SCHAME);
|
||||
// if (QGSettings::isSchemaInstalled(style_id)) {
|
||||
// styleGsettings = new QGSettings(style_id);
|
||||
// QString currentTheme = styleGsettings->get(COLOR_THEME).toString();
|
||||
// if(currentTheme == "ukui-default"){
|
||||
// pal = lightPalette(this);
|
||||
// }
|
||||
// }
|
||||
|
||||
QGSettings * styleGsettings = nullptr;
|
||||
const QByteArray style_id(THEME_SCHAME);
|
||||
if (QGSettings::isSchemaInstalled(style_id)) {
|
||||
styleGsettings = new QGSettings(style_id);
|
||||
QString currentTheme = styleGsettings->get(COLOR_THEME).toString();
|
||||
if(currentTheme == "ukui-default"){
|
||||
pal = lightPalette(this);
|
||||
}
|
||||
}
|
||||
pal.setColor(QPalette::Background, pal.base().color());
|
||||
this->setPalette(pal);
|
||||
|
||||
setFramePalette(m_securityPage, pal);
|
||||
|
||||
if (styleGsettings != nullptr) {
|
||||
delete styleGsettings;
|
||||
styleGsettings = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void EnterpriseWlanDialog::initData()
|
||||
|
@ -238,7 +240,7 @@ void EnterpriseWlanDialog::onBtnConnectClicked()
|
|||
KyWirelessConnectSetting connetSetting;
|
||||
connetSetting.setConnectName(m_wirelessNetItem.m_NetSsid);
|
||||
connetSetting.setIfaceName(m_deviceName);
|
||||
// connetSetting.isAutoConnect = true; //ZJP_TODO 自动连接选项
|
||||
connetSetting.isAutoConnect = m_securityPage->getAutoConnectState(); //ZJP_TODO 自动连接选项
|
||||
connetSetting.m_type = KyKeyMgmt::WpaEap;
|
||||
connetSetting.m_ssid = m_wirelessNetItem.m_NetSsid;
|
||||
connetSetting.m_secretFlag = 0;
|
||||
|
@ -268,18 +270,21 @@ void EnterpriseWlanDialog::onEapTypeChanged(const KyEapMethodType &type)
|
|||
m_resource->getEnterPriseInfoTls(m_wirelessNetItem.m_connectUuid, m_info.tlsInfo);
|
||||
}
|
||||
this->setFixedSize(MAIN_SIZE_EXPAND);
|
||||
// m_centerWidget->setFixedHeight(TLS_SCRO_HEIGHT);
|
||||
break;
|
||||
case KyEapMethodType::PEAP:
|
||||
if (m_wirelessNetItem.m_connectUuid.isEmpty()) {
|
||||
m_resource->getEnterPriseInfoPeap(m_wirelessNetItem.m_connectUuid, m_info.peapInfo);
|
||||
}
|
||||
this->setFixedSize(MAIN_SIZE_NARROW);
|
||||
// m_centerWidget->setFixedHeight(PEAP_SCRO_HEIGHT);
|
||||
break;
|
||||
case KyEapMethodType::TTLS:
|
||||
if (!m_wirelessNetItem.m_connectUuid.isEmpty()) {
|
||||
m_resource->getEnterPriseInfoTtls(m_wirelessNetItem.m_connectUuid, m_info.ttlsInfo);
|
||||
}
|
||||
this->setFixedSize(MAIN_SIZE_NARROW);
|
||||
// m_centerWidget->setFixedHeight(PEAP_SCRO_HEIGHT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -6,7 +6,6 @@ include(list-items/list-items.pri)
|
|||
include(netdetails/netdetails.pri)
|
||||
include(enterprise-wlan/enterprise-wlan.pri)
|
||||
include(networkmode/networkmode.pri)
|
||||
include(single-pages/single-pages.pri)
|
||||
|
||||
FORMS += \
|
||||
$$PWD/wificonfigdialog.ui
|
||||
|
@ -14,13 +13,11 @@ FORMS += \
|
|||
HEADERS += \
|
||||
$$PWD/customstyle.h \
|
||||
$$PWD/mainwindow.h \
|
||||
$$PWD/vpnmainwindow.h \
|
||||
$$PWD/wificonfigdialog.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/customstyle.cpp \
|
||||
$$PWD/mainwindow.cpp \
|
||||
$$PWD/vpnmainwindow.cpp \
|
||||
$$PWD/wificonfigdialog.cpp
|
||||
|
||||
DISTFILES += \
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
#include <QDebug>
|
||||
|
||||
#define LOG_FLAG "[LanListItem]"
|
||||
#define NAMELABLE_MAX_WIDTH_HOVER 220
|
||||
#define NAMELABLE_MAX_WIDTH_ACTIVATED 190
|
||||
#define NAMELABLE_MAX_WIDTH_DEACTIVATED 326
|
||||
|
||||
LanListItem::LanListItem(const KyConnectItem *lanConnectItem,
|
||||
const QString &deviceName, QWidget *parent):ListItem(parent)
|
||||
|
@ -42,16 +45,19 @@ LanListItem::LanListItem(const KyConnectItem *lanConnectItem,
|
|||
m_netButton->stopLoading();
|
||||
if (m_lanConnectItem.m_connectState == Activated) {
|
||||
setIcon(true);
|
||||
m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_ACTIVATED);
|
||||
} else {
|
||||
setIcon(false);
|
||||
m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_DEACTIVATED);
|
||||
}
|
||||
} else {
|
||||
m_netButton->startLoading();
|
||||
}
|
||||
|
||||
m_itemFrame->installEventFilter(this);
|
||||
connect(this->m_infoButton, &InfoButton::clicked, this, &LanListItem::onInfoButtonClicked);
|
||||
// connect(this->m_infoButton, &InfoButton::clicked, this, &LanListItem::onInfoButtonClicked);
|
||||
connect(m_menu, &QMenu::triggered, this, &LanListItem::onMenuTriggered);
|
||||
connect(m_hoverButton, &FixPushButton::clicked, this, &LanListItem::onNetButtonClicked);
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,7 +68,7 @@ LanListItem::LanListItem(QWidget *parent) : ListItem(parent)
|
|||
setIcon(false);
|
||||
const QString str=tr("Not connected");
|
||||
m_nameLabel->setLabelText(str);
|
||||
this->m_infoButton->hide();
|
||||
// this->m_infoButton->hide();
|
||||
}
|
||||
|
||||
LanListItem::~LanListItem()
|
||||
|
@ -120,8 +126,7 @@ void LanListItem::onNetButtonClicked()
|
|||
this->showDesktopNotify(tr("Wired Device not carried"), "networkwrong");
|
||||
}
|
||||
} else {
|
||||
qDebug() << LOG_FLAG <<"the connection" << m_lanConnectItem.m_connectName
|
||||
<< "is not deactived, so it can not be operation.";
|
||||
m_connectOperation->deactivateWiredConnection(m_lanConnectItem.m_connectName, m_lanConnectItem.m_connectUuid);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -144,9 +149,10 @@ void LanListItem::onRightButtonClicked()
|
|||
} else {
|
||||
return;
|
||||
}
|
||||
m_menu->addAction(new QAction(tr("Property"), this));
|
||||
m_menu->addAction(new QAction(tr("Delete"), this));
|
||||
|
||||
m_menu->move(cursor().pos());
|
||||
m_menu->show();
|
||||
m_menu->popup(cursor().pos());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -159,6 +165,10 @@ void LanListItem::onMenuTriggered(QAction *action)
|
|||
qDebug() << LOG_FLAG << "it will disconnect connection" << m_lanConnectItem.m_connectName
|
||||
<< ". it's device is" << m_deviceName;
|
||||
m_netButton->startLoading();
|
||||
} else if (action->text() == tr("Property")) {
|
||||
onInfoButtonClicked();
|
||||
} else if (action->text() == tr("Delete")) {
|
||||
m_connectOperation->deleteConnect(m_lanConnectItem.m_connectUuid);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -171,15 +181,15 @@ void LanListItem::onInfoButtonClicked()
|
|||
return;
|
||||
}
|
||||
|
||||
if(netDetail != nullptr){
|
||||
netDetail->activateWindow();
|
||||
return;
|
||||
}
|
||||
// if(netDetail != nullptr){
|
||||
// netDetail->activateWindow();
|
||||
// return;
|
||||
// }
|
||||
|
||||
qDebug()<< LOG_FLAG << "the info button of lan is clicked! uuid = "
|
||||
<< m_lanConnectItem.m_connectUuid << "; name = " << m_lanConnectItem.m_connectName
|
||||
<< "." <<Q_FUNC_INFO << __LINE__;
|
||||
|
||||
#if 0
|
||||
bool isActivated = false;
|
||||
if (Activated == m_lanConnectItem.m_connectState) {
|
||||
isActivated = true;
|
||||
|
@ -195,7 +205,8 @@ void LanListItem::onInfoButtonClicked()
|
|||
});
|
||||
|
||||
netDetail->show();
|
||||
Q_EMIT this->detailShow(true);
|
||||
#endif
|
||||
Q_EMIT this->detailShow(m_deviceName, m_lanConnectItem.m_connectUuid);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -239,3 +250,40 @@ void LanListItem::updateConnectionPath(QString connectionPath)
|
|||
{
|
||||
m_lanConnectItem.m_connectPath = connectionPath;
|
||||
}
|
||||
|
||||
void LanListItem::enterEvent(QEvent *event)
|
||||
{
|
||||
m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_HOVER);
|
||||
if (m_lanConnectItem.m_connectState != UnknownState) {
|
||||
if (Deactivated != m_lanConnectItem.m_connectState) {
|
||||
m_hoverButton->setProperty("useButtonPalette", true);
|
||||
m_hoverButton->setProperty("isImportant", false);
|
||||
m_hoverButton->setButtonText(tr("Disconnect"));
|
||||
} else {
|
||||
m_hoverButton->setProperty("isImportant", true);
|
||||
m_hoverButton->setProperty("useButtonPalette", false);
|
||||
m_hoverButton->setButtonText(tr("Connect"));
|
||||
}
|
||||
m_hoverButton->show();
|
||||
m_lbLoadUp->hide();
|
||||
m_lbLoadDown->hide();
|
||||
m_lbLoadDownImg->hide();
|
||||
m_lbLoadUpImg->hide();
|
||||
}
|
||||
return ListItem::enterEvent(event);
|
||||
}
|
||||
|
||||
void LanListItem::leaveEvent(QEvent *event)
|
||||
{
|
||||
m_hoverButton->hide();
|
||||
if (m_lanConnectItem.m_connectState == Activated) {
|
||||
m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_ACTIVATED);
|
||||
m_lbLoadUp->show();
|
||||
m_lbLoadDown->show();
|
||||
m_lbLoadDownImg->show();
|
||||
m_lbLoadUpImg->show();
|
||||
} else {
|
||||
m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_DEACTIVATED);
|
||||
}
|
||||
return ListItem::leaveEvent(event);
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ public:
|
|||
protected:
|
||||
void setIcon(bool isOn);
|
||||
void onRightButtonClicked();
|
||||
void enterEvent(QEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
|
||||
private:
|
||||
void connectItemCopy(const KyConnectItem *lanConnectItem);
|
||||
|
|
|
@ -8,13 +8,11 @@ HEADERS += \
|
|||
$$PWD/lanlistitem.h \
|
||||
$$PWD/listitem.h \
|
||||
$$PWD/wlanlistitem.h \
|
||||
$$PWD/wlanmoreitem.h \
|
||||
$$PWD/vpnlistitem.h
|
||||
$$PWD/wlanmoreitem.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/lanlistitem.cpp \
|
||||
$$PWD/listitem.cpp \
|
||||
$$PWD/wlanlistitem.cpp \
|
||||
$$PWD/wlanmoreitem.cpp \
|
||||
$$PWD/vpnlistitem.cpp
|
||||
$$PWD/wlanmoreitem.cpp
|
||||
|
||||
|
|
|
@ -31,6 +31,85 @@
|
|||
#define LIGHT_HOVER_COLOR QColor(240,240,240,255)
|
||||
#define DARK_HOVER_COLOR QColor(15,15,15,255)
|
||||
|
||||
#define CONNECT_BUTTON_WIDTH 96
|
||||
#define PWD_AREA_HEIGHT 36
|
||||
|
||||
#define FREQLABLE_HIGHT 18
|
||||
#define FREQLABLE_MARGINS 4,0,4,0
|
||||
#define LOADIMG_SIZE 16,16
|
||||
|
||||
FreqLabel::FreqLabel(QWidget *parent) : QLabel(parent)
|
||||
{
|
||||
const QByteArray id("org.ukui.style");
|
||||
QGSettings * fontSetting = new QGSettings(id, QByteArray(), this);
|
||||
if(QGSettings::isSchemaInstalled(id)){
|
||||
connect(fontSetting, &QGSettings::changed,[=](QString key) {
|
||||
if ("systemFontSize" ==key) {
|
||||
changedFontSlot();
|
||||
}
|
||||
});
|
||||
}
|
||||
changedFontSlot();
|
||||
}
|
||||
|
||||
void FreqLabel::changedFontSlot()
|
||||
{
|
||||
const QByteArray id("org.ukui.style");
|
||||
if(QGSettings::isSchemaInstalled(id)){
|
||||
QGSettings * fontSetting = new QGSettings(id, QByteArray(), this);
|
||||
QVariant fontVariant = fontSetting->get("systemFontSize");
|
||||
QFont font;
|
||||
font.setPointSize(fontVariant.toInt()*0.85);
|
||||
this->setFont(font);
|
||||
}
|
||||
}
|
||||
|
||||
void FreqLabel::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing); //抗锯齿效果
|
||||
auto rect = this->rect();
|
||||
painter.drawRoundedRect(rect, 6, 6);
|
||||
QLabel::paintEvent(event);
|
||||
}
|
||||
|
||||
FixPushButton::FixPushButton(QWidget *parent) :
|
||||
QPushButton(parent)
|
||||
{
|
||||
const QByteArray id("org.ukui.style");
|
||||
QGSettings * fontSetting = new QGSettings(id, QByteArray(), this);
|
||||
if(QGSettings::isSchemaInstalled(id)){
|
||||
connect(fontSetting, &QGSettings::changed,[=](QString key) {
|
||||
if ("systemFont" == key || "systemFontSize" ==key) {
|
||||
changedLabelSlot();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FixPushButton::setButtonText(QString text) {
|
||||
|
||||
mStr = text;
|
||||
changedLabelSlot();
|
||||
}
|
||||
|
||||
QString FixPushButton::getText(){
|
||||
return mStr;
|
||||
}
|
||||
|
||||
void FixPushButton::changedLabelSlot() {
|
||||
QFontMetrics fontMetrics(this->font());
|
||||
int fontSize = fontMetrics.width(mStr);
|
||||
if (fontSize > 65) {
|
||||
setText(fontMetrics.elidedText(mStr, Qt::ElideRight, 65));
|
||||
setToolTip(mStr);
|
||||
} else {
|
||||
setText(mStr);
|
||||
setToolTip("");
|
||||
}
|
||||
}
|
||||
|
||||
ListItem::ListItem(QWidget *parent) : QFrame(parent)
|
||||
{
|
||||
m_connectState = UnknownState;
|
||||
|
@ -48,10 +127,10 @@ ListItem::~ListItem()
|
|||
m_netButton = nullptr;
|
||||
}
|
||||
|
||||
if (nullptr != m_infoButton) {
|
||||
delete m_infoButton;
|
||||
m_infoButton = nullptr;
|
||||
}
|
||||
// if (nullptr != m_infoButton) {
|
||||
// delete m_infoButton;
|
||||
// m_infoButton = nullptr;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
@ -156,22 +235,66 @@ void ListItem::initUI()
|
|||
|
||||
m_hItemLayout = new QHBoxLayout(m_itemFrame);
|
||||
m_hItemLayout->setContentsMargins(ITEM_FRAME_MARGINS);
|
||||
m_hItemLayout->setSpacing(ITEM_FRAME_SPACING);
|
||||
m_hItemLayout->setSpacing(0);
|
||||
m_hItemLayout->setAlignment(Qt::AlignHCenter);
|
||||
|
||||
m_netButton = new RadioItemButton(m_itemFrame);
|
||||
m_nameLabel = new FixLabel(m_itemFrame);
|
||||
m_nameLabel->setMinimumWidth(262);
|
||||
m_infoButton = new InfoButton(m_itemFrame);
|
||||
m_infoButton->setIconSize(QSize(INFO_ICON_WIDTH,INFO_ICON_HEIGHT));
|
||||
m_freq = new FreqLabel(m_itemFrame);
|
||||
m_freq->setEnabled(false);
|
||||
m_freq->setText("...");
|
||||
m_freq->setAlignment(Qt::AlignCenter);
|
||||
m_freq->hide();
|
||||
m_freq->setFixedHeight(FREQLABLE_HIGHT);
|
||||
m_freq->setContentsMargins(FREQLABLE_MARGINS);
|
||||
m_nameLabel = new NameLabel(m_itemFrame);
|
||||
m_hoverButton = new FixPushButton(m_itemFrame);
|
||||
m_hoverButton->setProperty("needTranslucent", true);
|
||||
m_hoverButton->setFixedSize(CONNECT_BUTTON_WIDTH, PWD_AREA_HEIGHT);
|
||||
// m_infoButton = new InfoButton(m_itemFrame);
|
||||
// m_infoButton->setIconSize(QSize(INFO_ICON_WIDTH,INFO_ICON_HEIGHT));
|
||||
|
||||
m_lbLoadUp = new QLabel(m_itemFrame);
|
||||
m_lbLoadUp->setAlignment(Qt::AlignCenter);
|
||||
m_lbLoadDown = new QLabel(m_itemFrame);
|
||||
m_lbLoadDown->setAlignment(Qt::AlignCenter);
|
||||
m_lbLoadDownImg = new QLabel(m_itemFrame);
|
||||
m_lbLoadUpImg = new QLabel(m_itemFrame);
|
||||
m_lbLoadUp->hide();
|
||||
m_lbLoadDown->hide();
|
||||
m_lbLoadDownImg->hide();
|
||||
m_lbLoadUpImg->hide();
|
||||
m_lbLoadDownImg->setFixedSize(LOADIMG_SIZE);
|
||||
m_lbLoadDownImg->setAlignment(Qt::AlignCenter);
|
||||
m_lbLoadUpImg->setFixedSize(LOADIMG_SIZE);
|
||||
m_lbLoadUpImg->setAlignment(Qt::AlignCenter);
|
||||
QFont font;
|
||||
font.setPointSize(10);
|
||||
m_lbLoadUp->setFont(font);
|
||||
m_lbLoadDown->setFont(font);
|
||||
m_lbLoadUp->setText("0KB/s");
|
||||
m_lbLoadDown->setText("0KB/s");
|
||||
m_lbLoadDownImg->setPixmap(QPixmap(QLatin1String(":/res/x/load-down.png")));
|
||||
m_lbLoadUpImg->setPixmap(QPixmap(QLatin1String(":/res/x/load-up.png")));
|
||||
|
||||
m_hItemLayout->addWidget(m_netButton);
|
||||
m_hItemLayout->addSpacing(10);
|
||||
m_hItemLayout->addWidget(m_nameLabel);
|
||||
m_hItemLayout->addSpacing(8);
|
||||
m_hItemLayout->addWidget(m_freq);
|
||||
m_hItemLayout->addStretch();
|
||||
m_hItemLayout->addWidget(m_infoButton);
|
||||
m_hItemLayout->addWidget(m_lbLoadUpImg);
|
||||
m_hItemLayout->addWidget(m_lbLoadUp);
|
||||
m_hItemLayout->addSpacing(2);
|
||||
m_hItemLayout->addWidget(m_lbLoadDownImg);
|
||||
m_hItemLayout->addWidget(m_lbLoadDown);
|
||||
m_hItemLayout->addSpacing(2);
|
||||
m_hItemLayout->addWidget(m_hoverButton);
|
||||
// m_hItemLayout->addWidget(m_infoButton);
|
||||
|
||||
m_mainLayout->addWidget(m_itemFrame);
|
||||
|
||||
m_hoverButton->hide();
|
||||
|
||||
// this->setAutoFillBackground(true);
|
||||
// this->setBackgroundRole(QPalette::Base);
|
||||
// QPalette pal = qApp->palette();
|
||||
|
@ -193,3 +316,46 @@ void ListItem::onPaletteChanged()
|
|||
// this->setPalette(pal);
|
||||
}
|
||||
|
||||
|
||||
NameLabel::NameLabel(QWidget *parent)
|
||||
:QLabel(parent)
|
||||
{
|
||||
const QByteArray id("org.ukui.style");
|
||||
QGSettings * fontSetting = new QGSettings(id, QByteArray(), this);
|
||||
if(QGSettings::isSchemaInstalled(id)){
|
||||
connect(fontSetting, &QGSettings::changed,[=](QString key) {
|
||||
if ("systemFont" == key || "systemFontSize" ==key) {
|
||||
changedLabelSlot();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void NameLabel::setLabelText(QString text)
|
||||
{
|
||||
m_name = text;
|
||||
changedLabelSlot();
|
||||
}
|
||||
|
||||
void NameLabel::setLabelMaximumWidth(int width)
|
||||
{
|
||||
m_maximumWidth = width;
|
||||
this->setMaximumWidth(m_maximumWidth);
|
||||
if (m_name != nullptr) {
|
||||
changedLabelSlot();
|
||||
}
|
||||
}
|
||||
|
||||
void NameLabel::changedLabelSlot()
|
||||
{
|
||||
QFontMetrics fontMetrics(this->font());
|
||||
int fontSize = fontMetrics.width(m_name);
|
||||
if (fontSize > m_maximumWidth) {
|
||||
setText(fontMetrics.elidedText(m_name, Qt::ElideRight, m_maximumWidth));
|
||||
setToolTip(m_name);
|
||||
} else {
|
||||
this->setFixedWidth(fontMetrics.width(m_name));
|
||||
setText(m_name);
|
||||
setToolTip("");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,54 @@ typedef enum{
|
|||
Deactivated /**< The connection is no longer active */
|
||||
}ConnectState;
|
||||
|
||||
class FreqLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FreqLabel(QWidget *parent = nullptr);
|
||||
~FreqLabel() = default;
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
private Q_SLOTS:
|
||||
void changedFontSlot();
|
||||
};
|
||||
|
||||
class FixPushButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FixPushButton(QWidget *parent = 0);
|
||||
|
||||
public:
|
||||
void setButtonText(QString text);
|
||||
QString getText();
|
||||
|
||||
private Q_SLOTS:
|
||||
void changedLabelSlot();
|
||||
private:
|
||||
QString mStr;
|
||||
|
||||
};
|
||||
|
||||
class NameLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit NameLabel(QWidget *parent = 0);
|
||||
~NameLabel() = default;
|
||||
void setLabelText(QString text);
|
||||
void setLabelMaximumWidth(int width);
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
int m_maximumWidth = 120;
|
||||
|
||||
private Q_SLOTS:
|
||||
void changedLabelSlot();
|
||||
|
||||
};
|
||||
|
||||
class ListItem : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -58,19 +106,29 @@ protected:
|
|||
protected:
|
||||
QFrame * m_itemFrame = nullptr;
|
||||
|
||||
FixLabel * m_nameLabel = nullptr;
|
||||
NameLabel * m_nameLabel = nullptr;
|
||||
RadioItemButton * m_netButton = nullptr;
|
||||
InfoButton * m_infoButton = nullptr;
|
||||
// InfoButton * m_infoButton = nullptr;
|
||||
|
||||
bool m_isActive = false;
|
||||
ConnectState m_connectState;
|
||||
|
||||
QMenu *m_menu = nullptr;
|
||||
|
||||
|
||||
public:
|
||||
QVBoxLayout * m_mainLayout = nullptr;
|
||||
QHBoxLayout * m_hItemLayout = nullptr;
|
||||
|
||||
QLabel *m_lbLoadDown = nullptr;
|
||||
QLabel *m_lbLoadUp = nullptr;
|
||||
QLabel *m_lbLoadDownImg = nullptr;
|
||||
QLabel *m_lbLoadUpImg = nullptr;
|
||||
QLabel *m_freq = nullptr;
|
||||
|
||||
NetDetail *netDetail = nullptr;
|
||||
|
||||
FixPushButton *m_hoverButton = nullptr;
|
||||
private:
|
||||
void initUI();
|
||||
void initConnection();
|
||||
|
@ -81,7 +139,7 @@ public Q_SLOTS:
|
|||
virtual void onMenuTriggered(QAction *action)=0;
|
||||
|
||||
Q_SIGNALS:
|
||||
void detailShow(bool isShow);
|
||||
void detailShow(QString, QString);
|
||||
};
|
||||
|
||||
#endif // LISTITEM_H
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
#define WAIT_US 10*1000
|
||||
#define ENABLE_BUTTON_COLOR qApp->palette().highlight().color()
|
||||
#define UNABLE_BUTTON_COLOR qApp->palette().button().color()
|
||||
#define NAMELABLE_MAX_WIDTH_HOVER 176
|
||||
#define NAMELABLE_MAX_WIDTH_ACTIVATED 142
|
||||
#define NAMELABLE_MAX_WIDTH_DEACTIVATED 276
|
||||
|
||||
const QString ENTERPRICE_TYPE = "802.1X";
|
||||
const QString WPA1_AND_WPA2 = "WPA";
|
||||
|
@ -49,8 +52,9 @@ WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, Q
|
|||
initWlanUI();
|
||||
setExpanded(false);
|
||||
|
||||
connect(this->m_infoButton, &InfoButton::clicked, this, &WlanListItem::onInfoButtonClicked);
|
||||
// connect(this->m_infoButton, &InfoButton::clicked, this, &WlanListItem::onInfoButtonClicked);
|
||||
connect(m_menu, &QMenu::triggered, this, &WlanListItem::onMenuTriggered);
|
||||
connect(m_hoverButton, &FixPushButton::clicked, this, &WlanListItem::onNetButtonClicked);
|
||||
|
||||
m_wirelessConnectOperation = new KyWirelessConnectOperation(this);
|
||||
m_deviceResource = new KyNetworkDeviceResourse(this);
|
||||
|
@ -69,7 +73,7 @@ WlanListItem::WlanListItem(QWidget *parent) : ListItem(parent)
|
|||
setExpanded(false);
|
||||
this->setName(name);
|
||||
// this->m_netButton->setEnabled(false);
|
||||
this->m_infoButton->hide();
|
||||
// this->m_infoButton->hide();
|
||||
}
|
||||
|
||||
WlanListItem::~WlanListItem()
|
||||
|
@ -133,6 +137,8 @@ void WlanListItem::setExpanded(const bool &expanded)
|
|||
if (expanded) {
|
||||
m_pwdLineEdit->setFocus();
|
||||
setFixedHeight(EXPANDED_HEIGHT);
|
||||
m_hoverButton->hide();
|
||||
m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_DEACTIVATED);
|
||||
} else {
|
||||
setFixedHeight(NORMAL_HEIGHT);
|
||||
}
|
||||
|
@ -176,12 +182,14 @@ void WlanListItem::onRightButtonClicked()
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
if (m_wirelessNetItem.m_isConfigured) {
|
||||
m_menu->addAction(new QAction(tr("Property"), this));
|
||||
m_menu->addAction(new QAction(tr("Forget"), this));
|
||||
}
|
||||
|
||||
m_menu->move(cursor().pos());
|
||||
m_menu->show();
|
||||
// m_menu->move(cursor().pos());
|
||||
m_menu->popup(cursor().pos());
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -190,6 +198,23 @@ void WlanListItem::enterEvent(QEvent *event)
|
|||
{
|
||||
//qDebug()<< LOG_FLAG <<"enterEvent" << m_wirelessNetItem.m_NetSsid;
|
||||
m_mouseIsOut = false;
|
||||
if (m_pwdFrame != nullptr && !m_pwdFrame->isVisible()) {
|
||||
if (Deactivated != m_connectState) {
|
||||
m_hoverButton->setProperty("useButtonPalette", true);
|
||||
m_hoverButton->setProperty("isImportant", false);
|
||||
m_hoverButton->setButtonText(tr("Disconnect"));
|
||||
} else {
|
||||
m_hoverButton->setProperty("isImportant", true);
|
||||
m_hoverButton->setProperty("useButtonPalette", false);
|
||||
m_hoverButton->setButtonText(tr("Connect"));
|
||||
}
|
||||
m_hoverButton->show();
|
||||
m_lbLoadUp->hide();
|
||||
m_lbLoadDown->hide();
|
||||
m_lbLoadDownImg->hide();
|
||||
m_lbLoadUpImg->hide();
|
||||
}
|
||||
m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_HOVER);
|
||||
return ListItem::enterEvent(event);
|
||||
}
|
||||
|
||||
|
@ -197,6 +222,16 @@ void WlanListItem::leaveEvent(QEvent *event)
|
|||
{
|
||||
//qDebug()<< LOG_FLAG <<"leaveEvent"<< m_wirelessNetItem.m_NetSsid;
|
||||
m_mouseIsOut = true;
|
||||
m_hoverButton->hide();
|
||||
if (m_connectState == Activated) {
|
||||
m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_ACTIVATED);
|
||||
m_lbLoadUp->show();
|
||||
m_lbLoadDown->show();
|
||||
m_lbLoadDownImg->show();
|
||||
m_lbLoadUpImg->show();
|
||||
} else {
|
||||
m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_DEACTIVATED);
|
||||
}
|
||||
if (m_pwdFrame && m_pwdFrame->isVisible()) {
|
||||
if (m_focusIsOut) {
|
||||
setExpanded(false);
|
||||
|
@ -245,6 +280,7 @@ void WlanListItem::paintEvent(QPaintEvent *event)
|
|||
{
|
||||
QPalette pal = qApp->palette();
|
||||
if (m_pwdLineEdit != nullptr) {
|
||||
pal.setColor(QPalette::Base, pal.color(QPalette::Base));
|
||||
m_pwdLineEdit->setPalette(pal);
|
||||
}
|
||||
|
||||
|
@ -293,11 +329,11 @@ void WlanListItem::initWlanUI()
|
|||
m_pwdLineEdit->setFixedHeight(PWD_AREA_HEIGHT);
|
||||
m_pwdFrameLyt->addWidget(m_pwdLineEdit);
|
||||
|
||||
m_connectButton = new QPushButton(m_pwdFrame);
|
||||
m_connectButton = new FixPushButton(m_pwdFrame);
|
||||
m_connectButton->setProperty("isImportant", true);
|
||||
m_connectButton->setProperty("needTranslucent", true);
|
||||
m_connectButton->setFixedSize(CONNECT_BUTTON_WIDTH, PWD_AREA_HEIGHT);
|
||||
m_connectButton->setText(tr("Connect"));
|
||||
m_connectButton->setButtonText(tr("Connect"));
|
||||
m_connectButton->setEnabled(false);
|
||||
connect(m_connectButton, &QPushButton::clicked, this, &WlanListItem::onConnectButtonClicked);
|
||||
m_pwdFrameLyt->addWidget(m_connectButton);
|
||||
|
@ -328,6 +364,9 @@ void WlanListItem::initWlanUI()
|
|||
|
||||
m_pwdFrame->hide();
|
||||
m_autoConnectFrame->hide();
|
||||
|
||||
this->m_freq->show();
|
||||
this->setFrequency();
|
||||
}
|
||||
|
||||
QString getIcon(bool isEncrypted, int signalStrength, int category) {
|
||||
|
@ -435,17 +474,17 @@ void WlanListItem::refreshIcon(bool isActivated)
|
|||
void WlanListItem::onInfoButtonClicked()
|
||||
{
|
||||
//ZJP_TODO 呼出无线详情页
|
||||
if(netDetail != nullptr){
|
||||
netDetail->activateWindow();
|
||||
return;
|
||||
}
|
||||
// if(netDetail != nullptr){
|
||||
// netDetail->activateWindow();
|
||||
// return;
|
||||
// }
|
||||
|
||||
qDebug() << LOG_FLAG << "Net active or not:"<< m_connectState;
|
||||
qDebug() << LOG_FLAG << "On wlan info button clicked! ssid = "
|
||||
<< m_wirelessNetItem.m_NetSsid << "; name = "
|
||||
<< m_wirelessNetItem.m_connName << "." <<Q_FUNC_INFO << __LINE__;
|
||||
|
||||
|
||||
#if 0
|
||||
bool isActive = false;
|
||||
if (Activated == m_connectState) {
|
||||
isActive = true;
|
||||
|
@ -460,7 +499,8 @@ void WlanListItem::onInfoButtonClicked()
|
|||
}
|
||||
});
|
||||
netDetail->show();
|
||||
Q_EMIT this->detailShow(true);
|
||||
#endif
|
||||
Q_EMIT this->detailShow(m_wlanDevice, m_wirelessNetItem.m_NetSsid);
|
||||
}
|
||||
|
||||
void WlanListItem::onNetButtonClicked()
|
||||
|
@ -471,8 +511,7 @@ void WlanListItem::onNetButtonClicked()
|
|||
}
|
||||
|
||||
if (Deactivated != m_connectState) {
|
||||
qDebug() << LOG_FLAG <<"the connection" << m_wirelessNetItem.m_connName
|
||||
<< "is not deactived, so it can not be operation." << Q_FUNC_INFO << __LINE__;
|
||||
m_wirelessConnectOperation->deActivateWirelessConnection(m_wlanDevice, m_wirelessNetItem.m_connectUuid);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -510,6 +549,7 @@ void WlanListItem::onNetButtonClicked()
|
|||
if (m_wirelessNetItem.m_secuType.contains("802.1x", Qt::CaseInsensitive)) {
|
||||
if (isEnterpriseWlanDialogShow && enterpriseWlanDialog != nullptr) {
|
||||
qDebug() << LOG_FLAG <<"EnterpriseWlanDialog is show do not show again!";
|
||||
KWindowSystem::activateWindow(enterpriseWlanDialog->winId());
|
||||
KWindowSystem::raiseWindow(enterpriseWlanDialog->winId());
|
||||
return;
|
||||
} else {
|
||||
|
@ -619,13 +659,28 @@ void WlanListItem::updateConnectState(ConnectState state)
|
|||
if (Activated == state) {
|
||||
m_netButton->stopLoading();
|
||||
m_netButton->setActive(true);
|
||||
m_hoverButton->setProperty("useButtonPalette", true);
|
||||
m_hoverButton->setProperty("isImportant", false);
|
||||
m_hoverButton->setButtonText(tr("Disconnect"));
|
||||
if (m_hoverButton->isHidden()) {
|
||||
m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_ACTIVATED);
|
||||
}
|
||||
} else if(Deactivated == state) {
|
||||
qDebug() << "[WlanListItem] stop loading connect state:" << state;
|
||||
m_netButton->stopLoading();
|
||||
m_netButton->setActive(false);
|
||||
m_hoverButton->setProperty("isImportant", true);
|
||||
m_hoverButton->setProperty("useButtonPalette", false);
|
||||
m_hoverButton->setButtonText(tr("Connect"));
|
||||
if (m_hoverButton->isHidden()) {
|
||||
m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_DEACTIVATED);
|
||||
}
|
||||
} else {
|
||||
qDebug() << "[WlanListItem] start loading connect state:" << state;
|
||||
m_netButton->startLoading();
|
||||
m_hoverButton->setProperty("useButtonPalette", true);
|
||||
m_hoverButton->setProperty("isImportant", false);
|
||||
m_hoverButton->setButtonText(tr("Disconnect"));
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -645,6 +700,8 @@ void WlanListItem::onMenuTriggered(QAction *action)
|
|||
m_pwdLineEdit->clear();
|
||||
}
|
||||
m_wirelessConnectOperation->deleteWirelessConnect(m_wirelessNetItem.m_connectUuid);
|
||||
} else if (action->text() == tr("Property")) {
|
||||
onInfoButtonClicked();
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -664,3 +721,22 @@ void WlanListItem::forgetPwd()
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WlanListItem::setFrequency()
|
||||
{
|
||||
uint freq = m_wirelessNetItem.m_frequency;
|
||||
bool isMix = m_wirelessNetItem.m_isMix;
|
||||
|
||||
if (isMix) {
|
||||
this->m_freq->setText("2.4/5G");
|
||||
return;
|
||||
}
|
||||
if (freq < FREQ_5GHZ) {
|
||||
this->m_freq->setText("2.4G");
|
||||
} else {
|
||||
this->m_freq->setText("5G");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ using namespace kdk;
|
|||
#define LOW_SIGNAL 5
|
||||
#define NONE_SIGNAL 0
|
||||
|
||||
#define FREQ_5GHZ 5000
|
||||
|
||||
class WlanListItem : public ListItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -79,6 +81,8 @@ public:
|
|||
|
||||
void forgetPwd();
|
||||
|
||||
void setFrequency();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void onRightButtonClicked();
|
||||
|
@ -110,7 +114,7 @@ private:
|
|||
QFrame *m_pwdFrame = nullptr;
|
||||
QHBoxLayout *m_pwdFrameLyt = nullptr;
|
||||
KPasswordEdit *m_pwdLineEdit = nullptr;
|
||||
QPushButton *m_connectButton = nullptr;
|
||||
FixPushButton *m_connectButton = nullptr;
|
||||
|
||||
//自动连接选择区域UI
|
||||
QFrame *m_autoConnectFrame = nullptr;
|
||||
|
|
|
@ -23,7 +23,8 @@ WlanMoreItem::WlanMoreItem(QWidget *parent) : ListItem(parent)
|
|||
{
|
||||
setObjectName(WMI_OB_NAME);
|
||||
m_netButton->setVisible(false);
|
||||
m_infoButton->setVisible(false);
|
||||
// m_infoButton->setVisible(false);
|
||||
m_nameLabel->setLabelMaximumWidth(326);
|
||||
m_nameLabel->setLabelText(tr("Add Others..."));
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,24 @@ const QString intel = "V10SP1-edu";
|
|||
|
||||
#define KEY_PRODUCT_FEATURES "PRODUCT_FEATURES"
|
||||
|
||||
#define MW_EXCELLENT_SIGNAL 80
|
||||
#define MW_GOOD_SIGNAL 55
|
||||
#define MW_OK_SIGNAL 30
|
||||
#define MW_LOW_SIGNAL 5
|
||||
#define MW_NONE_SIGNAL 0
|
||||
|
||||
#define EXCELLENT_SIGNAL_ICON "network-wireless-signal-excellent-symbolic"
|
||||
#define GOOD_SIGNAL_ICON "network-wireless-signal-good-symbolic"
|
||||
#define OK_SIGNAL_ICON "network-wireless-signal-ok-symbolic"
|
||||
#define LOW_SIGNAL_ICON "network-wireless-signal-weak-symbolic"
|
||||
#define NONE_SIGNAL_ICON "network-wireless-signal-none-symbolic"
|
||||
|
||||
#define EXCELLENT_SIGNAL_LIMIT_ICON "ukui-network-wireless-signal-excellent-error-symbolic"
|
||||
#define GOOD_SIGNAL_LIMIT_ICON "ukui-network-wireless-signal-good-error-symbolic"
|
||||
#define OK_SIGNAL_LIMIT_ICON "ukui-network-wireless-signal-ok-error-symbolic"
|
||||
#define LOW_SIGNAL_LIMIT_ICON "ukui-network-wireless-signal-weak-error-symbolic"
|
||||
#define NONE_SIGNAL_LIMIT_ICON "ukui-network-wireless-signal-none-error-symbolic"
|
||||
|
||||
#include <kwindowsystem.h>
|
||||
#include <kwindowsystem_export.h>
|
||||
|
||||
|
@ -139,6 +157,7 @@ void MainWindow::firstlyStart()
|
|||
initDbusConnnect();
|
||||
initWindowTheme();
|
||||
initTrayIcon();
|
||||
initPlatform();
|
||||
m_secondaryStartTimer = new QTimer(this);
|
||||
connect(m_secondaryStartTimer, &QTimer::timeout, this, [ = ]() {
|
||||
m_secondaryStartTimer->stop();
|
||||
|
@ -148,6 +167,10 @@ void MainWindow::firstlyStart()
|
|||
|
||||
m_createPagePtrMap.clear();
|
||||
|
||||
m_networkMode = new NetworkMode(this);
|
||||
m_networkMode->initWiredNetworkMode();
|
||||
m_networkMode->initWirelessNetworkMode();
|
||||
|
||||
//加载key ring
|
||||
agent_init();
|
||||
}
|
||||
|
@ -167,19 +190,19 @@ void MainWindow::secondaryStart()
|
|||
*/
|
||||
void MainWindow::initPlatform()
|
||||
{
|
||||
// char* projectName = kdk_system_get_projectName();
|
||||
// QString strProjectName(projectName);
|
||||
// free(projectName);
|
||||
// projectName = NULL;
|
||||
// if(v10Sp1.compare(strProjectName,Qt::CaseInsensitive) == 0) {
|
||||
// unsigned int feature = kdk_system_get_productFeatures();
|
||||
// if (feature == 3) {
|
||||
// m_isShowInCenter = true;
|
||||
// }
|
||||
// } else if (intel.compare(strProjectName,Qt::CaseInsensitive) == 0) {
|
||||
// m_isShowInCenter = true;
|
||||
// }
|
||||
// qDebug() << "projectName" << projectName << m_isShowInCenter;
|
||||
char* projectName = kdk_system_get_projectName();
|
||||
QString strProjectName(projectName);
|
||||
free(projectName);
|
||||
projectName = NULL;
|
||||
if(v10Sp1.compare(strProjectName,Qt::CaseInsensitive) == 0) {
|
||||
unsigned int feature = kdk_system_get_productFeatures();
|
||||
if (feature == 3) {
|
||||
m_isShowInCenter = true;
|
||||
}
|
||||
} else if (intel.compare(strProjectName,Qt::CaseInsensitive) == 0) {
|
||||
m_isShowInCenter = true;
|
||||
}
|
||||
qDebug() << "projectName" << projectName << m_isShowInCenter;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -289,18 +312,14 @@ void MainWindow::initUI()
|
|||
*/
|
||||
void MainWindow::initTrayIcon()
|
||||
{
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-1"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-2"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-3"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-4"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-5"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-6"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-7"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-8"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-9"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-10"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-11"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-12"));
|
||||
loadIcons.append(QIcon::fromTheme("ukui-loading-0-symbolic"));
|
||||
loadIcons.append(QIcon::fromTheme("ukui-loading-1-symbolic"));
|
||||
loadIcons.append(QIcon::fromTheme("ukui-loading-2-symbolic"));
|
||||
loadIcons.append(QIcon::fromTheme("ukui-loading-3-symbolic"));
|
||||
loadIcons.append(QIcon::fromTheme("ukui-loading-4-symbolic"));
|
||||
loadIcons.append(QIcon::fromTheme("ukui-loading-5-symbolic"));
|
||||
loadIcons.append(QIcon::fromTheme("ukui-loading-6-symbolic"));
|
||||
loadIcons.append(QIcon::fromTheme("ukui-loading-7-symbolic"));
|
||||
iconTimer = new QTimer(this);
|
||||
connect(iconTimer, &QTimer::timeout, this, &MainWindow::onSetTrayIconLoading);
|
||||
|
||||
|
@ -357,7 +376,7 @@ void MainWindow::initDbusConnnect()
|
|||
connect(m_wlanWidget, &WlanPage::connectivityChanged, this, &MainWindow::onConnectivityChanged);
|
||||
|
||||
//模式切换
|
||||
QDBusConnection::sessionBus().connect(QString("com.kylin.statusmanager.interface"),
|
||||
QDBusConnection::sessionBus().connect(QString("com.kylin.statusmanager.interfacer"),
|
||||
QString("/"),
|
||||
QString("com.kylin.statusmanager.interface"),
|
||||
QString("mode_change_signal"), this, SLOT(onTabletModeChanged(bool)));
|
||||
|
@ -514,7 +533,6 @@ void MainWindow::showByWaylandHelper()
|
|||
//去除窗管标题栏,传入参数为QWidget*
|
||||
kdk::UkuiStyleHelper::self()->removeHeader(this);
|
||||
this->show();
|
||||
getTabletMode();
|
||||
resetWindowPosition();
|
||||
//设置窗体位置,传入参数为QWindow*,QRect
|
||||
|
||||
|
@ -535,24 +553,6 @@ void MainWindow::setCentralWidgetType(IconActiveType iconStatus)
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::getTabletMode()
|
||||
{
|
||||
// QDBusInterface interface(QString("com.kylin.statusmanager.interface"),
|
||||
// QString("/"),
|
||||
// QString("com.kylin.statusmanager.interface"),
|
||||
// QDBusConnection::sessionBus());
|
||||
// if(!interface.isValid()) {
|
||||
// m_isShowInCenter = true;
|
||||
// return;
|
||||
// }
|
||||
// QDBusReply<bool> reply = interface.call("get_current_tabletmode");
|
||||
// if (!reply.isValid()) {
|
||||
// m_isShowInCenter = true;
|
||||
// return;
|
||||
// }
|
||||
// m_isShowInCenter = reply.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MainWindow::onTrayIconActivated 点击托盘图标的槽函数
|
||||
*/
|
||||
|
@ -597,12 +597,14 @@ void MainWindow::onThemeChanged(const QString &key)
|
|||
void MainWindow::onRefreshTrayIcon()
|
||||
{
|
||||
//更新托盘图标显示
|
||||
int signalStrength = 0;
|
||||
iconTimer->stop();
|
||||
if (m_lanWidget->lanIsConnected()) {
|
||||
m_trayIcon->setIcon(QIcon::fromTheme("network-wired-connected-symbolic"));
|
||||
iconStatus = IconActiveType::LAN_CONNECTED;
|
||||
} else if (m_wlanWidget->checkWlanStatus(NetworkManager::ActiveConnection::State::Activated)){
|
||||
m_trayIcon->setIcon(QIcon::fromTheme("network-wireless-connected-symbolic"));
|
||||
// m_trayIcon->setIcon(QIcon::fromTheme("network-wireless-connected-symbolic"));
|
||||
signalStrength = m_wlanWidget->getAcivateWifiSignal();
|
||||
iconStatus = IconActiveType::WLAN_CONNECTED;
|
||||
} else {
|
||||
m_trayIcon->setIcon(QIcon::fromTheme("network-wired-disconnected-symbolic"));
|
||||
|
@ -617,15 +619,42 @@ void MainWindow::onRefreshTrayIcon()
|
|||
iconStatus = IconActiveType::LAN_CONNECTED_LIMITED;
|
||||
} else if (iconStatus == IconActiveType::WLAN_CONNECTED) {
|
||||
//todo 信号强度
|
||||
m_trayIcon->setIcon(QIcon::fromTheme("network-wireless-signal-excellent-error-symbolic"));
|
||||
// m_trayIcon->setIcon(QIcon::fromTheme("network-wireless-signal-excellent-error-symbolic"));
|
||||
iconStatus = IconActiveType::WLAN_CONNECTED_LIMITED;
|
||||
}
|
||||
}
|
||||
|
||||
if (iconStatus == IconActiveType::WLAN_CONNECTED
|
||||
|| iconStatus == IconActiveType::WLAN_CONNECTED_LIMITED) {
|
||||
if (signalStrength > MW_EXCELLENT_SIGNAL){
|
||||
m_trayIcon->setIcon(QIcon::fromTheme(EXCELLENT_SIGNAL_ICON));
|
||||
} else if (signalStrength > MW_GOOD_SIGNAL) {
|
||||
m_trayIcon->setIcon(QIcon::fromTheme(GOOD_SIGNAL_ICON));
|
||||
} else if (signalStrength > MW_OK_SIGNAL) {
|
||||
m_trayIcon->setIcon(QIcon::fromTheme(OK_SIGNAL_ICON));
|
||||
} else if (signalStrength > MW_LOW_SIGNAL) {
|
||||
m_trayIcon->setIcon(QIcon::fromTheme(LOW_SIGNAL_ICON));
|
||||
} else {
|
||||
m_trayIcon->setIcon(QIcon::fromTheme(NONE_SIGNAL_ICON));
|
||||
}
|
||||
} else if (iconStatus == IconActiveType::WLAN_CONNECTED_LIMITED) {
|
||||
if (signalStrength > MW_EXCELLENT_SIGNAL){
|
||||
m_trayIcon->setIcon(QIcon::fromTheme(EXCELLENT_SIGNAL_LIMIT_ICON));
|
||||
} else if (signalStrength > MW_GOOD_SIGNAL) {
|
||||
m_trayIcon->setIcon(QIcon::fromTheme(GOOD_SIGNAL_LIMIT_ICON));
|
||||
} else if (signalStrength > MW_OK_SIGNAL) {
|
||||
m_trayIcon->setIcon(QIcon::fromTheme(OK_SIGNAL_LIMIT_ICON));
|
||||
} else if (signalStrength > MW_LOW_SIGNAL) {
|
||||
m_trayIcon->setIcon(QIcon::fromTheme(LOW_SIGNAL_LIMIT_ICON));
|
||||
} else {
|
||||
m_trayIcon->setIcon(QIcon::fromTheme(NONE_SIGNAL_LIMIT_ICON));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onSetTrayIconLoading()
|
||||
{
|
||||
if (currentIconIndex > 11) {
|
||||
if (currentIconIndex > 7) {
|
||||
currentIconIndex = 0;
|
||||
}
|
||||
m_trayIcon->setIcon(loadIcons.at(currentIconIndex));
|
||||
|
@ -833,7 +862,7 @@ void MainWindow::showCreateWiredConnectWidget(const QString devName)
|
|||
if (m_createPagePtrMap.contains(devName)) {
|
||||
if (m_createPagePtrMap[devName] != nullptr) {
|
||||
qDebug() << "showCreateWiredConnectWidget" << devName << "already create,just raise";
|
||||
|
||||
KWindowSystem::activateWindow(m_createPagePtrMap[devName]->winId());
|
||||
KWindowSystem::raiseWindow(m_createPagePtrMap[devName]->winId());
|
||||
return;
|
||||
}
|
||||
|
@ -851,35 +880,7 @@ void MainWindow::showCreateWiredConnectWidget(const QString devName)
|
|||
void MainWindow::showAddOtherWlanWidget(QString devName)
|
||||
{
|
||||
qDebug() << "showAddOtherWlanWidget! devName = " << devName;
|
||||
if (m_addOtherPagePtrMap.contains(devName)) {
|
||||
if (m_addOtherPagePtrMap[devName] != nullptr) {
|
||||
qDebug() << "showAddOtherWlanWidget" << devName << "already create,just raise";
|
||||
|
||||
KWindowSystem::raiseWindow(m_addOtherPagePtrMap[devName]->winId());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
NetDetail *netDetail = new NetDetail(devName, "", "", false, true, true, this);
|
||||
connect(netDetail, &NetDetail::createPageClose, [&](QString interfaceName){
|
||||
if (m_addOtherPagePtrMap.contains(interfaceName)) {
|
||||
m_addOtherPagePtrMap[interfaceName] = nullptr;
|
||||
}
|
||||
});
|
||||
m_addOtherPagePtrMap.insert(devName, netDetail);
|
||||
netDetail->show();
|
||||
#endif
|
||||
|
||||
JoinHiddenWiFiPage *hiddenWiFi =new JoinHiddenWiFiPage(devName);
|
||||
connect(hiddenWiFi, &JoinHiddenWiFiPage::hiddenWiFiPageClose, [&](QString interfaceName){
|
||||
if (m_addOtherPagePtrMap.contains(interfaceName)) {
|
||||
m_addOtherPagePtrMap[interfaceName] = nullptr;
|
||||
}
|
||||
});
|
||||
m_addOtherPagePtrMap.insert(devName, hiddenWiFi);
|
||||
connect(hiddenWiFi, &JoinHiddenWiFiPage::showWlanList, this, &MainWindow::onShowMainWindow);
|
||||
hiddenWiFi->show();
|
||||
m_wlanWidget->showAddOtherPage(devName);
|
||||
}
|
||||
|
||||
void MainWindow::getWirelessDeviceCap(QMap<QString, int> &map)
|
||||
|
@ -887,12 +888,6 @@ void MainWindow::getWirelessDeviceCap(QMap<QString, int> &map)
|
|||
m_wlanWidget->getWirelessDeviceCap(map);
|
||||
}
|
||||
|
||||
//有线连接删除
|
||||
void MainWindow::deleteWired(const QString &connUuid)
|
||||
{
|
||||
m_lanWidget->deleteWired(connUuid);
|
||||
}
|
||||
|
||||
//有线连接断开
|
||||
void MainWindow::activateWired(const QString& devName, const QString& connUuid)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include "wlanpage.h"
|
||||
#include "netdetails/netdetail.h"
|
||||
#include "netdetails/joinhiddenwifipage.h"
|
||||
//安全中心-网络防火墙模式配置
|
||||
#include "networkmodeconfig.h"
|
||||
//删除此头文件,别在添加
|
||||
//#include <ukuisdk/kylin-com4cxx.h>
|
||||
|
||||
|
@ -81,8 +83,6 @@ public:
|
|||
void getApConnectionPath(QString &path, QString uuid);
|
||||
//获取热点ActivePath
|
||||
void getActiveConnectionPath(QString &path, QString uuid);
|
||||
//删除有线连接
|
||||
void deleteWired(const QString& connUuid);
|
||||
//有线连接断开
|
||||
void activateWired(const QString& devName, const QString& connUuid);
|
||||
void deactivateWired(const QString& devName, const QString& connUuid);
|
||||
|
@ -154,13 +154,13 @@ private:
|
|||
void initUI();
|
||||
void initDbusConnnect();
|
||||
void initTrayIcon();
|
||||
|
||||
void resetTrayIconTool();
|
||||
void initWindowTheme();
|
||||
void resetWindowTheme();
|
||||
void showControlCenter();
|
||||
void showByWaylandHelper();
|
||||
void setCentralWidgetType(IconActiveType iconStatus);
|
||||
void getTabletMode();
|
||||
double m_transparency=1.0; //透明度
|
||||
QGSettings * m_transGsettings; //透明度配置文件
|
||||
int currentIconIndex=0;
|
||||
|
@ -197,8 +197,8 @@ private:
|
|||
IconActiveType iconStatus = IconActiveType::NOT_CONNECTED;
|
||||
|
||||
QMap<QString, NetDetail*> m_createPagePtrMap;
|
||||
// QMap<QString, NetDetail*> m_addOtherPagePtrMap;
|
||||
QMap<QString, JoinHiddenWiFiPage*> m_addOtherPagePtrMap;
|
||||
|
||||
NetworkMode *m_networkMode;
|
||||
|
||||
public Q_SLOTS:
|
||||
void onShowMainWindow(int type);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <QProcess>
|
||||
|
||||
#define VERTICAL_SPACING 24
|
||||
#define KSC_FIREWALL_NOCONFIG -1
|
||||
#define KSC_FIREWALL_PUBLIC 0
|
||||
#define KSC_FIREWALL_PRIVATE 1
|
||||
|
||||
|
@ -65,7 +66,7 @@ void ConfigPage::initUi()
|
|||
"it is suitable for networks in public places, such as airports or coffee shops, etc."));
|
||||
m_publicLabel->setWordWrap(true);
|
||||
//专用 网络中的设备可发现此电脑。一般情况下适用于家庭或工作单位的网络,您认识并信任网络上的个人和设备。
|
||||
m_privateLabel->setText(tr("Devices on the network can discover this computer. Generally applicable to a network "
|
||||
m_privateLabel->setText(tr("Private Devices on the network can discover this computer. Generally applicable to a network "
|
||||
"at home or work where you know and trust the individuals and devices on the network."));
|
||||
m_privateLabel->setWordWrap(true);
|
||||
//配置防火墙和安全设置
|
||||
|
@ -111,6 +112,7 @@ int ConfigPage::getConfigState()
|
|||
} else if (m_privateButton->isChecked()) {
|
||||
return KSC_FIREWALL_PRIVATE;
|
||||
}
|
||||
return KSC_FIREWALL_NOCONFIG;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#ifndef CONINFO_H
|
||||
#define CONINFO_H
|
||||
|
||||
#include <QApplication>
|
||||
#include <QString>
|
||||
#include <QPalette>
|
||||
#include <QComboBox>
|
||||
|
@ -93,7 +94,6 @@ public:
|
|||
QString strIPV4FirDns;
|
||||
QString strIPV4SecDns;
|
||||
QString strIPV4GateWay;
|
||||
QList<QHostAddress> ipv4DnsList;
|
||||
|
||||
KyIpConfigType ipv6ConfigType = CONFIG_IP_DHCP;
|
||||
QString strIPV6Address;
|
||||
|
@ -101,7 +101,6 @@ public:
|
|||
QString strIPV6FirDns;
|
||||
QString strIPV6SecDns;
|
||||
QString strIPV6GateWay;
|
||||
QList<QHostAddress> ipv6DnsList;
|
||||
|
||||
KyEapMethodType enterpriseType;
|
||||
KyEapMethodTlsInfo tlsInfo;
|
||||
|
@ -126,11 +125,12 @@ static void setFramePalette(QFrame *widget, QPalette &pal) {
|
|||
|
||||
static QPalette lightPalette(QWidget *widget)
|
||||
{
|
||||
auto palette = widget->palette();
|
||||
//ukui-light palette UKUI3.1
|
||||
QPalette palette = qApp->palette();
|
||||
|
||||
//ukui-light palette UKUI3.1 亮主题色板
|
||||
QColor windowText_at(38, 38, 38),
|
||||
windowText_iat(38, 38, 38),
|
||||
windowText_dis(166, 166, 166),
|
||||
windowText_iat(0, 0, 0, 255 * 0.55),
|
||||
windowText_dis(0, 0, 0, 255 * 0.3),
|
||||
button_at(230, 230, 230),
|
||||
button_iat(230, 230, 230),
|
||||
button_dis(233, 233, 233),
|
||||
|
@ -148,10 +148,10 @@ static QPalette lightPalette(QWidget *widget)
|
|||
mid_dis(102, 102, 102),
|
||||
text_at(38, 38, 38),
|
||||
text_iat(38, 38, 38),
|
||||
text_dis(140, 140, 140),
|
||||
brightText_at(89, 89, 89),
|
||||
brightText_iat(89, 89, 89),
|
||||
brightText_dis(77, 77, 77),
|
||||
text_dis(0, 0, 0, 255 * 0.3),
|
||||
brightText_at(0, 0, 0),
|
||||
brightText_iat(0, 0, 0),
|
||||
brightText_dis(0, 0, 0),
|
||||
buttonText_at(38, 38, 38),
|
||||
buttonText_iat(38, 38, 38),
|
||||
buttonText_dis(179, 179, 179),
|
||||
|
@ -161,24 +161,12 @@ static QPalette lightPalette(QWidget *widget)
|
|||
window_at(245, 245, 245),
|
||||
window_iat(237, 237, 237),
|
||||
window_dis(230, 230, 230),
|
||||
shadow_at(0, 0, 0, 16),
|
||||
shadow_iat(0, 0, 0, 16),
|
||||
shadow_dis(0, 0, 0, 21),
|
||||
// shadow_at(214, 214, 214),
|
||||
// shadow_iat(214, 214, 214),
|
||||
// shadow_dis(201, 201, 201),
|
||||
highLight_at(55, 144, 250),
|
||||
highLight_iat(55, 144, 250),
|
||||
highLight_dis(233, 233, 233),
|
||||
shadow_at(0, 0, 0, 255 * 0.16),
|
||||
shadow_iat(0, 0, 0, 255 * 0.16),
|
||||
shadow_dis(0, 0, 0, 255 * 0.21),
|
||||
highLightText_at(255, 255, 255),
|
||||
highLightText_iat(255, 255, 255),
|
||||
highLightText_dis(179, 179, 179),
|
||||
link_at(55, 144, 250),
|
||||
link_iat(55, 144, 250),
|
||||
link_dis(55, 144, 250),
|
||||
linkVisited_at(114, 46, 209),
|
||||
linkVisited_iat(114, 46, 209),
|
||||
linkVisited_dis(114, 46, 209),
|
||||
alternateBase_at(245, 245, 245),
|
||||
alternateBase_iat(245, 245, 245),
|
||||
alternateBase_dis(245, 245, 245),
|
||||
|
@ -191,11 +179,9 @@ static QPalette lightPalette(QWidget *widget)
|
|||
toolTipText_at(38, 38, 38),
|
||||
toolTipText_iat(38, 38, 38),
|
||||
toolTipText_dis(38, 38, 38),
|
||||
placeholderText_at(38, 38, 38),
|
||||
placeholderText_iat(38, 38, 38),
|
||||
placeholderText_dis(38, 38, 38);
|
||||
|
||||
|
||||
placeholderText_at(0, 0, 0, 255 * 0.35),
|
||||
placeholderText_iat(0, 0, 0, 255 * 0.35),
|
||||
placeholderText_dis(0, 0, 0, 255 * 0.3);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::WindowText, windowText_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::WindowText, windowText_iat);
|
||||
|
@ -245,22 +231,10 @@ static QPalette lightPalette(QWidget *widget)
|
|||
palette.setColor(QPalette::Inactive, QPalette::Shadow, shadow_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Shadow, shadow_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Highlight, highLight_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Highlight, highLight_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Highlight, highLight_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::HighlightedText, highLightText_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::HighlightedText, highLightText_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::HighlightedText, highLightText_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Link, link_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Link, link_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Link, link_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::LinkVisited, linkVisited_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::LinkVisited, linkVisited_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::LinkVisited, linkVisited_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::AlternateBase, alternateBase_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::AlternateBase, alternateBase_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::AlternateBase, alternateBase_dis);
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include "math.h"
|
||||
|
||||
#define MAX_NAME_LENGTH 32
|
||||
#define HINT_TEXT_MARGINS 8, 1, 0, 3
|
||||
#define LABEL_HEIGHT 24
|
||||
|
||||
CreatNetPage::CreatNetPage(QWidget *parent):QFrame(parent)
|
||||
{
|
||||
|
@ -36,39 +38,87 @@ void CreatNetPage::initUI()
|
|||
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);
|
||||
m_addressLabel = new QLabel(this);
|
||||
m_maskLabel = new QLabel(this);
|
||||
m_gateWayLabel = new QLabel(this);
|
||||
m_dnsLabel = new QLabel(this);
|
||||
m_secDnsLabel = new QLabel(this);
|
||||
|
||||
// IP的正则格式限制
|
||||
QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
|
||||
m_dnsWidget = new MultipleDnsWidget(rx, this);
|
||||
QLabel *nameEmptyLabel = new QLabel(this);
|
||||
QLabel *configEmptyLabel = new QLabel(this);
|
||||
QLabel *gateWayEmptyLabel = new QLabel(this);
|
||||
QLabel *firstDnsEmptyLabel = new QLabel(this);
|
||||
nameEmptyLabel->setFixedHeight(LABEL_HEIGHT);
|
||||
configEmptyLabel->setFixedHeight(LABEL_HEIGHT);
|
||||
gateWayEmptyLabel->setFixedHeight(LABEL_HEIGHT);
|
||||
firstDnsEmptyLabel->setFixedHeight(LABEL_HEIGHT);
|
||||
|
||||
m_addressHintLabel = new QLabel(this);
|
||||
m_maskHintLabel = new QLabel(this);
|
||||
m_addressHintLabel->setFixedHeight(LABEL_HEIGHT);
|
||||
m_maskHintLabel->setFixedHeight(LABEL_HEIGHT);
|
||||
m_addressHintLabel->setContentsMargins(HINT_TEXT_MARGINS);
|
||||
m_maskHintLabel->setContentsMargins(HINT_TEXT_MARGINS);
|
||||
|
||||
QPalette hintTextColor;
|
||||
hintTextColor.setColor(QPalette::WindowText, Qt::red);
|
||||
m_addressHintLabel->setPalette(hintTextColor);
|
||||
m_maskHintLabel->setPalette(hintTextColor);
|
||||
|
||||
QWidget *addressWidget = new QWidget(this);
|
||||
QVBoxLayout *addressLayout = new QVBoxLayout(addressWidget);
|
||||
addressLayout->setContentsMargins(0, 0, 0, 0);
|
||||
addressLayout->setSpacing(0);
|
||||
addressLayout->addWidget(ipv4addressEdit);
|
||||
addressLayout->addWidget(m_addressHintLabel);
|
||||
|
||||
QWidget *maskWidget = new QWidget(this);
|
||||
QVBoxLayout *maskLayout = new QVBoxLayout(maskWidget);
|
||||
maskLayout->setContentsMargins(0, 0, 0, 0);
|
||||
maskLayout->setSpacing(0);
|
||||
maskLayout->addWidget(netMaskEdit);
|
||||
maskLayout->addWidget(m_maskHintLabel);
|
||||
|
||||
m_connNameLabel->setText(tr("Connection Name"));
|
||||
m_configLabel->setText(tr("IPv4Config"));
|
||||
m_addressLabel->setText(tr("Address"));
|
||||
m_maskLabel->setText(tr("Netmask"));
|
||||
m_gateWayLabel->setText(tr("Default Gateway"));
|
||||
m_dnsLabel->setText(tr("Prefs DNS"));
|
||||
m_secDnsLabel->setText(tr("Alternative DNS"));
|
||||
|
||||
m_detailLayout = new QFormLayout(this);
|
||||
m_detailLayout->setVerticalSpacing(0);
|
||||
m_detailLayout->setContentsMargins(0, 0, 0, 0);
|
||||
m_detailLayout->setSpacing(24);
|
||||
m_detailLayout->addRow(m_connNameLabel,connNameEdit);
|
||||
m_detailLayout->addRow(nameEmptyLabel);
|
||||
m_detailLayout->addRow(m_configLabel,ipv4ConfigCombox);
|
||||
m_detailLayout->addRow(m_addressLabel,ipv4addressEdit);
|
||||
m_detailLayout->addRow(m_maskLabel,netMaskEdit);
|
||||
m_detailLayout->addRow(configEmptyLabel);
|
||||
m_detailLayout->addRow(m_addressLabel, addressWidget);
|
||||
m_detailLayout->addRow(m_maskLabel, maskWidget);
|
||||
m_detailLayout->addRow(m_gateWayLabel,gateWayEdit);
|
||||
m_detailLayout->addRow(m_dnsWidget);
|
||||
m_detailLayout->addRow(gateWayEmptyLabel);
|
||||
m_detailLayout->addRow(m_dnsLabel,firstDnsEdit);
|
||||
m_detailLayout->addRow(firstDnsEmptyLabel);
|
||||
m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit);
|
||||
|
||||
ipv4ConfigCombox->addItem(tr("Auto(DHCP)"), AUTO_CONFIG); //"自动(DHCP)"
|
||||
ipv4ConfigCombox->addItem(tr("Manual"), MANUAL_CONFIG); //"手动"
|
||||
|
||||
|
||||
// IP的正则格式限制
|
||||
QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
|
||||
|
||||
ipv4addressEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
gateWayEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
netMaskEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
firstDnsEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
secondDnsEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
}
|
||||
|
||||
void CreatNetPage::initComponent() {
|
||||
|
@ -83,6 +133,11 @@ void CreatNetPage::initComponent() {
|
|||
connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), 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()));
|
||||
connect(secondDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
|
||||
connect(ipv4addressEdit, SIGNAL(textChanged(QString)), this, SLOT(onAddressTextChanged()));
|
||||
connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(onNetMaskTextChanged()));
|
||||
}
|
||||
|
||||
bool CreatNetPage::checkConnectBtnIsEnabled()
|
||||
|
@ -104,6 +159,26 @@ bool CreatNetPage::checkConnectBtnIsEnabled()
|
|||
qDebug() << "create ipv4 netMask empty or invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (gateWayEdit->text().isEmpty() || !getTextEditState(gateWayEdit->text())) {
|
||||
// qDebug() << "create ipv4 gateway empty or invalid";
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if (firstDnsEdit->text().isEmpty() && !secondDnsEdit->text().isEmpty()) {
|
||||
qDebug() << "create ipv4 dns sort invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getTextEditState(firstDnsEdit->text())) {
|
||||
qDebug() << "create ipv4 first dns invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getTextEditState(secondDnsEdit->text())) {
|
||||
qDebug() << "create ipv4 second dns invalid";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -117,17 +192,38 @@ void CreatNetPage::configChanged(int index) {
|
|||
}
|
||||
}
|
||||
|
||||
void CreatNetPage::onAddressTextChanged()
|
||||
{
|
||||
if (!getTextEditState(ipv4addressEdit->text())) {
|
||||
m_addressHintLabel->setText(tr("Invalid address"));
|
||||
} else {
|
||||
m_addressHintLabel->clear();
|
||||
}
|
||||
}
|
||||
|
||||
void CreatNetPage::onNetMaskTextChanged()
|
||||
{
|
||||
if (!netMaskIsValide(netMaskEdit->text())) {
|
||||
m_maskHintLabel->setText(tr("Invalid subnet mask"));
|
||||
} else {
|
||||
m_maskHintLabel->clear();
|
||||
}
|
||||
}
|
||||
|
||||
void CreatNetPage::setLineEnabled(bool check) {
|
||||
|
||||
ipv4addressEdit->setEnabled(check);
|
||||
netMaskEdit->setEnabled(check);
|
||||
gateWayEdit->setEnabled(check);
|
||||
m_dnsWidget->setEditEnabled(check);
|
||||
firstDnsEdit->setEnabled(check);
|
||||
secondDnsEdit->setEnabled(check);
|
||||
|
||||
if (!check) {
|
||||
ipv4addressEdit->clear();
|
||||
netMaskEdit->clear();
|
||||
gateWayEdit->clear();
|
||||
firstDnsEdit->clear();
|
||||
secondDnsEdit->clear();
|
||||
|
||||
ipv4addressEdit->setPlaceholderText(" ");
|
||||
netMaskEdit->setPlaceholderText(" ");
|
||||
|
@ -165,17 +261,13 @@ void CreatNetPage::constructIpv4Info(KyConnectSetting &setting)
|
|||
<< " gateWay " << gateWay;
|
||||
|
||||
QStringList dnsList;
|
||||
dnsList.clear();
|
||||
|
||||
QList<QHostAddress> ipv4dnsList;
|
||||
ipv4dnsList.clear();
|
||||
ipv4dnsList = m_dnsWidget->getDns();
|
||||
for (QHostAddress str: ipv4dnsList) {
|
||||
if (!dnsList.contains(str.toString())) {
|
||||
dnsList << str.toString();
|
||||
dnsList.empty();
|
||||
if (!firstDnsEdit->text().isEmpty()) {
|
||||
dnsList << firstDnsEdit->text();
|
||||
if (!secondDnsEdit->text().isEmpty()) {
|
||||
dnsList << secondDnsEdit->text();
|
||||
}
|
||||
}
|
||||
|
||||
if (ipv4ConfigCombox->currentData() == AUTO_CONFIG) {
|
||||
setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_DHCP);
|
||||
} else {
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <QDebug>
|
||||
|
||||
#include "coninfo.h"
|
||||
#include "multiplednswidget.h"
|
||||
|
||||
class CreatNetPage : public QFrame
|
||||
{
|
||||
|
@ -47,7 +46,10 @@ private:
|
|||
LineEdit *ipv4addressEdit;
|
||||
LineEdit *netMaskEdit;
|
||||
LineEdit *gateWayEdit;
|
||||
LineEdit *firstDnsEdit;
|
||||
LineEdit *secondDnsEdit;
|
||||
|
||||
private:
|
||||
QFormLayout *m_detailLayout;
|
||||
QVBoxLayout *mvBoxLayout;
|
||||
QLabel *m_connNameLabel;
|
||||
|
@ -55,8 +57,11 @@ private:
|
|||
QLabel *m_addressLabel;
|
||||
QLabel *m_maskLabel;
|
||||
QLabel *m_gateWayLabel;
|
||||
MultipleDnsWidget *m_dnsWidget = nullptr;
|
||||
QLabel *m_dnsLabel;
|
||||
QLabel *m_secDnsLabel;
|
||||
|
||||
QLabel *m_addressHintLabel;
|
||||
QLabel *m_maskHintLabel;
|
||||
private:
|
||||
void initUI();
|
||||
void initComponent();
|
||||
|
@ -71,6 +76,9 @@ private:
|
|||
private Q_SLOTS:
|
||||
void setEnableOfSaveBtn();
|
||||
void configChanged(int index);
|
||||
void onAddressTextChanged();
|
||||
void onNetMaskTextChanged();
|
||||
|
||||
Q_SIGNALS:
|
||||
void setCreatePageState(bool);
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ void DetailPage::initUI() {
|
|||
|
||||
m_IPV4Dns = new QLabel(this);
|
||||
m_ipv4DnsWidget = new DetailWidget(qobject_cast<QWidget *>(m_IPV4Dns), m_listWidget);
|
||||
m_ipv4DnsWidget->setKey(tr("IPv4 Dns:"));
|
||||
m_ipv4DnsWidget->setKey(tr("IPv4 DNS:"));
|
||||
|
||||
m_IPV6 = new FixLabel(this);
|
||||
m_IPV6->setFixedWidth(MAX_LABEL_WIDTH);
|
||||
|
@ -324,7 +324,7 @@ void DetailPage::on_btnCopyNetDetail_clicked()
|
|||
QString chanCopy= tr ("Chan:");
|
||||
QString bandwithCopy = tr("BandWidth:");
|
||||
QString ipv4Copy = tr("IPv4:");
|
||||
QString ipv4dnsCopy = tr("IPv4 Dns:");
|
||||
QString ipv4dnsCopy = tr("IPv4 DNS:");
|
||||
QString ipv6Copy = tr("IPv6:");
|
||||
QString macCopy = tr("Mac:");
|
||||
QString netDetailCopyText;
|
||||
|
|
|
@ -18,9 +18,7 @@
|
|||
*
|
||||
*/
|
||||
#include "detailwidget.h"
|
||||
#include <QFontMetrics>
|
||||
#include <QDebug>
|
||||
#include <QGSettings>
|
||||
|
||||
#define ITEM_HEIGHT 36
|
||||
#define ITEM_MARGINS 18,0,16,0
|
||||
|
@ -28,45 +26,6 @@
|
|||
#define MAX_LABEL_WIDTH 154
|
||||
#define MAX_WIDGET_WIDTH 270
|
||||
|
||||
FixLabel::FixLabel(QWidget *parent) :
|
||||
QLabel(parent)
|
||||
{
|
||||
const QByteArray id("org.ukui.style");
|
||||
QGSettings * fontSetting = new QGSettings(id, QByteArray(), this);
|
||||
if(QGSettings::isSchemaInstalled(id)){
|
||||
connect(fontSetting, &QGSettings::changed,[=](QString key) {
|
||||
if ("systemFont" == key || "systemFontSize" ==key) {
|
||||
changedLabelSlot();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FixLabel::setLabelText(QString text) {
|
||||
|
||||
mStr = text;
|
||||
changedLabelSlot();
|
||||
}
|
||||
|
||||
QString FixLabel::getText(){
|
||||
return mStr;
|
||||
}
|
||||
|
||||
void FixLabel::changedLabelSlot() {
|
||||
QFontMetrics fontMetrics(this->font());
|
||||
int fontSize = fontMetrics.width(mStr);
|
||||
if (fontSize > this->width()) {
|
||||
setText(fontMetrics.elidedText(mStr, Qt::ElideRight, this->width()));
|
||||
setToolTip(mStr);
|
||||
} else {
|
||||
setText(mStr);
|
||||
setToolTip("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
DetailWidget::DetailWidget(QWidget *valueWidget, QWidget *parent, QWidget *buttonWidget)
|
||||
: m_valueWidget(valueWidget) , QWidget(parent) , m_copyButton(buttonWidget)
|
||||
{
|
||||
|
|
|
@ -23,23 +23,7 @@
|
|||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
class FixLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FixLabel(QWidget *parent = 0);
|
||||
|
||||
public:
|
||||
void setLabelText(QString text);
|
||||
QString getText();
|
||||
|
||||
private Q_SLOTS:
|
||||
void changedLabelSlot();
|
||||
private:
|
||||
QString mStr;
|
||||
|
||||
};
|
||||
#include "kylable.h"
|
||||
|
||||
class DetailWidget : public QWidget
|
||||
{
|
||||
|
|
|
@ -39,11 +39,15 @@ void Ipv4Page::initUI() {
|
|||
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);
|
||||
m_maskLabel = new QLabel(this);
|
||||
m_gateWayLabel = new QLabel(this);
|
||||
m_dnsLabel = new QLabel(this);
|
||||
m_secDnsLabel = new QLabel(this);
|
||||
|
||||
m_configEmptyLabel = new QLabel(this);
|
||||
m_configEmptyLabel->setFixedHeight(LABEL_HEIGHT);
|
||||
|
@ -60,10 +64,16 @@ void Ipv4Page::initUI() {
|
|||
m_gateWayEmptyLabel = new QLabel(this);
|
||||
m_gateWayEmptyLabel->setFixedHeight(LABEL_HEIGHT);
|
||||
|
||||
m_firstDnsEmptyLabel = new QLabel(this);
|
||||
m_firstDnsEmptyLabel->setFixedHeight(LABEL_HEIGHT);
|
||||
|
||||
|
||||
m_configLabel->setText(tr("IPv4Config"));
|
||||
m_addressLabel->setText(tr("Address"));
|
||||
m_maskLabel->setText(tr("Netmask"));
|
||||
m_gateWayLabel->setText(tr("Default Gateway"));
|
||||
m_dnsLabel->setText(tr("Prefs DNS"));
|
||||
m_secDnsLabel->setText(tr("Alternative DNS"));
|
||||
|
||||
m_statusLabel = new QLabel(this);
|
||||
m_statusLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
|
@ -90,10 +100,6 @@ void Ipv4Page::initUI() {
|
|||
maskLayout->addWidget(netMaskEdit);
|
||||
maskLayout->addWidget(m_maskHintLabel);
|
||||
|
||||
// IP的正则格式限制
|
||||
QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
|
||||
m_dnsWidget = new MultipleDnsWidget(rx, this);
|
||||
|
||||
m_detailLayout = new QFormLayout(this);
|
||||
m_detailLayout->setVerticalSpacing(0);
|
||||
m_detailLayout->setContentsMargins(LAYOUT_MARGINS);
|
||||
|
@ -103,7 +109,9 @@ void Ipv4Page::initUI() {
|
|||
m_detailLayout->addRow(m_maskLabel,maskWidget);
|
||||
m_detailLayout->addRow(m_gateWayLabel,gateWayEdit);
|
||||
m_detailLayout->addRow(m_gateWayEmptyLabel);
|
||||
m_detailLayout->addRow(m_dnsWidget);
|
||||
m_detailLayout->addRow(m_dnsLabel,firstDnsEdit);
|
||||
m_detailLayout->addRow(m_firstDnsEmptyLabel);
|
||||
m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit);
|
||||
|
||||
ipv4ConfigCombox->addItem(tr("Auto(DHCP)")); //"自动(DHCP)"
|
||||
ipv4ConfigCombox->addItem(tr("Manual")); //"手动"
|
||||
|
@ -116,9 +124,14 @@ void Ipv4Page::initUI() {
|
|||
// netMaskCombox->addItem("255.0.0.0"); //8
|
||||
|
||||
|
||||
// IP的正则格式限制
|
||||
QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
|
||||
|
||||
ipv4addressEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
gateWayEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
netMaskEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
firstDnsEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
secondDnsEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
|
||||
initLoadingIcon();
|
||||
}
|
||||
|
@ -139,6 +152,8 @@ void Ipv4Page::initComponent() {
|
|||
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()));
|
||||
connect(secondDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
}
|
||||
|
||||
void Ipv4Page::setIpv4Config(KyIpConfigType ipv4Config)
|
||||
|
@ -160,9 +175,14 @@ void Ipv4Page::setNetMask(const QString &netMask)
|
|||
netMaskEdit->setText(netMask);
|
||||
}
|
||||
|
||||
void Ipv4Page::setMulDns(const QList<QHostAddress> &dns)
|
||||
void Ipv4Page::setIpv4FirDns(const QString &ipv4FirDns)
|
||||
{
|
||||
m_dnsWidget->setDnsListText(dns);
|
||||
firstDnsEdit->setText(ipv4FirDns);
|
||||
}
|
||||
|
||||
void Ipv4Page::setIpv4SecDns(const QString &ipv4SecDns)
|
||||
{
|
||||
secondDnsEdit->setText(ipv4SecDns);
|
||||
}
|
||||
|
||||
void Ipv4Page::setGateWay(const QString &gateWay)
|
||||
|
@ -193,22 +213,19 @@ bool Ipv4Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting)
|
|||
isChanged = true;
|
||||
}
|
||||
qDebug() << "ipv4 netmask " << getNetMaskText(netMaskEdit->text());
|
||||
|
||||
QList<QHostAddress> ipv4dnsList;
|
||||
ipv4dnsList.clear();
|
||||
ipv4dnsList = m_dnsWidget->getDns();
|
||||
|
||||
if(info.strIPV4Address != ipv4addressEdit->text()
|
||||
|| info.strIPV4NetMask != /*netMaskEdit->text()*/getNetMaskText(netMaskEdit->text())
|
||||
|| info.strIPV4GateWay != gateWayEdit->text()
|
||||
|| info.ipv4DnsList != ipv4dnsList) {
|
||||
|| info.strIPV4FirDns != firstDnsEdit->text()
|
||||
|| info.strIPV4SecDns != secondDnsEdit->text()) {
|
||||
|
||||
qDebug() << "ipv4 info changed";
|
||||
QStringList dnsList;
|
||||
dnsList.clear();
|
||||
for (QHostAddress str: ipv4dnsList) {
|
||||
if (!dnsList.contains(str.toString())) {
|
||||
dnsList << str.toString();
|
||||
dnsList.empty();
|
||||
if (!firstDnsEdit->text().isEmpty()) {
|
||||
dnsList << firstDnsEdit->text();
|
||||
if (!secondDnsEdit->text().isEmpty()) {
|
||||
dnsList << secondDnsEdit->text();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,6 +256,26 @@ bool Ipv4Page::checkConnectBtnIsEnabled()
|
|||
qDebug() << "ipv4 netMask empty or invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (gateWayEdit->text().isEmpty() || !getTextEditState(gateWayEdit->text())) {
|
||||
// qDebug() << "ipv4 gateway empty or invalid";
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if (firstDnsEdit->text().isEmpty() && !secondDnsEdit->text().isEmpty()) {
|
||||
qDebug() << "ipv4 dns sort invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getTextEditState(firstDnsEdit->text())) {
|
||||
qDebug() << "ipv4 first dns invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getTextEditState(secondDnsEdit->text())) {
|
||||
qDebug() << "ipv4 second dns invalid";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -288,6 +325,8 @@ void Ipv4Page::setLineEnabled(bool check) {
|
|||
ipv4addressEdit->clear();
|
||||
netMaskEdit->clear();
|
||||
gateWayEdit->clear();
|
||||
firstDnsEdit->clear();
|
||||
secondDnsEdit->clear();
|
||||
|
||||
ipv4addressEdit->setPlaceholderText(" ");
|
||||
netMaskEdit->setPlaceholderText(" ");
|
||||
|
@ -300,7 +339,8 @@ void Ipv4Page::setLineEnabled(bool check) {
|
|||
ipv4addressEdit->setEnabled(check);
|
||||
netMaskEdit->setEnabled(check);
|
||||
gateWayEdit->setEnabled(check);
|
||||
m_dnsWidget->setEditEnabled(check);
|
||||
firstDnsEdit->setEnabled(check);
|
||||
secondDnsEdit->setEnabled(check);
|
||||
}
|
||||
|
||||
void Ipv4Page::setEnableOfSaveBtn() {
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
//#include "kylinconnectsetting.h"
|
||||
#include "coninfo.h"
|
||||
#include "multiplednswidget.h"
|
||||
|
||||
class Ipv4Page : public QFrame
|
||||
{
|
||||
|
@ -43,11 +42,10 @@ public:
|
|||
void setIpv4Config(KyIpConfigType ipv4Config);
|
||||
void setIpv4(const QString &ipv4);
|
||||
void setNetMask(const QString &netMask);
|
||||
void setMulDns(const QList<QHostAddress> &dns);
|
||||
void setIpv4FirDns(const QString &ipv4FirDns);
|
||||
void setIpv4SecDns(const QString &ipv4SecDns);
|
||||
void setGateWay(const QString &gateWay);
|
||||
|
||||
QString getNetMaskText(QString text);
|
||||
|
||||
bool checkIsChanged(const ConInfo info, KyConnectSetting &setting);
|
||||
|
||||
void startLoading();
|
||||
|
@ -59,6 +57,8 @@ private:
|
|||
LineEdit *ipv4addressEdit;
|
||||
LineEdit *netMaskEdit;
|
||||
LineEdit *gateWayEdit;
|
||||
LineEdit *firstDnsEdit;
|
||||
LineEdit *secondDnsEdit;
|
||||
|
||||
QFormLayout *m_detailLayout;
|
||||
QVBoxLayout *mvBoxLayout;
|
||||
|
@ -66,13 +66,14 @@ private:
|
|||
QLabel *m_addressLabel;
|
||||
QLabel *m_maskLabel;
|
||||
QLabel *m_gateWayLabel;
|
||||
QLabel *m_dnsLabel;
|
||||
QLabel *m_secDnsLabel;
|
||||
|
||||
QLabel *m_configEmptyLabel;
|
||||
QLabel *m_addressHintLabel;
|
||||
QLabel *m_maskHintLabel;
|
||||
QLabel *m_gateWayEmptyLabel;
|
||||
|
||||
MultipleDnsWidget *m_dnsWidget = nullptr;
|
||||
QLabel *m_firstDnsEmptyLabel;
|
||||
|
||||
QLabel *m_statusLabel = nullptr;
|
||||
QList<QIcon> m_loadIcons;
|
||||
|
@ -89,7 +90,7 @@ private:
|
|||
void configSave();
|
||||
bool getTextEditState(QString text);
|
||||
bool netMaskIsValide(QString text);
|
||||
|
||||
QString getNetMaskText(QString text);
|
||||
bool checkConnectBtnIsEnabled();
|
||||
void initConflictHintLable();
|
||||
void initLoadingIcon();
|
||||
|
|
|
@ -52,9 +52,14 @@ void Ipv6Page::setIpv6Perfix(const int &ipv6Perfix)
|
|||
lengthEdit->setText(QString::number(ipv6Perfix));
|
||||
}
|
||||
|
||||
void Ipv6Page::setMulDns(const QList<QHostAddress> &dns)
|
||||
void Ipv6Page::setIpv6FirDns(const QString &ipv6FirDns)
|
||||
{
|
||||
m_dnsWidget->setDnsListText(dns);
|
||||
firstDnsEdit->setText(ipv6FirDns);
|
||||
}
|
||||
|
||||
void Ipv6Page::setIpv6SecDns(const QString &ipv6SecDns)
|
||||
{
|
||||
secondDnsEdit->setText(ipv6SecDns);
|
||||
}
|
||||
|
||||
void Ipv6Page::setGateWay(const QString &gateWay)
|
||||
|
@ -83,21 +88,19 @@ bool Ipv6Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting)
|
|||
setting.setIpConfigType(IPADDRESS_V6, CONFIG_IP_MANUAL);
|
||||
isChanged = true;
|
||||
}
|
||||
|
||||
QList<QHostAddress> ipv6dnsList;
|
||||
ipv6dnsList.clear();
|
||||
ipv6dnsList = m_dnsWidget->getDns();
|
||||
if(info.strIPV6Address != ipv6AddressEdit->text()
|
||||
|| info.iIPV6Prefix != lengthEdit->text().toInt()
|
||||
|| info.strIPV6GateWay != gateWayEdit->text()
|
||||
|| info.ipv6DnsList != ipv6dnsList) {
|
||||
|| info.strIPV6FirDns != firstDnsEdit->text()
|
||||
|| info.strIPV6SecDns != secondDnsEdit->text()) {
|
||||
|
||||
qDebug() << "ipv6 info changed";
|
||||
QStringList dnsList;
|
||||
dnsList.clear();
|
||||
for (QHostAddress str: ipv6dnsList) {
|
||||
if (!dnsList.contains(str.toString())) {
|
||||
dnsList << str.toString();
|
||||
dnsList.empty();
|
||||
if (!firstDnsEdit->text().isEmpty()) {
|
||||
dnsList << firstDnsEdit->text();
|
||||
if (!secondDnsEdit->text().isEmpty()) {
|
||||
dnsList << secondDnsEdit->text();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,11 +120,15 @@ void Ipv6Page::initUI() {
|
|||
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);
|
||||
m_subnetLabel = new QLabel(this);
|
||||
m_gateWayLabel = new QLabel(this);
|
||||
m_dnsLabel = new QLabel(this);
|
||||
m_secDnsLabel = new QLabel(this);
|
||||
|
||||
m_configEmptyLabel = new QLabel(this);
|
||||
m_configEmptyLabel->setFixedHeight(LABEL_HEIGHT);
|
||||
|
@ -138,10 +145,16 @@ void Ipv6Page::initUI() {
|
|||
m_subnetEmptyLabel = new QLabel(this);
|
||||
m_subnetEmptyLabel->setFixedHeight(LABEL_HEIGHT);
|
||||
|
||||
m_firstDnsEmptyLabel = new QLabel(this);
|
||||
m_firstDnsEmptyLabel->setFixedHeight(LABEL_HEIGHT);
|
||||
|
||||
|
||||
m_configLabel->setText(tr("IPv6Config"));
|
||||
m_addressLabel->setText(tr("Address"));
|
||||
m_subnetLabel->setText(tr("Subnet prefix Length"));
|
||||
m_gateWayLabel->setText(tr("Default Gateway"));
|
||||
m_dnsLabel->setText(tr("Prefs DNS"));
|
||||
m_secDnsLabel->setText(tr("Alternative DNS"));
|
||||
|
||||
m_statusLabel = new QLabel(this);
|
||||
m_statusLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
|
@ -168,9 +181,6 @@ void Ipv6Page::initUI() {
|
|||
gateWayLayout->addWidget(gateWayEdit);
|
||||
gateWayLayout->addWidget(m_gateWayHintLabel);
|
||||
|
||||
QRegExp ipv6_rx("^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$");
|
||||
m_dnsWidget = new MultipleDnsWidget(ipv6_rx, this);
|
||||
|
||||
m_detailLayout = new QFormLayout(this);
|
||||
m_detailLayout->setContentsMargins(0, 0, 0, 0);
|
||||
m_detailLayout->setVerticalSpacing(0);
|
||||
|
@ -180,13 +190,18 @@ void Ipv6Page::initUI() {
|
|||
m_detailLayout->addRow(m_subnetLabel,lengthEdit);
|
||||
m_detailLayout->addRow(m_subnetEmptyLabel);
|
||||
m_detailLayout->addRow(m_gateWayLabel,gateWayWidget);
|
||||
m_detailLayout->addRow(m_dnsWidget);
|
||||
m_detailLayout->addRow(m_dnsLabel,firstDnsEdit);
|
||||
m_detailLayout->addRow(m_firstDnsEmptyLabel);
|
||||
m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit);
|
||||
|
||||
ipv6ConfigCombox->addItem(tr("Auto(DHCP)")); //"自动(DHCP)"
|
||||
ipv6ConfigCombox->addItem(tr("Manual")); //"手动"
|
||||
|
||||
QRegExp ipv6_rx("^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$");
|
||||
ipv6AddressEdit->setValidator(new QRegExpValidator(ipv6_rx, this));
|
||||
gateWayEdit->setValidator(new QRegExpValidator(ipv6_rx, this));
|
||||
firstDnsEdit->setValidator(new QRegExpValidator(ipv6_rx, this));
|
||||
secondDnsEdit->setValidator(new QRegExpValidator(ipv6_rx, this));
|
||||
|
||||
QRegExp prefix_rx("\\b(?:(?:12[0-8]|1[0-1][0-9]|^[1-9][0-9]?$)\\.){3}(?:12[0-8]|1[0-1][0-9]|^[1-9][0-9]?$)\\b");
|
||||
lengthEdit->setValidator(new QRegExpValidator(prefix_rx,this));
|
||||
|
@ -210,6 +225,8 @@ void Ipv6Page::initComponent() {
|
|||
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()));
|
||||
connect(secondDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
}
|
||||
|
||||
void Ipv6Page::configChanged(int index) {
|
||||
|
@ -227,6 +244,8 @@ void Ipv6Page::setControlEnabled(bool check)
|
|||
ipv6AddressEdit->clear();
|
||||
lengthEdit->clear();
|
||||
gateWayEdit->clear();
|
||||
firstDnsEdit->clear();
|
||||
secondDnsEdit->clear();
|
||||
|
||||
ipv6AddressEdit->setPlaceholderText(" ");
|
||||
lengthEdit->setPlaceholderText(" ");
|
||||
|
@ -234,13 +253,13 @@ void Ipv6Page::setControlEnabled(bool check)
|
|||
} else {
|
||||
ipv6AddressEdit->setPlaceholderText(tr("Required")); //必填
|
||||
lengthEdit->setPlaceholderText(tr("Required")); //必填
|
||||
gateWayEdit->setPlaceholderText(tr("Required")); //必填
|
||||
}
|
||||
|
||||
ipv6AddressEdit->setEnabled(check);
|
||||
lengthEdit->setEnabled(check);
|
||||
gateWayEdit->setEnabled(check);
|
||||
m_dnsWidget->setEditEnabled(check);
|
||||
firstDnsEdit->setEnabled(check);
|
||||
secondDnsEdit->setEnabled(check);
|
||||
}
|
||||
|
||||
void Ipv6Page::setEnableOfSaveBtn()
|
||||
|
@ -293,8 +312,23 @@ bool Ipv6Page::checkConnectBtnIsEnabled()
|
|||
return false;
|
||||
}
|
||||
|
||||
if (gateWayEdit->text().isEmpty() || !getIpv6EditState(gateWayEdit->text())) {
|
||||
qDebug() << "ipv6 gateway empty or invalid";
|
||||
// if (gateWayEdit->text().isEmpty() || !getIpv6EditState(gateWayEdit->text())) {
|
||||
// qDebug() << "ipv6 gateway empty or invalid";
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if (firstDnsEdit->text().isEmpty() && !secondDnsEdit->text().isEmpty()) {
|
||||
qDebug() << "ipv6 dns sort invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getIpv6EditState(firstDnsEdit->text())) {
|
||||
qDebug() << "ipv6 first dns invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getIpv6EditState(secondDnsEdit->text())) {
|
||||
qDebug() << "ipv6 second dns invalid";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
//#include "kylinconnectsetting.h"
|
||||
#include "coninfo.h"
|
||||
#include "multiplednswidget.h"
|
||||
|
||||
class Ipv6Page : public QFrame
|
||||
{
|
||||
|
@ -43,9 +42,8 @@ public:
|
|||
void setIpv6Config(KyIpConfigType ipv6Config);
|
||||
void setIpv6(const QString &ipv4);
|
||||
void setIpv6Perfix(const int &ipv6Perfix);
|
||||
// void setIpv6FirDns(const QString &ipv6FirDns);
|
||||
// void setIpv6SecDns(const QString &ipv6SecDns);
|
||||
void setMulDns(const QList<QHostAddress> &dns);
|
||||
void setIpv6FirDns(const QString &ipv6FirDns);
|
||||
void setIpv6SecDns(const QString &ipv6SecDns);
|
||||
void setGateWay(const QString &gateWay);
|
||||
|
||||
bool checkIsChanged(const ConInfo info, KyConnectSetting &setting);
|
||||
|
@ -56,28 +54,27 @@ public:
|
|||
void stopLoading();
|
||||
void showIpv6AddressConflict(bool isConflict);
|
||||
|
||||
private:
|
||||
public:
|
||||
QComboBox *ipv6ConfigCombox;
|
||||
LineEdit *ipv6AddressEdit;
|
||||
LineEdit *lengthEdit;
|
||||
LineEdit *gateWayEdit;
|
||||
// LineEdit *firstDnsEdit;
|
||||
// LineEdit *secondDnsEdit;
|
||||
|
||||
LineEdit *firstDnsEdit;
|
||||
LineEdit *secondDnsEdit;
|
||||
private:
|
||||
QFormLayout *m_detailLayout;
|
||||
QLabel *m_configLabel;
|
||||
QLabel *m_addressLabel;
|
||||
QLabel *m_subnetLabel;
|
||||
QLabel *m_gateWayLabel;
|
||||
// QLabel *m_dnsLabel;
|
||||
// QLabel *m_secDnsLabel;
|
||||
QLabel *m_dnsLabel;
|
||||
QLabel *m_secDnsLabel;
|
||||
|
||||
QLabel *m_configEmptyLabel;
|
||||
QLabel *m_addressHintLabel;
|
||||
QLabel *m_subnetEmptyLabel;
|
||||
QLabel *m_gateWayHintLabel;
|
||||
|
||||
MultipleDnsWidget *m_dnsWidget = nullptr;
|
||||
QLabel *m_firstDnsEmptyLabel;
|
||||
|
||||
QLabel *m_statusLabel = nullptr;
|
||||
QList<QIcon> m_loadIcons;
|
||||
|
@ -86,7 +83,6 @@ private:
|
|||
|
||||
QLabel *m_iconLabel;
|
||||
QLabel *m_textLabel;
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
void initComponent();
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
#define BOTTOM_LAYOUT_MARGINS 24, 24, 24, 24
|
||||
#define LAYOUT_SPACING 16
|
||||
#define LABEL_MIN_WIDTH 146
|
||||
#define LABEL_MAX_WIDTH 434
|
||||
#define MAX_NAME_LENGTH 32
|
||||
#define SCROAREA_WIDTH 480
|
||||
#define PSK_SCRO_HEIGHT 182
|
||||
#define PEAP_SCRO_HEIGHT 340
|
||||
#define TLS_SCRO_HEIGHT 560
|
||||
#define MEDIUM_WEIGHT_VALUE 57
|
||||
|
||||
bool LaunchApp(QString desktopFile);
|
||||
|
||||
JoinHiddenWiFiPage::JoinHiddenWiFiPage(QString devName, KDialog *parent)
|
||||
:m_devName(devName),
|
||||
KDialog(parent)
|
||||
|
@ -48,6 +49,7 @@ JoinHiddenWiFiPage::JoinHiddenWiFiPage(QString devName, KDialog *parent)
|
|||
initUI();
|
||||
initComponent();
|
||||
|
||||
setFixedWidth(WINDOW_WIDTH);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
setJoinBtnEnable();
|
||||
|
@ -58,19 +60,9 @@ JoinHiddenWiFiPage::~JoinHiddenWiFiPage()
|
|||
|
||||
}
|
||||
|
||||
void JoinHiddenWiFiPage::setJoinHiddenWiFiShowed(bool state)
|
||||
{
|
||||
m_joinHiddenWiFiShowed = state;
|
||||
}
|
||||
|
||||
void JoinHiddenWiFiPage::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
Q_EMIT this->hiddenWiFiPageClose(m_devName);
|
||||
|
||||
if (m_joinHiddenWiFiShowed) {
|
||||
LaunchApp("ukui-control-center.desktop");
|
||||
m_joinHiddenWiFiShowed = false;
|
||||
}
|
||||
return QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
|
@ -82,7 +74,8 @@ void JoinHiddenWiFiPage::initUI()
|
|||
m_secuWidget = new SecurityPage(false, this);
|
||||
m_secuWidget->setSecurity(KySecuType::WPA_AND_WPA2_PERSONAL);
|
||||
|
||||
m_descriptionLabel = new QLabel(this);
|
||||
m_descriptionLabel = new FixLabel(this);
|
||||
m_descriptionLabel->setFixedWidth(LABEL_MAX_WIDTH);
|
||||
m_nameLabel = new FixLabel(this);
|
||||
m_nameLabel->setFixedWidth(LABEL_MIN_WIDTH);
|
||||
m_nameEdit =new LineEdit(this);
|
||||
|
@ -128,11 +121,8 @@ void JoinHiddenWiFiPage::initUI()
|
|||
m_centerVBoxLayout->addWidget(ssidWidget);
|
||||
m_centerVBoxLayout->addSpacing(LAYOUT_SPACING);
|
||||
m_centerVBoxLayout->addWidget(m_secuWidget);
|
||||
|
||||
m_centerWidget->setFixedWidth(SCROAREA_WIDTH);
|
||||
m_hiddenWifiScrollArea->setFixedWidth(SCROAREA_WIDTH);
|
||||
m_centerVBoxLayout->addStretch();
|
||||
m_hiddenWifiScrollArea->setWidget(m_centerWidget);
|
||||
m_hiddenWifiScrollArea->setWidgetResizable(true);
|
||||
|
||||
//底部按钮
|
||||
m_bottomLayout = new QHBoxLayout(m_bottomWidget);
|
||||
|
@ -144,7 +134,7 @@ void JoinHiddenWiFiPage::initUI()
|
|||
m_bottomLayout->addWidget(m_joinBtn);
|
||||
|
||||
//请输入您想要加入网络的名称和安全类型
|
||||
m_descriptionLabel->setText(tr("Please enter the network name and security type"));
|
||||
m_descriptionLabel->setLabelText(tr("Please enter the network name and security type"));
|
||||
QFont font = m_descriptionLabel->font();
|
||||
font.setWeight(MEDIUM_WEIGHT_VALUE);
|
||||
m_descriptionLabel->setFont(font);
|
||||
|
@ -159,8 +149,9 @@ void JoinHiddenWiFiPage::initUI()
|
|||
|
||||
this->setWindowTitle(tr("Find and Join Wi-Fi"));
|
||||
this->setWindowIcon(QIcon::fromTheme("kylin-network"));
|
||||
this->setFixedWidth(WINDOW_WIDTH);
|
||||
|
||||
this->setFixedHeight(MIN_WINDOW_HEIGHT);
|
||||
onPaletteChanged();
|
||||
}
|
||||
|
||||
void JoinHiddenWiFiPage::initComponent()
|
||||
|
@ -245,6 +236,7 @@ void JoinHiddenWiFiPage::onSecuTypeChanged(const KySecuType &type)
|
|||
{
|
||||
if (type != KySecuType::WPA_AND_WPA2_ENTERPRISE) {
|
||||
this->setFixedHeight(MIN_WINDOW_HEIGHT);
|
||||
m_centerWidget->setFixedSize(WINDOW_WIDTH, PSK_SCRO_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,8 +244,10 @@ void JoinHiddenWiFiPage::onEapTypeChanged(const KyEapMethodType &type)
|
|||
{
|
||||
if (type == KyEapMethodType::TLS) {
|
||||
this->setFixedHeight(TLS_WINDOW_HEIGHT);
|
||||
m_centerWidget->setFixedSize(WINDOW_WIDTH, TLS_SCRO_HEIGHT);
|
||||
} else if (type == KyEapMethodType::PEAP || type == KyEapMethodType::TTLS) {
|
||||
this->setFixedHeight(PEAP_WINDOW_HEIGHT);
|
||||
m_centerWidget->setFixedSize(WINDOW_WIDTH, PEAP_SCRO_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,14 +256,14 @@ void JoinHiddenWiFiPage::onPaletteChanged()
|
|||
QPalette pal = qApp->palette();
|
||||
|
||||
QGSettings * styleGsettings = nullptr;
|
||||
// const QByteArray style_id(THEME_SCHAME);
|
||||
// if (QGSettings::isSchemaInstalled(style_id)) {
|
||||
// styleGsettings = new QGSettings(style_id);
|
||||
// QString currentTheme = styleGsettings->get(COLOR_THEME).toString();
|
||||
// if(currentTheme == "ukui-default"){
|
||||
// pal = lightPalette(this);
|
||||
// }
|
||||
// }
|
||||
const QByteArray style_id(THEME_SCHAME);
|
||||
if (QGSettings::isSchemaInstalled(style_id)) {
|
||||
styleGsettings = new QGSettings(style_id);
|
||||
QString currentTheme = styleGsettings->get(COLOR_THEME).toString();
|
||||
if(currentTheme == "ukui-default"){
|
||||
pal = lightPalette(this);
|
||||
}
|
||||
}
|
||||
this->setPalette(pal);
|
||||
setFramePalette(m_secuWidget, pal);
|
||||
setFramePalette(m_hiddenWifiScrollArea, pal);
|
||||
|
@ -279,3 +273,4 @@ void JoinHiddenWiFiPage::onPaletteChanged()
|
|||
styleGsettings = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,6 @@ public:
|
|||
JoinHiddenWiFiPage(QString devName, KDialog *parent = nullptr);
|
||||
~JoinHiddenWiFiPage();
|
||||
|
||||
void setJoinHiddenWiFiShowed(bool state);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
|
@ -63,7 +61,7 @@ private:
|
|||
QWidget *m_bottomWidget;
|
||||
SecurityPage *m_secuWidget;
|
||||
|
||||
QLabel *m_descriptionLabel;
|
||||
FixLabel *m_descriptionLabel;
|
||||
FixLabel *m_nameLabel;
|
||||
LineEdit *m_nameEdit;
|
||||
|
||||
|
@ -80,7 +78,6 @@ private:
|
|||
|
||||
bool m_isJoinBtnEnable = false;
|
||||
bool m_isSecuOk = false;
|
||||
bool m_joinHiddenWiFiShowed = false;
|
||||
ConInfo m_info;
|
||||
|
||||
private Q_SLOTS:
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include "backend/kylinipv4arping.h"
|
||||
#include "backend/kylinipv6arping.h"
|
||||
//#include "xatom/xatom-helper.h"
|
||||
#include "networkmodeconfig.h"
|
||||
|
||||
|
||||
#define THEME_SCHAME "org.ukui.style"
|
||||
#define COLOR_THEME "styleName"
|
||||
|
@ -41,6 +39,7 @@
|
|||
#define CENTER_LAYOUT_MARGINS 24,0,0,0
|
||||
#define BOTTOM_LAYOUT_MARGINS 24,0,24,0
|
||||
#define BOTTOM_LAYOUT_SPACING 16
|
||||
#define PAGE_LAYOUT_SPACING 1
|
||||
#define DETAIL_PAGE_NUM 0
|
||||
#define IPV4_PAGE_NUM 1
|
||||
#define IPV6_PAGE_NUM 2
|
||||
|
@ -48,36 +47,15 @@
|
|||
#define CONFIG_PAGE_NUM 4
|
||||
#define CREATE_NET_PAGE_NUM 5
|
||||
#define PAGE_MIN_HEIGHT 40
|
||||
#define PAGE_WIDTH 472
|
||||
#define LAN_TAB_WIDTH 180
|
||||
#define WLAN_TAB_WIDTH 240
|
||||
#define SCRO_WIDTH 496
|
||||
#define SCRO_HEIGHT 600
|
||||
#define SCRO_WIDTH 472
|
||||
#define PEAP_SCRO_HEIGHT 300
|
||||
#define TLS_SCRO_HEIGHT 480
|
||||
#define MAX_TAB_TEXT_LENGTH 44
|
||||
#define KYLIN_APP_MANAGER_NAME "com.kylin.AppManager"
|
||||
#define KYLIN_APP_MANAGER_PATH "/com/kylin/AppManager"
|
||||
#define KYLIN_APP_MANAGER_INTERFACE "com.kylin.AppManager"
|
||||
|
||||
//extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed);
|
||||
|
||||
bool LaunchApp(QString desktopFile)
|
||||
{
|
||||
QDBusInterface m_appManagerDbusInterface(KYLIN_APP_MANAGER_NAME,
|
||||
KYLIN_APP_MANAGER_PATH,
|
||||
KYLIN_APP_MANAGER_INTERFACE,
|
||||
QDBusConnection::sessionBus());//局部变量
|
||||
|
||||
if (!m_appManagerDbusInterface.isValid()) {
|
||||
qWarning()<<"m_appManagerDbusInterface init error";
|
||||
return false;
|
||||
} else {
|
||||
QDBusReply<bool> reply =m_appManagerDbusInterface.call("LaunchApp",desktopFile);
|
||||
return reply;
|
||||
}
|
||||
}
|
||||
|
||||
void NetDetail::showDesktopNotify(const QString &message, QString soundName)
|
||||
{
|
||||
QDBusInterface iface("org.freedesktop.Notifications",
|
||||
|
@ -189,7 +167,7 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv
|
|||
getConInfo(m_info);
|
||||
startObjectThread();
|
||||
pagePadding(name,isWlan);
|
||||
|
||||
setSecuPageHeight();
|
||||
connect(qApp, &QApplication::paletteChanged, this, &NetDetail::onPaletteChanged);
|
||||
|
||||
isCreateOk = !(m_isCreateNet && !isWlan);
|
||||
|
@ -218,16 +196,16 @@ void NetDetail::onPaletteChanged()
|
|||
{
|
||||
QPalette pal = qApp->palette();
|
||||
|
||||
// QGSettings * styleGsettings = nullptr;
|
||||
// const QByteArray style_id(THEME_SCHAME);
|
||||
// if (QGSettings::isSchemaInstalled(style_id)) {
|
||||
// styleGsettings = new QGSettings(style_id);
|
||||
// QString currentTheme = styleGsettings->get(COLOR_THEME).toString();
|
||||
// if(currentTheme == "ukui-default"){
|
||||
// pal = lightPalette(this);
|
||||
// }
|
||||
// }
|
||||
|
||||
QGSettings * styleGsettings = nullptr;
|
||||
const QByteArray style_id(THEME_SCHAME);
|
||||
if (QGSettings::isSchemaInstalled(style_id)) {
|
||||
styleGsettings = new QGSettings(style_id);
|
||||
QString currentTheme = styleGsettings->get(COLOR_THEME).toString();
|
||||
if(currentTheme == "ukui-default"){
|
||||
pal = lightPalette(this);
|
||||
}
|
||||
}
|
||||
pal.setColor(QPalette::Background, pal.base().color());
|
||||
this->setPalette(pal);
|
||||
|
||||
setFramePalette(detailPage, pal);
|
||||
|
@ -238,18 +216,15 @@ void NetDetail::onPaletteChanged()
|
|||
QToolTip::setPalette(pal);
|
||||
|
||||
QPalette listwidget_pal(detailPage->m_listWidget->palette());
|
||||
listwidget_pal.setColor(QPalette::Base, this->palette().base().color());
|
||||
listwidget_pal.setColor(QPalette::AlternateBase, this->palette().alternateBase().color());
|
||||
listwidget_pal.setColor(QPalette::Base, pal.base().color());
|
||||
listwidget_pal.setColor(QPalette::AlternateBase, pal.alternateBase().color());
|
||||
detailPage->m_listWidget->setAlternatingRowColors(true);
|
||||
detailPage->m_listWidget->setPalette(listwidget_pal);
|
||||
|
||||
// if (styleGsettings != nullptr) {
|
||||
// delete styleGsettings;
|
||||
// styleGsettings = nullptr;
|
||||
// }
|
||||
|
||||
QColor colorTabBar = pal.color(QPalette::Disabled, QPalette::Highlight);
|
||||
m_netTabBar->setBackgroundColor(colorTabBar);
|
||||
if (styleGsettings != nullptr) {
|
||||
delete styleGsettings;
|
||||
styleGsettings = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void NetDetail::currentRowChangeSlot(int row)
|
||||
|
@ -271,24 +246,19 @@ void NetDetail::currentRowChangeSlot(int row)
|
|||
|
||||
void NetDetail::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPalette pal = qApp->palette();
|
||||
QPainter painter(this);
|
||||
painter.setBrush(pal.color(QPalette::Base));
|
||||
painter.drawRect(this->rect());
|
||||
painter.fillRect(rect(), QBrush(pal.color(QPalette::Base)));
|
||||
// QPalette pal = qApp->palette();
|
||||
// QPainter painter(this);
|
||||
// painter.setBrush(pal.color(QPalette::Base));
|
||||
// painter.drawRect(this->rect());
|
||||
// painter.fillRect(rect(), QBrush(pal.color(QPalette::Base)));
|
||||
|
||||
return QWidget::paintEvent(event);
|
||||
}
|
||||
|
||||
void NetDetail::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
Q_EMIT this->detailPageClose(false);
|
||||
Q_EMIT this->detailPageClose(m_deviceName, m_name, m_uuid);
|
||||
Q_EMIT this->createPageClose(m_deviceName);
|
||||
|
||||
if (m_hasDetailPageShowed) {
|
||||
LaunchApp("ukui-control-center.desktop");
|
||||
m_hasDetailPageShowed = false;
|
||||
}
|
||||
return QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
|
@ -311,79 +281,69 @@ void NetDetail::initUI()
|
|||
{
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setContentsMargins(0,9,0,24);
|
||||
mainLayout->setSpacing(22);
|
||||
|
||||
this->installEventFilter(this);
|
||||
pageFrame = new QFrame(this);
|
||||
centerWidget = new QWidget(this);
|
||||
bottomWidget = new QWidget(this);
|
||||
mainLayout->setSpacing(24);
|
||||
|
||||
detailPage = new DetailPage(isWlan, m_name.isEmpty(), this);
|
||||
|
||||
ipv4Page = new Ipv4Page(this);
|
||||
ipv6Page = new Ipv6Page(this);
|
||||
securityPage = new SecurityPage(this);
|
||||
createNetPage = new CreatNetPage(this);
|
||||
configPage = new ConfigPage(this);
|
||||
|
||||
detailPage->setFixedWidth(PAGE_WIDTH);
|
||||
ipv4Page->setFixedWidth(PAGE_WIDTH);
|
||||
ipv6Page->setFixedWidth(PAGE_WIDTH);
|
||||
securityPage->setFixedWidth(PAGE_WIDTH);
|
||||
createNetPage->setFixedWidth(PAGE_WIDTH);
|
||||
configPage->setFixedWidth(PAGE_WIDTH);
|
||||
this->installEventFilter(this);
|
||||
|
||||
centerWidget = new QWidget(this);
|
||||
bottomWidget = new QWidget(this);
|
||||
|
||||
// 滚动区域
|
||||
m_secuPageScrollArea = new QScrollArea(centerWidget);
|
||||
m_secuPageScrollArea->setFixedWidth(SCRO_WIDTH);
|
||||
m_secuPageScrollArea = new QScrollArea(this);
|
||||
m_secuPageScrollArea->setFrameShape(QFrame::NoFrame);
|
||||
m_secuPageScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_secuPageScrollArea->setWidget(securityPage);
|
||||
m_secuPageScrollArea->setWidgetResizable(true);
|
||||
|
||||
m_ipv4ScrollArea = new QScrollArea(centerWidget);
|
||||
m_ipv4ScrollArea->setFixedWidth(SCRO_WIDTH);
|
||||
m_ipv4ScrollArea->setFrameShape(QFrame::NoFrame);
|
||||
m_ipv4ScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_ipv4ScrollArea->setWidget(ipv4Page);
|
||||
m_ipv4ScrollArea->setWidgetResizable(true);
|
||||
|
||||
m_ipv6ScrollArea = new QScrollArea(centerWidget);
|
||||
m_ipv6ScrollArea->setFixedWidth(SCRO_WIDTH);
|
||||
m_ipv6ScrollArea->setFrameShape(QFrame::NoFrame);
|
||||
m_ipv6ScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_ipv6ScrollArea->setWidget(ipv6Page);
|
||||
m_ipv6ScrollArea->setWidgetResizable(true);
|
||||
|
||||
QPalette pal = m_secuPageScrollArea->palette();
|
||||
pal.setBrush(QPalette::Window, Qt::transparent);
|
||||
pal.setBrush(QPalette::Base, QColor(0,0,0,0));
|
||||
m_secuPageScrollArea->setPalette(pal);
|
||||
m_ipv4ScrollArea->setPalette(pal);
|
||||
m_ipv6ScrollArea->setPalette(pal);
|
||||
|
||||
detailPage->setFixedWidth(SCRO_WIDTH);
|
||||
ipv4Page->setFixedWidth(SCRO_WIDTH);
|
||||
ipv6Page->setFixedWidth(SCRO_WIDTH);
|
||||
createNetPage->setFixedWidth(SCRO_WIDTH);
|
||||
configPage->setFixedWidth(SCRO_WIDTH);
|
||||
|
||||
stackWidget = new QStackedWidget(centerWidget);
|
||||
stackWidget->addWidget(detailPage);
|
||||
stackWidget->addWidget(m_ipv4ScrollArea);
|
||||
stackWidget->addWidget(m_ipv6ScrollArea);
|
||||
stackWidget->addWidget(ipv4Page);
|
||||
stackWidget->addWidget(ipv6Page);
|
||||
stackWidget->addWidget(m_secuPageScrollArea);
|
||||
stackWidget->addWidget(configPage);
|
||||
stackWidget->addWidget(createNetPage);
|
||||
|
||||
mainLayout->addWidget(centerWidget);
|
||||
mainLayout->addWidget(bottomWidget);
|
||||
|
||||
bottomWidget->setMinimumHeight(PAGE_MIN_HEIGHT);
|
||||
|
||||
pageFrame = new QFrame(this);
|
||||
QHBoxLayout *pageLayout = new QHBoxLayout(pageFrame);
|
||||
// pageLayout->setSpacing(PAGE_LAYOUT_SPACING);
|
||||
|
||||
// TabBar
|
||||
onPaletteChanged();
|
||||
m_networkMode = NetworkModeType(NetworkModeConfig::getInstance()->getNetworkModeConfig(m_uuid));
|
||||
m_netTabBar = new NetTabBar(this);
|
||||
m_netTabBar->addTab(tr("Detail")); //详情
|
||||
m_netTabBar->addTab(tr("IPv4"));//Ipv4
|
||||
m_netTabBar->addTab(tr("IPv6"));//Ipv6
|
||||
if (isWlan) {
|
||||
m_netTabBar->addTab(tr("Security"));//安全
|
||||
if (isActive) {
|
||||
if (isActive && m_networkMode != DBUS_INVAILD && m_networkMode != NO_CONFIG) {
|
||||
m_netTabBar->addTab(tr("Config")); //配置
|
||||
m_netTabBar->setFixedWidth(WLAN_TAB_WIDTH + TAB_WIDTH);
|
||||
} else {
|
||||
m_netTabBar->setFixedWidth(WLAN_TAB_WIDTH);
|
||||
}
|
||||
} else {
|
||||
if (isActive) {
|
||||
if (isActive && m_networkMode != DBUS_INVAILD && m_networkMode != NO_CONFIG) {
|
||||
m_netTabBar->addTab(tr("Config")); //配置
|
||||
m_netTabBar->setFixedWidth(LAN_TAB_WIDTH + TAB_WIDTH);
|
||||
} else {
|
||||
|
@ -391,26 +351,27 @@ void NetDetail::initUI()
|
|||
}
|
||||
}
|
||||
|
||||
pageLayout->addWidget(m_netTabBar, Qt::AlignCenter);
|
||||
pageLayout->addSpacing(24);
|
||||
|
||||
// TabBar关联选项卡页面
|
||||
connect(m_netTabBar, SIGNAL(currentChanged(int)), this, SLOT(currentRowChangeSlot(int)));
|
||||
setNetTabToolTip();
|
||||
|
||||
confimBtn = new QPushButton(this);
|
||||
confimBtn->setText(tr("Confirm"));
|
||||
|
||||
cancelBtn = new QPushButton(this);
|
||||
cancelBtn->setText(tr("Cancel"));
|
||||
forgetBtn = new QPushButton(this);
|
||||
|
||||
QHBoxLayout *pageLayout = new QHBoxLayout(pageFrame);
|
||||
pageLayout->setContentsMargins(0, 0, 0, 0);
|
||||
pageLayout->addWidget(m_netTabBar, Qt::AlignCenter);
|
||||
forgetBtn = new QPushButton(this);
|
||||
|
||||
QVBoxLayout *centerlayout = new QVBoxLayout(centerWidget);
|
||||
centerlayout->setContentsMargins(CENTER_LAYOUT_MARGINS); // 右边距为0,为安全页滚动区域留出空间
|
||||
centerlayout->addWidget(pageFrame);
|
||||
centerlayout->addSpacing(4);
|
||||
centerlayout->addWidget(stackWidget);
|
||||
|
||||
// centerWidget->setStyleSheet("QWidget{border:1px solid rgba(255,0,0,1);}");//测试用, 画出边界线
|
||||
|
||||
QHBoxLayout *bottomLayout = new QHBoxLayout(bottomWidget);
|
||||
bottomLayout->setContentsMargins(BOTTOM_LAYOUT_MARGINS);
|
||||
bottomLayout->setSpacing(BOTTOM_LAYOUT_SPACING);
|
||||
|
@ -418,14 +379,11 @@ void NetDetail::initUI()
|
|||
bottomLayout->addStretch();
|
||||
bottomLayout->addWidget(cancelBtn);
|
||||
bottomLayout->addWidget(confimBtn);
|
||||
bottomWidget->setMinimumHeight(PAGE_MIN_HEIGHT);
|
||||
|
||||
mainLayout->addWidget(pageFrame);
|
||||
mainLayout->addWidget(centerWidget);
|
||||
mainLayout->addWidget(bottomWidget);
|
||||
|
||||
// QPalette pal(this->palette());
|
||||
// pal.setColor(QPalette::Background, qApp->palette().base().color());
|
||||
this->setAutoFillBackground(true);
|
||||
onPaletteChanged();
|
||||
// this->setPalette(pal);
|
||||
}
|
||||
|
||||
void NetDetail::loadPage()
|
||||
|
@ -434,13 +392,12 @@ void NetDetail::loadPage()
|
|||
if (m_isCreateNet && !isWlan) {
|
||||
pageFrame->hide();
|
||||
stackWidget->setCurrentIndex(CREATE_NET_PAGE_NUM);
|
||||
this->setWindowTitle(tr("Add Lan Connect"));
|
||||
setDetailPageShowed(true);
|
||||
this->setWindowTitle(tr("Add LAN Connect"));
|
||||
} else {
|
||||
stackWidget->setCurrentIndex(DETAIL_PAGE_NUM);
|
||||
this->setWindowTitle(m_name);
|
||||
if (isWlan && m_name.isEmpty()) {
|
||||
this->setWindowTitle(tr("connect hiddin wlan"));
|
||||
this->setWindowTitle(tr("Connect Hidden WLAN"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -489,6 +446,13 @@ void NetDetail::initComponent()
|
|||
setConfirmEnable();
|
||||
});
|
||||
|
||||
connect(securityPage, &SecurityPage::secuTypeChanged, this, [=]() {
|
||||
setSecuPageHeight();
|
||||
});
|
||||
connect(securityPage, &SecurityPage::eapTypeChanged, this, [=]() {
|
||||
setSecuPageHeight();
|
||||
});
|
||||
|
||||
const QByteArray id(THEME_SCHAME);
|
||||
if(QGSettings::isSchemaInstalled(id)){
|
||||
QGSettings * fontSetting = new QGSettings(id, QByteArray(), this);
|
||||
|
@ -527,9 +491,8 @@ void NetDetail::pagePadding(QString netName, bool isWlan)
|
|||
ipv4Page->setIpv4Config(m_info.ipv4ConfigType);
|
||||
ipv4Page->setIpv4(m_info.strIPV4Address);
|
||||
ipv4Page->setNetMask(m_info.strIPV4NetMask);
|
||||
// ipv4Page->setIpv4FirDns(m_info.strIPV4FirDns);
|
||||
// ipv4Page->setIpv4SecDns(m_info.strIPV4SecDns);
|
||||
ipv4Page->setMulDns(m_info.ipv4DnsList);
|
||||
ipv4Page->setIpv4FirDns(m_info.strIPV4FirDns);
|
||||
ipv4Page->setIpv4SecDns(m_info.strIPV4SecDns);
|
||||
ipv4Page->setGateWay(m_info.strIPV4GateWay);
|
||||
} else {
|
||||
ipv4Page->setIpv4Config(m_info.ipv4ConfigType);
|
||||
|
@ -540,9 +503,8 @@ void NetDetail::pagePadding(QString netName, bool isWlan)
|
|||
ipv6Page->setIpv6Config(m_info.ipv6ConfigType);
|
||||
ipv6Page->setIpv6(m_info.strIPV6Address);
|
||||
ipv6Page->setIpv6Perfix(m_info.iIPV6Prefix);
|
||||
// ipv6Page->setIpv6FirDns(m_info.strIPV6FirDns);
|
||||
// ipv6Page->setIpv6SecDns(m_info.strIPV6SecDns);
|
||||
ipv6Page->setMulDns(m_info.ipv6DnsList);
|
||||
ipv6Page->setIpv6FirDns(m_info.strIPV6FirDns);
|
||||
ipv6Page->setIpv6SecDns(m_info.strIPV6SecDns);
|
||||
ipv6Page->setGateWay(m_info.strIPV6GateWay);
|
||||
} else {
|
||||
ipv6Page->setIpv6Config(m_info.ipv6ConfigType);
|
||||
|
@ -564,8 +526,8 @@ void NetDetail::pagePadding(QString netName, bool isWlan)
|
|||
}
|
||||
|
||||
//配置页面
|
||||
if (isActive) {
|
||||
configPage->setConfigState(NetworkModeConfig::getInstance()->getNetworkModeConfig(m_uuid));
|
||||
if (isActive && m_networkMode != DBUS_INVAILD && m_networkMode != NO_CONFIG) {
|
||||
configPage->setConfigState(m_networkMode);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -689,16 +651,22 @@ void NetDetail::getStaticIpInfo(ConInfo &conInfo, bool bActived)
|
|||
kyConnectResourse->getConnectionSetting(m_uuid,connetSetting);
|
||||
connetSetting.dumpInfo();
|
||||
|
||||
// conInfo.ipv4ConfigType = connetSetting.m_ipv4ConfigIpType;
|
||||
conInfo.ipv4ConfigType = connetSetting.m_ipv4ConfigIpType;
|
||||
conInfo.ipv6ConfigType = connetSetting.m_ipv6ConfigIpType;
|
||||
conInfo.isAutoConnect = connetSetting.m_isAutoConnect;
|
||||
|
||||
//openkylin从第三方库读取有问题 改为ipv4信息直接通过dbus获取
|
||||
KyConnectItem* item = kyConnectResourse->getConnectionItemByUuidWithoutActivateChecking(m_uuid);
|
||||
if (item == nullptr) {
|
||||
conInfo.ipv4ConfigType = CONFIG_IP_DHCP;
|
||||
} else {
|
||||
getIpv4Info(item->m_connectPath, conInfo);
|
||||
if (connetSetting.m_ipv4ConfigIpType == CONFIG_IP_MANUAL) {
|
||||
if (connetSetting.m_ipv4Address.size() > 0) {
|
||||
conInfo.strIPV4Address = connetSetting.m_ipv4Address.at(0).ip().toString();
|
||||
conInfo.strIPV4NetMask = connetSetting.m_ipv4Address.at(0).netmask().toString();
|
||||
conInfo.strIPV4GateWay = connetSetting.m_ipv4Address.at(0).gateway().toString();
|
||||
}
|
||||
if (connetSetting.m_ipv4Dns.size() == 1) {
|
||||
conInfo.strIPV4FirDns = connetSetting.m_ipv4Dns.at(0).toString();
|
||||
} else if (connetSetting.m_ipv4Dns.size() > 1) {
|
||||
conInfo.strIPV4FirDns = connetSetting.m_ipv4Dns.at(0).toString();
|
||||
conInfo.strIPV4SecDns = connetSetting.m_ipv4Dns.at(1).toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (connetSetting.m_ipv6ConfigIpType == CONFIG_IP_MANUAL) {
|
||||
|
@ -707,29 +675,19 @@ void NetDetail::getStaticIpInfo(ConInfo &conInfo, bool bActived)
|
|||
conInfo.iIPV6Prefix = ipv6Page->getPerfixLength(connetSetting.m_ipv6Address.at(0).netmask().toString());
|
||||
conInfo.strIPV6GateWay = connetSetting.m_ipv6Address.at(0).gateway().toString();
|
||||
}
|
||||
#if 0
|
||||
|
||||
if (connetSetting.m_ipv6Dns.size() == 1) {
|
||||
conInfo.strIPV6FirDns = connetSetting.m_ipv6Dns.at(0).toString();
|
||||
} else if (connetSetting.m_ipv4Dns.size() > 1) {
|
||||
conInfo.strIPV6FirDns = connetSetting.m_ipv6Dns.at(0).toString();
|
||||
conInfo.strIPV6SecDns = connetSetting.m_ipv6Dns.at(1).toString();
|
||||
}
|
||||
#endif
|
||||
|
||||
conInfo.ipv6DnsList = connetSetting.m_ipv6Dns;
|
||||
}
|
||||
|
||||
if (!bActived) {
|
||||
conInfo.strDynamicIpv4 = conInfo.strIPV4Address.isEmpty() ? tr("Auto") : conInfo.strIPV4Address;
|
||||
conInfo.strDynamicIpv6 = conInfo.strIPV6Address.isEmpty() ? tr("Auto") : conInfo.strIPV6Address;
|
||||
QString dns(" ");
|
||||
for (int i = 0; i < conInfo.ipv4DnsList.size(); ++i) {
|
||||
dns.append(conInfo.ipv4DnsList.at(i).toString());
|
||||
if (i != conInfo.ipv4DnsList.size()-1) {
|
||||
dns.append(" ");
|
||||
}
|
||||
}
|
||||
conInfo.strDynamicIpv4Dns = dns.isEmpty() ? tr("Auto") : dns;
|
||||
conInfo.strDynamicIpv4Dns = conInfo.strIPV4FirDns.isEmpty() ? tr("Auto") : conInfo.strIPV4FirDns;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -769,6 +727,22 @@ void NetDetail::initSecuData()
|
|||
}
|
||||
}
|
||||
|
||||
void NetDetail::setSecuPageHeight()
|
||||
{
|
||||
KySecuType secuType;
|
||||
KyEapMethodType eapType;
|
||||
securityPage->getSecuType(secuType, eapType);
|
||||
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
|
||||
if (eapType == TLS) {
|
||||
securityPage->setFixedSize(SCRO_WIDTH, TLS_SCRO_HEIGHT);
|
||||
} else {
|
||||
securityPage->setFixedSize(SCRO_WIDTH, PEAP_SCRO_HEIGHT);
|
||||
}
|
||||
} else {
|
||||
securityPage->setFixedSize(SCRO_WIDTH, PEAP_SCRO_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
void NetDetail::initTlsInfo(ConInfo &conInfo)
|
||||
{
|
||||
m_resource->getEnterPriseInfoTls(m_uuid, conInfo.tlsInfo);
|
||||
|
@ -1087,7 +1061,7 @@ bool NetDetail::updateConnect()
|
|||
}
|
||||
}
|
||||
|
||||
if (configPage != nullptr) {
|
||||
if (m_networkMode != DBUS_INVAILD && m_networkMode != NO_CONFIG) {
|
||||
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(m_uuid);
|
||||
bool configPageChange = configPage->checkIsChanged(configType);
|
||||
int currentConfigType = configPage->getConfigState();
|
||||
|
@ -1144,11 +1118,6 @@ bool NetDetail::eventFilter(QObject *w, QEvent *event)
|
|||
return QWidget::eventFilter(w, event);
|
||||
}
|
||||
|
||||
void NetDetail::setDetailPageShowed(bool state)
|
||||
{
|
||||
m_hasDetailPageShowed = state;
|
||||
}
|
||||
|
||||
void NetDetail::setNetTabToolTip()
|
||||
{
|
||||
int tabCount = m_netTabBar->count();
|
||||
|
@ -1166,26 +1135,7 @@ void NetDetail::setNetTabToolTip()
|
|||
NetTabBar::NetTabBar(QWidget *parent)
|
||||
:KTabBar(KTabBarStyle::SegmentDark, parent)
|
||||
{
|
||||
//模式切换
|
||||
QDBusConnection::sessionBus().connect(QString("com.kylin.statusmanager.interface"),
|
||||
QString("/"),
|
||||
QString("com.kylin.statusmanager.interface"),
|
||||
QString("mode_change_signal"), this, SLOT(onModeChanged(bool)));
|
||||
//模式获取
|
||||
QDBusInterface interface(QString("com.kylin.statusmanager.interface"),
|
||||
QString("/"),
|
||||
QString("com.kylin.statusmanager.interface"),
|
||||
QDBusConnection::sessionBus());
|
||||
if(!interface.isValid()) {
|
||||
this->setFixedHeight(TAB_HEIGHT);
|
||||
return;
|
||||
}
|
||||
QDBusReply<bool> reply = interface.call("get_current_tabletmode");
|
||||
if (!reply.isValid()) {
|
||||
this->setFixedHeight(TAB_HEIGHT);
|
||||
return;
|
||||
}
|
||||
onModeChanged(reply.value());
|
||||
|
||||
}
|
||||
|
||||
NetTabBar::~NetTabBar()
|
||||
|
@ -1195,27 +1145,15 @@ NetTabBar::~NetTabBar()
|
|||
|
||||
QSize NetTabBar::sizeHint() const
|
||||
{
|
||||
QSize size = KTabBar::sizeHint();
|
||||
size.setWidth(TAB_WIDTH);
|
||||
return size;
|
||||
return QSize(TAB_WIDTH, TAB_HEIGHT);
|
||||
}
|
||||
|
||||
QSize NetTabBar::minimumTabSizeHint(int index) const
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
QSize size = KTabBar::minimumTabSizeHint(index);
|
||||
size.setWidth(TAB_WIDTH);
|
||||
return size;
|
||||
return QSize(TAB_WIDTH, TAB_HEIGHT);
|
||||
}
|
||||
|
||||
void NetTabBar::onModeChanged(bool mode)
|
||||
{
|
||||
if (mode) {
|
||||
this->setFixedHeight(TAB_HEIGHT_TABLET); // 平板模式
|
||||
} else {
|
||||
this->setFixedHeight(TAB_HEIGHT); // PC模式
|
||||
}
|
||||
}
|
||||
|
||||
ThreadObject::ThreadObject(QString deviceName, QObject *parent)
|
||||
:m_devName(deviceName), QObject(parent)
|
||||
|
@ -1242,6 +1180,24 @@ void ThreadObject::checkIpv4ConflictThread(const QString &ipv4Address)
|
|||
KyIpv4Arping* ipv4Arping = new KyIpv4Arping(m_devName, ipv4Address);
|
||||
if (ipv4Arping->ipv4ConflictCheck() >= 0) {
|
||||
isConflict = ipv4Arping->ipv4IsConflict();
|
||||
if (isConflict) {
|
||||
QString mac = ipv4Arping->getMacAddress();
|
||||
qDebug() << "conflict mac" << mac;
|
||||
KyNetworkDeviceResourse resource;
|
||||
QStringList devList,devList1,devList2;
|
||||
resource.getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, devList1);
|
||||
resource.getNetworkDeviceList(NetworkManager::Device::Type::Wifi, devList2);
|
||||
devList << devList1 << devList2;
|
||||
for(int i = 0; i < devList.size(); ++i){
|
||||
QString hardAddress;
|
||||
int band;
|
||||
resource.getHardwareInfo(devList.at(i), hardAddress, band);
|
||||
if (hardAddress == mac) {
|
||||
qDebug() << "conflict local card" << devList.at(i);
|
||||
isConflict = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qWarning() << "checkIpv4Conflict internal error";
|
||||
}
|
||||
|
@ -1258,7 +1214,6 @@ void ThreadObject::checkIpv6ConflictThread(const QString &ipv6Address)
|
|||
}
|
||||
bool isConflict = false;
|
||||
KyIpv6Arping* ipv6rping = new KyIpv6Arping(m_devName, ipv6Address);
|
||||
|
||||
if (ipv6rping->ipv6ConflictCheck() >= 0) {
|
||||
isConflict = ipv6rping->ipv6IsConflict();
|
||||
} else {
|
||||
|
@ -1269,88 +1224,3 @@ void ThreadObject::checkIpv6ConflictThread(const QString &ipv6Address)
|
|||
ipv6rping = nullptr;
|
||||
Q_EMIT ipv6IsConflict(isConflict);
|
||||
}
|
||||
|
||||
void NetDetail::getIpv4Info(QString objPath, ConInfo &conInfo)
|
||||
{
|
||||
QDBusInterface m_interface("org.freedesktop.NetworkManager",
|
||||
objPath,
|
||||
"org.freedesktop.NetworkManager.Settings.Connection",
|
||||
QDBusConnection::systemBus());
|
||||
QDBusMessage result = m_interface.call("GetSettings");
|
||||
|
||||
if (result.arguments().isEmpty()) { return; }
|
||||
const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value<QDBusArgument>();
|
||||
QMap<QString,QMap<QString,QVariant>> map;
|
||||
dbusArg1st >> map;
|
||||
|
||||
for (QString key : map.keys() ) {
|
||||
QMap<QString,QVariant> innerMap = map.value(key);
|
||||
if (key == "ipv4") {
|
||||
for (QString inner_key : innerMap.keys()) {
|
||||
if (inner_key == "address-data") {
|
||||
//ipv4地址 ipv4子网掩码
|
||||
const QDBusArgument &dbusArg2nd = innerMap.value(inner_key).value<QDBusArgument>();
|
||||
QVector<QMap<QString,QVariant>> addressVector;
|
||||
|
||||
dbusArg2nd.beginArray();
|
||||
|
||||
while (!dbusArg2nd.atEnd()) {
|
||||
QMap<QString,QVariant> tempMap;
|
||||
dbusArg2nd >> tempMap;
|
||||
addressVector.append(tempMap);
|
||||
}
|
||||
dbusArg2nd.endArray();
|
||||
if (addressVector.size() >= 1) {
|
||||
conInfo.strIPV4Address = addressVector.at(0).value("address").toString();
|
||||
conInfo.strIPV4NetMask = ipv4Page->getNetMaskText(addressVector.at(0).value("prefix").toString());
|
||||
}
|
||||
} else if (inner_key == "method") {
|
||||
//ipv4 method
|
||||
if (innerMap.value(inner_key).toString() == "auto")
|
||||
conInfo.ipv4ConfigType = CONFIG_IP_DHCP;
|
||||
else {
|
||||
conInfo.ipv4ConfigType = CONFIG_IP_MANUAL;
|
||||
}
|
||||
} else if (inner_key == "dns") {
|
||||
//dns
|
||||
const QDBusArgument &dbusArg2nd = innerMap.value(inner_key).value<QDBusArgument>();
|
||||
QList<uint> addressVector;
|
||||
|
||||
dbusArg2nd.beginArray();
|
||||
while (!dbusArg2nd.atEnd()) {
|
||||
uint tempMap;
|
||||
dbusArg2nd >> tempMap;
|
||||
addressVector.append(tempMap);
|
||||
}
|
||||
dbusArg2nd.endArray();
|
||||
for (int i = 0; i < addressVector.size(); ++i) {
|
||||
QString dns(inet_ntoa(*(struct in_addr *)&addressVector.at(i)));
|
||||
conInfo.ipv4DnsList << QHostAddress(dns);
|
||||
}
|
||||
|
||||
} else if (inner_key == "gateway") {
|
||||
//gateway
|
||||
conInfo.strIPV4GateWay = innerMap.value(inner_key).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (key == "ipv6") {
|
||||
// for (QString inner_key : innerMap.keys()) {
|
||||
// if (inner_key == "address-data"){
|
||||
// const QDBusArgument &dbusArg2nd = innerMap.value(inner_key).value<QDBusArgument>();
|
||||
// QMap<QString,QVariant> m_map;
|
||||
|
||||
// dbusArg2nd.beginArray();
|
||||
// while (!dbusArg2nd.atEnd()) {
|
||||
// dbusArg2nd >> m_map;// append map to a vector here if you want to keep it
|
||||
// }
|
||||
// dbusArg2nd.endArray();
|
||||
|
||||
// dbusWifiIpv6 = m_map.value("address").toString();
|
||||
// } else if (inner_key == "method") {
|
||||
// dbusWifiIpv6Method = innerMap.value(inner_key).toString();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,13 +50,12 @@
|
|||
#include "tab-pages/tabpage.h"
|
||||
#include "kwidget.h"
|
||||
#include "ktabbar.h"
|
||||
#include "networkmodeconfig.h"
|
||||
|
||||
#include <arpa/inet.h>
|
||||
using namespace kdk;
|
||||
|
||||
#define TAB_WIDTH 60
|
||||
#define TAB_HEIGHT 36
|
||||
#define TAB_HEIGHT_TABLET 48
|
||||
|
||||
class NetTabBar : public KTabBar
|
||||
{
|
||||
|
@ -64,15 +63,10 @@ class NetTabBar : public KTabBar
|
|||
public:
|
||||
explicit NetTabBar(QWidget *parent = nullptr);
|
||||
~NetTabBar();
|
||||
protected:
|
||||
|
||||
QSize sizeHint() const;
|
||||
QSize minimumTabSizeHint(int index) const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onModeChanged(bool mode);
|
||||
|
||||
};
|
||||
|
||||
class ThreadObject : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -105,8 +99,6 @@ public:
|
|||
void closeEvent(QCloseEvent *event);
|
||||
bool eventFilter(QObject *w, QEvent *event);
|
||||
|
||||
void setDetailPageShowed(bool state);
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
void centerToScreen();
|
||||
|
@ -115,6 +107,7 @@ private:
|
|||
void loadPage();
|
||||
void pagePadding(QString netName, bool isWlan);
|
||||
void initSecuData();
|
||||
void setSecuPageHeight();
|
||||
|
||||
void initTlsInfo(ConInfo &conInfo);
|
||||
void initPeapInfo(ConInfo &conInfo);
|
||||
|
@ -147,7 +140,6 @@ private:
|
|||
void startObjectThread();
|
||||
void setNetTabToolTip();
|
||||
|
||||
void getIpv4Info(QString objPath, ConInfo &conInfo);
|
||||
private:
|
||||
KyNetworkDeviceResourse *m_netDeviceResource = nullptr;
|
||||
KyConnectOperation* m_connectOperation = nullptr;
|
||||
|
@ -167,8 +159,6 @@ private:
|
|||
QWidget * centerWidget;
|
||||
QWidget * bottomWidget;
|
||||
QScrollArea * m_secuPageScrollArea;
|
||||
QScrollArea * m_ipv4ScrollArea;
|
||||
QScrollArea * m_ipv6ScrollArea;
|
||||
|
||||
QPushButton * cancelBtn;
|
||||
QPushButton * forgetBtn;
|
||||
|
@ -192,11 +182,12 @@ private:
|
|||
bool isIpv6Ok;
|
||||
bool isSecuOk;
|
||||
bool isConfirmBtnEnable;
|
||||
bool m_hasDetailPageShowed = false;
|
||||
|
||||
ConInfo m_info;
|
||||
|
||||
ThreadObject *m_object;
|
||||
QThread *m_objectThread;
|
||||
NetworkModeType m_networkMode = DBUS_INVAILD;
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_btnConfirm_clicked();
|
||||
|
@ -207,7 +198,7 @@ protected Q_SLOTS:
|
|||
void currentRowChangeSlot(int row);
|
||||
|
||||
Q_SIGNALS:
|
||||
void detailPageClose(bool on);
|
||||
void detailPageClose(QString, QString, QString);
|
||||
void createPageClose(QString);
|
||||
void currentChanged(int);
|
||||
void checkCurrentIpv4Conflict(const QString &address);
|
||||
|
|
|
@ -10,7 +10,6 @@ HEADERS += \
|
|||
$$PWD/ipv4page.h \
|
||||
$$PWD/ipv6page.h \
|
||||
$$PWD/joinhiddenwifipage.h \
|
||||
$$PWD/multiplednswidget.h \
|
||||
$$PWD/netdetail.h \
|
||||
$$PWD/securitypage.h
|
||||
|
||||
|
@ -23,6 +22,5 @@ SOURCES += \
|
|||
$$PWD/ipv4page.cpp \
|
||||
$$PWD/ipv6page.cpp \
|
||||
$$PWD/joinhiddenwifipage.cpp \
|
||||
$$PWD/multiplednswidget.cpp \
|
||||
$$PWD/netdetail.cpp \
|
||||
$$PWD/securitypage.cpp
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define DETAIL_MIN_LABEL_WIDTH 80
|
||||
#define DETAIL_MIN_EDIT_WIDTH 390
|
||||
#define MIN_LABEL_WIDTH 146
|
||||
#define MIN_EDIT_WIDTH 286
|
||||
#define MIN_EDIT_WIDTH 278
|
||||
|
||||
SecurityPage::SecurityPage(bool isNetDetailPage, QWidget *parent) : isDetailPage(isNetDetailPage), QFrame(parent)
|
||||
{
|
||||
|
@ -223,7 +223,7 @@ void SecurityPage::initUI()
|
|||
|
||||
//PEAP TTLS共有
|
||||
eapMethodLabel->setLabelText(tr("Ineer authentication"));
|
||||
userNameLabel->setText(tr("Usename"));
|
||||
userNameLabel->setText(tr("Username"));
|
||||
userPwdLabel->setText(tr("Password"));
|
||||
userPwdFlagLabel->setText(tr("Ask pwd each query"));
|
||||
userNameEdit->setPlaceholderText(tr("Required"));
|
||||
|
@ -467,6 +467,12 @@ void SecurityPage::getSecuType(KySecuType &secuType, KyEapMethodType &enterprise
|
|||
enterpriseType = (KyEapMethodType)eapTypeCombox->currentData().toInt();
|
||||
}
|
||||
|
||||
bool SecurityPage::getAutoConnectState()
|
||||
{
|
||||
bool state = m_rememberCheckBox->isChecked();
|
||||
return state;
|
||||
}
|
||||
|
||||
bool SecurityPage::checkIsChanged(const ConInfo info)
|
||||
{
|
||||
if (info.secType != secuTypeCombox->currentData().toInt()) {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <QCheckBox>
|
||||
|
||||
#include "coninfo.h"
|
||||
#include "detailwidget.h"
|
||||
#include "kylable.h"
|
||||
#include "kwidget.h"
|
||||
#include "kpasswordedit.h"
|
||||
|
||||
|
@ -54,6 +54,7 @@ public:
|
|||
void updateTtlsChange(KyEapMethodTtlsInfo &info);
|
||||
|
||||
void getSecuType(KySecuType &secuType, KyEapMethodType &enterpriseType);
|
||||
bool getAutoConnectState();
|
||||
|
||||
private:
|
||||
bool isDetailPage;
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
*/
|
||||
#include "firewalldialog.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#define THEME_SCHAME "org.ukui.style"
|
||||
#define COLOR_THEME "styleName"
|
||||
#define ICON_SIZE 16,16
|
||||
|
||||
FirewallDialog::FirewallDialog(QWidget *parent): KDialog(parent)
|
||||
|
@ -28,6 +32,7 @@ FirewallDialog::FirewallDialog(QWidget *parent): KDialog(parent)
|
|||
this->setFixedSize(480, 204);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
// centerToScreen();
|
||||
connect(qApp, &QApplication::paletteChanged, this, &FirewallDialog::onPaletteChanged);
|
||||
}
|
||||
|
||||
FirewallDialog::~FirewallDialog()
|
||||
|
@ -38,29 +43,33 @@ FirewallDialog::~FirewallDialog()
|
|||
void FirewallDialog::initUI()
|
||||
{
|
||||
m_iconLabel = new QLabel(this);
|
||||
m_contentLabel = new QLabel(this);
|
||||
m_suggestLabel = new QLabel(this);
|
||||
m_YesBtn = new QPushButton(this);
|
||||
m_NoBtn = new QPushButton(this);
|
||||
m_contentLabel = new FixLabel(this);
|
||||
m_suggestLabel = new FixLabel(this);
|
||||
m_PublicBtn = new QPushButton(this);
|
||||
m_PrivateBtn = new QPushButton(this);
|
||||
m_dialogLayout = new QVBoxLayout(this);
|
||||
|
||||
m_contentLabel->setFixedWidth(405);
|
||||
m_suggestLabel->setFixedWidth(405);
|
||||
|
||||
QWidget *contentWidget = new QWidget(this);
|
||||
QGridLayout *contentLayout = new QGridLayout(contentWidget);
|
||||
contentLayout->setHorizontalSpacing(0);
|
||||
contentLayout->setContentsMargins(0, 0, 0, 0);
|
||||
contentLayout->addWidget(m_iconLabel, 0, 0, Qt::AlignVCenter);
|
||||
contentLayout->addWidget(m_iconLabel, 0, 0);
|
||||
contentLayout->addWidget(m_contentLabel, 0, 1);
|
||||
contentLayout->addWidget(m_suggestLabel, 1, 1);
|
||||
m_iconLabel->setFixedWidth(16);
|
||||
m_iconLabel->setFixedWidth(24);
|
||||
|
||||
QWidget *btnWidget = new QWidget(this);
|
||||
QHBoxLayout *btnLayout = new QHBoxLayout(btnWidget);
|
||||
btnLayout->setContentsMargins(0, 0, 0, 0);
|
||||
btnLayout->setSpacing(16);
|
||||
btnLayout->addStretch();
|
||||
btnLayout->addWidget(m_YesBtn);
|
||||
btnLayout->addWidget(m_NoBtn);
|
||||
btnLayout->addWidget(m_PublicBtn);
|
||||
btnLayout->addWidget(m_PrivateBtn);
|
||||
|
||||
m_dialogLayout->setContentsMargins(24, 16, 24, 24);
|
||||
m_dialogLayout->setContentsMargins(22, 16, 22, 24);
|
||||
m_dialogLayout->setSpacing(0);
|
||||
m_dialogLayout->addWidget(contentWidget);
|
||||
m_dialogLayout->addStretch();
|
||||
|
@ -73,20 +82,19 @@ void FirewallDialog::initUI()
|
|||
font.setWeight(57);
|
||||
m_contentLabel->setFont(font);
|
||||
//是否允许此网络上的其他设备发现这台电脑?
|
||||
m_contentLabel->setText(tr("Allow other devices on this network to discover this computer?"));
|
||||
m_contentLabel->setWordWrap(true);
|
||||
m_contentLabel->setLabelText(tr("Allow other devices on this network to discover this computer?"));
|
||||
//不建议在公共网络上开启此功能
|
||||
m_suggestLabel->setText(tr("It is not recommended to enable this feature on public networks"));
|
||||
m_suggestLabel->setWordWrap(true);
|
||||
m_suggestLabel->setLabelText(tr("It is not recommended to enable this feature on public networks"));
|
||||
|
||||
m_YesBtn->setText(tr("Not allowed (recommended)"));
|
||||
m_NoBtn->setText(tr("Allowed"));
|
||||
m_PublicBtn->setText(tr("Not allowed (recommended)"));
|
||||
m_PrivateBtn->setText(tr("Allowed"));
|
||||
|
||||
this->closeButton();
|
||||
this->mainWidget()->setLayout(m_dialogLayout);
|
||||
onPaletteChanged();
|
||||
|
||||
connect(m_YesBtn, &QPushButton::clicked, this, &FirewallDialog::setPublicNetMode);
|
||||
connect(m_NoBtn, &QPushButton::clicked, this, &FirewallDialog::setPrivateNetMode);
|
||||
connect(m_PublicBtn, &QPushButton::clicked, this, &FirewallDialog::setPublicNetMode);
|
||||
connect(m_PrivateBtn, &QPushButton::clicked, this, &FirewallDialog::setPrivateNetMode);
|
||||
}
|
||||
|
||||
void FirewallDialog::centerToScreen()
|
||||
|
@ -99,3 +107,24 @@ void FirewallDialog::centerToScreen()
|
|||
int y = this->height();
|
||||
this->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top());
|
||||
}
|
||||
|
||||
void FirewallDialog::onPaletteChanged()
|
||||
{
|
||||
QPalette pal = qApp->palette();
|
||||
|
||||
QGSettings * styleGsettings = nullptr;
|
||||
const QByteArray style_id(THEME_SCHAME);
|
||||
if (QGSettings::isSchemaInstalled(style_id)) {
|
||||
styleGsettings = new QGSettings(style_id);
|
||||
QString currentTheme = styleGsettings->get(COLOR_THEME).toString();
|
||||
if(currentTheme == "ukui-default"){
|
||||
pal = lightPalette(this);
|
||||
}
|
||||
}
|
||||
this->setPalette(pal);
|
||||
|
||||
if (styleGsettings != nullptr) {
|
||||
delete styleGsettings;
|
||||
styleGsettings = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,11 @@
|
|||
#include <QLabel>
|
||||
#include <QDesktopWidget>
|
||||
#include <QApplication>
|
||||
|
||||
#include "coninfo.h"
|
||||
#include "kwidget.h"
|
||||
#include "kdialog.h"
|
||||
#include "kylable.h"
|
||||
|
||||
using namespace kdk;
|
||||
|
||||
|
@ -48,16 +51,20 @@ private:
|
|||
|
||||
QString m_uuid;
|
||||
QLabel * m_iconLabel = nullptr;
|
||||
QLabel * m_contentLabel = nullptr;
|
||||
QLabel * m_suggestLabel = nullptr;
|
||||
FixLabel * m_contentLabel = nullptr;
|
||||
FixLabel * m_suggestLabel = nullptr;
|
||||
QVBoxLayout *m_dialogLayout = nullptr;
|
||||
QPushButton *m_YesBtn = nullptr;
|
||||
QPushButton *m_NoBtn = nullptr;
|
||||
QPushButton *m_PublicBtn = nullptr;
|
||||
QPushButton *m_PrivateBtn = nullptr;
|
||||
|
||||
Q_SIGNALS:
|
||||
void setPublicNetMode();
|
||||
void setPrivateNetMode();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onPaletteChanged();
|
||||
|
||||
|
||||
public Q_SLOTS:
|
||||
void closeMyself(QString uuid, int status) {
|
||||
if (uuid == m_uuid && status == 4) {
|
||||
|
|
|
@ -18,8 +18,11 @@
|
|||
*
|
||||
*/
|
||||
#include "networkmodeconfig.h"
|
||||
#include "firewalldialog.h"
|
||||
#include <QDebug>
|
||||
|
||||
#define LOG_FLAG "[NetworkMode]"
|
||||
|
||||
NetworkModeConfig *NetworkModeConfig::m_netModeInstance = nullptr;
|
||||
|
||||
NetworkModeConfig *NetworkModeConfig::getInstance()
|
||||
|
@ -37,17 +40,21 @@ NetworkModeConfig::NetworkModeConfig(QObject *parent) : QObject(parent)
|
|||
"/firewall",
|
||||
"com.ksc.defender.firewall",
|
||||
QDBusConnection::systemBus());
|
||||
if(!m_dbusInterface->isValid()) {
|
||||
qWarning() << qPrintable(QDBusConnection::sessionBus().lastError().message());
|
||||
}
|
||||
}
|
||||
|
||||
int NetworkModeConfig::getNetworkModeConfig(QString uuid)
|
||||
{
|
||||
if (uuid.isEmpty()) {
|
||||
qWarning()<< /*LOG_FLAG <<*/ "uuid is empty, so can not get network mode config";
|
||||
return -1;
|
||||
return NO_CONFIG;
|
||||
}
|
||||
|
||||
if(!m_dbusInterface->isValid()) {
|
||||
qWarning ()<< "init com.ksc.defender dbus error";
|
||||
if(m_dbusInterface == nullptr || !m_dbusInterface->isValid()) {
|
||||
qWarning () << "com.ksc.defender dbus is invalid";
|
||||
return DBUS_INVAILD;
|
||||
}
|
||||
|
||||
QDBusReply<int> reply = m_dbusInterface->call("get_networkModeConfig", uuid);
|
||||
|
@ -56,13 +63,14 @@ int NetworkModeConfig::getNetworkModeConfig(QString uuid)
|
|||
} else {
|
||||
qWarning() << "call get_networkModeConfig failed" << reply.error().message();
|
||||
}
|
||||
return -1;
|
||||
return NO_CONFIG;
|
||||
}
|
||||
|
||||
void NetworkModeConfig::setNetworkModeConfig(QString uuid, QString cardName, QString ssid, int mode)
|
||||
{
|
||||
if(!m_dbusInterface->isValid()) {
|
||||
qWarning ()<< "init com.ksc.defender dbus error";
|
||||
if(m_dbusInterface == nullptr || !m_dbusInterface->isValid()) {
|
||||
qWarning () << "com.ksc.defender dbus is invalid";
|
||||
return;
|
||||
}
|
||||
|
||||
QDBusReply<int> reply = m_dbusInterface->call("set_networkModeConfig", uuid, cardName, ssid, mode);
|
||||
|
@ -75,8 +83,9 @@ void NetworkModeConfig::setNetworkModeConfig(QString uuid, QString cardName, QSt
|
|||
|
||||
int NetworkModeConfig::breakNetworkConnect(QString uuid, QString cardName, QString ssid)
|
||||
{
|
||||
if(!m_dbusInterface->isValid()) {
|
||||
qWarning ()<< "init com.ksc.defender dbus error";
|
||||
if(m_dbusInterface == nullptr || !m_dbusInterface->isValid()) {
|
||||
qWarning () << "com.ksc.defender dbus is invalid";
|
||||
return -1;
|
||||
}
|
||||
|
||||
QDBusReply<int> reply = m_dbusInterface->call("break_networkConnect", uuid, cardName, ssid);
|
||||
|
@ -88,3 +97,157 @@ int NetworkModeConfig::breakNetworkConnect(QString uuid, QString cardName, QStri
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
//安全中心-网络防火墙模式配置
|
||||
NetworkMode::NetworkMode(QObject *parent)
|
||||
:QObject(parent)
|
||||
{
|
||||
qRegisterMetaType<NetworkManager::Device::State>("NetworkManager::Device::State");
|
||||
qRegisterMetaType<NetworkManager::Device::StateChangeReason>("NetworkManager::Device::StateChangeReason");
|
||||
m_deviceResource = new KyNetworkDeviceResourse(this);
|
||||
m_activatedConnectResource = new KyActiveConnectResourse(this);
|
||||
m_connectResource = new KyConnectResourse(this);
|
||||
m_wirelessNetResource = new KyWirelessNetResource(this);
|
||||
connect(m_activatedConnectResource, &KyActiveConnectResourse::stateChangeReason,
|
||||
this, &NetworkMode::onConnectionStateChanged);
|
||||
}
|
||||
|
||||
void NetworkMode::initWiredNetworkMode()
|
||||
{
|
||||
qDebug()<< LOG_FLAG << "initWiredNetworkMode";
|
||||
QStringList wiredDevList;
|
||||
m_deviceResource->getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, wiredDevList);
|
||||
if (wiredDevList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto devName : wiredDevList) {
|
||||
QList<KyConnectItem *> activedList;
|
||||
m_activatedConnectResource->getActiveConnectionList(devName,
|
||||
NetworkManager::ConnectionSettings::Wired,
|
||||
activedList);
|
||||
if (activedList.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(activedList.at(0)->m_connectUuid);
|
||||
if (configType == DBUS_INVAILD) {
|
||||
return;
|
||||
} else if (configType == NO_CONFIG) {
|
||||
//已连接网络无配置 默认公有配置
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(activedList.at(0)->m_connectUuid, devName,
|
||||
activedList.at(0)->m_connectName, KSC_FIREWALL_PUBLIC);
|
||||
} else {
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(activedList.at(0)->m_connectUuid, devName,
|
||||
activedList.at(0)->m_connectName, configType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkMode::initWirelessNetworkMode()
|
||||
{
|
||||
qDebug()<< LOG_FLAG << "initWirelessNetworkMode";
|
||||
QStringList wirelessDevList;
|
||||
m_deviceResource->getNetworkDeviceList(NetworkManager::Device::Type::Wifi, wirelessDevList);
|
||||
if (wirelessDevList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto devName : wirelessDevList) {
|
||||
KyWirelessNetItem wirelessNetItem;
|
||||
bool ret = m_wirelessNetResource->getActiveWirelessNetItem(devName, wirelessNetItem);
|
||||
|
||||
if (ret == true) {
|
||||
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(wirelessNetItem.m_connectUuid);
|
||||
if (configType == DBUS_INVAILD) {
|
||||
return;
|
||||
} else if (configType == NO_CONFIG) {
|
||||
//已连接网络无配置 默认公有配置
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(wirelessNetItem.m_connectUuid, devName,
|
||||
wirelessNetItem.m_connName, KSC_FIREWALL_PUBLIC);
|
||||
} else {
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(wirelessNetItem.m_connectUuid, devName,
|
||||
wirelessNetItem.m_connName, configType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkMode::setFirstConnectNetworkMode(QString uuid, QString deviceName, QString ssid)
|
||||
{
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC); //默认公有配置
|
||||
FirewallDialog *fireWallDialog = new FirewallDialog();
|
||||
fireWallDialog->setUuid(uuid);
|
||||
fireWallDialog->setWindowTitle(ssid);
|
||||
|
||||
connect(fireWallDialog, &FirewallDialog::setPrivateNetMode, this, [=](){
|
||||
fireWallDialog->hide();
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PRIVATE);
|
||||
});
|
||||
|
||||
connect(fireWallDialog, &FirewallDialog::setPublicNetMode, this, [=](){
|
||||
fireWallDialog->hide();
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC);
|
||||
});
|
||||
|
||||
connect(m_activatedConnectResource, &KyActiveConnectResourse::stateChangeReason, fireWallDialog, &FirewallDialog::closeMyself);
|
||||
|
||||
fireWallDialog->show();
|
||||
fireWallDialog->centerToScreen();
|
||||
}
|
||||
|
||||
void NetworkMode::onConnectionStateChanged(QString uuid,
|
||||
NetworkManager::ActiveConnection::State state,
|
||||
NetworkManager::ActiveConnection::Reason reason)
|
||||
{
|
||||
if (state == NetworkManager::ActiveConnection::State::Activated) {
|
||||
QString deviceName = "";
|
||||
QString ssid = "";
|
||||
|
||||
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(uuid);
|
||||
|
||||
//有线网络连接
|
||||
if (m_connectResource->isWiredConnection(uuid)) {
|
||||
KyConnectItem *p_newItem = nullptr;
|
||||
p_newItem = m_activatedConnectResource->getActiveConnectionByUuid(uuid);
|
||||
if (nullptr == p_newItem) {
|
||||
//删除此网络
|
||||
qDebug()<< LOG_FLAG << "delete wired connect:" << uuid << ", call break_networkConnect";
|
||||
NetworkModeConfig::getInstance()->breakNetworkConnect(uuid, "", "");
|
||||
return;
|
||||
}
|
||||
|
||||
deviceName = p_newItem->m_ifaceName;
|
||||
ssid = p_newItem->m_connectName;
|
||||
if (configType == NO_CONFIG) {
|
||||
//首次连接的网络
|
||||
setFirstConnectNetworkMode(uuid, deviceName, ssid);
|
||||
} else if (configType == KSC_FIREWALL_PUBLIC) {
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC);
|
||||
} else if (configType == KSC_FIREWALL_PRIVATE) {
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PRIVATE);
|
||||
}
|
||||
}
|
||||
//无线网络连接
|
||||
if (m_connectResource->isWirelessConnection(uuid)) {
|
||||
m_wirelessNetResource->getSsidByUuid(uuid, ssid);
|
||||
m_wirelessNetResource->getDeviceByUuid(uuid, deviceName);
|
||||
if (ssid.isEmpty()) {
|
||||
//忘记此网络
|
||||
qDebug()<< LOG_FLAG << "forgrt wireless connect:" << uuid <<", call break_networkConnect";
|
||||
NetworkModeConfig::getInstance()->breakNetworkConnect(uuid, "", "");
|
||||
}
|
||||
|
||||
if (configType == NO_CONFIG) {
|
||||
setFirstConnectNetworkMode(uuid, deviceName, ssid);
|
||||
} else if (configType == KSC_FIREWALL_PUBLIC) {
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC);
|
||||
} else if (configType == KSC_FIREWALL_PRIVATE) {
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PRIVATE);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (state == NetworkManager::ActiveConnection::State::Deactivated) {
|
||||
NetworkModeConfig::getInstance()->breakNetworkConnect(uuid, "", "");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,16 @@
|
|||
#include <QObject>
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusReply>
|
||||
#include "kylinactiveconnectresource.h"
|
||||
#include "kylinconnectresource.h"
|
||||
#include "kywirelessnetresource.h"
|
||||
|
||||
enum NetworkModeType {
|
||||
DBUS_INVAILD = -2,
|
||||
NO_CONFIG = -1,
|
||||
KSC_FIREWALL_PUBLIC = 0,
|
||||
KSC_FIREWALL_PRIVATE
|
||||
};
|
||||
|
||||
class NetworkModeConfig : public QObject
|
||||
{
|
||||
|
@ -43,4 +53,27 @@ private:
|
|||
QDBusInterface *m_dbusInterface = nullptr;
|
||||
};
|
||||
|
||||
|
||||
class NetworkMode : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
NetworkMode(QObject *parent = 0);
|
||||
~NetworkMode() = default;
|
||||
void initWiredNetworkMode();
|
||||
void initWirelessNetworkMode();
|
||||
|
||||
private:
|
||||
KyNetworkDeviceResourse *m_deviceResource = nullptr;
|
||||
KyActiveConnectResourse *m_activatedConnectResource = nullptr;
|
||||
KyConnectResourse * m_connectResource = nullptr;
|
||||
KyWirelessNetResource *m_wirelessNetResource = nullptr;
|
||||
void setFirstConnectNetworkMode(QString uuid, QString deviceName, QString ssid);
|
||||
|
||||
private Q_SLOTS:
|
||||
void onConnectionStateChanged(QString uuid,
|
||||
NetworkManager::ActiveConnection::State state,
|
||||
NetworkManager::ActiveConnection::Reason reason);
|
||||
};
|
||||
|
||||
#endif // NETWORKMODECONFIG_H
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
*
|
||||
*/
|
||||
#include "lanpage.h"
|
||||
#include "networkmodeconfig.h"
|
||||
#include "kwindowsystem.h"
|
||||
#include "kwindowsystem_export.h"
|
||||
#include <QDebug>
|
||||
#include <QScrollBar>
|
||||
|
||||
|
@ -77,6 +78,7 @@ LanPage::LanPage(QWidget *parent) : TabPage(parent)
|
|||
m_netSwitch->setChecked(!checked);
|
||||
m_wiredConnectOperation->setWiredEnabled(checked);
|
||||
});
|
||||
m_lanPagePtrMap.clear();
|
||||
}
|
||||
|
||||
LanPage::~LanPage()
|
||||
|
@ -138,28 +140,28 @@ void LanPage::initLanDeviceState()
|
|||
|
||||
void LanPage::initNetSwitch()
|
||||
{
|
||||
bool wiredSwitch = true;
|
||||
bool wiredGsetting = true;
|
||||
bool wiredEnable = m_wiredConnectOperation->getWiredEnabled();
|
||||
|
||||
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) {
|
||||
m_switchGsettings = new QGSettings(GSETTINGS_SCHEMA);
|
||||
if (m_switchGsettings->keys().contains(WIRED_SWITCH)) {
|
||||
wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool();
|
||||
wiredGsetting = m_switchGsettings->get(WIRED_SWITCH).toBool();
|
||||
connect(m_switchGsettings, &QGSettings::changed, this, &LanPage::onSwithGsettingsChanged);
|
||||
if (wiredEnable != wiredGsetting) {
|
||||
wiredEnable = wiredGsetting;
|
||||
m_wiredConnectOperation->setWiredEnabled(wiredGsetting);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qDebug()<<"[LanPage] org.ukui.kylin-nm.switch is not installed!";
|
||||
}
|
||||
|
||||
if (m_switchGsettings != nullptr
|
||||
&&wiredSwitch != wiredEnable) {
|
||||
m_switchGsettings->set(WIRED_SWITCH, wiredEnable);
|
||||
}
|
||||
|
||||
//从3.0升级上来 先读取老的配置文件来保证和升级前状态一致
|
||||
bool oldVersionState;
|
||||
bool oldVersionState = true;
|
||||
if (getOldVersionWiredSwitchState(oldVersionState)) {
|
||||
if (wiredEnable != oldVersionState) {
|
||||
wiredEnable = oldVersionState;
|
||||
m_wiredConnectOperation->setWiredEnabled(oldVersionState);
|
||||
}
|
||||
}
|
||||
|
@ -342,22 +344,10 @@ void LanPage::constructActiveConnectionArea()
|
|||
QListWidgetItem *p_listWidgetItem = addNewItem(p_activeConnectionItem, m_activatedLanListWidget);
|
||||
m_activeConnectionMap.insert(p_activeConnectionItem->m_connectUuid, p_listWidgetItem);
|
||||
|
||||
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(p_activeConnectionItem->m_connectUuid);
|
||||
if (configType == -1) {
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(p_activeConnectionItem->m_connectUuid,
|
||||
m_currentDeviceName,
|
||||
p_activeConnectionItem->m_connectName,
|
||||
KSC_FIREWALL_PUBLIC);
|
||||
} else {
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(p_activeConnectionItem->m_connectUuid,
|
||||
m_currentDeviceName,
|
||||
p_activeConnectionItem->m_connectName,
|
||||
configType);
|
||||
}
|
||||
|
||||
delete p_activeConnectionItem;
|
||||
p_activeConnectionItem = nullptr;
|
||||
}
|
||||
setNetSpeed->start(REFRESH_NETWORKSPEED_TIMER);
|
||||
} else {
|
||||
qDebug()<<"[LanPage] there is not active";
|
||||
addEmptyConnectItem(m_activeConnectionMap, m_activatedLanListWidget);
|
||||
|
@ -452,6 +442,13 @@ void LanPage::onRemoveConnection(QString path) //删除时后端会
|
|||
qDebug() << "[LanPage] Q_EMIT lanRemove because onRemoveConnection " << path;
|
||||
Q_EMIT lanRemove(path);
|
||||
|
||||
if (m_lanPagePtrMap.contains(path)) {
|
||||
if (m_lanPagePtrMap[path] != nullptr) {
|
||||
delete m_lanPagePtrMap[path];
|
||||
m_lanPagePtrMap[path] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (removeConnectionItem(m_inactiveConnectionMap, m_inactivatedLanListWidget, path)) {
|
||||
return;
|
||||
} else {
|
||||
|
@ -459,7 +456,7 @@ void LanPage::onRemoveConnection(QString path) //删除时后端会
|
|||
if (m_activeConnectionMap.count() <= 0) {
|
||||
addEmptyConnectItem(m_activeConnectionMap, m_activatedLanListWidget);
|
||||
}
|
||||
|
||||
setNetSpeed->stop();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -758,6 +755,12 @@ void LanPage::initUI()
|
|||
m_inactivatedLanListWidget->setProperty("needTranslucent", true);
|
||||
m_inactivatedAreaLayout->addWidget(m_inactivatedLanListWidget);
|
||||
|
||||
connect(m_inactivatedLanListWidget, &QListWidget::currentItemChanged, this, [=]() {
|
||||
if (m_inactivatedLanListWidget->currentItem() != nullptr) {
|
||||
m_inactivatedLanListWidget->currentItem()->setSelected(false);
|
||||
}
|
||||
});
|
||||
|
||||
QPalette pal = m_activatedLanListWidget->palette();
|
||||
pal.setBrush(QPalette::Base, QColor(0,0,0,0)); //背景透明
|
||||
m_activatedLanListWidget->setPalette(pal);
|
||||
|
@ -765,6 +768,10 @@ void LanPage::initUI()
|
|||
|
||||
m_settingsLabel->installEventFilter(this);
|
||||
m_netSwitch->installEventFilter(this);
|
||||
m_activatedLanListWidget->installEventFilter(this);
|
||||
m_inactivatedLanListWidget->installEventFilter(this);
|
||||
|
||||
showRate();
|
||||
}
|
||||
|
||||
QListWidgetItem *LanPage::insertNewItem(KyConnectItem *itemData, QListWidget *listWidget)
|
||||
|
@ -782,7 +789,7 @@ QListWidgetItem *LanPage::insertNewItem(KyConnectItem *itemData, QListWidget *li
|
|||
}
|
||||
|
||||
QListWidgetItem *p_sortListWidgetItem = new QListWidgetItem();
|
||||
p_sortListWidgetItem->setFlags(p_sortListWidgetItem->flags() & (~Qt::ItemIsSelectable)); //设置不可被选中
|
||||
// p_sortListWidgetItem->setFlags(p_sortListWidgetItem->flags() & (~Qt::ItemIsSelectable)); //设置不可被选中
|
||||
p_sortListWidgetItem->setSizeHint(QSize(listWidget->width(),ITEM_HEIGHT));
|
||||
|
||||
listWidget->insertItem(index, p_sortListWidgetItem);
|
||||
|
@ -790,14 +797,14 @@ QListWidgetItem *LanPage::insertNewItem(KyConnectItem *itemData, QListWidget *li
|
|||
LanListItem *p_sortLanItem = nullptr;
|
||||
p_sortLanItem = new LanListItem(itemData, m_currentDeviceName);
|
||||
listWidget->setItemWidget(p_sortListWidgetItem, p_sortLanItem);
|
||||
|
||||
connect(p_sortLanItem, &LanListItem::detailShow, this, &LanPage::showDetailPage);
|
||||
return p_sortListWidgetItem;
|
||||
}
|
||||
|
||||
QListWidgetItem *LanPage::addNewItem(KyConnectItem *itemData, QListWidget *listWidget)
|
||||
{
|
||||
QListWidgetItem *p_listWidgetItem = new QListWidgetItem();
|
||||
p_listWidgetItem->setFlags(p_listWidgetItem->flags() & (~Qt::ItemIsSelectable));
|
||||
// p_listWidgetItem->setFlags(p_listWidgetItem->flags() & (~Qt::ItemIsSelectable));
|
||||
p_listWidgetItem->setSizeHint(QSize(listWidget->width(), ITEM_HEIGHT));
|
||||
listWidget->addItem(p_listWidgetItem);
|
||||
LanListItem *p_lanItem = nullptr;
|
||||
|
@ -811,6 +818,7 @@ QListWidgetItem *LanPage::addNewItem(KyConnectItem *itemData, QListWidget *listW
|
|||
}
|
||||
|
||||
listWidget->setItemWidget(p_listWidgetItem, p_lanItem);
|
||||
connect(p_lanItem, &LanListItem::detailShow, this, &LanPage::showDetailPage);
|
||||
return p_listWidgetItem;
|
||||
}
|
||||
|
||||
|
@ -921,7 +929,6 @@ void LanPage::onConnectionStateChange(QString uuid,
|
|||
|
||||
KyConnectItem *p_newItem = nullptr;
|
||||
QString deviceName = "";
|
||||
QString ssid = "";
|
||||
|
||||
if (state == NetworkManager::ActiveConnection::State::Activated) {
|
||||
p_newItem = m_activeResourse->getActiveConnectionByUuid(uuid);
|
||||
|
@ -929,41 +936,10 @@ void LanPage::onConnectionStateChange(QString uuid,
|
|||
qWarning()<<"[LanPage] get active connection failed, connection uuid" << uuid;
|
||||
return;
|
||||
}
|
||||
|
||||
deviceName = p_newItem->m_ifaceName;
|
||||
ssid = p_newItem->m_connectName;
|
||||
|
||||
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(uuid);
|
||||
|
||||
if (configType == -1) {
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC); //默认公有配置
|
||||
FirewallDialog *fireWallDialog = new FirewallDialog();
|
||||
fireWallDialog->setUuid(uuid);
|
||||
fireWallDialog->setWindowTitle(ssid);
|
||||
|
||||
connect(fireWallDialog, &FirewallDialog::setPrivateNetMode, this, [=](){
|
||||
fireWallDialog->hide();
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PRIVATE);
|
||||
});
|
||||
|
||||
connect(fireWallDialog, &FirewallDialog::setPublicNetMode, this, [=](){
|
||||
fireWallDialog->hide();
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC);
|
||||
});
|
||||
|
||||
connect(m_activeResourse, &KyActiveConnectResourse::stateChangeReason, fireWallDialog, &FirewallDialog::closeMyself);
|
||||
|
||||
fireWallDialog->show();
|
||||
fireWallDialog->centerToScreen();
|
||||
|
||||
} else if (configType == KSC_FIREWALL_PUBLIC) {
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC);
|
||||
} else if (configType == KSC_FIREWALL_PRIVATE) {
|
||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PRIVATE);
|
||||
}
|
||||
|
||||
updateActivatedConnectionArea(p_newItem);
|
||||
updateConnectionState(m_activeConnectionMap, m_activatedLanListWidget, uuid, (ConnectState)state);
|
||||
deviceName = p_newItem->m_ifaceName;
|
||||
setNetSpeed->start(REFRESH_NETWORKSPEED_TIMER);
|
||||
} else if (state == NetworkManager::ActiveConnection::State::Deactivated) {
|
||||
p_newItem = m_connectResourse->getConnectionItemByUuidWithoutActivateChecking(uuid);
|
||||
qDebug() << "[LanPage] deactivated reason" << reason;
|
||||
|
@ -973,10 +949,9 @@ void LanPage::onConnectionStateChange(QString uuid,
|
|||
}
|
||||
|
||||
deviceName = p_newItem->m_ifaceName;
|
||||
ssid = p_newItem->m_connectName;
|
||||
updateConnectionArea(p_newItem);
|
||||
updateConnectionState(m_inactiveConnectionMap, m_inactivatedLanListWidget, uuid, (ConnectState)state);
|
||||
NetworkModeConfig::getInstance()->breakNetworkConnect(uuid, deviceName, ssid);
|
||||
setNetSpeed->stop();
|
||||
} else if (state == NetworkManager::ActiveConnection::State::Activating) {
|
||||
deviceName = getConnectionDevice(uuid);
|
||||
if (deviceName == m_currentDeviceName) {
|
||||
|
@ -1204,20 +1179,25 @@ bool LanPage::eventFilter(QObject *watched, QEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
} else if (watched == m_activatedLanListWidget) {
|
||||
//去掉无右键菜单显示时的选中效果
|
||||
if (event->type() == QEvent::FocusIn) {
|
||||
if (m_activatedLanListWidget->currentItem() != nullptr) {
|
||||
m_activatedLanListWidget->currentItem()->setSelected(false);
|
||||
}
|
||||
}
|
||||
} else if (watched == m_inactivatedLanListWidget) {
|
||||
//去掉无右键菜单显示时的选中效果
|
||||
if (event->type() == QEvent::FocusIn) {
|
||||
if (m_inactivatedLanListWidget->currentItem() != nullptr) {
|
||||
m_inactivatedLanListWidget->currentItem()->setSelected(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void LanPage::deleteWired(const QString &connUuid)
|
||||
{
|
||||
qDebug() << "[LanPage] deleteWired" << connUuid;
|
||||
if (connUuid == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_wiredConnectOperation->deleteWiredConnect(connUuid);
|
||||
}
|
||||
|
||||
void LanPage::onWiredEnabledChanged(bool enabled)
|
||||
{
|
||||
if (m_devList.isEmpty()) {
|
||||
|
@ -1270,9 +1250,38 @@ void LanPage::showDetailPage(QString devName, QString uuid)
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_lanPagePtrMap.contains(p_item->m_connectPath)) {
|
||||
if (m_lanPagePtrMap[p_item->m_connectPath] != nullptr) {
|
||||
qDebug() << "[LanPage] ShowLanDetailPage" << uuid << "already create,just raise";
|
||||
KWindowSystem::activateWindow(m_lanPagePtrMap[p_item->m_connectPath]->winId());
|
||||
KWindowSystem::raiseWindow(m_lanPagePtrMap[p_item->m_connectPath]->winId());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NetDetail *netDetail = new NetDetail(devName, p_item->m_connectName, uuid, isActive, false, false);
|
||||
m_lanPagePtrMap.insert(p_item->m_connectPath, netDetail);
|
||||
netDetail->show();
|
||||
netDetail->setDetailPageShowed(true);
|
||||
|
||||
connect(netDetail, &NetDetail::detailPageClose, [&](QString deviceName, QString lanName, QString lanUuid){
|
||||
if (lanUuid.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
KyConnectItem *currentItem = nullptr;
|
||||
if (m_connectResourse->isActivatedConnection(lanUuid)) {
|
||||
currentItem = m_activeResourse->getActiveConnectionByUuid(lanUuid);
|
||||
} else {
|
||||
currentItem = m_connectResourse->getConnectionItemByUuid(lanUuid);
|
||||
}
|
||||
if (currentItem == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (m_lanPagePtrMap.contains(currentItem->m_connectPath)) {
|
||||
m_lanPagePtrMap[currentItem->m_connectPath] = nullptr;
|
||||
}
|
||||
delete currentItem;
|
||||
currentItem = nullptr;
|
||||
});
|
||||
|
||||
delete p_item;
|
||||
p_item = nullptr;
|
||||
|
@ -1287,3 +1296,13 @@ bool LanPage::lanIsConnected()
|
|||
}
|
||||
}
|
||||
|
||||
void LanPage::showRate()
|
||||
{
|
||||
//定时获取网速
|
||||
setNetSpeed = new QTimer(this);
|
||||
setNetSpeed->setTimerType(Qt::PreciseTimer);
|
||||
connect(setNetSpeed, &QTimer::timeout, [&]() {
|
||||
onSetNetSpeed(m_activatedLanListWidget, m_activeConnectionMap.contains(EMPTY_SSID), m_currentDeviceName);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ public:
|
|||
|
||||
//for dbus
|
||||
void getWiredList(QMap<QString, QVector<QStringList> > &map);
|
||||
void deleteWired(const QString& connUuid);
|
||||
void activateWired(const QString& devName, const QString& connUuid);
|
||||
void deactivateWired(const QString& devName, const QString& connUuid);
|
||||
void showDetailPage(QString devName, QString uuid);
|
||||
|
@ -99,6 +98,7 @@ private:
|
|||
QListWidget *lanListWidget, QString uuid);
|
||||
|
||||
void updateCurrentDevice(QString deviceName);
|
||||
void showRate();
|
||||
|
||||
Q_SIGNALS:
|
||||
void lanAdd(QString devName, QStringList info);
|
||||
|
@ -108,6 +108,8 @@ Q_SIGNALS:
|
|||
void lanActiveConnectionStateChanged(QString interface, QString uuid, int status);
|
||||
void lanConnectChanged(int state);
|
||||
|
||||
void showLanRate(QListWidget *widget, QMap<QString, QListWidgetItem *> &map, QString dev, bool isLan);
|
||||
|
||||
private Q_SLOTS:
|
||||
void onConnectionStateChange(QString uuid, NetworkManager::ActiveConnection::State state,
|
||||
NetworkManager::ActiveConnection::Reason reason);
|
||||
|
@ -150,6 +152,7 @@ private:
|
|||
QStringList m_disableDeviceList;
|
||||
|
||||
QGSettings *m_switchGsettings = nullptr;
|
||||
QMap<QString, NetDetail*> m_lanPagePtrMap;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
#include <QLabel>
|
||||
#include <QApplication>
|
||||
#include <QDBusReply>
|
||||
#include <QListWidget>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
#include"listitem.h"
|
||||
|
||||
#define LOG_FLAG "[tabPage]"
|
||||
|
||||
TabPage::TabPage(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
|
@ -167,6 +173,141 @@ void TabPage::onPaletteChanged()
|
|||
}
|
||||
}
|
||||
|
||||
int TabPage::getCurrentLoadRate(QString dev, long *save_rate, long *tx_rate)
|
||||
{
|
||||
FILE * net_dev_file; //文件指针
|
||||
char buffer[1024]; //文件中的内容暂存在字符缓冲区里
|
||||
//size_t bytes_read; //实际读取的内容大小
|
||||
char * match; //用以保存所匹配字符串及之后的内容
|
||||
char * device;//将QString转为Char *
|
||||
QByteArray ba = dev.toLatin1(); // must
|
||||
device = ba.data();
|
||||
int counter = 0;
|
||||
//int i = 0;
|
||||
char tmp_value[128];
|
||||
|
||||
if ((NULL == device) || (NULL == save_rate) || (NULL == tx_rate)) {
|
||||
qDebug() << LOG_FLAG << "parameter pass error" ;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((net_dev_file = fopen("/proc/net/dev", "r")) == NULL) {
|
||||
//打开文件/pro/net/dev/,从中读取流量数据
|
||||
qDebug() << LOG_FLAG << "error occurred when try to open file /proc/net/dev/";
|
||||
return -1;
|
||||
}
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
|
||||
while (fgets(buffer, sizeof(buffer), net_dev_file) != NULL) {
|
||||
match = strstr(buffer, device);
|
||||
|
||||
if (NULL == match) {
|
||||
// qDebug()<<"No eth0 keyword to find!";
|
||||
continue;
|
||||
} else {
|
||||
match = match + strlen(device) + strlen(":"); //地址偏移到冒号
|
||||
sscanf(match, "%ld ", save_rate);
|
||||
memset(tmp_value, 0, sizeof(tmp_value));
|
||||
sscanf(match, "%s ", tmp_value);
|
||||
match = match + strlen(tmp_value);
|
||||
for (size_t i=0; i<strlen(buffer); ++i) {
|
||||
if (0x20 == *match) {
|
||||
match ++;
|
||||
} else {
|
||||
if (8 == counter) {
|
||||
sscanf(match, "%ld ", tx_rate);
|
||||
}
|
||||
memset(tmp_value, 0, sizeof(tmp_value));
|
||||
sscanf(match, "%s ", tmp_value);
|
||||
match = match + strlen(tmp_value);
|
||||
counter ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(net_dev_file);
|
||||
net_dev_file = nullptr;
|
||||
|
||||
return 0; //返回成功
|
||||
}
|
||||
|
||||
void TabPage::onSetNetSpeed(QListWidget* m_activatedNetListWidget, bool isEmpty, QString dev)
|
||||
{
|
||||
//未连接不显示网速
|
||||
QListWidgetItem* activeitem = m_activatedNetListWidget->item(0);
|
||||
ListItem *p_item = (ListItem *)m_activatedNetListWidget->itemWidget(activeitem);
|
||||
if (isEmpty) {
|
||||
p_item->m_lbLoadUp->hide();
|
||||
p_item->m_lbLoadDown->hide();
|
||||
p_item->m_lbLoadDownImg->hide();
|
||||
p_item->m_lbLoadUpImg->hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->isVisible()) {
|
||||
|
||||
if (getCurrentLoadRate(dev, &start_rcv_rates, &start_tx_rates) == -1) {
|
||||
start_rcv_rates = end_rcv_rates;
|
||||
return;
|
||||
}
|
||||
|
||||
long int delta_rcv = (start_rcv_rates - end_rcv_rates) / 1024;
|
||||
long int delta_tx = (start_tx_rates - end_tx_rates) / 1024;
|
||||
|
||||
//简易滤波
|
||||
if (delta_rcv < 0 || delta_tx < 0) {
|
||||
delta_rcv = 0;
|
||||
delta_tx = 0;
|
||||
}
|
||||
else if (end_rcv_rates == 0 || end_tx_rates == 0){
|
||||
delta_rcv = 0;
|
||||
delta_tx = 0;
|
||||
}
|
||||
|
||||
end_rcv_rates = start_rcv_rates;
|
||||
end_tx_rates = start_tx_rates;
|
||||
|
||||
int rcv_num = delta_rcv;
|
||||
int tx_num = delta_tx;
|
||||
|
||||
QString str_rcv = 0;
|
||||
QString str_tx = 0;
|
||||
|
||||
if (rcv_num < 1024) {
|
||||
str_rcv = QString::number(rcv_num) + "KB/s";
|
||||
} else {
|
||||
int remainder;
|
||||
if (rcv_num % 1024 < 100) {
|
||||
remainder = 0;
|
||||
} else {
|
||||
remainder = (rcv_num % 1024) / 100;
|
||||
}
|
||||
str_rcv = QString::number(rcv_num / 1024) + "." + QString::number(remainder) + "MB/s";
|
||||
}
|
||||
|
||||
if (tx_num < 1024) {
|
||||
str_tx = QString::number(tx_num) + "KB/s";
|
||||
} else {
|
||||
int remainder;
|
||||
if (tx_num % 1024 < 100) {
|
||||
remainder = 0;
|
||||
} else {
|
||||
remainder = (tx_num % 1024)/100;
|
||||
}
|
||||
str_tx = QString::number(tx_num / 1024) + "." + QString::number(remainder) + "MB/s";
|
||||
}
|
||||
p_item->m_lbLoadDown->setText(str_rcv);
|
||||
p_item->m_lbLoadUp->setText(str_tx);
|
||||
if (!p_item->m_hoverButton->isVisible()) {
|
||||
p_item->m_lbLoadDown->show();
|
||||
p_item->m_lbLoadUp->show();
|
||||
p_item->m_lbLoadDownImg->show();
|
||||
p_item->m_lbLoadUpImg->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TabPage::showDesktopNotify(const QString &message, QString soundName)
|
||||
{
|
||||
QDBusInterface iface("org.freedesktop.Notifications",
|
||||
|
@ -302,7 +443,7 @@ void getDeviceEnableState(int type, QMap<QString, bool> &map)
|
|||
kdr = nullptr;
|
||||
}
|
||||
|
||||
bool getOldVersionWiredSwitchState(bool state)
|
||||
bool getOldVersionWiredSwitchState(bool &state)
|
||||
{
|
||||
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
||||
QVariant value = m_settings->value("lan_switch_opened");
|
||||
|
|
|
@ -34,17 +34,15 @@
|
|||
#include <QProcess>
|
||||
#include <QDebug>
|
||||
#include "kylinnetworkdeviceresource.h"
|
||||
#include "firewalldialog.h"
|
||||
#include "kwidget.h"
|
||||
#include "kswitchbutton.h"
|
||||
//#include "kborderlessbutton.h"
|
||||
|
||||
using namespace kdk;
|
||||
#define EMPTY_SSID "emptyssid"
|
||||
|
||||
enum network_mode {
|
||||
KSC_FIREWALL_PUBLIC = 0,
|
||||
KSC_FIREWALL_PRIVATE
|
||||
};
|
||||
#define REFRESH_NETWORKSPEED_TIMER 1000
|
||||
|
||||
using namespace kdk;
|
||||
|
||||
#define MAIN_LAYOUT_MARGINS 0,0,0,0
|
||||
#define MAIN_LAYOUT_SPACING 0
|
||||
|
@ -81,7 +79,7 @@ bool checkDeviceExist(KyDeviceType deviceType, QString deviceName);
|
|||
QString getDefaultDeviceName(KyDeviceType deviceType);
|
||||
void setDefaultDevice(KyDeviceType deviceType, QString deviceName);
|
||||
void getDeviceEnableState(int type, QMap<QString, bool> &map);
|
||||
bool getOldVersionWiredSwitchState(bool state);
|
||||
bool getOldVersionWiredSwitchState(bool &state);
|
||||
|
||||
class TabPage : public QWidget
|
||||
{
|
||||
|
@ -117,8 +115,10 @@ Q_SIGNALS:
|
|||
|
||||
protected:
|
||||
void initUI();
|
||||
int getCurrentLoadRate(QString dev, long *save_rate, long *tx_rate);
|
||||
// virtual void initDevice() = 0;//初始化默认设备
|
||||
virtual void initDeviceCombox() = 0;//初始化设备选择下拉框
|
||||
QTimer *setNetSpeed = nullptr;
|
||||
QVBoxLayout * m_mainLayout = nullptr;
|
||||
QFrame * m_titleFrame = nullptr;
|
||||
QHBoxLayout * m_titleLayout = nullptr;
|
||||
|
@ -152,10 +152,17 @@ protected:
|
|||
QComboBox * m_deviceComboBox = nullptr;
|
||||
QLabel * m_tipsLabel = nullptr;
|
||||
|
||||
long int start_rcv_rates = 0; //保存开始时的流量计数
|
||||
long int end_rcv_rates = 0; //保存结束时的流量计数
|
||||
long int start_tx_rates = 0; //保存开始时的流量计数
|
||||
long int end_tx_rates = 0; //保存结束时的流量计数
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual void onDeviceComboxIndexChanged(int currentIndex) = 0;
|
||||
void onPaletteChanged();
|
||||
|
||||
protected Q_SLOTS:
|
||||
void onSetNetSpeed(QListWidget* m_activatedNetListWidget, bool isActive, QString dev);
|
||||
};
|
||||
|
||||
#endif // TABPAGE_H
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue