From f356ca340a05bdfae6663292ec44b8a5d56acbfd Mon Sep 17 00:00:00 2001 From: Jinxujie Date: Fri, 4 Mar 2022 11:36:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=BC=95=E6=93=8E=E8=B7=9F?= =?UTF-8?q?=E9=9A=8F=E6=8E=A7=E5=88=B6=E9=9D=A2=E6=9D=BF=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libsearch/websearch/web-search-plugin.cpp | 31 ++++++++++++++++++++++- libsearch/websearch/web-search-plugin.h | 4 +++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/libsearch/websearch/web-search-plugin.cpp b/libsearch/websearch/web-search-plugin.cpp index 64f1718..d210790 100644 --- a/libsearch/websearch/web-search-plugin.cpp +++ b/libsearch/websearch/web-search-plugin.cpp @@ -1,5 +1,8 @@ #include "web-search-plugin.h" #include "global-settings.h" +#define WEB_ENGINE_KEY "webEngine" +#define BROWSERTYPE "x-scheme-handler/http" +#define DESKTOPPATH "/usr/share/applications/" using namespace UkuiSearch; WebSearchPlugin::WebSearchPlugin(QObject *parent) : QObject(parent) @@ -30,9 +33,22 @@ void UkuiSearch::WebSearchPlugin::KeywordSearch(QString keyword, DataQueueenqueue(resultInfo); + g_object_unref(textinfo); } void WebSearchPlugin::stopSearch() @@ -112,3 +128,16 @@ void UkuiSearch::WebSearchPlugin::initDetailPage() openAction(0, m_currentActionKey, 0); }); } + +QString WebSearchPlugin::getDefaultAppId(const char *contentType) +{ + GAppInfo * app = g_app_info_get_default_for_type(contentType, false); + if(app != NULL){ + const char * id = g_app_info_get_id(app); + QString strId(id); + g_object_unref(app); + return strId; + } else { + return QString(""); + } +} diff --git a/libsearch/websearch/web-search-plugin.h b/libsearch/websearch/web-search-plugin.h index 5790411..87d2414 100644 --- a/libsearch/websearch/web-search-plugin.h +++ b/libsearch/websearch/web-search-plugin.h @@ -12,8 +12,10 @@ #include #include "action-label.h" #include "search-plugin-iface.h" +#include namespace UkuiSearch { + class LIBSEARCH_EXPORT WebSearchPlugin : public QObject, public SearchPluginIface { Q_OBJECT @@ -48,6 +50,8 @@ private: bool m_enable = true; QList m_actionInfo; + + QString getDefaultAppId(const char * contentType); }; } #endif // WEBSEARCHPLUGIN_H