From 7e1e60ea4a57c0313d8c3e0f76b33a3ff0c02836 Mon Sep 17 00:00:00 2001 From: youdiansaodongxi Date: Wed, 24 May 2023 14:36:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=8E=E6=94=B6=E8=97=8F?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E7=82=B9=E5=BC=80=E5=BA=94=E7=94=A8=E8=93=9D?= =?UTF-8?q?=E7=82=B9=E4=B8=8D=E6=B6=88=E5=A4=B1=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qml/AppUI/AppList.qml | 6 ------ src/appdata/app-data-manager.cpp | 4 +++- src/utils/app-manager.cpp | 7 ++----- src/utils/app-manager.h | 1 - 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/qml/AppUI/AppList.qml b/qml/AppUI/AppList.qml index 2eecaf1..eac31e0 100644 --- a/qml/AppUI/AppList.qml +++ b/qml/AppUI/AppList.qml @@ -112,9 +112,6 @@ Item { } if (mouse.button === Qt.LeftButton) { appManager.launchApp(id); - if (recentInstall) { - appManager.appLaunched(id); - } return; } } @@ -140,9 +137,6 @@ Item { Keys.onPressed: { if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { appManager.launchApp(id); - if (recentInstall) { - appManager.appLaunched(id); - } } } } diff --git a/src/appdata/app-data-manager.cpp b/src/appdata/app-data-manager.cpp index 5822e5d..5a66d68 100644 --- a/src/appdata/app-data-manager.cpp +++ b/src/appdata/app-data-manager.cpp @@ -346,7 +346,9 @@ void AppDataWorker::fixToTopSlot(const QString &path, const int &num) void AppDataWorker::setAppLaunched(const QString &path) { - m_applicationInfo->setAppLaunchedState(path); + if (m_appManager->m_normalApps.value(path).launched() == 0) { + m_applicationInfo->setAppLaunchedState(path); + } } void AppDataWorker::loadPreInstallAppData() diff --git a/src/utils/app-manager.cpp b/src/utils/app-manager.cpp index 72502fc..abef7ff 100644 --- a/src/utils/app-manager.cpp +++ b/src/utils/app-manager.cpp @@ -50,6 +50,8 @@ AppManager::AppManager(QObject *parent) : QObject(parent) bool AppManager::launchApp(const QString &desktopFilePath) { Q_EMIT request(UkuiMenuApplication::Hide); + AppDataManager::instance()->appLaunch(desktopFilePath); + if (launchAppWithDBus(desktopFilePath)) { return true; } @@ -78,11 +80,6 @@ bool AppManager::launchBinaryApp(const QString &app, const QString &args) return QProcess::startDetached(cmd); } -void AppManager::appLaunched(const QString &desktopFilePath) -{ - AppDataManager::instance()->appLaunch(desktopFilePath); -} - bool AppManager::launchAppWithDBus(const QString &app) { if (!m_appManagerDbusInterface) { diff --git a/src/utils/app-manager.h b/src/utils/app-manager.h index 7a26d85..028ff55 100644 --- a/src/utils/app-manager.h +++ b/src/utils/app-manager.h @@ -35,7 +35,6 @@ public: Q_INVOKABLE bool launchApp(const QString &desktopFilePath); Q_INVOKABLE bool launchBinaryApp(const QString &app, const QString &args = QString()); - Q_INVOKABLE void appLaunched(const QString &desktopFilePath); private: explicit AppManager(QObject *parent = nullptr);