!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()
{
QProcess process;
process.startDetached("fcitx-config-gtk3");
QDBusInterface ifc("com.kylin.AppManager",
"/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 <QProcess>
#include <QDebug>
#include <QtDBus/QDBusInterface>
#include "../../../shell/component/Label/titlelabel.h"

View File

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

View File

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

View File

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

View File

@ -131,7 +131,11 @@ void Screenlock::initSearchText() {
ui->onlineBtn->setCursor( QCursor(Qt::PointingHandCursor));
ui->onlineBtn->setStyleSheet("QPushButton{background: transparent;border-radius: 4px;text-decoration: underline;} ");
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
ui->resetBtn->setText(tr("Reset To Default"));

View File

@ -138,7 +138,11 @@ void Wallpaper::initSearchText() {
ui->onlineBtn->setCursor( QCursor(Qt::PointingHandCursor));
ui->onlineBtn->setStyleSheet("QPushButton{background: transparent;border-radius: 4px;text-decoration: underline;} ");
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
ui->resetBtn->setText(tr("Reset To Default"));