mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-17 17:41:37 +08:00
增加dbus文件,再次启动的时候会唤起第一个进程
并且处理spark打开
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "HttpClient.h"
|
||||
#include "downloadworker.h"
|
||||
|
||||
#include "./dbus/dbussparkstore.h"
|
||||
DWIDGET_USE_NAMESPACE
|
||||
|
||||
Widget::Widget(DBlurEffectWidget *parent) :
|
||||
@@ -138,6 +139,9 @@ Widget::Widget(DBlurEffectWidget *parent) :
|
||||
});
|
||||
|
||||
notify_init(tr("Spark\\ Store").toLocal8Bit());
|
||||
|
||||
//初始化dbus服务
|
||||
initDbus();
|
||||
}
|
||||
|
||||
Widget::~Widget()
|
||||
@@ -452,6 +456,15 @@ void Widget::sendNotification(const char *message, const int msTimeout, const QS
|
||||
notify_notification_show(_notify, nullptr);
|
||||
}
|
||||
|
||||
void Widget::initDbus()
|
||||
{
|
||||
DBusSparkStoreService *dbusInter = new DBusSparkStoreService(this);
|
||||
|
||||
QDBusConnection::sessionBus().registerService("com.gitee.spark.store");
|
||||
QDBusConnection::sessionBus().registerObject("/com/gitee/spark/store", "com.gitee.spark.store", this);
|
||||
connect(dbusInter,&DBusSparkStoreService::sigOpenUrl,this,&Widget::onGetUrl);
|
||||
}
|
||||
|
||||
void Widget::updateUI()
|
||||
{
|
||||
if(themeIsDark)
|
||||
@@ -1354,3 +1367,12 @@ void Widget::on_pushButton_update_clicked()
|
||||
QDesktopServices::openUrl(QUrl("https://www.deepinos.org/"));
|
||||
}
|
||||
|
||||
void Widget::onGetUrl(const QString &url)
|
||||
{
|
||||
if(url.left(6)=="spk://")
|
||||
{
|
||||
openUrl(QUrl(url));
|
||||
}
|
||||
activateWindow();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user