From 88ca1c59c8797dcccc06de2eb7836fb78137447a Mon Sep 17 00:00:00 2001 From: zhangyuanyuan1 Date: Tue, 1 Nov 2022 17:30:20 +0800 Subject: [PATCH] fix bug 144990 --- .../netdetails/joinhiddenwifipage.cpp | 12 ++++++++ src/frontend/netdetails/joinhiddenwifipage.h | 3 ++ src/frontend/netdetails/netdetail.cpp | 30 +++++++++++++++++++ src/frontend/netdetails/netdetail.h | 4 ++- src/frontend/tab-pages/lanpage.cpp | 1 + src/frontend/tab-pages/wlanpage.cpp | 4 +-- 6 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/frontend/netdetails/joinhiddenwifipage.cpp b/src/frontend/netdetails/joinhiddenwifipage.cpp index a0fead7b..3524467c 100644 --- a/src/frontend/netdetails/joinhiddenwifipage.cpp +++ b/src/frontend/netdetails/joinhiddenwifipage.cpp @@ -35,6 +35,8 @@ #define TLS_SCRO_HEIGHT 560 #define MEDIUM_WEIGHT_VALUE 57 +bool LaunchApp(QString desktopFile); + JoinHiddenWiFiPage::JoinHiddenWiFiPage(QString devName, KDialog *parent) :m_devName(devName), KDialog(parent) @@ -55,9 +57,19 @@ JoinHiddenWiFiPage::~JoinHiddenWiFiPage() } +void JoinHiddenWiFiPage::setJoinHiddenWiFiShowed(bool state) +{ + m_joinHiddenWiFiShowed = state; +} + void JoinHiddenWiFiPage::closeEvent(QCloseEvent *event) { Q_EMIT this->hiddenWiFiPageClose(m_devName); + + if (m_joinHiddenWiFiShowed) { + LaunchApp("ukui-control-center.desktop"); + m_joinHiddenWiFiShowed = false; + } return QWidget::closeEvent(event); } diff --git a/src/frontend/netdetails/joinhiddenwifipage.h b/src/frontend/netdetails/joinhiddenwifipage.h index f3aa0edb..23d14328 100644 --- a/src/frontend/netdetails/joinhiddenwifipage.h +++ b/src/frontend/netdetails/joinhiddenwifipage.h @@ -43,6 +43,8 @@ public: JoinHiddenWiFiPage(QString devName, KDialog *parent = nullptr); ~JoinHiddenWiFiPage(); + void setJoinHiddenWiFiShowed(bool state); + protected: void closeEvent(QCloseEvent *event); @@ -78,6 +80,7 @@ private: bool m_isJoinBtnEnable = false; bool m_isSecuOk = false; + bool m_joinHiddenWiFiShowed = false; ConInfo m_info; private Q_SLOTS: diff --git a/src/frontend/netdetails/netdetail.cpp b/src/frontend/netdetails/netdetail.cpp index b88863aa..411d16c3 100644 --- a/src/frontend/netdetails/netdetail.cpp +++ b/src/frontend/netdetails/netdetail.cpp @@ -55,9 +55,28 @@ #define PEAP_SCRO_HEIGHT 300 #define TLS_SCRO_HEIGHT 480 #define MAX_TAB_TEXT_LENGTH 44 +#define KYLIN_APP_MANAGER_NAME "com.kylin.AppManager" +#define KYLIN_APP_MANAGER_PATH "/com/kylin/AppManager" +#define KYLIN_APP_MANAGER_INTERFACE "com.kylin.AppManager" //extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +bool LaunchApp(QString desktopFile) +{ + QDBusInterface m_appManagerDbusInterface(KYLIN_APP_MANAGER_NAME, + KYLIN_APP_MANAGER_PATH, + KYLIN_APP_MANAGER_INTERFACE, + QDBusConnection::sessionBus());//ć±€éƒšć˜é‡ + + if (!m_appManagerDbusInterface.isValid()) { + qWarning()<<"m_appManagerDbusInterface init error"; + return false; + } else { + QDBusReply reply =m_appManagerDbusInterface.call("LaunchApp",desktopFile); + return reply; + } +} + void NetDetail::showDesktopNotify(const QString &message, QString soundName) { QDBusInterface iface("org.freedesktop.Notifications", @@ -264,6 +283,11 @@ void NetDetail::closeEvent(QCloseEvent *event) { Q_EMIT this->detailPageClose(false); Q_EMIT this->createPageClose(m_deviceName); + + if (m_hasDetailPageShowed) { + LaunchApp("ukui-control-center.desktop"); + m_hasDetailPageShowed = false; + } return QWidget::closeEvent(event); } @@ -399,6 +423,7 @@ void NetDetail::loadPage() pageFrame->hide(); stackWidget->setCurrentIndex(CREATE_NET_PAGE_NUM); this->setWindowTitle(tr("Add Lan Connect")); + setDetailPageShowed(true); } else { stackWidget->setCurrentIndex(DETAIL_PAGE_NUM); this->setWindowTitle(m_name); @@ -1131,6 +1156,11 @@ bool NetDetail::eventFilter(QObject *w, QEvent *event) return QWidget::eventFilter(w, event); } +void NetDetail::setDetailPageShowed(bool state) +{ + m_hasDetailPageShowed = state; +} + void NetDetail::setNetTabToolTip() { int tabCount = m_netTabBar->count(); diff --git a/src/frontend/netdetails/netdetail.h b/src/frontend/netdetails/netdetail.h index 0d427e68..f46b73d2 100644 --- a/src/frontend/netdetails/netdetail.h +++ b/src/frontend/netdetails/netdetail.h @@ -98,6 +98,8 @@ public: void closeEvent(QCloseEvent *event); bool eventFilter(QObject *w, QEvent *event); + void setDetailPageShowed(bool state); + private: void initUI(); void centerToScreen(); @@ -181,7 +183,7 @@ private: bool isIpv6Ok; bool isSecuOk; bool isConfirmBtnEnable; - + bool m_hasDetailPageShowed = false; ConInfo m_info; ThreadObject *m_object; diff --git a/src/frontend/tab-pages/lanpage.cpp b/src/frontend/tab-pages/lanpage.cpp index 0a596c02..19b0845c 100644 --- a/src/frontend/tab-pages/lanpage.cpp +++ b/src/frontend/tab-pages/lanpage.cpp @@ -1265,6 +1265,7 @@ void LanPage::showDetailPage(QString devName, QString uuid) NetDetail *netDetail = new NetDetail(devName, p_item->m_connectName, uuid, isActive, false, false); netDetail->show(); + netDetail->setDetailPageShowed(true); delete p_item; p_item = nullptr; diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index efe6ea31..fb1245a0 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -1099,7 +1099,7 @@ void WlanPage::requestScan() void WlanPage::onHiddenWlanClicked() { -// qDebug() << "[wlanPage] AddHideWifi Clicked! " << Q_FUNC_INFO << __LINE__ ; + qDebug() << "[wlanPage] AddHideWifi Clicked! " << Q_FUNC_INFO << __LINE__ ; // NetDetail *netDetail = new NetDetail(m_currentDevice, "", "", false, true, true); // netDetail->show(); if(m_hiddenWiFi != nullptr){ @@ -1486,7 +1486,7 @@ void WlanPage::showDetailPage(QString devName, QString ssid) NetDetail *netDetail = new NetDetail(devName, ssid, wirelessNetItem.m_connectUuid, isActive, true, !wirelessNetItem.m_isConfigured); netDetail->show(); - + netDetail->setDetailPageShowed(true); return; }