diff --git a/debian/changelog b/debian/changelog index d8392128..dc64d451 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,16 @@ +kylin-nm (3.20.1.6-ok4) v101; urgency=medium + + * BUG号: + -#143364 【网络设置】任务栏点击网络图标,网络设置窗口显示在屏幕中央 + * 需求号: + * 其他改动:无 + * 影响域:显示位置 + + -- zhaoshixu Fri, 21 Oct 2022 11:12:38 +0800 + kylin-nm (3.20.1.6-ok3) v101; urgency=medium - * iBUG号: + * BUG号: * 需求号: -#16989 创建的VPN等虚拟网络可直接查看、操作连接 * 其他改动:无 diff --git a/src/frontend/mainwindow.cpp b/src/frontend/mainwindow.cpp index 0a0b7883..26e766b4 100644 --- a/src/frontend/mainwindow.cpp +++ b/src/frontend/mainwindow.cpp @@ -508,7 +508,7 @@ void MainWindow::showByWaylandHelper() //去除窗管标题栏,传入参数为QWidget* kdk::UkuiStyleHelper::self()->removeHeader(this); this->show(); - initPlatform(); + getTabletMode(); resetWindowPosition(); //设置窗体位置,传入参数为QWindow*,QRect @@ -529,6 +529,29 @@ void MainWindow::setCentralWidgetType(IconActiveType iconStatus) } } +void MainWindow::getTabletMode() +{ + QDBusConnection::sessionBus().connect(QString("com.kylin.statusmanager.interfacer"), + QString("/"), + QString("qt5-ukui-platformtheme"), + QString("mode_change_signal"), this, SLOT(onTabletModeChanged(bool))); + + QDBusInterface interface(QString("com.kylin.statusmanager.interfacer"), + QString("/"), + QString("qt5-ukui-platformtheme"), + QDBusConnection::sessionBus); + if(!interface.isValid()) { + m_isShowInCenter = true; + return; + } + QDBusReply reply = interface->call("get_current_tabletmode"); + if (!reply.isValid()) { + m_isShowInCenter = true; + return; + } + m_isShowInCenter = reply.value(); +} + /** * @brief MainWindow::onTrayIconActivated 点击托盘图标的槽函数 */ diff --git a/src/frontend/mainwindow.h b/src/frontend/mainwindow.h index 59111d42..c5169274 100644 --- a/src/frontend/mainwindow.h +++ b/src/frontend/mainwindow.h @@ -161,6 +161,7 @@ private: void showControlCenter(); void showByWaylandHelper(); void setCentralWidgetType(IconActiveType iconStatus); + void getTabletMode(); double m_transparency=1.0; //透明度 QGSettings * m_transGsettings; //透明度配置文件 int currentIconIndex=0; diff --git a/src/frontend/vpnmainwindow.cpp b/src/frontend/vpnmainwindow.cpp index e9c9b591..e91a5ecb 100644 --- a/src/frontend/vpnmainwindow.cpp +++ b/src/frontend/vpnmainwindow.cpp @@ -120,7 +120,6 @@ void vpnMainWindow::firstlyStart() initDbusConnnect(); initWindowTheme(); initTrayIcon(); - initPlatform(); installEventFilter(this); m_secondaryStartTimer = new QTimer(this); connect(m_secondaryStartTimer, &QTimer::timeout, this, [ = ]() { @@ -428,6 +427,7 @@ void vpnMainWindow::showByWaylandHelper() //去除窗管标题栏,传入参数为QWidget* kdk::UkuiStyleHelper::self()->removeHeader(this); this->show(); + getTabletMode(); resetWindowPosition(); //设置窗体位置,传入参数为QWindow*,QRect @@ -448,6 +448,29 @@ void vpnMainWindow::setCentralWidgetType(IconActiveType iconStatus) } } +void vpnMainWindow::getTabletMode() +{ + QDBusConnection::sessionBus().connect(QString("com.kylin.statusmanager.interfacer"), + QString("/"), + QString("qt5-ukui-platformtheme"), + QString("mode_change_signal"), this, SLOT(onTabletModeChanged(bool))); + + QDBusInterface interface(QString("com.kylin.statusmanager.interfacer"), + QString("/"), + QString("qt5-ukui-platformtheme"), + QDBusConnection::sessionBus); + if(!interface.isValid()) { + m_isShowInCenter = true; + return; + } + QDBusReply reply = interface->call("get_current_tabletmode"); + if (!reply.isValid()) { + m_isShowInCenter = true; + return; + } + m_isShowInCenter = reply.value(); +} + /** * @brief vpnMainWindow::onTrayIconActivated 点击托盘图标的槽函数 */ diff --git a/src/frontend/vpnmainwindow.h b/src/frontend/vpnmainwindow.h index 4a898413..3dc6fc2c 100644 --- a/src/frontend/vpnmainwindow.h +++ b/src/frontend/vpnmainwindow.h @@ -111,6 +111,7 @@ private: // void showControlCenter(); void showByWaylandHelper(); void setCentralWidgetType(IconActiveType iconStatus); + void getTabletMode(); double m_transparency=1.0; //透明度 QGSettings * m_transGsettings; //透明度配置文件 int m_currentIconIndex = 0;