From 0ddfcf74fd21d4259eec7c33e23052e1e0def3bd Mon Sep 17 00:00:00 2001 From: qiqi49 Date: Wed, 11 Sep 2024 17:53:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(search):=E4=BF=AE=E5=A4=8D=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E7=8A=B6=E6=80=81=E4=B8=8B,=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=8F=B3=E9=94=AE=E8=8F=9C=E5=8D=95=E5=A7=8B=E7=BB=88=E4=B8=BA?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=B0=E6=94=B6=E8=97=8F=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libappdata/app-search-plugin.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/libappdata/app-search-plugin.cpp b/src/libappdata/app-search-plugin.cpp index 5df6f84..bd05991 100644 --- a/src/libappdata/app-search-plugin.cpp +++ b/src/libappdata/app-search-plugin.cpp @@ -19,6 +19,7 @@ */ #include "app-search-plugin.h" #include "data-entity.h" +#include "basic-app-model.h" #include #include @@ -60,9 +61,7 @@ AppSearchPluginPrivate::AppSearchPluginPrivate(QObject *parent) : QThread(parent m_appSearchTask->setSearchOnlineApps(false); UkuiSearch::SearchResultProperties searchResultProperties; - searchResultProperties << UkuiSearch::SearchProperty::SearchResultProperty::ApplicationDesktopPath - << UkuiSearch::SearchProperty::SearchResultProperty::ApplicationLocalName - << UkuiSearch::SearchProperty::SearchResultProperty::ApplicationIconName; + searchResultProperties << UkuiSearch::SearchProperty::SearchResultProperty::ApplicationDesktopPath; m_appSearchTask->setResultProperties(UkuiSearch::SearchProperty::SearchType::Application, searchResultProperties); m_timer = new QTimer; @@ -101,11 +100,10 @@ void AppSearchPluginPrivate::run() m_timer->stop(); if (result.getSearchId() == m_searchId) { DataEntity app; - app.setType(DataType::Normal); - app.setId(result.getValue(UkuiSearch::SearchProperty::ApplicationDesktopPath).toString()); - app.setName(result.getValue(UkuiSearch::SearchProperty::ApplicationLocalName).toString()); - app.setIcon(result.getValue(UkuiSearch::SearchProperty::ApplicationIconName).toString()); - + QString id = result.getValue(UkuiSearch::SearchProperty::ApplicationDesktopPath).toString(); + if (!BasicAppModel::instance()->getAppById(id, app)) { + BasicAppModel::instance()->databaseInterface()->getApp(id, app); + }; Q_EMIT this->searchedOne(app); } }