Merge from dev-unity.
This commit is contained in:
commit
26acf20077
|
@ -51,7 +51,7 @@ AppMatch::AppMatch(QObject *parent) : QThread(parent)
|
|||
if(!m_interFace->isValid()) {
|
||||
qWarning() << qPrintable(QDBusConnection::sessionBus().lastError().message());
|
||||
}
|
||||
m_interFace->setTimeout(200);
|
||||
m_interFace->setTimeout(1500);
|
||||
qDebug() << "AppMatch init finished.";
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QDir>
|
||||
#define UKUI_SEARCH_PIPE_PATH (QDir::homePath()+"/.config/org.ukui/ukui-search/ukuisearch").toLocal8Bit().constData()
|
||||
#define FILE_SEARCH_VALUE "0"
|
||||
#define DIR_SEARCH_VALUE "1"
|
||||
#define LABEL_MAX_WIDTH 300
|
||||
|
||||
#define HOME_PATH QDir::homePath()
|
||||
static const QStringList allAppPath = {
|
||||
QDir::homePath()+"/.local/share/applications/",
|
||||
"/usr/share/applications/"
|
||||
};
|
||||
static const QMap<QString, bool> targetFileTypeMap = {
|
||||
std::map<QString, bool>::value_type("doc", true),
|
||||
std::map<QString, bool>::value_type("docx", true),
|
||||
|
|
|
@ -54,7 +54,7 @@ QIcon FileUtils::getFileIcon(const QString &uri, bool checkValid) {
|
|||
nullptr,
|
||||
nullptr));
|
||||
if(!G_IS_FILE_INFO(info.get()->get()))
|
||||
return QIcon::fromTheme("unknown");
|
||||
return QIcon::fromTheme("unknown",QIcon(":res/icons/unknown.png"));
|
||||
GIcon *g_icon = g_file_info_get_icon(info.get()->get());
|
||||
|
||||
//do not unref the GIcon from info.
|
||||
|
@ -72,8 +72,7 @@ QIcon FileUtils::getFileIcon(const QString &uri, bool checkValid) {
|
|||
}
|
||||
}
|
||||
}
|
||||
return QIcon::fromTheme("unknown");
|
||||
|
||||
return QIcon::fromTheme("unknown",QIcon(":res/icons/unknown.png"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,7 +87,7 @@ QIcon FileUtils::getAppIcon(const QString &path) {
|
|||
keyfile = g_key_file_new();
|
||||
if(!g_key_file_load_from_file(keyfile, ba.data(), G_KEY_FILE_NONE, NULL)) {
|
||||
g_key_file_free(keyfile);
|
||||
return QIcon::fromTheme("unknown");
|
||||
return QIcon::fromTheme("unknown",QIcon(":res/icons/unknown.png"));
|
||||
}
|
||||
QString icon = QString(g_key_file_get_locale_string(keyfile, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, NULL, NULL));
|
||||
g_key_file_free(keyfile);
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include <uchardet/uchardet.h>
|
||||
//#include <poppler-qt5.h>
|
||||
#include <poppler/qt5/poppler-qt5.h>
|
||||
#include <common.h>
|
||||
|
||||
#include "libsearch_global.h"
|
||||
#include "gobject-template.h"
|
||||
|
|
|
@ -69,14 +69,13 @@ void ConstructDocumentForPath::run() {
|
|||
/* QStringList temp;
|
||||
// temp.append(index_text);
|
||||
temp.append(pinyin_text_list)*/;
|
||||
int postingCount = 0;
|
||||
while(postingCount < index_text.size()) {
|
||||
// QVector<size_t> p;
|
||||
// p.append(postingCount);
|
||||
doc.addPosting(QUrl::toPercentEncoding(index_text.at(postingCount)).toStdString(), postingCount);
|
||||
++postingCount;
|
||||
}
|
||||
int i = 0;
|
||||
int postingCount = 1; //terms post of Xapian document is start from 1!
|
||||
while(postingCount < index_text.size()) {
|
||||
doc.addPosting(QUrl::toPercentEncoding(index_text.at(i)).toStdString(), postingCount);
|
||||
++postingCount;
|
||||
++i;
|
||||
}
|
||||
for(QString& s : pinyin_text_list) {
|
||||
i = 0;
|
||||
while(i < s.size()) {
|
||||
|
|
|
@ -435,6 +435,10 @@ DirectSearch::DirectSearch(QString keyword, DataQueue<SearchPluginIface::ResultI
|
|||
}
|
||||
|
||||
void DirectSearch::run() {
|
||||
QStringList blockList = GlobalSettings::getInstance()->getBlockDirs();
|
||||
if(blockList.contains(QStandardPaths::writableLocation(QStandardPaths::HomeLocation).remove(0,1), Qt::CaseSensitive)) {
|
||||
return;
|
||||
}
|
||||
QQueue<QString> bfs;
|
||||
bfs.enqueue(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
||||
QFileInfoList list;
|
||||
|
@ -446,8 +450,6 @@ void DirectSearch::run() {
|
|||
dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
|
||||
dir.setSorting(QDir::DirsFirst);
|
||||
}
|
||||
|
||||
QStringList blockList = GlobalSettings::getInstance()->getBlockDirs();
|
||||
while(!bfs.empty()) {
|
||||
dir.setPath(bfs.dequeue());
|
||||
list = dir.entryInfoList();
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
Loading…
Reference in New Issue