fix(search):修复搜索状态下,应用右键菜单始终为添加到收藏的问题

This commit is contained in:
qiqi49 2024-09-11 17:53:21 +08:00 committed by youdiansaodongxi
parent c1a9dd04c5
commit 0ddfcf74fd
1 changed files with 6 additions and 8 deletions

View File

@ -19,6 +19,7 @@
*/
#include "app-search-plugin.h"
#include "data-entity.h"
#include "basic-app-model.h"
#include <UkuiSearchTask>
#include <QThread>
@ -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);
}
}