fix bug 145707

This commit is contained in:
zhangyuanyuan1 2022-11-01 17:29:21 +08:00
parent 1cf2aeb8ca
commit f6ee9aad87
4 changed files with 48 additions and 6 deletions

View File

@ -32,6 +32,9 @@
#define ITEMHEIGH 50
#define LAN_TYPE 0
#define CONTROL_CENTER_WIFI "org.ukui.control-center.wifi.switch"
#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 KLanSymbolic = "network-wired-connected-symbolic";
const QString NoNetSymbolic = "network-wired-disconnected-symbolic";
@ -350,9 +353,10 @@ void NetConnect::initNet()
}
void NetConnect::runExternalApp() {
QString cmd = "nm-connection-editor";
QProcess process(this);
process.startDetached(cmd);
// QString cmd = "nm-connection-editor";
// QProcess process(this);
// process.startDetached(cmd);
LaunchApp("nm-connection-editor.desktop");
}
//刪除
@ -928,3 +932,19 @@ int NetConnect::getInsertPos(QString connName, QString deviceName)
}
return index;
}
bool NetConnect::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<bool> reply =m_appManagerDbusInterface.call("LaunchApp",desktopFile);
return reply;
}
}

View File

@ -123,6 +123,7 @@ private:
//单个lan连接状态变化
void itemActiveConnectionStatusChanged(LanItem *item, int status);
bool LaunchApp(QString desktopFile);
protected:
bool eventFilter(QObject *w,QEvent *e);

View File

@ -99,6 +99,9 @@ const QString KApSymbolic = "network-wireless-hotspot-symbolic";
const QString IsApConnection = "1";
#define KYLIN_APP_MANAGER_NAME "com.kylin.AppManager"
#define KYLIN_APP_MANAGER_PATH "/com/kylin/AppManager"
#define KYLIN_APP_MANAGER_INTERFACE "com.kylin.AppManager"
#define ACTIVATING 1
#define ACTIVATED 2
@ -713,6 +716,22 @@ void WlanConnect::initSwtichState()
setSwitchBtnState(state);
}
bool WlanConnect::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<bool> reply =m_appManagerDbusInterface.call("LaunchApp",desktopFile);
return reply;
}
}
//初始化整体列表和单设备列表
void WlanConnect::initNet() {
// int count = 1;
@ -776,9 +795,10 @@ void WlanConnect::initNetListFromDevice(QString deviceName)
//高级设置
void WlanConnect::runExternalApp() {
QString cmd = "nm-connection-editor";
QProcess process(this);
process.startDetached(cmd);
// QString cmd = "nm-connection-editor";
// QProcess process(this);
// process.startDetached(cmd);
LaunchApp("nm-connection-editor.desktop");
}
//根据信号强度分级+安全性分图标

View File

@ -149,6 +149,7 @@ private:
}
}
bool LaunchApp(QString desktopFile);
protected:
bool eventFilter(QObject *w,QEvent *e);