diff --git a/debian/kylin-nm.preinst b/debian/kylin-nm.preinst
index 8b913081..1390f944 100755
--- a/debian/kylin-nm.preinst
+++ b/debian/kylin-nm.preinst
@@ -7,3 +7,6 @@ dpkg-divert --package kylin-nm --rename --divert "$path"".old" --add $path
path2="/usr/lib/`/usr/bin/dpkg-architecture -qDEB_TARGET_MULTIARCH`/ukui-control-center/libproxy.so"
dpkg-divert --package kylin-nm --rename --divert "$path2"".old" --add $path2
+
+path3="/usr/lib/`/usr/bin/dpkg-architecture -qDEB_TARGET_MULTIARCH`/ukui-control-center/libvpn.so"
+dpkg-divert --package kylin-nm --rename --divert "$path3"".old" --add $path3
diff --git a/plugins/vpn/translations/zh_CN.qm b/plugins/vpn/translations/zh_CN.qm
new file mode 100644
index 00000000..56074df7
Binary files /dev/null and b/plugins/vpn/translations/zh_CN.qm differ
diff --git a/plugins/vpn/translations/zh_CN.ts b/plugins/vpn/translations/zh_CN.ts
new file mode 100644
index 00000000..ed7ce029
--- /dev/null
+++ b/plugins/vpn/translations/zh_CN.ts
@@ -0,0 +1,80 @@
+
+
+
+
+ AddNetBtn
+
+
+
+
+
+
+
+
+
+
+
+
+ ItemFrame
+
+
+
+ 添加VPN
+
+
+
+ Vpn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 在任务栏显示图标
+
+
+
+
+
+ 已连接
+
+
+
+
+
+ 未连接
+
+
+
+ VpnItem
+
+
+
+ 删除
+
+
+
+
+
+ 断开
+
+
+
+
+
+ 连接
+
+
+
diff --git a/plugins/vpn/vpn.cpp b/plugins/vpn/vpn.cpp
index b6b05dae..f4c13273 100644
--- a/plugins/vpn/vpn.cpp
+++ b/plugins/vpn/vpn.cpp
@@ -52,11 +52,19 @@
#define KVpnSymbolic "ukui-vpn-symbolic"
+#define KYLIN_APP_MANAGER_NAME "com.kylin.AppManager"
+#define KYLIN_APP_MANAGER_PATH "/com/kylin/AppManager"
+#define KYLIN_APP_MANAGER_INTERFACE "com.kylin.AppManager"
+
const QString VISIBLE = "visible";
const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.vpnicon";
Vpn::Vpn() : mFirstLoad(true)
{
+ QTranslator* translator = new QTranslator(this);
+ translator->load("/usr/share/kylin-nm/vpn/" + QLocale::system().name());
+ QApplication::installTranslator(translator);
+
pluginName = tr("Vpn");
pluginType = NETWORK;
}
@@ -308,8 +316,6 @@ void Vpn::addOneVirtualItem(QStringList infoList)
int status = infoList.at(3).toInt(); //1-连接中 2-已连接 3-断开中 4-已断开
VpnItem * item = new VpnItem(pluginWidget);
- item->statusLabel->setText(tr("not connected"));
-
QIcon searchIcon = QIcon::fromTheme(KVpnSymbolic);
item->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(ICON_SIZE))));
item->titileLabel->setText(connName);
@@ -321,19 +327,28 @@ void Vpn::addOneVirtualItem(QStringList infoList)
item->startLoading();
}
-// connect(lanItem->infoLabel, &GrayInfoButton::clicked, this, [=]{
-// // open landetail page
-// if (!m_interface->isValid()) {
-// return;
-// }
-// qDebug() << "[NetConnect]call showPropertyWidget" << deviceName << connUuid << __LINE__;
-// m_interface->call(QStringLiteral("showPropertyWidget"), deviceName, connUuid);
-// qDebug() << "[NetConnect]call showPropertyWidget respond" << __LINE__;
-// });
+ connect(item->infoLabel, &GrayInfoButton::clicked, this, [=]{
+ QDBusInterface appManagerDbusInterface(KYLIN_APP_MANAGER_NAME,
+ KYLIN_APP_MANAGER_PATH,
+ KYLIN_APP_MANAGER_INTERFACE,
+ QDBusConnection::sessionBus());
+
+ if (!appManagerDbusInterface.isValid()) {
+ qWarning()<<"appManagerDbusInterface init error";
+ } else {
+ QDBusReply reply = appManagerDbusInterface.call("LaunchApp", "nm-connection-editor.desktop");
+ }
+ });
item->isAcitve = (status == 2);
item->setConnectActionText(item->isAcitve);
+ if (item->isAcitve) {
+ item->statusLabel->setText(tr("connected"));
+ } else {
+ item->statusLabel->setText(tr("not connected"));
+ }
+
connect(item, &QPushButton::clicked, this, [=] {
if (item->isAcitve || item->loading) {
deActiveConnect(item->uuid);
diff --git a/plugins/vpn/vpn.pro b/plugins/vpn/vpn.pro
index 4884bc97..957517c6 100644
--- a/plugins/vpn/vpn.pro
+++ b/plugins/vpn/vpn.pro
@@ -19,6 +19,8 @@ PKGCONFIG += gsettings-qt \
TARGET = $$qtLibraryTarget(vpn)
DESTDIR = ../..
target.path = $$[QT_INSTALL_LIBS]/ukui-control-center
+trans.files = translations/*
+trans.path = /usr/share/kylin-nm/vpn/
INCLUDEPATH += \
$$PROJECT_COMPONENTSOURCE \
@@ -41,4 +43,8 @@ HEADERS += \
FORMS += \
vpn.ui
-INSTALLS += target
+INSTALLS += target \
+ trans
+
+TRANSLATIONS += \
+ translations/zh_CN.ts
diff --git a/plugins/vpn/vpnitem.cpp b/plugins/vpn/vpnitem.cpp
index 52897159..28ff57eb 100644
--- a/plugins/vpn/vpnitem.cpp
+++ b/plugins/vpn/vpnitem.cpp
@@ -46,7 +46,7 @@ VpnItem::VpnItem(bool bAcitve, QWidget *parent)
titileLabel = new FixLabel(this);
statusLabel = new QLabel(this);
statusLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
-// infoLabel = new GrayInfoButton(this);
+ infoLabel = new GrayInfoButton(this);
m_moreButton = new QToolButton(this);
m_moreButton->setProperty("useButtonPalette", true);
@@ -66,7 +66,7 @@ VpnItem::VpnItem(bool bAcitve, QWidget *parent)
mLanLyt->addWidget(titileLabel,Qt::AlignLeft);
mLanLyt->addStretch();
mLanLyt->addWidget(statusLabel);
-// mLanLyt->addWidget(infoLabel);
+ mLanLyt->addWidget(infoLabel);
mLanLyt->addWidget(m_moreButton);
loadIcons.append(QIcon::fromTheme("ukui-loading-1-symbolic"));
diff --git a/plugins/vpn/vpnitem.h b/plugins/vpn/vpnitem.h
index eef1b415..6947d60f 100644
--- a/plugins/vpn/vpnitem.h
+++ b/plugins/vpn/vpnitem.h
@@ -42,7 +42,7 @@ public:
VpnItem(bool bAcitve, QWidget *parent = nullptr);
public:
QLabel * iconLabel = nullptr;
-// GrayInfoButton * infoLabel = nullptr;
+ GrayInfoButton * infoLabel = nullptr;
FixLabel * titileLabel = nullptr;
QLabel * statusLabel = nullptr;
QToolButton* m_moreButton = nullptr;
diff --git a/src/frontend/list-items/vpnlistitem.cpp b/src/frontend/list-items/vpnlistitem.cpp
index 493507eb..0a1541d1 100644
--- a/src/frontend/list-items/vpnlistitem.cpp
+++ b/src/frontend/list-items/vpnlistitem.cpp
@@ -26,7 +26,6 @@
VpnListItem::VpnListItem(const KyConnectItem *lanConnectItem, QWidget *parent):ListItem(parent)
{
- m_infoButton->setVisible(false);
m_connectOperation = new KyWiredConnectOperation(this);
m_deviceResource = new KyNetworkDeviceResourse(this);
@@ -182,40 +181,25 @@ void VpnListItem::onMenuTriggered(QAction *action)
return;
}
+bool VpnListItem::launchApp(QString desktopFile)
+{
+ QDBusInterface appManagerDbusInterface(KYLIN_APP_MANAGER_NAME,
+ KYLIN_APP_MANAGER_PATH,
+ KYLIN_APP_MANAGER_INTERFACE,
+ QDBusConnection::sessionBus());
+
+ if (!appManagerDbusInterface.isValid()) {
+ qWarning()<<"appManagerDbusInterface init error";
+ return false;
+ } else {
+ QDBusReply reply = appManagerDbusInterface.call("LaunchApp", desktopFile);
+ return reply;
+ }
+}
void VpnListItem::onInfoButtonClicked()
{
-// if (m_vpnConnectItem.m_connectUuid.isEmpty()) {
-// qDebug() << LOG_FLAG << "connect is empty, so can not show detail info.";
-// return;
-// }
-
-// if(netDetail != nullptr){
-// netDetail->activateWindow();
-// return;
-// }
-
-// qDebug()<< LOG_FLAG << "the info button of lan is clicked! uuid = "
-// << m_vpnConnectItem.m_connectUuid << "; name = " << m_vpnConnectItem.m_connectName
-// << "." <show();
-// Q_EMIT this->detailShow(true);
-
+ launchApp("nm-connection-editor.desktop");
return;
}
diff --git a/src/frontend/list-items/vpnlistitem.h b/src/frontend/list-items/vpnlistitem.h
index 2e361fe6..b65d22dc 100644
--- a/src/frontend/list-items/vpnlistitem.h
+++ b/src/frontend/list-items/vpnlistitem.h
@@ -26,6 +26,10 @@
#include
#include
+#define KYLIN_APP_MANAGER_NAME "com.kylin.AppManager"
+#define KYLIN_APP_MANAGER_PATH "/com/kylin/AppManager"
+#define KYLIN_APP_MANAGER_INTERFACE "com.kylin.AppManager"
+
class VpnListItem : public ListItem
{
Q_OBJECT
@@ -50,6 +54,7 @@ public:
protected:
void setIcon(bool isOn);
void onRightButtonClicked();
+ bool launchApp(QString desktopFile);
private:
void connectItemCopy(const KyConnectItem *lanConnectItem);
@@ -61,6 +66,7 @@ private Q_SLOTS:
private:
KyConnectItem m_vpnConnectItem;
+// QDBusInterface m_appManagerDbusInterface;
KyWiredConnectOperation *m_connectOperation = nullptr;
KyNetworkDeviceResourse *m_deviceResource = nullptr;
diff --git a/src/frontend/single-pages/singlepage.cpp b/src/frontend/single-pages/singlepage.cpp
index 2e059cac..f3293a5e 100644
--- a/src/frontend/single-pages/singlepage.cpp
+++ b/src/frontend/single-pages/singlepage.cpp
@@ -42,7 +42,7 @@ void SinglePage::initUI()
this->setLayout(m_mainLayout);
m_netFrame = new QFrame(this);
- m_netFrame->setMinimumHeight(INACTIVE_AREA_MIN_HEIGHT);
+ m_netFrame->setMinimumHeight(TEXT_HEIGHT + 17);
m_netLayout = new QVBoxLayout(m_netFrame);
m_netLayout->setContentsMargins(NET_LAYOUT_MARGINS);
m_netFrame->setLayout(m_netLayout);
@@ -79,7 +79,6 @@ void SinglePage::initUI()
m_mainLayout->addStretch();
m_mainLayout->addWidget(m_netDivider);
m_mainLayout->addWidget(m_settingsFrame);
-
}
void SinglePage::showDesktopNotify(const QString &message, QString soundName)
diff --git a/src/frontend/single-pages/singlepage.h b/src/frontend/single-pages/singlepage.h
index a9248433..356cbacd 100644
--- a/src/frontend/single-pages/singlepage.h
+++ b/src/frontend/single-pages/singlepage.h
@@ -44,10 +44,6 @@ using namespace kdk;
#define MAIN_LAYOUT_MARGINS 0,0,0,0
#define MAIN_LAYOUT_SPACING 0
#define TITLE_FRAME_HEIGHT 50 //TabWidget的tab和widget有间隙,和设计稿看起来一致就不能设为设计稿里的高度
-#define TITLE_LAYOUT_MARGINS 24,0,24,0
-#define DEVICE_LAYOUT_MARGINS 24,0,24,8
-#define DEVICE_COMBOBOX_WIDTH 180
-#define ACTIVE_NET_LAYOUT_MARGINS 8,8,8,8
#define NET_LAYOUT_MARGINS 8,8,0,1
#define NET_LAYOUT_SPACING 8
#define NET_LIST_SPACING 0
@@ -57,7 +53,6 @@ using namespace kdk;
#define SETTINGS_LAYOUT_MARGINS 23,0,24,0
#define TRANSPARENT_COLOR QColor(0,0,0,0)
#define INACTIVE_AREA_MIN_HEIGHT 170
-#define ACTIVE_AREA_MAX_HEIGHT 92
#define MAX_ITEMS 4
#define MAX_WIDTH 412
diff --git a/src/frontend/single-pages/vpnpage.cpp b/src/frontend/single-pages/vpnpage.cpp
index 3ed01a2f..d594a35c 100644
--- a/src/frontend/single-pages/vpnpage.cpp
+++ b/src/frontend/single-pages/vpnpage.cpp
@@ -22,14 +22,7 @@
#include
#include
-#define MAIN_LAYOUT_MARGINS 0,0,0,0
-#define MAIN_LAYOUT_SPACING 0
-#define TITLE_FRAME_HEIGHT 52
-#define TITLE_LAYOUT_MARGINS 24,0,24,0
-#define LAN_LIST_SPACING 0
-#define TEXT_MARGINS 16,0,0,0
-#define SETTINGS_LAYOUT_MARGINS 24,16,24,16
-#define TRANSPARENT_COLOR QColor(0,0,0,0)
+#define VPN_LIST_SPACING 0
#define ITEM_HEIGHT 48
@@ -49,7 +42,7 @@ VpnPage::VpnPage(QWidget *parent) : SinglePage(parent)
initUI();
initVpnArea();
- connect(m_activeResourse, &KyActiveConnectResourse::vpnConnectChangeReason, this, &VpnPage::onConnectionStateChange);
+ connect(m_activeResourse, &KyActiveConnectResourse::stateChangeReason, this, &VpnPage::onConnectionStateChange);
connect(m_activeResourse, &KyActiveConnectResourse::activeConnectRemove, this, [=] (QString activeConnectUuid) {
sendVpnStateChangeSignal(activeConnectUuid,Deactivated);
} );
@@ -115,6 +108,7 @@ void VpnPage::constructActiveConnectionArea()
{
QList activedList;
QList netList;
+ QGSettings vpnGsettings(GSETTINGS_VPNICON_VISIBLE);
activedList.clear();
netList.clear();
@@ -136,7 +130,6 @@ void VpnPage::constructActiveConnectionArea()
if (m_activeConnectionMap.contains(p_netConnectionItem->m_connectUuid)) {
qDebug()<m_connectUuid;
}
-// p_netConnectionItem->m_connectState = NetworkManager::ActiveConnection::Activated;
QListWidgetItem *p_listWidgetItem = addNewItem(p_newItem, m_vpnListWidget);
m_activeConnectionMap.insert(p_netConnectionItem->m_connectUuid, p_listWidgetItem);
}
@@ -144,21 +137,29 @@ void VpnPage::constructActiveConnectionArea()
delete p_netConnectionItem;
p_netConnectionItem = nullptr;
}
+ if (vpnGsettings.keys().contains(QString(VISIBLE))) {
+ vpnGsettings.set(VISIBLE, true);
+ }
+ } else {
+ if (vpnGsettings.keys().contains(QString(VISIBLE))) {
+ vpnGsettings.set(VISIBLE, false);
+ }
}
+
if (m_vpnListWidget->count() <= MAX_ITEMS) {
m_vpnListWidget->setFixedWidth(MIN_WIDTH);
+ m_netListArea->setFixedHeight(m_vpnListWidget->count() * ITEM_HEIGHT);
} else {
m_vpnListWidget->setFixedWidth(MAX_WIDTH);
+ m_netListArea->setFixedHeight(MAX_ITEMS * ITEM_HEIGHT);
}
- return;
+ m_netFrame->setFixedHeight(37 + m_netListArea->height());
}
void VpnPage::initVpnArea()
{
m_netFrame->show();
constructActiveConnectionArea();
-
- return;
}
bool VpnPage::removeConnectionItem(QMap &connectMap,
@@ -182,6 +183,7 @@ bool VpnPage::removeConnectionItem(QMap &connectMap,
iter = connectMap.erase(iter);
if (m_vpnListWidget->count() <= MAX_ITEMS) {
m_vpnListWidget->setFixedWidth(MIN_WIDTH);
+ m_netListArea->setFixedHeight(m_vpnListWidget->count() * ITEM_HEIGHT);
}
return true;
}
@@ -197,6 +199,7 @@ void VpnPage::onRemoveConnection(QString path) //删除时后端会
Q_EMIT vpnRemove(path);
if (removeConnectionItem(m_netConnectionMap, m_vpnListWidget, path)) {
+ m_netFrame->setFixedHeight(37 + m_netListArea->height());
return;
}
}
@@ -224,9 +227,13 @@ void VpnPage::onAddConnection(QString uuid) //新增一个有线
delete p_newItem;
p_newItem = nullptr;
- if (m_vpnListWidget->count() > MAX_ITEMS) {
+ if (m_vpnListWidget->count() >= MAX_ITEMS) {
m_vpnListWidget->setFixedWidth(MAX_WIDTH);
+ m_netListArea->setFixedHeight(MAX_ITEMS * ITEM_HEIGHT);
+ } else {
+ m_netListArea->setFixedHeight(m_vpnListWidget->count() * ITEM_HEIGHT);
}
+ m_netFrame->setFixedHeight(37 + m_netListArea->height());
return;
}
@@ -241,13 +248,14 @@ void VpnPage::initUI()
m_netLabel->setText(tr("VPN Connection"));
m_vpnListWidget = new QListWidget(m_netListArea);
m_vpnListWidget->setFrameShape(QFrame::Shape::NoFrame);
- m_vpnListWidget->setSpacing(LAN_LIST_SPACING);
+ m_vpnListWidget->setSpacing(VPN_LIST_SPACING);
m_vpnListWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_vpnListWidget->setVerticalScrollMode(QAbstractItemView::ScrollMode::ScrollPerPixel);
m_vpnListWidget->verticalScrollBar()->setProperty("drawScrollBarGroove",false); //去除滚动条的外侧黑框
m_vpnListWidget->verticalScrollBar()->setSingleStep(SCROLL_STEP);
m_vpnListWidget->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu);
m_netAreaLayout->addWidget(m_vpnListWidget);
+ m_netListArea->setFixedHeight(0);
QPalette pal = m_vpnListWidget->palette();
pal.setBrush(QPalette::Base, QColor(0,0,0,0)); //背景透明
@@ -337,8 +345,6 @@ void VpnPage::updateConnectionArea(KyConnectItem *p_newItem)
} else {
m_vpnListWidget->setFixedWidth(MAX_WIDTH);
}
-
- return;
}
void VpnPage::updateConnectionState(QMap &connectMap,
@@ -352,12 +358,11 @@ void VpnPage::updateConnectionState(QMap &connectMap
p_lanItem->updateConnectionState(state);
}
- return;
}
void VpnPage::onConnectionStateChange(QString uuid,
- NetworkManager::VpnConnection::State state,
- NetworkManager::VpnConnection::StateChangeReason reason)
+ NetworkManager::ActiveConnection::State state,
+ NetworkManager::ActiveConnection::Reason reason)
{
//VpnPage函数内持续监听连接状态的变化并记录供其他函数调用获取状态
if (!m_connectResourse->isVirtualConncection(uuid)) {
@@ -416,7 +421,6 @@ void VpnPage::onConnectionStateChange(QString uuid,
return;
}
-
void VpnPage::getVirtualList(QVector &vector)
{
QList netConnectList;
@@ -424,10 +428,17 @@ void VpnPage::getVirtualList(QVector &vector)
m_connectResourse->getVpnAndVirtualConnections(netConnectList); //未激活列表的显示
if (!netConnectList.isEmpty()) {
for (int i = 0; i < netConnectList.size(); i++) {
+ KyConnectItem *p_newItem = nullptr;
+ KyConnectItem *p_netConnectionItem = netConnectList.at(i);
+ p_newItem = m_activeResourse->getActiveConnectionByUuid(p_netConnectionItem->m_connectUuid);
+ NetworkManager::ActiveConnection::State state = p_netConnectionItem->m_connectState;
+ if (p_newItem != nullptr) {
+ state = NetworkManager::ActiveConnection::Activated;
+ }
vector.append(QStringList() << netConnectList.at(i)->m_connectName
<< netConnectList.at(i)->m_connectUuid
<< netConnectList.at(i)->m_connectPath
- << QString::number(netConnectList.at(i)->m_connectState));
+ << QString::number(state));
}
}
return;
@@ -445,10 +456,16 @@ void VpnPage::sendVpnUpdateSignal(KyConnectItem *p_connectItem)
void VpnPage::sendVpnAddSignal(KyConnectItem *p_connectItem)
{
QStringList info;
+ KyConnectItem *p_newItem = nullptr;
+ p_newItem = m_activeResourse->getActiveConnectionByUuid(p_connectItem->m_connectUuid);
+ NetworkManager::ActiveConnection::State state = p_connectItem->m_connectState;
+ if (p_newItem != nullptr) {
+ state = NetworkManager::ActiveConnection::Activated;
+ }
info << p_connectItem->m_connectName
<< p_connectItem->m_connectUuid
<< p_connectItem->m_connectPath
- << QString::number(p_connectItem->m_connectState);
+ << QString::number(state);
qDebug() << "[VpnPage] emit vpnAdd because addConnection ";
Q_EMIT vpnAdd(info);
@@ -521,7 +538,7 @@ void VpnPage::updateActiveConnectionProperty(KyConnectItem *p_connectItem)
void VpnPage::onUpdateConnection(QString uuid)
{
- if (!m_connectResourse->isWiredConnection(uuid)) {
+ if (!m_connectResourse->isVirtualConncection(uuid)) {
return;
}
diff --git a/src/frontend/single-pages/vpnpage.h b/src/frontend/single-pages/vpnpage.h
index c064bd75..0b3c5fd8 100644
--- a/src/frontend/single-pages/vpnpage.h
+++ b/src/frontend/single-pages/vpnpage.h
@@ -35,6 +35,9 @@
#define VPNPAGE_LAYOUT_MARGINS 0,0,0,0
+#define VISIBLE "visible"
+const QByteArray GSETTINGS_VPNICON_VISIBLE = "org.ukui.kylin-nm.vpnicon";
+
class VpnListItem;
class VpnPage : public SinglePage
@@ -65,7 +68,6 @@ private:
bool removeConnectionItem(QMap &connectMap,
QListWidget *lanListWidget, QString path);
- void constructConnectionArea();
void constructActiveConnectionArea();
void updateConnectionArea(KyConnectItem *p_newItem);
@@ -95,8 +97,8 @@ Q_SIGNALS:
private Q_SLOTS:
void onConnectionStateChange(QString uuid,
- NetworkManager::VpnConnection::State state,
- NetworkManager::VpnConnection::StateChangeReason reason);
+ NetworkManager::ActiveConnection::State state,
+ NetworkManager::ActiveConnection::Reason reason);
void onAddConnection(QString uuid);
void onRemoveConnection(QString path);
diff --git a/src/frontend/vpnmainwindow.cpp b/src/frontend/vpnmainwindow.cpp
index 4238cd33..e5c1a4f0 100644
--- a/src/frontend/vpnmainwindow.cpp
+++ b/src/frontend/vpnmainwindow.cpp
@@ -73,23 +73,10 @@ void vpnMainWindow::showMainwindow()
KWindowSystem::setState(this->winId(), NET::SkipTaskbar | NET::SkipPager);
}
}
-
this->showByWaylandHelper();
this->raise();
this->activateWindow();
- Q_EMIT this->mainWindowVisibleChanged(true);
-#ifdef WITHKYSEC
-// if (!kysec_is_disabled() && kysec_get_3adm_status() && (getuid() || geteuid())){
-// if (nullptr != m_vpnPage) {
-// m_vpnPage->hideSetting();
-// }
-// } else {
-// if (nullptr != m_vpnPage) {
-// m_vpnPage->showSetting();
-// }
-// }
-#endif
-
+// Q_EMIT this->mainWindowVisibleChanged(true);
}
/**
@@ -98,7 +85,7 @@ void vpnMainWindow::showMainwindow()
void vpnMainWindow::hideMainwindow()
{
this->hide();
- Q_EMIT this->mainWindowVisibleChanged(false);
+// Q_EMIT this->mainWindowVisibleChanged(false);
}
///**
@@ -258,7 +245,6 @@ void vpnMainWindow::initDbusConnnect()
connect(m_vpnPage, &VpnPage::vpnRemove, this, &vpnMainWindow::vpnRemove);
connect(m_vpnPage, &VpnPage::vpnUpdate, this, &vpnMainWindow::vpnUpdate);
connect(m_vpnPage, &VpnPage::vpnActiveConnectionStateChanged, this, &vpnMainWindow::vpnActiveConnectionStateChanged);
-
//模式切换
QDBusConnection::sessionBus().connect(QString("com.kylin.statusmanager.interface"),
QString("/"),
@@ -499,7 +485,7 @@ void vpnMainWindow::initVpnIconVisible()
{
if(QGSettings::isSchemaInstalled(GSETTINGS_VPNICON_VISIBLE)) {
m_vpnGsettings = new QGSettings(GSETTINGS_VPNICON_VISIBLE);
- if(m_vpnGsettings->keys().contains(QString("visible"))) {
+ if(m_vpnGsettings->keys().contains(QString(VISIBLE))) {
connect(m_vpnGsettings, &QGSettings::changed, this, &vpnMainWindow::onVpnIconVisibleChanged);
m_vpnTrayIcon->setVisible(m_vpnGsettings->get("visible").toBool());
}
diff --git a/src/frontend/vpnmainwindow.h b/src/frontend/vpnmainwindow.h
index 341efe85..8630d8dc 100644
--- a/src/frontend/vpnmainwindow.h
+++ b/src/frontend/vpnmainwindow.h
@@ -33,8 +33,6 @@
#include "vpnpage.h"
#include "mainwindow.h"
-const QByteArray GSETTINGS_VPNICON_VISIBLE = "org.ukui.kylin-nm.vpnicon";
-
class VpnPage;
class vpnMainWindow : public QMainWindow