Merge branch 'yhkylin/v101' of https://gitlab2.kylin.com/kylinos-src/kylin-nm into maidian

This commit is contained in:
jzxc95 2023-06-26 16:53:10 +08:00
commit 5ba5a32737
70 changed files with 3063 additions and 1618 deletions

64
debian/changelog vendored
View File

@ -1,3 +1,67 @@
kylin-nm (3.24.0.0-0k1.1) v101; urgency=medium
* BUG号
-#172221 设计走查 界面中英文之间增加空格(半角)
-#176216 【9006c】【设置全局】打开设置第一次点击代理后要等大概5秒才可以点击其他模块标题
-#165498 【HWE】【网络】【控制面板】控制面板-网络-代理界面,开关应用代理按钮时会有撕裂态横细线出现
* 需求号:
-#21408 海关总署选型:策略管理-对于域管理员下发给终端的可见策略,如对控制面板的策略,在终端主机上预览且不可修改,对配置项隐藏
-#22635 dns高级配置选项
-20962 【台州银行】IP地址冲突弹窗提示
* 其他改动:
* 影响域:自身
-- zhaoshixu <zhaoshixu@kylinos.cn> Sun, 25 Jun 2023 18:25:38 +0800
kylin-nm (3.20.1.17-0k1.10) v101; urgency=medium
* BUG号
-#175029 【WiFi】企业wifi弹窗下拉菜单显示有问题
* 需求号:
* 其他改动:
* 影响域:自身
-- zhangyuanyuan1 <zhangyuanyuan1@kylinos.cn> Wed, 14 Jun 2023 16:15:59 +0800
kylin-nm (3.20.1.17-0k1.9) v101; urgency=medium
* BUG号
-#172410 【通知中心】设置弹窗显示标题为控制面板,与实际不一致
* 需求号:
* 其他改动:
* 影响域:自身
-- zhaoshixu <zhaoshixu@kylinos.cn> Fri, 02 Jun 2023 14:13:28 +0800
kylin-nm (3.20.1.17-0k1.8) v101; urgency=medium
* BUG号
-#173716 【走查】【移动热点】英文模式下无提示图标
-#172489 WIFI】外接USB网卡在移动热点界面拖动右侧窗口存在叹号消失的情况
* 需求号:
* 其他改动:控制面板有线网络及无线网络的悬停点击背景色
* 影响域:自身
-- zhangyuanyuan1 <zhangyuanyuan1@kylinos.cn> Wed, 31 May 2023 16:23:30 +0800
kylin-nm (3.20.1.17-0k1.7) v101; urgency=medium
* BUG号
-#172627 【990】【WiFi】连接WIF6或WIFI6+后任务栏网络显示6或6+图标
* 需求号:
* 其他改动:无
* 影响域:自身
-- zhaoshixu <zhaoshixu@kylinos.cn> Tue, 30 May 2023 16:44:26 +0800
kylin-nm (3.20.1.17-0k1.6) v101; urgency=medium
* BUG号:
-#172627 【990】【WiFi】连接WIF6或WIFI6+后任务栏网络显示6或6+图标
-#172210 【HWE】【VPN】注销后再登录会生成vpn的core文件
-- zhaoshixu <zhaoshixu@kylinos.cn> Fri, 26 May 2023 14:06:49 +0800
kylin-nm (3.20.1.17-0k1.5) v101; urgency=medium
* BUG号

View File

@ -3,15 +3,11 @@ TEMPLATE = subdirs
CONFIG += \
ordered \
qt
qt \
SUBDIRS = \
plugins/plugin.pro \
src-vpn/src-vpn.pro \
src
TRANSLATIONS += \
translations/kylin-nm_zh_CN.ts \
translations/kylin-nm_tr.ts \
translations/kylin-nm_bo.ts \
translations/kylin-nm_bo_CN.ts
QT += widgets

View File

@ -34,7 +34,6 @@ AddNetBtn::AddNetBtn(bool isWlan, QWidget *parent) : QPushButton(parent)
this->setMaximumSize(QSize(16777215, 60));
this->setProperty("useButtonPalette", true);
this->setFlat(true);
this->setProperty("needTranslucent", true);
QHBoxLayout *addLyt = new QHBoxLayout;
@ -85,6 +84,12 @@ void AddNetBtn::paintEvent(QPaintEvent *event)
painter.setPen(Qt::NoPen);
painter.setBrush(this->palette().base().color());
QPalette pal = qApp->palette();
QColor color = pal.color(QPalette::Button);
color.setAlphaF(0.5);
pal.setColor(QPalette::Button, color);
this->setPalette(pal);
QRect rect = this->rect();
QPainterPath path;

View File

@ -58,10 +58,10 @@ void MobileHotspotWidget::showDesktopNotify(const QString &message)
"org.freedesktop.Notifications",
QDBusConnection::sessionBus());
QList<QVariant> args;
args<<(tr("ukui control center"))
args<<(tr("Settings"))
<<((unsigned int) 0)
<<QString("ukui-control-center")
<<tr("ukui control center desktop message") //显示的是什么类型的信息
<<tr("Settings desktop message") //显示的是什么类型的信息
<<message //显示的具体信息
<<QStringList()
<<QVariantMap()
@ -608,7 +608,7 @@ void MobileHotspotWidget::setInterFaceFrame()
m_warnWidget->setFixedHeight(20);
m_warnWidget->setContentsMargins(8,0,0,0);
QFormLayout *warnTextHLayout = new QFormLayout(m_warnWidget);
QHBoxLayout *warnTextHLayout = new QHBoxLayout(m_warnWidget);
QLabel* warnIcon = new QLabel(this);
warnIcon->setContentsMargins(0,0,0,0);
warnIcon->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(16,16));
@ -622,16 +622,11 @@ void MobileHotspotWidget::setInterFaceFrame()
warnTextHLayout->setSpacing(8);
warnTextHLayout->setContentsMargins(0,0,0,0);
warnTextHLayout->addRow(warnIcon, m_interfaceWarnLabel);
warnTextHLayout->addWidget(warnIcon);
warnTextHLayout->addWidget(m_interfaceWarnLabel);
warnIcon->setFixedWidth(16);
m_warnWidget->setLayout(warnTextHLayout);
QWidget *pwdInputWidget = new QWidget(m_interfaceFrame);
QVBoxLayout *pwdInputVLayout = new QVBoxLayout(pwdInputWidget);
pwdInputVLayout->setContentsMargins(CONTENTS_MARGINS);
pwdInputVLayout->setSpacing(0);
pwdInputVLayout->addWidget(m_interfaceComboBox);
pwdInputVLayout->addWidget(m_warnWidget);
QGridLayout *interfaceFLayout = new QGridLayout(m_interfaceFrame);
interfaceFLayout->setContentsMargins(PASSWORD_ITEM_MARGINS);
interfaceFLayout->setSpacing(0);

View File

@ -55,16 +55,6 @@
</context>
<context>
<name>MobileHotspotWidget</name>
<message>
<location filename="../mobilehotspotwidget.cpp" line="61"/>
<source>ukui control center</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="64"/>
<source>ukui control center desktop message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="151"/>
<source>wirless switch is close or no wireless device</source>
@ -76,7 +66,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="536"/>
<location filename="../mobilehotspotwidget.cpp" line="540"/>
<source>Contains at least 8 characters</source>
<translation type="unfinished"></translation>
</message>
@ -85,6 +75,16 @@
<source>Hotspot</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="61"/>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="64"/>
<source>Settings desktop message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="336"/>
<source>use </source>
@ -102,27 +102,27 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="482"/>
<location filename="../mobilehotspotwidget.cpp" line="486"/>
<source>Open</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="503"/>
<location filename="../mobilehotspotwidget.cpp" line="507"/>
<source>Wi-Fi Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="524"/>
<location filename="../mobilehotspotwidget.cpp" line="528"/>
<source>Password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="565"/>
<location filename="../mobilehotspotwidget.cpp" line="571"/>
<source>Frequency band</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="589"/>
<location filename="../mobilehotspotwidget.cpp" line="595"/>
<source>Net card</source>
<translation type="unfinished"></translation>
</message>

View File

@ -56,14 +56,12 @@
<context>
<name>MobileHotspotWidget</name>
<message>
<location filename="../mobilehotspotwidget.cpp" line="61"/>
<source>ukui control center</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="64"/>
<source>ukui control center desktop message</source>
<translation>ukui </translation>
<translation type="vanished">ukui </translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="151"/>
@ -88,7 +86,7 @@
<translation type="vanished"> </translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="536"/>
<location filename="../mobilehotspotwidget.cpp" line="540"/>
<source>Contains at least 8 characters</source>
<translation></translation>
</message>
@ -97,6 +95,16 @@
<source>Hotspot</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="61"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="64"/>
<source>Settings desktop message</source>
<translation> </translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="336"/>
<source>use </source>
@ -114,27 +122,27 @@
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="482"/>
<location filename="../mobilehotspotwidget.cpp" line="486"/>
<source>Open</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="503"/>
<location filename="../mobilehotspotwidget.cpp" line="507"/>
<source>Wi-Fi Name</source>
<translation>Wi-Fiཡི</translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="524"/>
<location filename="../mobilehotspotwidget.cpp" line="528"/>
<source>Password</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="565"/>
<location filename="../mobilehotspotwidget.cpp" line="571"/>
<source>Frequency band</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="589"/>
<location filename="../mobilehotspotwidget.cpp" line="595"/>
<source>Net card</source>
<translation></translation>
</message>

View File

@ -56,14 +56,22 @@
<context>
<name>MobileHotspotWidget</name>
<message>
<location filename="../mobilehotspotwidget.cpp" line="61"/>
<source>ukui control center</source>
<translation>ukui control center</translation>
<translation type="vanished">ukui control center</translation>
</message>
<message>
<source>ukui control center desktop message</source>
<translation type="vanished">ukui control center desktop message</translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="61"/>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="64"/>
<source>ukui control center desktop message</source>
<translation>ukui control center desktop message</translation>
<source>Settings desktop message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="151"/>
@ -97,32 +105,32 @@
<translation>hotspot already close</translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="482"/>
<location filename="../mobilehotspotwidget.cpp" line="486"/>
<source>Open</source>
<translation>Open</translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="503"/>
<location filename="../mobilehotspotwidget.cpp" line="507"/>
<source>Wi-Fi Name</source>
<translation>Wi-Fi Name</translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="524"/>
<location filename="../mobilehotspotwidget.cpp" line="528"/>
<source>Password</source>
<translation>Password</translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="536"/>
<location filename="../mobilehotspotwidget.cpp" line="540"/>
<source>Contains at least 8 characters</source>
<translation>Contains at least 8 characters</translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="565"/>
<location filename="../mobilehotspotwidget.cpp" line="571"/>
<source>Frequency band</source>
<translation>Frequency band</translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="589"/>
<location filename="../mobilehotspotwidget.cpp" line="595"/>
<source>Net card</source>
<translation>Net card</translation>
</message>

View File

@ -55,16 +55,6 @@
</context>
<context>
<name>MobileHotspotWidget</name>
<message>
<location filename="../mobilehotspotwidget.cpp" line="61"/>
<source>ukui control center</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="64"/>
<source>ukui control center desktop message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="151"/>
<source>wirless switch is close or no wireless device</source>
@ -76,7 +66,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="536"/>
<location filename="../mobilehotspotwidget.cpp" line="540"/>
<source>Contains at least 8 characters</source>
<translation type="unfinished"></translation>
</message>
@ -85,6 +75,16 @@
<source>Hotspot</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="61"/>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="64"/>
<source>Settings desktop message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="336"/>
<source>use </source>
@ -102,27 +102,27 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="482"/>
<location filename="../mobilehotspotwidget.cpp" line="486"/>
<source>Open</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="503"/>
<location filename="../mobilehotspotwidget.cpp" line="507"/>
<source>Wi-Fi Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="524"/>
<location filename="../mobilehotspotwidget.cpp" line="528"/>
<source>Password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="565"/>
<location filename="../mobilehotspotwidget.cpp" line="571"/>
<source>Frequency band</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="589"/>
<location filename="../mobilehotspotwidget.cpp" line="595"/>
<source>Net card</source>
<translation type="unfinished"></translation>
</message>

View File

@ -56,14 +56,12 @@
<context>
<name>MobileHotspotWidget</name>
<message>
<location filename="../mobilehotspotwidget.cpp" line="61"/>
<source>ukui control center</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="64"/>
<source>ukui control center desktop message</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="151"/>
@ -88,7 +86,7 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="536"/>
<location filename="../mobilehotspotwidget.cpp" line="540"/>
<source>Contains at least 8 characters</source>
<translation>8</translation>
</message>
@ -97,15 +95,25 @@
<source>Hotspot</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="61"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="64"/>
<source>Settings desktop message</source>
<translation> </translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="336"/>
<source>use </source>
<translation>使</translation>
<translation>使 </translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="337"/>
<source> share network, will interrupt local wireless connection</source>
<translation>线</translation>
<translation> 线</translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="353"/>
@ -114,27 +122,27 @@
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="482"/>
<location filename="../mobilehotspotwidget.cpp" line="486"/>
<source>Open</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="503"/>
<location filename="../mobilehotspotwidget.cpp" line="507"/>
<source>Wi-Fi Name</source>
<translation>Wi-Fi名称</translation>
<translation>Wi-Fi </translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="524"/>
<location filename="../mobilehotspotwidget.cpp" line="528"/>
<source>Password</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="565"/>
<location filename="../mobilehotspotwidget.cpp" line="571"/>
<source>Frequency band</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="589"/>
<location filename="../mobilehotspotwidget.cpp" line="595"/>
<source>Net card</source>
<translation></translation>
</message>

View File

@ -33,7 +33,6 @@ LanItem::LanItem(bool isAcitve, QWidget *parent)
this->setMinimumSize(550, 58);
this->setProperty("useButtonPalette", true);
this->setFlat(true);
this->setProperty("needTranslucent", true);
// setStyleSheet("QPushButton:!checked{background-color: palette(base)}");
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
mLanLyt->setContentsMargins(16,0,16,0);
@ -95,6 +94,12 @@ void LanItem::paintEvent(QPaintEvent *event)
painter.setPen(Qt::NoPen);
painter.setBrush(this->palette().base().color());
QPalette pal = qApp->palette();
QColor color = pal.color(QPalette::Button);
color.setAlphaF(0.5);
pal.setColor(QPalette::Button, color);
this->setPalette(pal);
QRect rect = this->rect();
painter.drawRect(rect);

View File

@ -61,10 +61,10 @@ void NetConnect::showDesktopNotify(const QString &message)
"org.freedesktop.Notifications",
QDBusConnection::sessionBus());
QList<QVariant> args;
args<<(tr("ukui control center"))
args<<(tr("Settings"))
<<((unsigned int) 0)
<<QString("gnome-dev-ethernet")
<<tr("ukui control center desktop message") //显示的是什么类型的信息
<<tr("Settings desktop message") //显示的是什么类型的信息
<<message //显示的具体信息
<<QStringList()
<<QVariantMap()

View File

@ -37,12 +37,12 @@
</message>
<message>
<location filename="../netconnect.cpp" line="64"/>
<source>ukui control center</source>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="67"/>
<source>ukui control center desktop message</source>
<source>Settings desktop message</source>
<translation type="unfinished"></translation>
</message>
<message>
@ -57,13 +57,13 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="429"/>
<location filename="../netconnect.cpp" line="850"/>
<location filename="../netconnect.cpp" line="437"/>
<location filename="../netconnect.cpp" line="861"/>
<source>connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="493"/>
<location filename="../netconnect.cpp" line="504"/>
<source>card</source>
<translation type="unfinished"></translation>
</message>

View File

@ -36,19 +36,27 @@
<extra-contents_path>/netconnect/Advanced settings&quot;</extra-contents_path>
</message>
<message>
<location filename="../netconnect.cpp" line="64"/>
<source>ukui control center</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="67"/>
<source>ukui control center desktop message</source>
<translation>ukui </translation>
<translation type="vanished">ukui </translation>
</message>
<message>
<source>WiredConnect</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="64"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="67"/>
<source>Settings desktop message</source>
<translation> </translation>
</message>
<message>
<location filename="../netconnect.cpp" line="81"/>
<location filename="../netconnect.cpp" line="153"/>
@ -61,13 +69,13 @@
<translation></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="429"/>
<location filename="../netconnect.cpp" line="850"/>
<location filename="../netconnect.cpp" line="437"/>
<location filename="../netconnect.cpp" line="861"/>
<source>connected</source>
<translation></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="493"/>
<location filename="../netconnect.cpp" line="504"/>
<source>card</source>
<translation></translation>
</message>

View File

@ -36,14 +36,22 @@
<extra-contents_path>/netconnect/Advanced settings&quot;</extra-contents_path>
</message>
<message>
<location filename="../netconnect.cpp" line="64"/>
<source>ukui control center</source>
<translation>ukui control center</translation>
<translation type="vanished">ukui control center</translation>
</message>
<message>
<source>ukui control center desktop message</source>
<translation type="vanished">ukui control center desktop message</translation>
</message>
<message>
<location filename="../netconnect.cpp" line="64"/>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="67"/>
<source>ukui control center desktop message</source>
<translation>ukui control center desktop message</translation>
<source>Settings desktop message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="81"/>
@ -57,13 +65,13 @@
<translation>No ethernet device avaliable</translation>
</message>
<message>
<location filename="../netconnect.cpp" line="429"/>
<location filename="../netconnect.cpp" line="850"/>
<location filename="../netconnect.cpp" line="437"/>
<location filename="../netconnect.cpp" line="861"/>
<source>connected</source>
<translation>connected</translation>
</message>
<message>
<location filename="../netconnect.cpp" line="493"/>
<location filename="../netconnect.cpp" line="504"/>
<source>card</source>
<translation>card</translation>
</message>

View File

@ -37,12 +37,12 @@
</message>
<message>
<location filename="../netconnect.cpp" line="64"/>
<source>ukui control center</source>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="67"/>
<source>ukui control center desktop message</source>
<source>Settings desktop message</source>
<translation type="unfinished"></translation>
</message>
<message>
@ -57,13 +57,13 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="429"/>
<location filename="../netconnect.cpp" line="850"/>
<location filename="../netconnect.cpp" line="437"/>
<location filename="../netconnect.cpp" line="861"/>
<source>connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="493"/>
<location filename="../netconnect.cpp" line="504"/>
<source>card</source>
<translation type="unfinished"></translation>
</message>

View File

@ -36,19 +36,27 @@
<extra-contents_path>/netconnect/Advanced settings&quot;</extra-contents_path>
</message>
<message>
<location filename="../netconnect.cpp" line="64"/>
<source>ukui control center</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="67"/>
<source>ukui control center desktop message</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<source>WiredConnect</source>
<translation type="vanished">线</translation>
</message>
<message>
<location filename="../netconnect.cpp" line="64"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="67"/>
<source>Settings desktop message</source>
<translation> </translation>
</message>
<message>
<location filename="../netconnect.cpp" line="81"/>
<location filename="../netconnect.cpp" line="153"/>
@ -61,13 +69,13 @@
<translation>线</translation>
</message>
<message>
<location filename="../netconnect.cpp" line="429"/>
<location filename="../netconnect.cpp" line="850"/>
<location filename="../netconnect.cpp" line="437"/>
<location filename="../netconnect.cpp" line="861"/>
<source>connected</source>
<translation></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="493"/>
<location filename="../netconnect.cpp" line="504"/>
<source>card</source>
<translation></translation>
</message>

View File

@ -43,12 +43,11 @@ void AppListWidget::setAppChecked(bool flag)
/**
* @brief AppListWidget::setAppIcon
* @param icon
* @param icon
*/
void AppListWidget::setAppIcon(const QPixmap &icon)
void AppListWidget::setAppIcon(const QIcon &icon)
{
m_iconLabel->setAlignment(Qt::AlignCenter);
m_iconLabel->setPixmap(icon);
m_iconBtn->setIcon(icon);
}
/**
@ -119,12 +118,19 @@ void AppListWidget::initUI()
mainLayout->setSpacing(8);
m_checkBox = new QCheckBox(this);
m_checkBox->setAttribute(Qt::WA_TransparentForMouseEvents, true); //m_checkBox不响应鼠标事件,将其传递给父窗口
m_iconLabel = new QLabel(this);
m_iconLabel->setFixedSize(24, 24);
m_iconBtn = new QToolButton(this);
m_iconBtn->setToolButtonStyle(Qt::ToolButtonStyle::ToolButtonIconOnly);
m_iconBtn->setAttribute(Qt::WA_TranslucentBackground, true); //透明
m_iconBtn->setAttribute(Qt::WA_TransparentForMouseEvents, true);
m_iconBtn->setAutoRaise(true);
m_iconBtn->setFixedSize(24, 24);
m_iconBtn->setIconSize(QSize(24, 24));
m_nameLabel = new QLabel(this);
mainLayout->addWidget(m_checkBox);
mainLayout->addWidget(m_iconLabel);
mainLayout->addWidget(m_iconBtn);
mainLayout->addWidget(m_nameLabel);
mainLayout->addStretch();
}

View File

@ -28,6 +28,7 @@
#include <QHBoxLayout>
#include <QDBusInterface>
#include <QDBusReply>
#include <QToolButton>
class AppListWidget : public QWidget
{
@ -37,7 +38,7 @@ public:
~AppListWidget();
void setAppChecked(bool flag);
void setAppIcon(const QPixmap &icon);
void setAppIcon(const QIcon &icon);
void setAppName(const QString &text);
void onAppCheckStateChanged();
void AddAppProxyConfig();
@ -51,7 +52,7 @@ private:
void initDbus();
QCheckBox *m_checkBox = nullptr;
QLabel *m_iconLabel = nullptr;
QToolButton *m_iconBtn = nullptr;
QLabel *m_nameLabel = nullptr;
QString m_path = nullptr;
QDBusInterface *m_dbusInterface = nullptr;

View File

@ -127,6 +127,7 @@ QWidget *Proxy::pluginUi() {
} else {
qCritical() << "Xml needed by Proxy is not installed";
}
setUkccProxySettings();
}
return pluginWidget;
}
@ -428,14 +429,21 @@ void Proxy::initUi(QWidget *widget)
AptLayout->addWidget(line_7);
AptLayout->addWidget(mAPTFrame_2);
m_sysSpacerFrame = new QFrame(widget);
m_sysSpacerFrame->setFixedHeight(32);
m_appListSpacerFrame = new QFrame(widget);
m_appListSpacerFrame->setFixedHeight(4);
m_appSpacerFrame = new QFrame(widget);;
m_appSpacerFrame->setFixedHeight(32);;
mverticalLayout->addWidget(mTitleLabel);
mverticalLayout->addWidget(mProxyFrame);
mverticalLayout->addSpacing(32);
mverticalLayout->addWidget(m_sysSpacerFrame);
mverticalLayout->addWidget(m_appProxyLabel);
mverticalLayout->addWidget(m_appProxyFrame);
mverticalLayout->addSpacing(4);
mverticalLayout->addWidget(m_appListSpacerFrame);
mverticalLayout->addWidget(m_appListFrame);
mverticalLayout->addSpacing(32);
mverticalLayout->addWidget(m_appSpacerFrame);
mverticalLayout->addWidget(mAptProxyLabel);
mverticalLayout->addWidget(mAPTFrame);
mverticalLayout->addStretch();
@ -726,10 +734,10 @@ void Proxy::initAppProxyStatus()
m_appEnableBtn->setChecked(state);
onappProxyEnableChanged(state);
appProxyInfoPadding();
// m_cancelBtn->setEnabled(false);
// m_saveBtn->setEnabled(false);
appListPadding();
if (state) {
appProxyInfoPadding();
appListPadding();
}
}
int Proxy::_getCurrentProxyMode(){
@ -974,6 +982,50 @@ QMap<QString, QStringList> Proxy::getAppListProxy()
return appList;
}
void Proxy::setUkccProxySettings()
{
setSystemProxyFrameHidden(false);
setAppProxyFrameHidden(false);
setAPTProxyFrameHidden(false);
QDBusInterface ukccDbusInterface("org.ukui.ukcc.session",
"/",
"org.ukui.ukcc.session.interface",
QDBusConnection::sessionBus());
if(!ukccDbusInterface.isValid()) {
qWarning() << "ukccDbusInterface is invalid";
return;
}
QDBusReply<QMap<QString, QVariant> > reply = ukccDbusInterface.call("getModuleHideStatus");
if (!reply.isValid()) {
qWarning() << "reply of getModuleHideStatus is invalid";
return;
}
QStringList proxySettingList;
if (reply.value().contains("proxySettings")) {
QString proxySettings = reply.value()["proxySettings"].toString();
qDebug() << "proxySettings" << proxySettings;
if (proxySettings.isEmpty()) {
return;
}
proxySettingList = proxySettings.split(",");
}
for (const QString setting : proxySettingList) {
if (setting.contains("SystemProxyFrame") && setting.contains("false")) {
setSystemProxyFrameHidden(true);
} else if (setting.contains("AppProxyFrame") && setting.contains("false")) {
setAppProxyFrameHidden(true);
} else if (setting.contains("APTProxyFrame") && setting.contains("false")) {
setAPTProxyFrameHidden(true);
}
}
}
#if 0
bool Proxy::checkIsChanged(QStringList info)
{
@ -1137,17 +1189,24 @@ void Proxy::setAppProxyFrameUi(QWidget *widget)
m_appLine4 = setLine(m_appProxyFrame);
m_appLine5 = setLine(m_appProxyFrame);
m_appProxyInfoWidget = new QWidget(m_appProxyFrame);
QVBoxLayout *widgetHLayout = new QVBoxLayout(m_appProxyInfoWidget);
widgetHLayout->setContentsMargins(0, 0, 0, 0);
widgetHLayout->setSpacing(0);
widgetHLayout->addWidget(m_appLine1);
widgetHLayout->addWidget(m_proxyTypeFrame);
widgetHLayout->addWidget(m_appLine2);
widgetHLayout->addWidget(m_ipAddressFrame);
widgetHLayout->addWidget(m_appLine3);
widgetHLayout->addWidget(m_portFrame);
widgetHLayout->addWidget(m_appLine4);
widgetHLayout->addWidget(m_userNameFrame);
widgetHLayout->addWidget(m_appLine5);
widgetHLayout->addWidget(m_pwdFrame);
appProxyLayout->addWidget(m_appEnableFrame);
appProxyLayout->addWidget(m_appLine1);
appProxyLayout->addWidget(m_proxyTypeFrame);
appProxyLayout->addWidget(m_appLine2);
appProxyLayout->addWidget(m_ipAddressFrame);
appProxyLayout->addWidget(m_appLine3);
appProxyLayout->addWidget(m_portFrame);
appProxyLayout->addWidget(m_appLine4);
appProxyLayout->addWidget(m_userNameFrame);
appProxyLayout->addWidget(m_appLine5);
appProxyLayout->addWidget(m_pwdFrame);
appProxyLayout->addWidget(m_appProxyInfoWidget);
// appProxyLayout->addWidget(line5);
// appProxyLayout->addWidget(m_appBtnFrame);
@ -1234,7 +1293,7 @@ void Proxy::appListPadding()
AppListWidget *appWidget = new AppListWidget(index, m_appListWidget);
appWidget->setAppName(appInfo.value(0));
appWidget->setAppIcon(QIcon::fromTheme(appInfo.value(1)).pixmap(24, 24));
appWidget->setAppIcon(QIcon::fromTheme(appInfo.value(1)));
appWidget->setAppChecked(flag);
QListWidgetItem *appListWidgetItem = new QListWidgetItem(m_appListWidget);
@ -1258,6 +1317,28 @@ bool Proxy::getipEditState(QString text)
return match;
}
void Proxy::setSystemProxyFrameHidden(bool state)
{
mTitleLabel->setHidden(state);
mProxyFrame->setHidden(state);
m_sysSpacerFrame->setHidden(state);
}
void Proxy::setAppProxyFrameHidden(bool state)
{
m_appProxyLabel->setHidden(state);
m_appProxyFrame->setHidden(state);
m_appListFrame->setHidden(state);
m_appListSpacerFrame->setHidden(state);
m_appSpacerFrame->setHidden(state);
}
void Proxy::setAPTProxyFrameHidden(bool state)
{
mAptProxyLabel->setHidden(state);
mAPTFrame->setHidden(state);
}
void Proxy::onipEditStateChanged()
{
if (!getipEditState(m_ipAddressLineEdit->text())) {
@ -1311,17 +1392,13 @@ void Proxy::onPaletteChanged()
void Proxy::onappProxyEnableChanged(bool enable)
{
m_proxyTypeFrame->setVisible(enable);
m_ipAddressFrame->setVisible(enable);
m_portFrame->setVisible(enable);
m_userNameFrame->setVisible(enable);
m_pwdFrame->setVisible(enable);
m_appListFrame->setVisible(enable);
m_appLine1->setVisible(enable);
m_appLine2->setVisible(enable);
m_appLine3->setVisible(enable);
m_appLine4->setVisible(enable);
m_appLine5->setVisible(enable);
if (enable) {
m_appProxyInfoWidget->show();
m_appListFrame->show();
} else {
m_appProxyInfoWidget->hide();
m_appListFrame->hide();
}
}
#if 0

View File

@ -138,6 +138,7 @@ public:
void setAppProxyConf(QStringList list); //设置应用代理配置信息--调用Dbus
static QMap<QString, QStringList> getAppListProxy();
// bool checkIsChanged(QStringList info);
void setUkccProxySettings(); // 设置控制面板代理模块显示/隐藏
private:
void setAppProxyFrameUi(QWidget *widget);
@ -145,6 +146,13 @@ private:
void appProxyInfoPadding();
void appListPadding();
bool getipEditState(QString text);
void setSystemProxyFrameHidden(bool state);
void setAppProxyFrameHidden(bool state);
void setAPTProxyFrameHidden(bool state);
QFrame *m_sysSpacerFrame;
QFrame *m_appListSpacerFrame;
QFrame *m_appSpacerFrame;
QString pluginName;
int pluginType;
@ -252,6 +260,7 @@ private:
// QPushButton *m_cancelBtn;
// QPushButton *m_saveBtn;
QListWidget *m_appListWidget = nullptr;
QWidget *m_appProxyInfoWidget;
QTextEdit *mIgnoreLineEdit;

View File

@ -6,7 +6,7 @@
<message>
<location filename="../aptproxydialog.cpp" line="24"/>
<source>Set Apt Proxy</source>
<translation>APT代理</translation>
<translation> APT </translation>
</message>
<message>
<location filename="../aptproxydialog.cpp" line="41"/>
@ -69,31 +69,31 @@
<message>
<location filename="../proxy.cpp" line="452"/>
<source>Auto url</source>
<translation>URL</translation>
<translation> URL</translation>
<extra-contents_path>/Proxy/Auto url</extra-contents_path>
</message>
<message>
<location filename="../proxy.cpp" line="454"/>
<source>Http Proxy</source>
<translation>HTTP代理</translation>
<translation>HTTP </translation>
<extra-contents_path>/Proxy/Http Proxy</extra-contents_path>
</message>
<message>
<location filename="../proxy.cpp" line="456"/>
<source>Https Proxy</source>
<translation>HTTPS代理</translation>
<translation>HTTPS </translation>
<extra-contents_path>/Proxy/Https Proxy</extra-contents_path>
</message>
<message>
<location filename="../proxy.cpp" line="458"/>
<source>Ftp Proxy</source>
<translation>FTP代理</translation>
<translation>FTP </translation>
<extra-contents_path>/Proxy/Ftp Proxy</extra-contents_path>
</message>
<message>
<location filename="../proxy.cpp" line="460"/>
<source>Socks Proxy</source>
<translation>SOCKS代理</translation>
<translation>SOCKS </translation>
<extra-contents_path>/Proxy/Socks Proxy</extra-contents_path>
</message>
<message>
@ -119,7 +119,7 @@
<message>
<location filename="../proxy.cpp" line="471"/>
<source>Apt Proxy</source>
<translation>APT代理</translation>
<translation>APT </translation>
<extra-contents_path>/Proxy/Apt Proxy</extra-contents_path>
</message>
<message>
@ -146,7 +146,7 @@
<message>
<location filename="../proxy.cpp" line="573"/>
<source>The apt proxy has been turned off and needs to be restarted to take effect</source>
<translation>APT代理已关闭</translation>
<translation>APT </translation>
</message>
<message>
<location filename="../proxy.cpp" line="574"/>
@ -163,7 +163,7 @@
<message>
<location filename="../proxy.cpp" line="813"/>
<source>The system needs to be restarted to set the Apt proxy, whether to reboot</source>
<translation>APT代理需要重启系统后生效</translation>
<translation> APT </translation>
</message>
<message>
<location filename="../proxy.cpp" line="1017"/>
@ -173,7 +173,7 @@
<message>
<location filename="../proxy.cpp" line="1034"/>
<source>IP address</source>
<translation>IP地址</translation>
<translation>IP </translation>
</message>
<message>
<location filename="../proxy.cpp" line="1040"/>
@ -184,7 +184,7 @@
<message>
<location filename="../proxy.cpp" line="1061"/>
<source>Invalid IP Address</source>
<translation>IP地址</translation>
<translation> IP </translation>
</message>
<message>
<location filename="../proxy.cpp" line="1082"/>

View File

@ -19,7 +19,7 @@
<message>
<location filename="../itemframe.cpp" line="38"/>
<source>Add VPN</source>
<translation>VPN</translation>
<translation> VPN</translation>
</message>
</context>
<context>
@ -34,11 +34,6 @@
<source>import</source>
<translation></translation>
</message>
<message>
<location filename="../vpn.cpp" line="68"/>
<source>VPN</source>
<translation></translation>
</message>
<message>
<location filename="../vpn.cpp" line="151"/>
<source>Show on Taskbar</source>

View File

@ -20,6 +20,7 @@
#include "vpnitem.h"
#include <QPainter>
#include <QPainterPath>
#include <QApplication>
#define FRAME_SPEED 150
#define LIMIT_TIME 60*1000
#define TOTAL_PAGE 8
@ -34,7 +35,6 @@ VpnItem::VpnItem(bool bAcitve, QWidget *parent)
this->setMinimumSize(550, 58);
this->setProperty("useButtonPalette", true);
this->setFlat(true);
this->setProperty("needTranslucent", true);
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
mLanLyt->setContentsMargins(16,0,16,0);
@ -133,12 +133,16 @@ void VpnItem::onDeletetTriggered()
void VpnItem::paintEvent(QPaintEvent *event)
{
QPalette pal = this->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());
QPalette pal = qApp->palette();
QColor color = pal.color(QPalette::Button);
color.setAlphaF(0.5);
pal.setColor(QPalette::Button, color);
this->setPalette(pal);
QRect rect = this->rect();

View File

@ -43,14 +43,22 @@
<extra-contents_path>/wlanconnect/Advanced settings&quot;</extra-contents_path>
</message>
<message>
<location filename="../wlanconnect.cpp" line="123"/>
<source>ukui control center</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<source>ukui control center desktop message</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="123"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="126"/>
<source>ukui control center desktop message</source>
<translation></translation>
<source>Settings desktop message</source>
<translation> </translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="228"/>
@ -58,14 +66,14 @@
<translation></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="362"/>
<location filename="../wlanconnect.cpp" line="1028"/>
<location filename="../wlanconnect.cpp" line="1090"/>
<location filename="../wlanconnect.cpp" line="364"/>
<location filename="../wlanconnect.cpp" line="1033"/>
<location filename="../wlanconnect.cpp" line="1095"/>
<source>connected</source>
<translation></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="965"/>
<location filename="../wlanconnect.cpp" line="970"/>
<source>card</source>
<translation></translation>
</message>

View File

@ -43,14 +43,22 @@
<extra-contents_path>/wlanconnect/Advanced settings&quot;</extra-contents_path>
</message>
<message>
<location filename="../wlanconnect.cpp" line="123"/>
<source>ukui control center</source>
<translation>ukui control center</translation>
<translation type="vanished">ukui control center</translation>
</message>
<message>
<source>ukui control center desktop message</source>
<translation type="vanished">ukui control center desktop message</translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="123"/>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="126"/>
<source>ukui control center desktop message</source>
<translation>ukui control center desktop message</translation>
<source>Settings desktop message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="228"/>
@ -58,14 +66,14 @@
<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"/>
<location filename="../wlanconnect.cpp" line="364"/>
<location filename="../wlanconnect.cpp" line="1033"/>
<location filename="../wlanconnect.cpp" line="1095"/>
<source>connected</source>
<translation>connected</translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="965"/>
<location filename="../wlanconnect.cpp" line="970"/>
<source>card</source>
<translation>card</translation>
</message>

View File

@ -44,12 +44,12 @@
</message>
<message>
<location filename="../wlanconnect.cpp" line="123"/>
<source>ukui control center</source>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="126"/>
<source>ukui control center desktop message</source>
<source>Settings desktop message</source>
<translation type="unfinished"></translation>
</message>
<message>
@ -58,14 +58,14 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="362"/>
<location filename="../wlanconnect.cpp" line="1028"/>
<location filename="../wlanconnect.cpp" line="1090"/>
<location filename="../wlanconnect.cpp" line="364"/>
<location filename="../wlanconnect.cpp" line="1033"/>
<location filename="../wlanconnect.cpp" line="1095"/>
<source>connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="965"/>
<location filename="../wlanconnect.cpp" line="970"/>
<source>card</source>
<translation type="unfinished"></translation>
</message>

View File

@ -43,14 +43,22 @@
<extra-contents_path>/wlanconnect/Advanced settings&quot;</extra-contents_path>
</message>
<message>
<location filename="../wlanconnect.cpp" line="123"/>
<source>ukui control center</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<source>ukui control center desktop message</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="123"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="126"/>
<source>ukui control center desktop message</source>
<translation></translation>
<source>Settings desktop message</source>
<translation> </translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="228"/>
@ -58,14 +66,14 @@
<translation>线</translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="362"/>
<location filename="../wlanconnect.cpp" line="1028"/>
<location filename="../wlanconnect.cpp" line="1090"/>
<location filename="../wlanconnect.cpp" line="364"/>
<location filename="../wlanconnect.cpp" line="1033"/>
<location filename="../wlanconnect.cpp" line="1095"/>
<source>connected</source>
<translation></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="965"/>
<location filename="../wlanconnect.cpp" line="970"/>
<source>card</source>
<translation></translation>
</message>

View File

@ -120,10 +120,10 @@ void WlanConnect::showDesktopNotify(const QString &message)
"org.freedesktop.Notifications",
QDBusConnection::sessionBus());
QList<QVariant> args;
args<<(tr("ukui control center"))
args<<(tr("Settings"))
<<((unsigned int) 0)
<<QString("gnome-dev-ethernet")
<<tr("ukui control center desktop message") //显示的是什么类型的信息
<<tr("Settings desktop message") //显示的是什么类型的信息
<<message //显示的具体信息
<<QStringList()
<<QVariantMap()

View File

@ -35,7 +35,6 @@ WlanItem::WlanItem(bool bAcitve, bool isLock, QWidget *parent)
this->setMinimumSize(550, 58);
this->setProperty("useButtonPalette", true);
this->setFlat(true);
this->setProperty("needTranslucent", true);
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
mLanLyt->setContentsMargins(16,0,16,0);
@ -93,17 +92,16 @@ void WlanItem::stopLoading(){
void WlanItem::paintEvent(QPaintEvent *event)
{
// QPalette pal = qApp->palette();
QPainter painter(this);
painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿
painter.setPen(Qt::NoPen);
painter.setBrush(this->palette().base().color());
// QColor color = pal.color(QPalette::Button);
// color.setAlphaF(0.5);
// pal.setColor(QPalette::Button, color);
// this->setPalette(pal);
QPalette pal = qApp->palette();
QColor color = pal.color(QPalette::Button);
color.setAlphaF(0.5);
pal.setColor(QPalette::Button, color);
this->setPalette(pal);
QRect rect = this->rect();

View File

@ -88,11 +88,25 @@ int main(int argc, char *argv[])
QApplication::setQuitOnLastWindowClosed(false);
QThread thread;
QDBusInterface interface("com.kylin.kylinvpn",
"/com/kylin/kylinvpn",
"com.kylin.kylinvpn",
QDBusConnection::sessionBus());
if(interface.isValid()) {
return 0;
}
QThread *thread = new QThread();
KyNetworkResourceManager *p_networkResource = KyNetworkResourceManager::getInstance();
p_networkResource->moveToThread(&thread);
QObject::connect(&thread, SIGNAL(started()), p_networkResource, SLOT(onInitNetwork()));
thread.start();
p_networkResource->moveToThread(thread);
QObject::connect(thread, &QThread::started, p_networkResource, &KyNetworkResourceManager::onInitNetwork);
QObject::connect(&a,&QtSingleApplication::aboutToQuit, thread, &QThread::quit);
QObject::connect(thread, &QThread::finished, thread, &QThread::deleteLater);
QObject::connect(thread, &QThread::finished, [=](){
qDebug() << "release" ;
p_networkResource->Release();
});
thread->start();
// Internationalization
QString locale = QLocale::system().name();
@ -119,6 +133,8 @@ int main(int argc, char *argv[])
::usleep(1000);
}
vpnObject vpnobject;
a.setActivationWindow(&vpnobject);
vpnobject.setProperty("useStyleWindowManager", false); //禁用拖动

View File

@ -11,12 +11,12 @@
<message>
<location filename="../frontend/single-pages/singlepage.cpp" line="121"/>
<source>Kylin VPN</source>
<translation>VPN工具</translation>
<translation>VPN </translation>
</message>
<message>
<location filename="../frontend/single-pages/singlepage.cpp" line="124"/>
<source>kylin vpn applet desktop message</source>
<translation>vpn配置桌面提</translation>
<translation>VPN </translation>
</message>
</context>
<context>
@ -24,7 +24,7 @@
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="791"/>
<source>MPPE encryption algorithm:</source>
<translation>MPPE加密算法</translation>
<translation>MPPE </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="792"/>
@ -34,7 +34,7 @@
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="793"/>
<source>Send PPP echo packets</source>
<translation>PPP回显包</translation>
<translation> PPP </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="794"/>
@ -44,27 +44,27 @@
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="795"/>
<source>PAP authentication</source>
<translation>PAP认证</translation>
<translation>PAP </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="796"/>
<source>CHAP authentication</source>
<translation>CHAP认证</translation>
<translation>CHAP </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="797"/>
<source>MSCHAP authentication</source>
<translation>MSCHAP认证</translation>
<translation>MSCHAP </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="798"/>
<source>MSCHAP2 authentication</source>
<translation>MSCHAP2认证</translation>
<translation>MSCHAP2 </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="799"/>
<source>EAP authentication</source>
<translation>EAP认证</translation>
<translation>EAP </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="800"/>
@ -74,17 +74,17 @@
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="801"/>
<source>Allow BSD data compression</source>
<translation>BSD压缩</translation>
<translation> BSD </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="802"/>
<source>Allow Default data compression</source>
<translation>Default压缩</translation>
<translation> Default </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="803"/>
<source>Allow TCP header compression</source>
<translation>TCP头压缩</translation>
<translation> TCP </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="804"/>
@ -124,7 +124,7 @@
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1012"/>
<source>Use a TCP connection</source>
<translation>使TCP连接</translation>
<translation>使 TCP </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1013"/>
@ -139,7 +139,7 @@
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1015"/>
<source>Limit TCP Maximum Segment Size(MSS)</source>
<translation>TCP最大段尺寸MSS</translation>
<translation> TCP MSS</translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1016"/>
@ -149,17 +149,17 @@
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1017"/>
<source>IPv6 tun link</source>
<translation>IPv6 tun连接</translation>
<translation>IPv6 tun </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1018"/>
<source>Specify ping interval</source>
<translation>Ping周期</translation>
<translation> Ping </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1019"/>
<source>Specify exit or restart ping</source>
<translation>退Ping</translation>
<translation>退 Ping</translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1020"/>
@ -194,7 +194,7 @@
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1030"/>
<source>Use custom UDP fragment size</source>
<translation>使UDP分片大小</translation>
<translation>使 UDP </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1032"/>
@ -244,7 +244,7 @@
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1044"/>
<source>TLS settings</source>
<translation>TLS设置</translation>
<translation>TLS </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1045"/>
@ -259,7 +259,7 @@
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1049"/>
<source>Verify peer (server) certificate nsCertType specification</source>
<translation>nsCertType指定</translation>
<translation> nsCertType </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1050"/>
@ -284,7 +284,7 @@
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1054"/>
<source>HMAC Authentication</source>
<translation>HMAC认证</translation>
<translation>HMAC </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1064"/>
@ -383,17 +383,17 @@
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1179"/>
<source>Request an inner IP address</source>
<translation>IP地址</translation>
<translation> IP </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1180"/>
<source>Enforce UDP encapsulation</source>
<translation>UDP封装</translation>
<translation> UDP </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1181"/>
<source>Use IP compression</source>
<translation>使IP压缩</translation>
<translation>使 IP </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnadvancedpage.cpp" line="1182"/>
@ -421,17 +421,17 @@
<message>
<location filename="../frontend/vpndetails/vpnconfigpage.cpp" line="315"/>
<source>Local IP</source>
<translation>IP地址</translation>
<translation> IP </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnconfigpage.cpp" line="316"/>
<source>Remote IP</source>
<translation>IP地址</translation>
<translation> IP </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnconfigpage.cpp" line="317"/>
<source>PIN Code</source>
<translation>PIN</translation>
<translation>PIN </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnconfigpage.cpp" line="318"/>
@ -443,7 +443,7 @@
<message>
<location filename="../frontend/vpndetails/vpnconfigpage.cpp" line="319"/>
<source>NT Domain</source>
<translation>NT</translation>
<translation>NT </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnconfigpage.cpp" line="321"/>
@ -458,7 +458,7 @@
<message>
<location filename="../frontend/vpndetails/vpnconfigpage.cpp" line="323"/>
<source>CA Certificate</source>
<translation>CA证书</translation>
<translation>CA </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnconfigpage.cpp" line="324"/>
@ -564,7 +564,7 @@ If key direction is used, it must be opposite to the VPN side used. If &apos;1&a
<message>
<location filename="../frontend/vpndetails/vpnconfigpage.cpp" line="808"/>
<source>Certificate/ssh-agent</source>
<translation>/ssh-agent</translation>
<translation>/ ssh-agent</translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnconfigpage.cpp" line="809"/>
@ -580,12 +580,12 @@ If key direction is used, it must be opposite to the VPN side used. If &apos;1&a
<location filename="../frontend/vpndetails/vpnconfigpage.cpp" line="866"/>
<location filename="../frontend/vpndetails/vpnconfigpage.cpp" line="905"/>
<source>Key Files (*.key *.pem *.der *.p12 *.pfx)</source>
<translation>(*.key *.pem *.der *.p12 *.pfx)</translation>
<translation> (*.key *.pem *.der *.p12 *.pfx)</translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnconfigpage.cpp" line="877"/>
<source>Choose a CA certificate</source>
<translation>CA证书</translation>
<translation> CA </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnconfigpage.cpp" line="879"/>
@ -609,7 +609,7 @@ If key direction is used, it must be opposite to the VPN side used. If &apos;1&a
<message>
<location filename="../frontend/vpndetails/vpnipv4page.cpp" line="152"/>
<source>IPv4 Config</source>
<translation>IPv4配置</translation>
<translation>IPv4 </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnipv4page.cpp" line="153"/>
@ -629,7 +629,7 @@ If key direction is used, it must be opposite to the VPN side used. If &apos;1&a
<message>
<location filename="../frontend/vpndetails/vpnipv4page.cpp" line="156"/>
<source>DNS Server</source>
<translation>DNS服务器</translation>
<translation>DNS </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnipv4page.cpp" line="157"/>
@ -639,12 +639,12 @@ If key direction is used, it must be opposite to the VPN side used. If &apos;1&a
<message>
<location filename="../frontend/vpndetails/vpnipv4page.cpp" line="158"/>
<source>DHCP Client ID</source>
<translation>DHCP客户端ID</translation>
<translation>DHCP ID</translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnipv4page.cpp" line="160"/>
<source>Auto(DHCP)</source>
<translation>(DHCP)</translation>
<translation> (DHCP)</translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnipv4page.cpp" line="161"/>
@ -657,7 +657,7 @@ If key direction is used, it must be opposite to the VPN side used. If &apos;1&a
<message>
<location filename="../frontend/vpndetails/vpnipv6page.cpp" line="141"/>
<source>IPv6 Config</source>
<translation>IPv6配置</translation>
<translation>IPv6 </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnipv6page.cpp" line="142"/>
@ -677,7 +677,7 @@ If key direction is used, it must be opposite to the VPN side used. If &apos;1&a
<message>
<location filename="../frontend/vpndetails/vpnipv6page.cpp" line="145"/>
<source>DNS Server</source>
<translation>DNS服务器</translation>
<translation>DNS </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnipv6page.cpp" line="146"/>
@ -687,7 +687,7 @@ If key direction is used, it must be opposite to the VPN side used. If &apos;1&a
<message>
<location filename="../frontend/vpndetails/vpnipv6page.cpp" line="148"/>
<source>Auto(DHCP)</source>
<translation>(DHCP)</translation>
<translation> (DHCP)</translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnipv6page.cpp" line="149"/>
@ -725,7 +725,7 @@ If key direction is used, it must be opposite to the VPN side used. If &apos;1&a
<message>
<location filename="../frontend/single-pages/vpnpage.cpp" line="270"/>
<source>VPN Settings</source>
<translation>VPN设置</translation>
<translation>VPN </translation>
</message>
</context>
<context>
@ -733,17 +733,17 @@ If key direction is used, it must be opposite to the VPN side used. If &apos;1&a
<message>
<location filename="../frontend/vpndetails/vpnaddpage.cpp" line="15"/>
<source>create VPN</source>
<translation>VPN</translation>
<translation> VPN</translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnaddpage.cpp" line="47"/>
<source>VPN Type</source>
<translation>VPN类型</translation>
<translation>VPN </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnaddpage.cpp" line="75"/>
<source>VPN Name</source>
<translation>VPN名称</translation>
<translation>VPN </translation>
</message>
<message>
<location filename="../frontend/vpndetails/vpnaddpage.cpp" line="81"/>
@ -829,7 +829,7 @@ If key direction is used, it must be opposite to the VPN side used. If &apos;1&a
<message>
<location filename="../frontend/vpnobject.cpp" line="31"/>
<source>vpn tool</source>
<translation>VPN工具</translation>
<translation>VPN </translation>
</message>
</context>
</TS>

View File

@ -80,6 +80,8 @@ KyConnectResourse::KyConnectResourse(QObject *parent) : QObject(parent)
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionRemove, this, &KyConnectResourse::connectionRemove);
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionUpdate, this, &KyConnectResourse::connectionUpdate);
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectivityChanged, this, &KyConnectResourse::connectivityChanged);
connect(m_networkResourceInstance, &KyNetworkResourceManager::needShowDesktop, this, &KyConnectResourse::needShowDesktop);
}
KyConnectResourse::~KyConnectResourse()
@ -451,36 +453,28 @@ void KyConnectResourse::getIpv4ConnectSetting(
NetworkManager::Ipv4Setting::Ptr &ipv4Setting,
KyConnectSetting &connectSetting)
{
connectSetting.m_ipv4Dns = ipv4Setting->dns();
if (NetworkManager::Ipv4Setting::Automatic == ipv4Setting->method()) {
connectSetting.m_ipv4ConfigIpType = CONFIG_IP_DHCP;
return;
}
connectSetting.m_ipv4ConfigIpType = CONFIG_IP_MANUAL;
connectSetting.m_ipv4Address = ipv4Setting->addresses();
connectSetting.m_ipv4Dns = ipv4Setting->dns();
return;
}
void KyConnectResourse::getIpv6ConnectSetting(
NetworkManager::Ipv6Setting::Ptr &ipv6Setting,
KyConnectSetting &connectSetting)
{
connectSetting.m_ipv6Dns = ipv6Setting->dns();
if (NetworkManager::Ipv6Setting::Automatic == ipv6Setting->method()) {
connectSetting.m_ipv6ConfigIpType = CONFIG_IP_DHCP;
return;
}
connectSetting.m_ipv6ConfigIpType = CONFIG_IP_MANUAL;
connectSetting.m_ipv6Address = ipv6Setting->addresses();
connectSetting.m_ipv6Dns = ipv6Setting->dns();
return;
connectSetting.m_ipv6Address = ipv6Setting->addresses();
}
void KyConnectResourse::getConnectivity(NetworkManager::Connectivity &connectivity)

View File

@ -87,6 +87,8 @@ Q_SIGNALS:
void connectionRemove(QString path);
void connectivityChanged(NetworkManager::Connectivity connectivity);
void needShowDesktop(QString);
private:
KyNetworkResourceManager *m_networkResourceInstance = nullptr;
};

View File

@ -69,7 +69,8 @@ int KyConnectSetting::setIpConfigType(KyIpAddressType ipType, KyIpConfigType ipC
return 0;
}
void KyConnectSetting::ipv4AddressConstruct(QString &ipv4Address, QString &ipv4NetMask, QString &ipv4GateWay, QStringList &ipv4Dns)
void KyConnectSetting::ipv4AddressConstruct(QString &ipv4Address, QString &ipv4NetMask, QString &ipv4GateWay)
{
qDebug()<<"ipv4 address"<<ipv4Address << ipv4NetMask << ipv4GateWay;
NetworkManager::IpAddress nmIpv4Address;
@ -78,16 +79,14 @@ void KyConnectSetting::ipv4AddressConstruct(QString &ipv4Address, QString &ipv4N
nmIpv4Address.setNetmask(QHostAddress(ipv4NetMask));
m_ipv4Address.clear();
m_ipv4Address << nmIpv4Address;
m_ipv4Dns.clear();
for (int index = 0; index < ipv4Dns.size(); ++index) {
qDebug()<<"dns"<<ipv4Dns[index];
m_ipv4Dns << QHostAddress(ipv4Dns[index]);
}
return ;
}
void KyConnectSetting::ipv6AddressConstruct(QString &ipv6Address, QString &ipv6NetMask, QString &ipv6GateWay, QStringList &ipv6Dns)
void KyConnectSetting::ipv4DnsConstruct(QList<QHostAddress> &ipv4Dns)
{
m_ipv4Dns = ipv4Dns;
}
void KyConnectSetting::ipv6AddressConstruct(QString &ipv6Address, QString &ipv6NetMask, QString &ipv6GateWay)
{
NetworkManager::IpAddress nmIpv6Address;
nmIpv6Address.setIp(QHostAddress(ipv6Address));
@ -96,12 +95,11 @@ void KyConnectSetting::ipv6AddressConstruct(QString &ipv6Address, QString &ipv6N
m_ipv6Address.clear();
m_ipv6Address << nmIpv6Address;
m_ipv6Dns.clear();
for (int index = 0; index < ipv6Dns.size(); index++) {
m_ipv6Dns << QHostAddress(ipv6Dns[index]);
}
}
return ;
void KyConnectSetting::ipv6DnsConstruct(QList<QHostAddress> &ipv6Dns)
{
m_ipv6Dns = ipv6Dns;
}
void KyConnectSetting::dumpInfo()

View File

@ -50,8 +50,10 @@ public:
void setIfaceName(QString &ifaceName);
void setConnectName(QString &connectName);
int setIpConfigType(KyIpAddressType ipType, KyIpConfigType configType);
void ipv4AddressConstruct(QString &ipv4Address, QString &ipv4NetMask, QString &ipv4GateWay, QStringList &ipv4Dns);
void ipv6AddressConstruct(QString &ipv6Address, QString &ipv6NetMask, QString &ipv6GateWay, QStringList &ipv6Dns);
void ipv4DnsConstruct(QList<QHostAddress> &ipv4Dns);
void ipv4AddressConstruct(QString &ipv4Address, QString &ipv4NetMask, QString &ipv4GateWay);
void ipv6DnsConstruct(QList<QHostAddress> &ipv6Dns);
void ipv6AddressConstruct(QString &ipv6Address, QString &ipv6NetMask, QString &ipv6GateWay);
void dumpInfo();
public:

View File

@ -256,7 +256,7 @@ void KyNetworkDeviceResourse::getDeviceConnectivity(const QString &deviceName, N
QString dbusPath;
NetworkManager::Device::Ptr connectDevice =
m_networkResourceInstance->findDeviceInterface(deviceName);
if (connectDevice->isValid()) {
if (connectDevice != nullptr && connectDevice->isValid()) {
dbusPath = connectDevice->uni();
} else {
qWarning() << "[KyNetworkDeviceResourse] can not find device " << deviceName;

View File

@ -228,6 +228,10 @@ void KyNetworkResourceManager::removeDevice(int pos)
{
//connections signals
NetworkManager::Device::Ptr device = m_devices.takeAt(pos);
QDBusConnection::systemBus().disconnect(QString("org.freedesktop.NetworkManager"),
device.data()->uni(),
QString("org.freedesktop.NetworkManager.Device"),
QString("AcdIpProbed"), this, SIGNAL(needShowDesktop(QString)));
device->disconnect(this);
}
@ -303,6 +307,10 @@ void KyNetworkResourceManager::addDevice(NetworkManager::Device::Ptr device)
//TODO: other device types!
break;
}
QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"),
device.data()->uni(),
QString("org.freedesktop.NetworkManager.Device"),
QString("AcdIpProbed"), this, SIGNAL(needShowDesktop(QString)));
}
void KyNetworkResourceManager::insertDevices()

View File

@ -144,6 +144,7 @@ Q_SIGNALS:
void connectivityChanged(NetworkManager::Connectivity connectivity);
void stateChanged(NetworkManager::Device::State newstate, NetworkManager::Device::State oldstate, NetworkManager::Device::StateChangeReason reason);
void needShowDesktop(QString);
public Q_SLOTS:
void onInitNetwork();

View File

@ -35,19 +35,19 @@ const QString ENTERPRICE_TYPE = "802.1X";
const QString WPA1_AND_WPA2 = "WPA";
const QString WPA3 = "WPA3";
WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isApMode, bool isShowWifi6, QWidget *parent)
WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isApMode, bool isShowWifi6Plus, QWidget *parent)
: WlanListItem(wirelessNetItem, device, parent)
{
m_isApMode = isApMode;
m_isShowWifi6 = isShowWifi6;
m_isShowWifi6Plus = isShowWifi6Plus;
refreshIcon(false); // 额外刷新一次图标因为WlanListItem执行时m_isApMode尚未赋值
}
WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isShowWifi6, QWidget *parent) : ListItem(parent)
WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isShowWifi6Plus, QWidget *parent) : ListItem(parent)
{
m_wlanDevice = device;
m_wirelessNetItem = wirelessNetItem;
m_isShowWifi6 = isShowWifi6;
m_isShowWifi6Plus = isShowWifi6Plus;
qDebug()<<"[WlanPage] wlan list item is created." << m_wirelessNetItem.m_NetSsid;
@ -456,9 +456,7 @@ void WlanListItem::refreshIcon(bool isActivated)
int signalStrength = 0;
QString uni = "";
QString secuType = "";
if (m_isShowWifi6) {
category = m_wirelessNetItem.getCategory(m_wirelessNetItem.m_uni);
}
category = m_wirelessNetItem.getCategory(m_wirelessNetItem.m_uni);
signalStrength = m_wirelessNetItem.m_signalStrength;
if (isActivated) {
@ -468,6 +466,10 @@ void WlanListItem::refreshIcon(bool isActivated)
}
}
if (!m_isShowWifi6Plus && category == 2) {
category = 1;
}
QString iconPath = getIcon(m_hasPwd, signalStrength, category);
m_netButton->setButtonIcon(QIcon::fromTheme(iconPath));

View File

@ -54,8 +54,8 @@ class WlanListItem : public ListItem
{
Q_OBJECT
public:
WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isApMode, bool isShowWifi6, QWidget *parent = nullptr);
WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isShowWifi6, QWidget *parent = nullptr);
WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isApMode, bool isShowWifi6Plus, QWidget *parent = nullptr);
WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isShowWifi6Plus, QWidget *parent = nullptr);
WlanListItem(QWidget *parent = nullptr);
~WlanListItem();
@ -127,7 +127,7 @@ private:
bool m_forgetConnection = false;
bool m_isApMode = false;
bool m_isShowWifi6 = true;
bool m_isShowWifi6Plus = true;
protected Q_SLOTS:
void onInfoButtonClicked();

View File

@ -107,6 +107,7 @@ public:
QString strIPV4FirDns;
QString strIPV4SecDns;
QString strIPV4GateWay;
QList<QHostAddress> ipv4DnsList;
KyIpConfigType ipv6ConfigType = CONFIG_IP_DHCP;
QString strIPV6Address;
@ -114,6 +115,7 @@ public:
QString strIPV6FirDns;
QString strIPV6SecDns;
QString strIPV6GateWay;
QList<QHostAddress> ipv6DnsList;
KyEapMethodType enterpriseType;
KyEapMethodTlsInfo tlsInfo;

View File

@ -38,16 +38,16 @@ 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, false, this);
QLabel *nameEmptyLabel = new QLabel(this);
QLabel *configEmptyLabel = new QLabel(this);
@ -89,8 +89,6 @@ void CreatNetPage::initUI()
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);
@ -103,22 +101,15 @@ void CreatNetPage::initUI()
m_detailLayout->addRow(m_maskLabel, maskWidget);
m_detailLayout->addRow(m_gateWayLabel,gateWayEdit);
m_detailLayout->addRow(gateWayEmptyLabel);
m_detailLayout->addRow(m_dnsLabel,firstDnsEdit);
m_detailLayout->addRow(firstDnsEmptyLabel);
m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit);
m_detailLayout->addRow(m_dnsWidget);
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() {
@ -133,9 +124,6 @@ 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()));
}
@ -165,20 +153,6 @@ bool CreatNetPage::checkConnectBtnIsEnabled()
// 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;
}
@ -215,15 +189,11 @@ void CreatNetPage::setLineEnabled(bool check) {
ipv4addressEdit->setEnabled(check);
netMaskEdit->setEnabled(check);
gateWayEdit->setEnabled(check);
firstDnsEdit->setEnabled(check);
secondDnsEdit->setEnabled(check);
if (!check) {
ipv4addressEdit->clear();
netMaskEdit->clear();
gateWayEdit->clear();
firstDnsEdit->clear();
secondDnsEdit->clear();
ipv4addressEdit->setPlaceholderText(" ");
netMaskEdit->setPlaceholderText(" ");
@ -261,19 +231,27 @@ void CreatNetPage::constructIpv4Info(KyConnectSetting &setting)
<< " gateWay " << gateWay;
QStringList dnsList;
dnsList.empty();
dnsList.clear();
#if 0
if (!firstDnsEdit->text().isEmpty()) {
dnsList << firstDnsEdit->text();
if (!secondDnsEdit->text().isEmpty()) {
dnsList << secondDnsEdit->text();
}
}
#endif
QList<QHostAddress> ipv4dnsList;
ipv4dnsList.clear();
ipv4dnsList = m_dnsWidget->getDns();
if (ipv4ConfigCombox->currentData() == AUTO_CONFIG) {
setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_DHCP);
} else {
setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_MANUAL);
setting.ipv4AddressConstruct(ipv4address, netMask, gateWay, dnsList);
setting.ipv4AddressConstruct(ipv4address, netMask, gateWay);
}
setting.ipv4DnsConstruct(ipv4dnsList);
}

View File

@ -32,6 +32,7 @@
#include <QDebug>
#include "coninfo.h"
#include "multiplednswidget.h"
class CreatNetPage : public QFrame
{
@ -46,10 +47,7 @@ private:
LineEdit *ipv4addressEdit;
LineEdit *netMaskEdit;
LineEdit *gateWayEdit;
LineEdit *firstDnsEdit;
LineEdit *secondDnsEdit;
private:
QFormLayout *m_detailLayout;
QVBoxLayout *mvBoxLayout;
QLabel *m_connNameLabel;
@ -57,11 +55,12 @@ private:
QLabel *m_addressLabel;
QLabel *m_maskLabel;
QLabel *m_gateWayLabel;
QLabel *m_dnsLabel;
QLabel *m_secDnsLabel;
QLabel *m_addressHintLabel;
QLabel *m_maskHintLabel;
MultipleDnsWidget *m_dnsWidget = nullptr;
private:
void initUI();
void initComponent();

View File

@ -87,7 +87,7 @@ void DetailPage::setIpv4(const QString &ipv4) {
}
void DetailPage::setIpv4Dns(const QString &ipv4Dns) {
this->m_IPV4Dns->setText(ipv4Dns);
this->m_IPV4Dns->setLabelText(ipv4Dns);
}
void DetailPage::setIpv6(const QString &ipv6) {
@ -246,7 +246,9 @@ void DetailPage::initUI() {
m_ipv4Widget = new DetailWidget(qobject_cast<QWidget *>(m_IPV4), m_listWidget);
m_ipv4Widget->setKey(tr("IPv4:"));
m_IPV4Dns = new QLabel(this);
m_IPV4Dns = new FixLabel(this);
m_IPV4Dns->setFixedWidth(MAX_LABEL_WIDTH);
m_IPV4Dns->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
m_ipv4DnsWidget = new DetailWidget(qobject_cast<QWidget *>(m_IPV4Dns), m_listWidget);
m_ipv4DnsWidget->setKey(tr("IPv4 DNS:"));

View File

@ -91,7 +91,7 @@ public:
QLabel *m_Chan;
QLabel *m_BandWidth;
QLabel *m_IPV4;
QLabel *m_IPV4Dns;
FixLabel *m_IPV4Dns;
FixLabel *m_IPV6;
QLabel *m_Mac;
QLabel *m_autoConnect;

View File

@ -0,0 +1,156 @@
#include "dnssettingwidget.h"
#include <QLayout>
#include <QFormLayout>
#include <QApplication>
#include <QGSettings>
#include "coninfo.h"
#define THEME_SCHAME "org.ukui.style"
#define COLOR_THEME "styleName"
#define BOTTOM_LAYOUT_MARGINS 24, 16, 24, 24
#define LAYOUT_SPACING 16
DnsSettingWidget::DnsSettingWidget(QString timeout, QString retry, QString tactic, QWidget *parent)
:m_timeout(timeout), m_retry(retry), m_tactic(tactic), QDialog(parent)
{
this->setFixedSize(420, 420);
setAttribute(Qt::WA_DeleteOnClose, false);
setProperty("useStyleWindowManager", false);
initUi();
initConnect();
onPaletteChanged();
}
void DnsSettingWidget::initUi()
{
m_titleWidget = new QWidget(this);
m_centerWidget = new QWidget(this);
m_bottomWidget = new QWidget(this);
m_titleLabel = new QLabel(this);
m_titleLabel->setContentsMargins(24,14,0,0);
m_titleLabel->setText(tr("DNS Server Advanced Settings"));
m_tacticLabel = new QLabel(this);
m_tacticLabel->setText(tr("Tactic"));
m_timeoutLabel = new QLabel(this);
m_timeoutLabel->setText(tr("Timeout"));
m_retryLabel = new QLabel(this);
m_retryLabel->setText(tr("Retry Count"));
m_tacticComboBox = new QComboBox(this);
m_tacticComboBox->addItem(tr("order"), "order");
m_tacticComboBox->addItem(tr("rotate"), "rotate");
m_tacticComboBox->addItem(tr("concurrency"), "concurrency");
m_tacticComboBox->setCurrentIndex(m_tacticComboBox->findData(m_tactic));
m_timeoutComboBox = new QComboBox(this);
for (int i = 0; i < 30; ++i) {
m_timeoutComboBox->insertItem(i, QString::number(i+1) + tr(" s"), QString::number(i+1));
}
m_timeoutComboBox->setCurrentIndex(m_timeoutComboBox->findData(m_timeout.toInt()));
m_retryComboBox = new QComboBox(this);
for (int i = 0; i < 4; ++i) {
m_retryComboBox->insertItem(i, QString::number(i+1) + tr(" times"), QString::number(i+1));
}
m_retryComboBox->setCurrentIndex(m_retryComboBox->findData(m_retry.toInt()));
m_bottomDivider = new Divider(true, this);
m_closeBtn = new QPushButton(this);
m_closeBtn->setFixedSize(32,32);
m_closeBtn->setIcon(QIcon::fromTheme("application-exit-symbolic"));
m_closeBtn->setProperty("useButtonPalette", true);
m_closeBtn->setFlat(true);
m_cancelBtn = new QPushButton(this);
m_cancelBtn->setText(tr("Cancel"));
m_confirmBtn = new QPushButton(this);
m_confirmBtn->setText(tr("Confirm"));
QHBoxLayout* titleLayout = new QHBoxLayout(m_titleWidget);
titleLayout->setContentsMargins(0,4,3,0);
titleLayout->addStretch();
titleLayout->addWidget(m_closeBtn);
QVBoxLayout* mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(0,0,0,0);
mainLayout->setSpacing(0);
mainLayout->addWidget(m_titleWidget);
mainLayout->addWidget(m_titleLabel, Qt::AlignLeft);
mainLayout->addWidget(m_centerWidget);
mainLayout->addSpacing(115);
mainLayout->addWidget(m_bottomDivider);
mainLayout->addWidget(m_bottomWidget);
this->setLayout(mainLayout);
//中间页面
QFormLayout* centerLayout = new QFormLayout(m_centerWidget);
centerLayout->setContentsMargins(24,10,24,0);
centerLayout->setSpacing(16);
centerLayout->addRow(m_tacticLabel, m_tacticComboBox);
centerLayout->addRow(m_timeoutLabel, m_timeoutComboBox);
centerLayout->addRow(m_retryLabel, m_retryComboBox);
//底部按钮
QHBoxLayout* bottomLayout = new QHBoxLayout(m_bottomWidget);
bottomLayout->setContentsMargins(BOTTOM_LAYOUT_MARGINS);
bottomLayout->setSpacing(LAYOUT_SPACING);
bottomLayout->addStretch();
bottomLayout->addWidget(m_cancelBtn);
bottomLayout->addWidget(m_confirmBtn);
this->setWindowFlags(Qt::Dialog);
}
void DnsSettingWidget::initConnect()
{
connect(m_closeBtn, &QPushButton::released, this, [=](){
reject();
});
connect(m_cancelBtn, &QPushButton::released, this, [=](){
reject();
});
connect(m_confirmBtn, &QPushButton::released, this, [=](){
m_timeout = m_timeoutComboBox->currentData().toString();
m_tactic = m_tacticComboBox->currentData().toString();
m_retry = m_retryComboBox->currentData().toString();
accept();
});
connect(qApp, &QApplication::paletteChanged, this, &DnsSettingWidget::onPaletteChanged);
}
void DnsSettingWidget::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);
QList<QComboBox *> comboBoxList = this->findChildren<QComboBox *>();
for (int i = 0; i < comboBoxList.count(); ++i) {
comboBoxList.at(i)->setPalette(pal);
if (comboBoxList.at(i)->view()) {
comboBoxList.at(i)->view()->setPalette(pal);
}
}
if (styleGsettings != nullptr) {
delete styleGsettings;
styleGsettings = nullptr;
}
}

View File

@ -0,0 +1,57 @@
#ifndef DNSSETTINGWIDGET_H
#define DNSSETTINGWIDGET_H
#include <QObject>
#include <QDialog>
#include <QLabel>
#include <QComboBox>
#include <QDBusInterface>
#include <QPushButton>
#include "divider.h"
class DnsSettingWidget : public QDialog
{
Q_OBJECT
public:
explicit DnsSettingWidget(QString timeout = "", QString retry = "", QString tactic = "", QWidget *parent = nullptr);
void getDnsSettings(QString& timeout, QString& retry, QString& tactic) {
timeout = QString::number(m_timeoutComboBox->currentData().toInt());
retry = QString::number(m_retryComboBox->currentData().toInt());
tactic = m_tacticComboBox->currentData().toString();
}
private:
QWidget* m_titleWidget;
QWidget* m_centerWidget;
QWidget* m_bottomWidget;
QString m_timeout;
QString m_retry;
QString m_tactic;
QLabel* m_titleLabel;
QLabel* m_tacticLabel;
QLabel* m_timeoutLabel;
QLabel* m_retryLabel;
QComboBox* m_tacticComboBox;
QComboBox* m_timeoutComboBox;
QComboBox* m_retryComboBox;
Divider *m_bottomDivider = nullptr;
QPushButton *m_closeBtn;
QPushButton *m_cancelBtn;
QPushButton *m_confirmBtn;
void initUi();
void initConnect();
private Q_SLOTS:
void onPaletteChanged();
};
#endif // DNSSETTINGWIDGET_H

View File

@ -39,15 +39,11 @@ 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);
@ -64,16 +60,13 @@ void Ipv4Page::initUI() {
m_gateWayEmptyLabel = new QLabel(this);
m_gateWayEmptyLabel->setFixedHeight(LABEL_HEIGHT);
m_firstDnsEmptyLabel = new QLabel(this);
m_firstDnsEmptyLabel->setFixedHeight(LABEL_HEIGHT);
m_dnsEmptyLabel = new QLabel(this);
m_dnsEmptyLabel->setFixedHeight(21);
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);
@ -100,6 +93,12 @@ 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");
Divider* divider = new Divider(true, this);
m_dnsWidget = new MultipleDnsWidget(rx, true, this);
m_detailLayout = new QFormLayout(this);
m_detailLayout->setVerticalSpacing(0);
m_detailLayout->setContentsMargins(LAYOUT_MARGINS);
@ -109,9 +108,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_dnsLabel,firstDnsEdit);
m_detailLayout->addRow(m_firstDnsEmptyLabel);
m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit);
m_detailLayout->addRow(divider);
m_detailLayout->addRow(m_dnsEmptyLabel);
m_detailLayout->addRow(m_dnsWidget);
ipv4ConfigCombox->addItem(tr("Auto(DHCP)")); //"自动(DHCP)"
ipv4ConfigCombox->addItem(tr("Manual")); //"手动"
@ -124,14 +123,9 @@ 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();
}
@ -152,8 +146,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()));
connect(m_dnsWidget, &MultipleDnsWidget::scrollToBottom, this, &Ipv4Page::scrollToBottom);
}
void Ipv4Page::setIpv4Config(KyIpConfigType ipv4Config)
@ -175,14 +169,9 @@ void Ipv4Page::setNetMask(const QString &netMask)
netMaskEdit->setText(netMask);
}
void Ipv4Page::setIpv4FirDns(const QString &ipv4FirDns)
void Ipv4Page::setMulDns(const QList<QHostAddress> &dns)
{
firstDnsEdit->setText(ipv4FirDns);
}
void Ipv4Page::setIpv4SecDns(const QString &ipv4SecDns)
{
secondDnsEdit->setText(ipv4SecDns);
m_dnsWidget->setDnsListText(dns);
}
void Ipv4Page::setGateWay(const QString &gateWay)
@ -193,54 +182,53 @@ void Ipv4Page::setGateWay(const QString &gateWay)
bool Ipv4Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting)
{
bool isChanged = false;
KyIpConfigType type;
if (ipv4ConfigCombox->currentIndex() == AUTO_CONFIG) {
type = CONFIG_IP_DHCP;
if (info.ipv4ConfigType != CONFIG_IP_DHCP) {
qDebug() << "ipv4ConfigType change to Auto";
setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_DHCP);
QString ipv4address("");
QString netMask("");
QString gateWay("");
QStringList dnsList;
dnsList.empty();
qDebug() << ipv4address << netMask << gateWay;
setting.ipv4AddressConstruct(ipv4address, netMask, gateWay, dnsList);
isChanged = true;
}
} else {
type = CONFIG_IP_MANUAL;
if (info.ipv4ConfigType != CONFIG_IP_MANUAL) {
qDebug() << "ipv4ConfigType change to Manual";
setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_MANUAL);
isChanged = true;
}
qDebug() << "ipv4 netmask " << getNetMaskText(netMaskEdit->text());
if(info.strIPV4Address != ipv4addressEdit->text()
|| info.strIPV4NetMask != /*netMaskEdit->text()*/getNetMaskText(netMaskEdit->text())
|| info.strIPV4GateWay != gateWayEdit->text()
|| info.strIPV4FirDns != firstDnsEdit->text()
|| info.strIPV4SecDns != secondDnsEdit->text()) {
} else {
qDebug() << "ipv4 info changed";
QStringList dnsList;
dnsList.empty();
if (!firstDnsEdit->text().isEmpty()) {
dnsList << firstDnsEdit->text();
if (!secondDnsEdit->text().isEmpty()) {
dnsList << secondDnsEdit->text();
}
if(info.strIPV4Address != ipv4addressEdit->text()
|| info.strIPV4NetMask != getNetMaskText(netMaskEdit->text())
|| info.strIPV4GateWay != gateWayEdit->text()) {
qDebug() << "ipv4 info changed";
isChanged = true;
}
QString ipv4address =ipv4addressEdit->text();
QString netMask = getNetMaskText(netMaskEdit->text());
QString gateWay = gateWayEdit->text();
qDebug() << ipv4address << netMask << gateWay;
setting.ipv4AddressConstruct(ipv4address, netMask, gateWay, dnsList);
setting.dumpInfo();
isChanged = true;
}
}
QList<QHostAddress> ipv4dnsList;
ipv4dnsList.clear();
ipv4dnsList = m_dnsWidget->getDns();
if(info.ipv4DnsList != ipv4dnsList) {
isChanged = true;
}
if (isChanged) {
setting.setIpConfigType(IPADDRESS_V4, type);
QString ipv4address = ipv4addressEdit->text();
QString netMask = getNetMaskText(netMaskEdit->text());
QString gateWay = gateWayEdit->text();
setting.ipv4AddressConstruct(ipv4address, netMask, gateWay);
setting.ipv4DnsConstruct(ipv4dnsList);
setting.dumpInfo();
}
return isChanged;
}
bool Ipv4Page::checkDnsSettingsIsChanged() {
return m_dnsWidget->getDnsSettingsChanged();
}
bool Ipv4Page::checkConnectBtnIsEnabled()
{
qDebug() << "checkConnectBtnIsEnabled currentIndex" << ipv4ConfigCombox->currentIndex();
@ -262,20 +250,6 @@ bool Ipv4Page::checkConnectBtnIsEnabled()
// 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;
}
@ -325,8 +299,6 @@ void Ipv4Page::setLineEnabled(bool check) {
ipv4addressEdit->clear();
netMaskEdit->clear();
gateWayEdit->clear();
firstDnsEdit->clear();
secondDnsEdit->clear();
ipv4addressEdit->setPlaceholderText(" ");
netMaskEdit->setPlaceholderText(" ");
@ -339,8 +311,7 @@ void Ipv4Page::setLineEnabled(bool check) {
ipv4addressEdit->setEnabled(check);
netMaskEdit->setEnabled(check);
gateWayEdit->setEnabled(check);
firstDnsEdit->setEnabled(check);
secondDnsEdit->setEnabled(check);
// m_dnsWidget->setEditEnabled(check);
}
void Ipv4Page::setEnableOfSaveBtn() {

View File

@ -33,6 +33,8 @@
//#include "kylinconnectsetting.h"
#include "coninfo.h"
#include "multiplednswidget.h"
#include "divider.h"
class Ipv4Page : public QFrame
{
@ -42,11 +44,16 @@ public:
void setIpv4Config(KyIpConfigType ipv4Config);
void setIpv4(const QString &ipv4);
void setNetMask(const QString &netMask);
void setIpv4FirDns(const QString &ipv4FirDns);
void setIpv4SecDns(const QString &ipv4SecDns);
void setMulDns(const QList<QHostAddress> &dns);
void setGateWay(const QString &gateWay);
void setUuid(QString uuid) {
if (m_dnsWidget != nullptr) {
m_dnsWidget->setUuid(uuid);
}
}
bool checkIsChanged(const ConInfo info, KyConnectSetting &setting);
bool checkDnsSettingsIsChanged();
void startLoading();
void stopLoading();
@ -57,8 +64,6 @@ private:
LineEdit *ipv4addressEdit;
LineEdit *netMaskEdit;
LineEdit *gateWayEdit;
LineEdit *firstDnsEdit;
LineEdit *secondDnsEdit;
QFormLayout *m_detailLayout;
QVBoxLayout *mvBoxLayout;
@ -66,14 +71,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;
QLabel *m_firstDnsEmptyLabel;
QLabel *m_dnsEmptyLabel;
MultipleDnsWidget *m_dnsWidget = nullptr;
QLabel *m_statusLabel = nullptr;
QList<QIcon> m_loadIcons;
@ -106,6 +111,7 @@ private Q_SLOTS:
Q_SIGNALS:
void setIpv4PageState(bool);
void ipv4EditFinished(const QString &address);
void scrollToBottom();
};
#endif // IPV4PAGE_H

View File

@ -52,14 +52,9 @@ void Ipv6Page::setIpv6Perfix(const int &ipv6Perfix)
lengthEdit->setText(QString::number(ipv6Perfix));
}
void Ipv6Page::setIpv6FirDns(const QString &ipv6FirDns)
void Ipv6Page::setMulDns(const QList<QHostAddress> &dns)
{
firstDnsEdit->setText(ipv6FirDns);
}
void Ipv6Page::setIpv6SecDns(const QString &ipv6SecDns)
{
secondDnsEdit->setText(ipv6SecDns);
m_dnsWidget->setDnsListText(dns);
}
void Ipv6Page::setGateWay(const QString &gateWay)
@ -70,48 +65,43 @@ void Ipv6Page::setGateWay(const QString &gateWay)
bool Ipv6Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting)
{
bool isChanged = false;
KyIpConfigType type;
if (ipv6ConfigCombox->currentIndex() == AUTO_CONFIG) {
type = CONFIG_IP_DHCP;
if (info.ipv6ConfigType != CONFIG_IP_DHCP) {
qDebug() << "ipv6ConfigType change to Auto";
setting.setIpConfigType(IPADDRESS_V6, CONFIG_IP_DHCP);
QString ipv6address("");
QString prefix("");
QString gateWay("");
QStringList dnsList;
dnsList.empty();
setting.ipv6AddressConstruct(ipv6address, prefix, gateWay, dnsList);
isChanged = true;
}
} else {
type = CONFIG_IP_DHCP;
if (info.ipv6ConfigType != CONFIG_IP_MANUAL) {
qDebug() << "ipv6ConfigType change to Manual";
setting.setIpConfigType(IPADDRESS_V6, CONFIG_IP_MANUAL);
isChanged = true;
}
if(info.strIPV6Address != ipv6AddressEdit->text()
|| info.iIPV6Prefix != lengthEdit->text().toInt()
|| info.strIPV6GateWay != gateWayEdit->text()
|| info.strIPV6FirDns != firstDnsEdit->text()
|| info.strIPV6SecDns != secondDnsEdit->text()) {
|| info.strIPV6GateWay != gateWayEdit->text()) {
qDebug() << "ipv6 info changed";
QStringList dnsList;
dnsList.empty();
if (!firstDnsEdit->text().isEmpty()) {
dnsList << firstDnsEdit->text();
if (!secondDnsEdit->text().isEmpty()) {
dnsList << secondDnsEdit->text();
}
}
QString ipv6address =ipv6AddressEdit->text();
QString prefix = lengthEdit->text();
QString gateWay = gateWayEdit->text();
setting.ipv6AddressConstruct(ipv6address, prefix, gateWay, dnsList);
setting.dumpInfo();
isChanged = true;
}
}
QList<QHostAddress> ipv6dnsList;
ipv6dnsList.clear();
ipv6dnsList = m_dnsWidget->getDns();
if (info.ipv6DnsList != ipv6dnsList) {
isChanged = true;
}
if (isChanged) {
setting.setIpConfigType(IPADDRESS_V6, type);
QString ipv6address =ipv6AddressEdit->text();
QString prefix = lengthEdit->text();
QString gateWay = gateWayEdit->text();
setting.ipv6AddressConstruct(ipv6address, prefix, gateWay);
setting.ipv6DnsConstruct(ipv6dnsList);
setting.dumpInfo();
}
return isChanged;
}
@ -120,15 +110,11 @@ 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);
@ -145,16 +131,10 @@ 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);
@ -181,6 +161,9 @@ 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, false, this);
m_detailLayout = new QFormLayout(this);
m_detailLayout->setContentsMargins(0, 0, 0, 0);
m_detailLayout->setVerticalSpacing(0);
@ -190,18 +173,13 @@ void Ipv6Page::initUI() {
m_detailLayout->addRow(m_subnetLabel,lengthEdit);
m_detailLayout->addRow(m_subnetEmptyLabel);
m_detailLayout->addRow(m_gateWayLabel,gateWayWidget);
m_detailLayout->addRow(m_dnsLabel,firstDnsEdit);
m_detailLayout->addRow(m_firstDnsEmptyLabel);
m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit);
m_detailLayout->addRow(m_dnsWidget);
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));
@ -225,8 +203,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()));
connect(m_dnsWidget, &MultipleDnsWidget::scrollToBottom, this, &Ipv6Page::scrollToBottom);
}
void Ipv6Page::configChanged(int index) {
@ -244,8 +222,6 @@ void Ipv6Page::setControlEnabled(bool check)
ipv6AddressEdit->clear();
lengthEdit->clear();
gateWayEdit->clear();
firstDnsEdit->clear();
secondDnsEdit->clear();
ipv6AddressEdit->setPlaceholderText(" ");
lengthEdit->setPlaceholderText(" ");
@ -258,8 +234,6 @@ void Ipv6Page::setControlEnabled(bool check)
ipv6AddressEdit->setEnabled(check);
lengthEdit->setEnabled(check);
gateWayEdit->setEnabled(check);
firstDnsEdit->setEnabled(check);
secondDnsEdit->setEnabled(check);
}
void Ipv6Page::setEnableOfSaveBtn()
@ -316,21 +290,6 @@ bool Ipv6Page::checkConnectBtnIsEnabled()
// 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;
}
}
return true;
}

View File

@ -33,6 +33,7 @@
//#include "kylinconnectsetting.h"
#include "coninfo.h"
#include "multiplednswidget.h"
class Ipv6Page : public QFrame
{
@ -42,8 +43,7 @@ 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 setGateWay(const QString &gateWay);
bool checkIsChanged(const ConInfo info, KyConnectSetting &setting);
@ -54,27 +54,24 @@ public:
void stopLoading();
void showIpv6AddressConflict(bool isConflict);
public:
private:
QComboBox *ipv6ConfigCombox;
LineEdit *ipv6AddressEdit;
LineEdit *lengthEdit;
LineEdit *gateWayEdit;
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_configEmptyLabel;
QLabel *m_addressHintLabel;
QLabel *m_subnetEmptyLabel;
QLabel *m_gateWayHintLabel;
QLabel *m_firstDnsEmptyLabel;
MultipleDnsWidget *m_dnsWidget = nullptr;
QLabel *m_statusLabel = nullptr;
QList<QIcon> m_loadIcons;
@ -83,6 +80,7 @@ private:
QLabel *m_iconLabel;
QLabel *m_textLabel;
private:
void initUI();
void initComponent();
@ -106,6 +104,7 @@ private Q_SLOTS:
Q_SIGNALS:
void setIpv6PageState(bool);
void ipv6EditFinished(const QString &address);
void scrollToBottom();
};
#endif // IPV6PAGE_H

View File

@ -0,0 +1,312 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "multiplednswidget.h"
#include <QApplication>
#include <QDBusInterface>
#include <QPlainTextEdit>
#include <QGSettings>
#include "ukuistylehelper/ukuistylehelper.h"
#include "coninfo.h"
#define THEME_SCHAME "org.ukui.style"
#define COLOR_THEME "styleName"
#define DNS_LISTWIDGET_EMPTY_HEIGHT 79
#define DNS_LISTWIDGET_HEIGHT 188
#define BUTTON_SIZE 36,36
#define ITEM_HEIGHT 36
#define STR_ATTEMPTS "attempts"
#define STR_TIMEOUT "timeout"
#define STR_TYPE "type"
MultipleDnsWidget::MultipleDnsWidget(const QRegExp &rx, bool settingShow, QWidget *parent)
: m_regExp(rx),
m_settingShow(settingShow),
QWidget(parent)
{
initUI();
initComponent();
}
void MultipleDnsWidget::initUI()
{
QVBoxLayout *mulDnsVLayout = new QVBoxLayout(this);
mulDnsVLayout->setContentsMargins(0, 0, 0, 30);
m_mulDnsLabel = new QLabel(this);
m_mulDnsLabel->setText(tr("DNS server(Drag to sort)")); //DNS服务器
m_emptyWidget = new QFrame(this);
m_emptyWidget->setFrameShape(QFrame::Shape::StyledPanel);
m_emptyWidget->setFixedHeight(DNS_LISTWIDGET_EMPTY_HEIGHT);
emptyLabel = new QLabel(m_emptyWidget);
emptyLabel->setAlignment(Qt::AlignCenter);
emptyLabel->setText(tr("Click \"+\" to configure DNS"));
QVBoxLayout* emptyLayout = new QVBoxLayout(m_emptyWidget);
emptyLayout->addWidget(emptyLabel,Qt::AlignCenter);
m_dnsListWidget = new QListWidget(this);
m_dnsListWidget->setFixedHeight(DNS_LISTWIDGET_EMPTY_HEIGHT);
m_dnsListWidget->setBackgroundRole(QPalette::Base);
m_dnsListWidget->setFocusPolicy(Qt::FocusPolicy::NoFocus);
m_dnsListWidget->setFrameShape(QFrame::Shape::StyledPanel);
m_dnsListWidget->setEditTriggers(QAbstractItemView::DoubleClicked);
//item可拖拽
m_dnsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
m_dnsListWidget->setDragEnabled(true);
m_dnsListWidget->viewport()->setAcceptDrops(true);
m_dnsListWidget->setDropIndicatorShown(true);
m_dnsListWidget->setDragDropMode(QAbstractItemView::DragDropMode::InternalMove);
setDnsListWidgetStyle();
m_buttonBox = new KButtonBox(this);
m_buttonBox->setExclusive(false);
m_addDnsBtn = new KPushButton(this);
m_addDnsBtn->setIcon(QIcon::fromTheme("list-add-symbolic"));
m_addDnsBtn->setFixedSize(BUTTON_SIZE);
m_addDnsBtn->setProperty("useButtonPalette", true);
m_removeDnsBtn = new KPushButton(this);
m_removeDnsBtn->setIcon(QIcon::fromTheme("list-remove-symbolic"));
m_removeDnsBtn->setFixedSize(BUTTON_SIZE);
m_removeDnsBtn->setProperty("useButtonPalette", true);
m_removeDnsBtn->setEnabled(false);
m_buttonBox->addButton(m_addDnsBtn);
m_buttonBox->addButton(m_removeDnsBtn);
m_settingsLabel = new KBorderlessButton(this);
m_settingsLabel->setText(tr("Settings"));
QHBoxLayout *btnHLayout = new QHBoxLayout();
btnHLayout->setContentsMargins(0, 0, 0, 0);
btnHLayout->setSpacing(1);
btnHLayout->setAlignment(Qt::AlignLeft);
btnHLayout->addWidget(m_buttonBox);
btnHLayout->addSpacing(23);
btnHLayout->addWidget(m_settingsLabel);
mulDnsVLayout->addWidget(m_mulDnsLabel, Qt::AlignLeft);
mulDnsVLayout->addWidget(m_emptyWidget);
mulDnsVLayout->addWidget(m_dnsListWidget);
mulDnsVLayout->addLayout(btnHLayout);
m_emptyWidget->show();
m_dnsListWidget->hide();
if (!m_settingShow) {
m_settingsLabel->hide();
}
}
void MultipleDnsWidget::initComponent()
{
connect(qApp, &QApplication::paletteChanged, this, &MultipleDnsWidget::setDnsListWidgetStyle);
connect(m_addDnsBtn, &KPushButton::clicked, this, &MultipleDnsWidget::onAddBtnClicked);
connect(m_removeDnsBtn, &KPushButton::clicked, this, &MultipleDnsWidget::onRemoveBtnClicked);
connect(m_dnsListWidget, &QListWidget::itemClicked, this, [=]() {
if (m_dnsListWidget->count() < 1) {
m_removeDnsBtn->setEnabled(false);
} else {
m_removeDnsBtn->setEnabled(true);
}
});
connect(m_dnsListWidget, &QListWidget::itemDoubleClicked, this, [=](QListWidgetItem *item) {
m_dnsListWidget->edit(m_dnsListWidget->currentIndex());
item->setFlags(item->flags() | Qt::ItemIsEditable);
});
connect(m_settingsLabel, &KBorderlessButton::clicked, this, [&](){
showDnsSettingWidget();
});
}
void MultipleDnsWidget::setEditEnabled(bool state)
{
m_addDnsBtn->setEnabled(state);
if (!state) {
m_dnsListWidget->clear();
}
}
QList<QHostAddress> MultipleDnsWidget::getDns() const
{
QStringList dnsList;
dnsList.clear();
QList<QHostAddress> ipv4dnsList;
ipv4dnsList.clear();
int row = 0;
QString aDns;
while (m_dnsListWidget->count() > row) {
aDns = m_dnsListWidget->item(row)->text();
if (!dnsList.contains(aDns)) {
dnsList << aDns;
ipv4dnsList << QHostAddress(aDns);
}
row ++;
}
return ipv4dnsList;
}
void MultipleDnsWidget::setDnsListText(const QList<QHostAddress> &dns)
{
m_dnsListWidget->clear();
if (!dns.isEmpty()) {
m_dnsListWidget->setFixedHeight(DNS_LISTWIDGET_HEIGHT);
m_emptyWidget->hide();
m_dnsListWidget->show();
}
for (QHostAddress str: dns) {
QListWidgetItem *dnsListWidgetItem = new QListWidgetItem(m_dnsListWidget);
dnsListWidgetItem->setSizeHint(QSize(0,ITEM_HEIGHT));
dnsListWidgetItem->setText(str.toString());
}
}
void MultipleDnsWidget::AddOneDnsItem(QListWidget *listWidget)
{
if (m_dnsListWidget->count() == 0) {
m_emptyWidget->hide();
m_dnsListWidget->show();
m_dnsListWidget->setFixedHeight(DNS_LISTWIDGET_HEIGHT);
Q_EMIT scrollToBottom();
}
QListWidgetItem *dnsListWidgetItem = new QListWidgetItem(listWidget);
dnsListWidgetItem->setSizeHint(QSize(0,ITEM_HEIGHT));
dnsListWidgetItem->setFlags(dnsListWidgetItem->flags() | Qt::ItemIsEditable);
listWidget->addItem(dnsListWidgetItem);
listWidget->setCurrentItem(dnsListWidgetItem);
ListItemEdit *dnsListItemEdit = new ListItemEdit(m_regExp);
listWidget->setItemDelegateForRow(listWidget->currentIndex().row() , dnsListItemEdit);
listWidget->editItem(dnsListWidgetItem);
}
void MultipleDnsWidget::RemoveOneDnsItem(QListWidgetItem *aItem, QListWidget *listWidget)
{
if (aItem) {
listWidget->removeItemWidget(aItem);
delete aItem;
}
if (m_dnsListWidget->count() == 0) {
m_emptyWidget->show();
m_dnsListWidget->hide();
m_dnsListWidget->setFixedHeight(DNS_LISTWIDGET_EMPTY_HEIGHT);
}
}
void MultipleDnsWidget::setDnsListWidgetStyle()
{
QPalette pal = qApp->palette();
const QByteArray style_id(THEME_SCHAME);
if (QGSettings::isSchemaInstalled(style_id)) {
QGSettings styleGsettings(style_id);
QString currentTheme = styleGsettings.get(COLOR_THEME).toString();
if(currentTheme == "ukui-default"){
pal = lightPalette(this);
}
}
this->setPalette(pal);
m_dnsListWidget->setAlternatingRowColors(true);
QColor color = pal.color(QPalette::PlaceholderText);
pal.setColor(QPalette::WindowText, color);
emptyLabel->setPalette(pal);
}
void MultipleDnsWidget::onAddBtnClicked()
{
AddOneDnsItem(m_dnsListWidget);
//避免重复添加空白项
int row = m_dnsListWidget->count() - 1;
while (row >= 0) {
if (!m_dnsListWidget->item(row)->isSelected()
&& m_dnsListWidget->item(row)->text().isEmpty()) {
m_dnsListWidget->removeItemWidget(m_dnsListWidget->item(row));
delete m_dnsListWidget->item(row);
}
row --;
}
m_removeDnsBtn->setEnabled(true);
}
void MultipleDnsWidget::onRemoveBtnClicked()
{
QListWidgetItem *aItem = m_dnsListWidget->currentItem();
if (!aItem) {
return;
}
RemoveOneDnsItem(aItem, m_dnsListWidget);
if (m_dnsListWidget->count()< 1) {
m_removeDnsBtn->setEnabled(false);
}
}
void MultipleDnsWidget::showDnsSettingWidget()
{
QDBusInterface iface("com.kylin.network.enhancement.optimization",
"/com/kylin/network/enhancement/optimization/DNS",
"com.kylin.network.enhancement.optimization.DNS",
QDBusConnection::systemBus());
if (!iface.isValid()) {
return;
}
QDBusMessage result = iface.call("GetExtraDns", m_uuid);
const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value<QDBusArgument>();
QVariantMap map = result.arguments().at(0).toMap();
QString timeout, retry, tactic;
dbusArg1st >> map;
QString originTimeout,originRetry,originType;
originTimeout = map.value(STR_TIMEOUT).toString();
originRetry = map.value(STR_ATTEMPTS).toString();
originType = map.value(STR_TYPE).toString();
timeout = !originTimeout.isEmpty() ? map.value(STR_TIMEOUT).toString() : "5";
retry = !originRetry.isEmpty() ? map.value(STR_ATTEMPTS).toString() : "2";
tactic = !originType.isEmpty() ? map.value(STR_TYPE).toString() : "order";
DnsSettingWidget* dialog = new DnsSettingWidget(timeout, retry, tactic);
kdk::UkuiStyleHelper::self()->removeHeader(dialog);
if (dialog->exec() == QDialog::Accepted) {
QString timeout, retry, tactic;
dialog->getDnsSettings(timeout, retry, tactic);
if (iface.isValid()) {
iface.call("SetOptions", m_uuid, timeout, retry, tactic);
}
if (timeout != originTimeout || retry != originRetry || tactic != originType) {
m_dnsSettingChanged = true;
}
}
delete dialog;
dialog = nullptr;
}

View File

@ -0,0 +1,88 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef MULTIPLEDNSWIDGET_H
#define MULTIPLEDNSWIDGET_H
#include <QWidget>
#include <QLabel>
#include <QLayout>
#include <QLineEdit>
#include <QListWidget>
#include <QPushButton>
#include <QAbstractItemView>
#include <QString>
#include <QList>
#include <QHostAddress>
#include <QDebug>
#include "listitemedit.h"
#include "dnssettingwidget.h"
#include "kborderlessbutton.h"
#include "kbuttonbox.h"
using namespace kdk;
class MultipleDnsWidget: public QWidget
{
Q_OBJECT
public:
MultipleDnsWidget(const QRegExp &rx, bool settingShow = true, QWidget *parent = nullptr);
~MultipleDnsWidget() = default;
void setEditEnabled(bool state);
QList<QHostAddress> getDns() const;
void setDnsListText(const QList<QHostAddress> &dns);
void setUuid(QString uuid) {
m_uuid = uuid;
}
bool getDnsSettingsChanged() {
return m_dnsSettingChanged;
}
private:
void initUI();
void initComponent();
void AddOneDnsItem(QListWidget *listWidget);
void RemoveOneDnsItem(QListWidgetItem *aItem, QListWidget *listWidget);
void showDnsSettingWidget();
QLabel *m_mulDnsLabel;
QLabel *emptyLabel;
QFrame *m_emptyWidget;
QListWidget *m_dnsListWidget = nullptr;
KPushButton *m_addDnsBtn;
KPushButton *m_removeDnsBtn;
KButtonBox *m_buttonBox;
KBorderlessButton* m_settingsLabel;
QRegExp m_regExp;
QString m_uuid;
bool m_settingShow;
bool m_dnsSettingChanged = false;
private Q_SLOTS:
void setDnsListWidgetStyle();
void onAddBtnClicked();
void onRemoveBtnClicked();
Q_SIGNALS:
void scrollToBottom();
};
#endif // MULTIPLEDNSWIDGET_H

View File

@ -29,6 +29,7 @@
#include <QMenu>
#include <QToolTip>
#include <QFontMetrics>
#include <QScrollBar>
#include "windowmanager/windowmanager.h"
@ -282,7 +283,7 @@ void NetDetail::initUI()
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(0,9,0,24);
mainLayout->setSpacing(24);
mainLayout->setSpacing(0);
this->installEventFilter(this);
pageFrame = new QFrame(this);
@ -318,6 +319,11 @@ void NetDetail::initUI()
m_ipv4ScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_ipv4ScrollArea->setWidget(ipv4Page);
m_ipv4ScrollArea->setWidgetResizable(true);
connect(ipv4Page, &Ipv4Page::scrollToBottom, this, [&](){
QTimer::singleShot(50,this,[=]() {
m_ipv4ScrollArea->verticalScrollBar()->setValue(m_ipv4ScrollArea->verticalScrollBar()->maximum());
});
});
m_ipv6ScrollArea = new QScrollArea(centerWidget);
m_ipv6ScrollArea->setFixedWidth(SCRO_WIDTH);
@ -325,12 +331,18 @@ void NetDetail::initUI()
m_ipv6ScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_ipv6ScrollArea->setWidget(ipv6Page);
m_ipv6ScrollArea->setWidgetResizable(true);
connect(ipv6Page, &Ipv6Page::scrollToBottom, this, [&](){
QTimer::singleShot(50,this,[=]() {
m_ipv6ScrollArea->verticalScrollBar()->setValue(m_ipv6ScrollArea->verticalScrollBar()->maximum());
});
});
QPalette pal = m_secuPageScrollArea->palette();
pal.setBrush(QPalette::Base, QColor(0,0,0,0));
m_secuPageScrollArea->setPalette(pal);
m_ipv4ScrollArea->setPalette(pal);
m_ipv6ScrollArea->setPalette(pal);
m_createNetPageScrollArea = new QScrollArea(centerWidget);
m_createNetPageScrollArea->setFixedWidth(SCRO_WIDTH);
m_createNetPageScrollArea->setFrameShape(QFrame::NoFrame);
m_createNetPageScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_createNetPageScrollArea->setWidget(createNetPage);
m_createNetPageScrollArea->setWidgetResizable(true);
stackWidget = new QStackedWidget(centerWidget);
stackWidget->addWidget(detailPage);
@ -338,7 +350,7 @@ void NetDetail::initUI()
stackWidget->addWidget(m_ipv6ScrollArea);
stackWidget->addWidget(m_secuPageScrollArea);
stackWidget->addWidget(configPage);
stackWidget->addWidget(createNetPage);
stackWidget->addWidget(m_createNetPageScrollArea);
// TabBar
onPaletteChanged();
@ -382,6 +394,8 @@ void NetDetail::initUI()
centerlayout->setContentsMargins(CENTER_LAYOUT_MARGINS); // 右边距为0为安全页滚动区域留出空间
centerlayout->addWidget(stackWidget);
Divider *divider = new Divider(true, this);
QHBoxLayout *bottomLayout = new QHBoxLayout(bottomWidget);
bottomLayout->setContentsMargins(BOTTOM_LAYOUT_MARGINS);
bottomLayout->setSpacing(BOTTOM_LAYOUT_SPACING);
@ -392,7 +406,10 @@ void NetDetail::initUI()
bottomWidget->setMinimumHeight(PAGE_MIN_HEIGHT);
mainLayout->addWidget(pageFrame);
mainLayout->addSpacing(24);
mainLayout->addWidget(centerWidget);
mainLayout->addWidget(divider);
mainLayout->addSpacing(16);
mainLayout->addWidget(bottomWidget);
this->setAutoFillBackground(true);
@ -492,25 +509,28 @@ void NetDetail::pagePadding(QString netName, bool isWlan)
detailPage->setAutoConnect(m_info.isAutoConnect);
//ipv4页面填充
ipv4Page->setUuid(m_uuid);
ipv4Page->setMulDns(m_info.ipv4DnsList);
if (m_info.ipv4ConfigType == CONFIG_IP_MANUAL) {
Q_EMIT checkCurrentIpv4Conflict(m_info.strIPV4Address);
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->setIpv4FirDns(m_info.strIPV4FirDns);
// ipv4Page->setIpv4SecDns(m_info.strIPV4SecDns);
ipv4Page->setGateWay(m_info.strIPV4GateWay);
} else {
ipv4Page->setIpv4Config(m_info.ipv4ConfigType);
}
//ipv6页面填充
ipv6Page->setMulDns(m_info.ipv6DnsList);
if (m_info.ipv6ConfigType == CONFIG_IP_MANUAL) {
Q_EMIT checkCurrentIpv6Conflict(m_info.strIPV6Address);
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->setIpv6FirDns(m_info.strIPV6FirDns);
// ipv6Page->setIpv6SecDns(m_info.strIPV6SecDns);
ipv6Page->setGateWay(m_info.strIPV6GateWay);
} else {
ipv6Page->setIpv6Config(m_info.ipv6ConfigType);
@ -653,7 +673,15 @@ void NetDetail::getDynamicIpInfo(ConInfo &conInfo, bool bActived)
}
if (!ipv4Dns.isEmpty()) {
conInfo.strDynamicIpv4Dns = ipv4Dns.at(0).toString();
//conInfo.strDynamicIpv4Dns = ipv4Dns.at(0).toString();
QString dnsList;
dnsList.clear();
for (QHostAddress str: ipv4Dns) {
dnsList.append(str.toString());
dnsList.append("; ");
}
dnsList.chop(2);
conInfo.strDynamicIpv4Dns = dnsList;
}
}
@ -668,6 +696,8 @@ void NetDetail::getStaticIpInfo(ConInfo &conInfo, bool bActived)
conInfo.ipv4ConfigType = connetSetting.m_ipv4ConfigIpType;
conInfo.ipv6ConfigType = connetSetting.m_ipv6ConfigIpType;
conInfo.isAutoConnect = connetSetting.m_isAutoConnect;
conInfo.ipv4DnsList = connetSetting.m_ipv4Dns;
conInfo.ipv6DnsList = connetSetting.m_ipv6Dns;
if (connetSetting.m_ipv4ConfigIpType == CONFIG_IP_MANUAL) {
if (connetSetting.m_ipv4Address.size() > 0) {
@ -675,12 +705,14 @@ void NetDetail::getStaticIpInfo(ConInfo &conInfo, bool bActived)
conInfo.strIPV4NetMask = connetSetting.m_ipv4Address.at(0).netmask().toString();
conInfo.strIPV4GateWay = connetSetting.m_ipv4Address.at(0).gateway().toString();
}
#if 0
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();
}
#endif
}
if (connetSetting.m_ipv6ConfigIpType == CONFIG_IP_MANUAL) {
@ -689,13 +721,14 @@ 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_ipv6Dns.size() > 1) {
conInfo.strIPV6FirDns = connetSetting.m_ipv6Dns.at(0).toString();
conInfo.strIPV6SecDns = connetSetting.m_ipv6Dns.at(1).toString();
}
#endif
}
if (!bActived) {
@ -1082,22 +1115,6 @@ bool NetDetail::updateConnect()
qDebug() << "ipv4Changed" << ipv4Change << "ipv6Change" << ipv6Change;
// if (ipv4Change && connetSetting.m_ipv4ConfigIpType == CONFIG_IP_MANUAL) {
// if (checkIpv4Conflict(connetSetting.m_ipv4Address.at(0).ip().toString())) {
// qDebug() << "ipv4 conflict";
// showDesktopNotify(tr("ipv4 address conflict!"), "networkwrong");
// return false;
// }
// }
// if (ipv6Change && connetSetting.m_ipv6ConfigIpType == CONFIG_IP_MANUAL) {
// if (checkIpv6Conflict(connetSetting.m_ipv6Address.at(0).ip().toString())) {
// qDebug() << "ipv6 conflict";
// showDesktopNotify(tr("ipv6 address conflict!"), "networkwrong");
// return false;
// }
// }
if (ipv4Change || ipv6Change) {
connetSetting.dumpInfo();
m_wiredConnOperation->updateWiredConnect(m_uuid, connetSetting);
@ -1112,7 +1129,7 @@ bool NetDetail::updateConnect()
}
}
if (ipv4Change || ipv6Change || securityChange) {
if (ipv4Change || ipv6Change || securityChange || ipv4Page->checkDnsSettingsIsChanged()) {
if (isActive) {
//信息变化 断开-重连 更新需要時間 不可以立即重連
// sleep(1);

View File

@ -165,6 +165,7 @@ private:
QScrollArea * m_secuPageScrollArea;
QScrollArea * m_ipv4ScrollArea;
QScrollArea * m_ipv6ScrollArea;
QScrollArea * m_createNetPageScrollArea;
QPushButton * cancelBtn;
QPushButton * forgetBtn;

View File

@ -10,8 +10,10 @@ HEADERS += \
$$PWD/ipv4page.h \
$$PWD/ipv6page.h \
$$PWD/joinhiddenwifipage.h \
$$PWD/multiplednswidget.h \
$$PWD/netdetail.h \
$$PWD/securitypage.h
$$PWD/securitypage.h \
$$PWD/dnssettingwidget.h
SOURCES += \
$$PWD/configpage.cpp \
@ -22,5 +24,7 @@ SOURCES += \
$$PWD/ipv4page.cpp \
$$PWD/ipv6page.cpp \
$$PWD/joinhiddenwifipage.cpp \
$$PWD/multiplednswidget.cpp \
$$PWD/netdetail.cpp \
$$PWD/securitypage.cpp
$$PWD/securitypage.cpp \
$$PWD/dnssettingwidget.cpp

View File

@ -1192,8 +1192,14 @@ void SecurityPage::onClientPrivateKeyComboxIndexChanged(QString str)
{
if (str.contains("Choose from file...") || str.contains("从文件选择..."))
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///",
tr("CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx)"));
QString fileName;
// = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///",
// tr("CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx)"));
QFileDialog aa;
aa.setPalette(lightPalette(this));aa.update();
if (aa.exec()) {
}
if (!fileName.isNull()) {
QStringList nameList = fileName.split("/");
clientPrivateKeyCombox->blockSignals(true);

View File

@ -63,6 +63,10 @@ LanPage::LanPage(QWidget *parent) : TabPage(parent)
connect(m_connectResourse, &KyConnectResourse::connectionRemove, this, &LanPage::onRemoveConnection);
connect(m_connectResourse, &KyConnectResourse::connectionUpdate, this, &LanPage::onUpdateConnection);
connect(m_connectResourse, &KyConnectResourse::needShowDesktop, this, [=](QString ip) {
this->showDesktopNotify(ip + tr("conflict, unable to connect to the network normally!"), QString());
});
connect(m_deviceResource, &KyNetworkDeviceResourse::deviceAdd, this, &LanPage::onDeviceAdd);
connect(m_deviceResource, &KyNetworkDeviceResourse::deviceRemove, this, &LanPage::onDeviceRemove);
connect(m_deviceResource, &KyNetworkDeviceResourse::deviceNameUpdate, this, &LanPage::onDeviceNameUpdate);
@ -1318,7 +1322,7 @@ void LanPage::getWiredDeviceConnectState(QMap<QString, QString> &map)
if (state < NetworkManager::Connectivity::Full) {
m_activeResourse->getActiveConnectionList(devname, NetworkManager::ConnectionSettings::Wired, activedList);
if (!activedList.isEmpty()) {
map.insert(devname, QString(tr("Connected: ")) + activedList.at(0)->m_connectName + QString(tr("(Limited)")));
map.insert(devname, QString(tr("Connected: ")) + activedList.at(0)->m_connectName + " " + QString(tr("(Limited)")));
} else {
map.insert(devname, tr("Not Connected"));
}

View File

@ -45,7 +45,7 @@ WlanPage::WlanPage(QWidget *parent) : TabPage(parent)
m_connectResource = new KyConnectResourse(this);
m_wirelessConnectOpreation = new KyWirelessConnectOperation(this);
checkShowWifi6();
checkShowWifi6Plus();
initDevice();
initWlanUI();
initWlanSwitchState();
@ -194,9 +194,9 @@ bool WlanPage::getWirelessEnable()
return m_wirelessConnectOpreation->getWirelessEnabled();
}
void WlanPage::checkShowWifi6()
void WlanPage::checkShowWifi6Plus()
{
//990下不显示wifi6 wifi6+图标
//990下不显示wifi6+图标
QProcess * processCpuinfo = new QProcess(this);
processCpuinfo->start(QString("cat /proc/cpuinfo"));
connect(processCpuinfo, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
@ -205,8 +205,7 @@ void WlanPage::checkShowWifi6()
processCpuinfo->waitForFinished();
QString ctrCpuinfo = processCpuinfo->readAll();
if (ctrCpuinfo.indexOf("Kirin", 0, Qt::CaseInsensitive) != -1 && ctrCpuinfo.indexOf("990") != -1) {
//HW990上不显示wifi6/6+
m_showWifi6 = false;
m_showWifi6Plus = false;
}
}
@ -322,7 +321,7 @@ QListWidgetItem *WlanPage::addNewItem(KyWirelessNetItem &wirelessNetItem,
wirelessNetItem,
m_currentDevice,
m_connectResource->isApConnection(wirelessNetItem.m_connectUuid),
m_showWifi6);
m_showWifi6Plus);
connect(p_wlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged);
connect(p_wlanItem, &WlanListItem::detailShow, this, &WlanPage::showDetailPage);
@ -339,7 +338,7 @@ QListWidgetItem *WlanPage::insertNewItem(KyWirelessNetItem &wirelessNetItem,
QListWidget *wirelessListWidget,
int row)
{
WlanListItem *p_wlanItem = new WlanListItem(wirelessNetItem, m_currentDevice, m_showWifi6);
WlanListItem *p_wlanItem = new WlanListItem(wirelessNetItem, m_currentDevice, m_showWifi6Plus);
connect(p_wlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged);
connect(p_wlanItem, &WlanListItem::detailShow, this, &WlanPage::showDetailPage);
@ -360,7 +359,7 @@ QListWidgetItem *WlanPage::insertNewItemWithSort(KyWirelessNetItem &wirelessNetI
// qDebug()<< "insertNewItemWithSort" << wirelessNetItem.m_NetSsid
// <<"sort item config" << wirelessNetItem.m_isConfigured
// << "signal strength" << wirelessNetItem.m_signalStrength;
WlanListItem *p_sortWlanItem = new WlanListItem(wirelessNetItem, m_currentDevice, m_showWifi6);
WlanListItem *p_sortWlanItem = new WlanListItem(wirelessNetItem, m_currentDevice, m_showWifi6Plus);
connect(p_sortWlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged);
connect(p_sortWlanItem, &WlanListItem::detailShow, this, &WlanPage::showDetailPage);
@ -558,8 +557,11 @@ void WlanPage::onWlanAdded(QString interface, KyWirelessNetItem &item)
{
//for dbus
int category = 0;
if (m_showWifi6) {
category = item.getCategory(item.m_uni);
category = item.getCategory(item.m_uni);
//990 WiFi6+对应图标显示为WiFi6
if (!m_showWifi6Plus && category == 2) {
category = 1;
}
QStringList info;
@ -1260,7 +1262,7 @@ void WlanPage::onRefreshIconTimer()
int takeRow = m_inactivatedNetListWidget->row(p_sortListWidgetItem);
m_inactivatedNetListWidget->takeItem(takeRow);
WlanListItem *p_sortWlanItem = new WlanListItem(sortItem, m_currentDevice, m_showWifi6);
WlanListItem *p_sortWlanItem = new WlanListItem(sortItem, m_currentDevice, m_showWifi6Plus);
connect(p_sortWlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged);
connect(p_sortWlanItem, &WlanListItem::detailShow, this, &WlanPage::showDetailPage);
m_inactivatedNetListWidget->insertItem(sortRow, p_sortListWidgetItem);
@ -1311,10 +1313,10 @@ void WlanPage::getWirelessList(QMap<QString, QVector<QStringList> > &map)
QString uni,secuType;
if (m_netDeviceResource->getActiveConnectionInfo(iter.key(), signalStrength, uni, secuType)) {
if (m_showWifi6) {
category = data.getCategory(uni);
}
category = data.getCategory(uni);
}
if (!m_showWifi6Plus && category == 2) {
category = 1;
}
vector.append(QStringList() << data.m_NetSsid
<< QString::number(signalStrength)
@ -1335,8 +1337,9 @@ void WlanPage::getWirelessList(QMap<QString, QVector<QStringList> > &map)
continue;
}
int category = 0;
if (m_showWifi6) {
category = itemData.getCategory(itemData.m_uni);
category = itemData.getCategory(itemData.m_uni);
if (!m_showWifi6Plus && category == 2) {
category = 1;
}
vector.append(QStringList()<<itemData.m_NetSsid
<< QString::number(itemData.m_signalStrength)
@ -1674,7 +1677,7 @@ void WlanPage::getWirelssDeviceConnectState(QMap<QString, QString> &map)
m_netDeviceResource->getDeviceConnectivity(devname, state);
if (state < NetworkManager::Connectivity::Full) {
if (m_wirelessNetResource->getActiveWirelessNetItem(devname, wirelessNetItem)) {
map.insert(devname, QString(tr("Connected: ")) + wirelessNetItem.m_connName + QString(tr("(Limited)")));
map.insert(devname, QString(tr("Connected: ")) + wirelessNetItem.m_connName + " " + QString(tr("(Limited)")));
} else {
map.insert(devname, tr("Not Connected"));
}

View File

@ -214,8 +214,8 @@ private:
}
}
void checkShowWifi6();
bool m_showWifi6 = true;
void checkShowWifi6Plus();
bool m_showWifi6Plus = true;
private:
QMap<QString, QListWidgetItem*> m_wirelessNetItemMap;

View File

@ -21,20 +21,47 @@
#include <QPainter>
#include <QApplication>
Divider::Divider(QWidget * parent) : QFrame(parent)
#include "../netdetails/coninfo.h"
#define THEME_SCHAME "org.ukui.style"
#define COLOR_THEME "styleName"
Divider::Divider(bool useLightPal, QWidget * parent)
:m_useLightPal(useLightPal),
QFrame(parent)
{
this->setFixedHeight(1);
connect(qApp, &QApplication::paletteChanged, this ,&Divider::onPaletteChanged);
onPaletteChanged();
}
void Divider::onPaletteChanged()
{
QPalette pal = qApp->palette();
QGSettings * styleGsettings = nullptr;
const QByteArray style_id(THEME_SCHAME);
if (QGSettings::isSchemaInstalled(style_id) && m_useLightPal) {
styleGsettings = new QGSettings(style_id);
QString currentTheme = styleGsettings->get(COLOR_THEME).toString();
if(currentTheme == "ukui-default"){
pal = lightPalette(this);
}
}
m_color = pal.color(QPalette::BrightText);
m_color.setAlphaF(0.08);
if (styleGsettings != nullptr) {
delete styleGsettings;
styleGsettings = nullptr;
}
}
void Divider::paintEvent(QPaintEvent * e)
{
QPainter p(this);
QColor color = qApp->palette().color(QPalette::BrightText);
color.setAlphaF(0.08);
p.save();
p.setBrush(color);
p.setBrush(m_color);
p.setPen(Qt::transparent);
p.drawRoundedRect(this->rect(), 6, 6);
p.restore();

View File

@ -24,11 +24,15 @@
class Divider : public QFrame
{
public:
Divider(QWidget * parent = nullptr);
Divider(bool useLightPal = false, QWidget * parent = nullptr);
~Divider() = default;
private:
bool m_useLightPal;
QColor m_color;
private Q_SLOTS:
void onPaletteChanged();
protected:
void paintEvent(QPaintEvent *event);
void paintEvent(QPaintEvent * e);
};
#endif // DIVIDER_H

View File

@ -0,0 +1,53 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "listitemedit.h"
ListItemEdit::ListItemEdit(const QRegExp &rx, QObject *parent)
: m_regExp(rx),
QStyledItemDelegate(parent)
{
}
QWidget *ListItemEdit::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QLineEdit *editor = new QLineEdit(parent);
editor->setValidator(new QRegExpValidator(m_regExp, parent));
return editor;
}
void ListItemEdit::setEditorData(QWidget *editor, const QModelIndex &index) const
{
QLineEdit *lineEdit = static_cast <QLineEdit*>(editor);
QString text = index.model()->data(index, Qt::EditRole).toString();
lineEdit->setText(text);
}
void ListItemEdit::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
QLineEdit *lineEdit = static_cast <QLineEdit*>(editor);
QString text = lineEdit->text();
model->setData(index, text, Qt::EditRole);
}
void ListItemEdit::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
editor->setGeometry(option.rect);
}

View File

@ -0,0 +1,49 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef LISTITEMEDIT_H
#define LISTITEMEDIT_H
#include <QWidget>
#include <QStyledItemDelegate>
#include <QLineEdit>
class ListItemEdit: public QStyledItemDelegate
{
Q_OBJECT
public:
ListItemEdit(const QRegExp &rx, QObject *parent = nullptr);
~ListItemEdit() = default;
//创建一个控件
virtual QWidget *createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
//将数据设置到控件中
virtual void setEditorData (QWidget *editor, const QModelIndex &index) const;
//将控件中的数据更新到对应的model中
virtual void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
//更新控件位置
void updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option,
const QModelIndex &index) const override;
private:
QRegExp m_regExp;
};
#endif // LISTITEMEDIT_H

View File

@ -3,6 +3,7 @@ INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/divider.h \
$$PWD/infobutton.h \
$$PWD/listitemedit.h \
$$PWD/loadingdiv.h \
$$PWD/radioitembutton.h \
$$PWD/switchbutton.h \
@ -12,6 +13,7 @@ HEADERS += \
SOURCES += \
$$PWD/divider.cpp \
$$PWD/infobutton.cpp \
$$PWD/listitemedit.cpp \
$$PWD/loadingdiv.cpp \
$$PWD/radioitembutton.cpp \
$$PWD/switchbutton.cpp \

View File

@ -74,3 +74,9 @@ unix {
DISTFILES += \
org.ukui.kylin-nm.switch.gschema.xml
TRANSLATIONS += \
translations/kylin-nm_zh_CN.ts \
translations/kylin-nm_tr.ts \
translations/kylin-nm_bo.ts \
translations/kylin-nm_bo_CN.ts

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff