修改应用搜索插件接口图标返回格式

This commit is contained in:
iaom 2023-02-27 13:45:28 +08:00
parent d4f503d46e
commit 69abc4caf5
2 changed files with 3 additions and 9 deletions

View File

@ -2,6 +2,7 @@
#include <gio/gdesktopappinfo.h>
#include <QWidget>
#include <QLabel>
#include <qt5xdg/XdgIcon>
#include "file-utils.h"
using namespace UkuiSearch;
@ -172,13 +173,7 @@ void AppSearchPlugin::run()
SearchPluginIface::ResultInfo ri;
ri.actionKey = oneResult.getExtral().at(0).toString();
ri.name = oneResult.getExtral().at(1).toString();
QIcon icon = oneResult.getExtral().at(2).value<QIcon>();
if(icon.isNull()) {
ri.icon = QIcon(":/res/icons/unknown.svg");
} else {
ri.icon = icon;
}
ri.icon = XdgIcon::fromTheme(oneResult.getExtral().at(2).toString(), QIcon(":/res/icons/unknown.svg"));
SearchPluginIface::DescriptionInfo description;
description.key = QString(tr("Application Description:"));
description.value = oneResult.getExtral().at(3).toString();

View File

@ -1,7 +1,6 @@
#include "app-search-task.h"
#include "index-status-recorder.h"
#include "common.h"
#include <qt5xdg/XdgIcon>
#include <QDir>
#include <QFile>
#include <QQueue>
@ -81,7 +80,7 @@ void AppSearchWorker::run()
info << QVariant(results.at(i*3 + 1));
}
if (dataType & UkuiSearch::ApplicationIconName) {
info << QVariant(XdgIcon::fromTheme(results.at(i*3 + 2)));
info << QVariant(results.at(i*3 + 2));
}
if (dataType & UkuiSearch::ApplicationDescription) {//本地应用暂无简介
info << QVariant(QString());