diff --git a/debian/control b/debian/control index d2e11f86..2ed69020 100644 --- a/debian/control +++ b/debian/control @@ -24,6 +24,10 @@ Vcs-Browser: https://github.com/ukui/kylin-nm Package: kylin-nm Architecture: any Depends: network-manager (>=1.2.6), + network-manager-config-connectivity-ubuntu, + gir1.2-javascriptcoregtk-4.0, + gir1.2-webkit2-4.0, + gnome-shell, ${shlibs:Depends}, ${misc:Depends} Description: Gui Applet tool for display and edit network simply diff --git a/kylin-nm.pro b/kylin-nm.pro index 272e8fdf..7cffd87f 100644 --- a/kylin-nm.pro +++ b/kylin-nm.pro @@ -61,6 +61,7 @@ QMAKE_LFLAGS *= $(shell dpkg-buildflags --get LDFLAGS) SOURCES += \ src/backthread.cpp \ + src/wifi-auth-thread.cpp \ src/confform.cpp \ src/dbusadaptor.cpp \ src/ksimplenm.cpp \ @@ -92,6 +93,7 @@ SOURCES += \ HEADERS += \ src/backthread.h \ + src/wifi-auth-thread.h \ src/confform.h \ src/dbusadaptor.h \ src/ksimplenm.h \ diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d65c184e..9f7ed157 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -20,6 +20,7 @@ #include "ui_mainwindow.h" #include "oneconnform.h" #include "onelancform.h" +#include "wifi-auth-thread.h" #include "hot-spot/dlghotspotcreate.h" #include "wireless-security/dlghidewifi.h" #include "sysdbusregister.h" @@ -3188,6 +3189,8 @@ void MainWindow::connWifiDone(int connFlag) { // Wifi连接结果,0点击连接成功 1失败 2没有配置文件 3开机启动网络工具时已经连接 if (connFlag == 0) { + WifiAuthThread *wifi_auth_thread=new WifiAuthThread(); + wifi_auth_thread->start(); syslog(LOG_DEBUG, "Wi-Fi already connected by clicking button"); this->ksnm->execGetWifiList(); diff --git a/src/wifi-auth-thread.cpp b/src/wifi-auth-thread.cpp new file mode 100644 index 00000000..1b5bb4d1 --- /dev/null +++ b/src/wifi-auth-thread.cpp @@ -0,0 +1,15 @@ +#include "wifi-auth-thread.h" +void WifiAuthThread::run() +{ + QDBusInterface interface( "org.freedesktop.NetworkManager", + "/org/freedesktop/NetworkManager", + "org.freedesktop.NetworkManager", + QDBusConnection::systemBus() ); + QDBusReply reply= interface.call("CheckConnectivity"); + if (reply.isValid()) { + if (reply.value() == 2) + system("gdbus call --session --dest org.gnome.Shell.PortalHelper --object-path /org/gnome/Shell/PortalHelper --method org.gtk.Application.Activate []"); + } +} + + diff --git a/src/wifi-auth-thread.h b/src/wifi-auth-thread.h new file mode 100644 index 00000000..c7f18093 --- /dev/null +++ b/src/wifi-auth-thread.h @@ -0,0 +1,13 @@ +#ifndef WIFI_AUTH_THREAD_H +#define WIFI_AUTH_THREAD_H +#include +#include +#include + +class WifiAuthThread:public QThread +{ +protected: + virtual void run(); +}; + +#endif //WIFI_AUTH_THREAD_H