From 4b2a557a0557183aef3badef228b6ea04adde4bc Mon Sep 17 00:00:00 2001 From: jzxc95 <907297917@qq.com> Date: Wed, 15 Dec 2021 15:18:16 +0800 Subject: [PATCH] =?UTF-8?q?keyring=E5=BC=80=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/dbus-interface/kylinagentinterface.c | 12 ++++++++++++ src/backend/dbus-interface/kylinagentinterface.h | 1 + src/backend/dbusadaptor.cpp | 10 ++++++++++ src/backend/dbusadaptor.h | 3 +++ src/frontend/mainwindow.cpp | 10 ++++++++++ src/frontend/mainwindow.h | 3 +++ 6 files changed, 39 insertions(+) diff --git a/src/backend/dbus-interface/kylinagentinterface.c b/src/backend/dbus-interface/kylinagentinterface.c index ad6361a7..35a7d41a 100644 --- a/src/backend/dbus-interface/kylinagentinterface.c +++ b/src/backend/dbus-interface/kylinagentinterface.c @@ -403,6 +403,9 @@ applet_agent_cancel_secrets_cb (AppletAgent *agent, void agent_init() { + if (NULL != kylinAgent) { + return; + } GError *error = NULL; kylinAgent = applet_agent_new (&error); @@ -414,3 +417,12 @@ void agent_init() return; } + +void agent_clear() +{ + if (NULL == kylinAgent) { + return; + } + g_clear_object (&kylinAgent); + kylinAgent = NULL; +} diff --git a/src/backend/dbus-interface/kylinagentinterface.h b/src/backend/dbus-interface/kylinagentinterface.h index 0df883e0..2a097923 100644 --- a/src/backend/dbus-interface/kylinagentinterface.h +++ b/src/backend/dbus-interface/kylinagentinterface.h @@ -3,6 +3,7 @@ #ifdef __cplusplus extern "C"{ void agent_init(); +void agent_clear(); } #endif diff --git a/src/backend/dbusadaptor.cpp b/src/backend/dbusadaptor.cpp index 56802498..29d5b7e8 100644 --- a/src/backend/dbusadaptor.cpp +++ b/src/backend/dbusadaptor.cpp @@ -234,3 +234,13 @@ void DbusAdaptor::reScan() { parent()->rescan(); } + +void DbusAdaptor::keyRingInit() +{ + parent()->keyRingInit(); +} + +void DbusAdaptor::keyRingClear() +{ + parent()->keyRingClear(); +} diff --git a/src/backend/dbusadaptor.h b/src/backend/dbusadaptor.h index 613aecfa..18a28385 100644 --- a/src/backend/dbusadaptor.h +++ b/src/backend/dbusadaptor.h @@ -83,6 +83,9 @@ public Q_SLOTS: // METHODS QStringList getApInfoBySsid(QString devName, QString ssid); //wifi扫描 void reScan(); + //keyring + void keyRingInit(); + void keyRingClear(); Q_SIGNALS: // SIGNALS // void wirelessActivating(QString devName, QString ssid); // void wiredActivating(QString devName, QString ssid); diff --git a/src/frontend/mainwindow.cpp b/src/frontend/mainwindow.cpp index 793fe87f..4ce56ded 100644 --- a/src/frontend/mainwindow.cpp +++ b/src/frontend/mainwindow.cpp @@ -711,3 +711,13 @@ void MainWindow::rescan() { m_wlanWidget->requestScan(); } + +void MainWindow::keyRingInit() +{ + agent_init(); +} + +void MainWindow::keyRingClear() +{ + agent_clear(); +} diff --git a/src/frontend/mainwindow.h b/src/frontend/mainwindow.h index 5e27f7f9..d0bf9430 100644 --- a/src/frontend/mainwindow.h +++ b/src/frontend/mainwindow.h @@ -68,6 +68,9 @@ public: void rescan(); + void keyRingInit(); + void keyRingClear(); + signals: //设备插拔 void deviceStatusChanged();