!4 使用应用管理组件接口打开第三方应用

This commit is contained in:
nil 2022-06-23 12:58:20 +00:00 committed by handsome_feng
parent 9c4a89f1a0
commit 5a13b51ec9
7 changed files with 28 additions and 19 deletions

View File

@ -305,6 +305,9 @@ void KeyboardMain::keyTipsSlot(bool checked)
void KeyboardMain::inputMethodSetSlot() void KeyboardMain::inputMethodSetSlot()
{ {
QProcess process; QDBusInterface ifc("com.kylin.AppManager",
process.startDetached("fcitx-config-gtk3"); "/com/kylin/AppManager",
"com.kylin.AppManager",
QDBusConnection::sessionBus());
ifc.call("LaunchApp", "/usr/share/applications/fcitx-config-gtk3.desktop");
} }

View File

@ -11,6 +11,7 @@
#include <QPushButton> #include <QPushButton>
#include <QProcess> #include <QProcess>
#include <QDebug> #include <QDebug>
#include <QtDBus/QDBusInterface>
#include "../../../shell/component/Label/titlelabel.h" #include "../../../shell/component/Label/titlelabel.h"

View File

@ -240,18 +240,12 @@ void Printer::refreshPrinterDevSlot()
void Printer::runExternalApp() void Printer::runExternalApp()
{ {
if (Utils::isTablet()) {
QDBusInterface ifc("com.kylin.AppManager", QDBusInterface ifc("com.kylin.AppManager",
"/com/kylin/AppManager", "/com/kylin/AppManager",
"com.kylin.AppManager", "com.kylin.AppManager",
QDBusConnection::sessionBus()); QDBusConnection::sessionBus());
ifc.call("LaunchApp", "/usr/share/applications/system-config-printer.desktop"); ifc.call("LaunchApp", "/usr/share/applications/system-config-printer.desktop");
} else {
QString cmd = "system-config-printer";
QProcess process(this);
process.startDetached(cmd);
}
} }
void Printer::clearAutoItem() void Printer::clearAutoItem()

View File

@ -89,7 +89,9 @@ void Vpn::initComponent(){
} }
void Vpn::runExternalApp(){ void Vpn::runExternalApp(){
QString cmd = "nm-connection-editor"; QDBusInterface ifc("com.kylin.AppManager",
QProcess process(this); "/com/kylin/AppManager",
process.startDetached(cmd); "com.kylin.AppManager",
QDBusConnection::sessionBus());
ifc.call("LaunchApp", "/usr/share/applications/nm-connection-editor.desktop");
} }

View File

@ -22,6 +22,7 @@
#include <QObject> #include <QObject>
#include <QtPlugin> #include <QtPlugin>
#include <QtDBus/QDBusInterface>
#include "shell/interface.h" #include "shell/interface.h"
#include "../../../shell/component/AddBtn/addbtn.h" #include "../../../shell/component/AddBtn/addbtn.h"

View File

@ -131,7 +131,11 @@ void Screenlock::initSearchText() {
ui->onlineBtn->setCursor( QCursor(Qt::PointingHandCursor)); ui->onlineBtn->setCursor( QCursor(Qt::PointingHandCursor));
ui->onlineBtn->setStyleSheet("QPushButton{background: transparent;border-radius: 4px;text-decoration: underline;} "); ui->onlineBtn->setStyleSheet("QPushButton{background: transparent;border-radius: 4px;text-decoration: underline;} ");
connect( ui->onlineBtn, &QPushButton::clicked, this,[=] { connect( ui->onlineBtn, &QPushButton::clicked, this,[=] {
QDesktopServices::openUrl(QUrl(QLatin1String("https://www.ubuntukylin.com/wallpaper.html"))); QDBusInterface ifc("com.kylin.AppManager",
"/com/kylin/AppManager",
"com.kylin.AppManager",
QDBusConnection::sessionBus());
ifc.call("LaunchDefaultAppWithUrl", "https://www.ubuntukylin.com/wallpaper.html");
}); });
//~ contents_path /Screenlock/Reset To Default //~ contents_path /Screenlock/Reset To Default
ui->resetBtn->setText(tr("Reset To Default")); ui->resetBtn->setText(tr("Reset To Default"));

View File

@ -138,7 +138,11 @@ void Wallpaper::initSearchText() {
ui->onlineBtn->setCursor( QCursor(Qt::PointingHandCursor)); ui->onlineBtn->setCursor( QCursor(Qt::PointingHandCursor));
ui->onlineBtn->setStyleSheet("QPushButton{background: transparent;border-radius: 4px;text-decoration: underline;} "); ui->onlineBtn->setStyleSheet("QPushButton{background: transparent;border-radius: 4px;text-decoration: underline;} ");
connect( ui->onlineBtn, &QPushButton::clicked, this,[=] { connect( ui->onlineBtn, &QPushButton::clicked, this,[=] {
QDesktopServices::openUrl(QUrl(QLatin1String("https://www.ubuntukylin.com/wallpaper.html"))); QDBusInterface ifc("com.kylin.AppManager",
"/com/kylin/AppManager",
"com.kylin.AppManager",
QDBusConnection::sessionBus());
ifc.call("LaunchDefaultAppWithUrl", "https://www.ubuntukylin.com/wallpaper.html");
}); });
//~ contents_path /Wallpaper/Reset To Default //~ contents_path /Wallpaper/Reset To Default
ui->resetBtn->setText(tr("Reset To Default")); ui->resetBtn->setText(tr("Reset To Default"));