Merge branch 'main' into 'main'

Fix potential problems.

See merge request kylin-desktop/ukui-search!10
This commit is contained in:
PengfeiZhang 2021-04-08 10:46:16 +00:00
commit 0f1229f945
5 changed files with 9 additions and 8 deletions

View File

@ -35,8 +35,8 @@ FirstIndex::FirstIndex(const QString& path) : Traverse_BFS(path)
qDebug() << "contentIndexDataBaseStatus: " << contentIndexDataBaseStatus;
qDebug() << "inotifyIndexStatus: " << inotifyIndexStatus;
if (indexDataBaseStatus == "" || contentIndexDataBaseStatus == ""){
/* || contentIndexDataBaseStatus == ""*/
if (indexDataBaseStatus == ""){
this->bool_dataBaseExist = false;
}
else{
@ -75,7 +75,7 @@ FirstIndex::~FirstIndex()
void FirstIndex::DoSomething(const QFileInfo& fileInfo){
// qDebug() << "there are some shit here"<<fileInfo.fileName() << fileInfo.absoluteFilePath() << QString(fileInfo.isDir() ? "1" : "0");
this->q_index->enqueue(QVector<QString>() << fileInfo.fileName() << fileInfo.absoluteFilePath() << QString((fileInfo.isDir() && (!fileInfo.isSymLink())) ? "1" : "0"));
if ((!fileInfo.fileName().split(".").isEmpty()) && (true == targetFileTypeMap[fileInfo.fileName().split(".").last()])){
if ((fileInfo.fileName().split(".", QString::SkipEmptyParts).length() > 1) && (true == targetFileTypeMap[fileInfo.fileName().split(".").last()])){
this->q_content_index->enqueue(fileInfo.absoluteFilePath());
}
}

View File

@ -67,9 +67,9 @@ private:
std::map<QString, bool>::value_type("doc", true),
std::map<QString, bool>::value_type("docx", true),
std::map<QString, bool>::value_type("ppt", true),
// std::map<QString, bool>::value_type(".pptx", true),
// std::map<QString, bool>::value_type("pptx", true),
std::map<QString, bool>::value_type("xls", true),
// std::map<QString, bool>::value_type(".xlsx", true),
// std::map<QString, bool>::value_type("xlsx", true),
std::map<QString, bool>::value_type("txt", true),
std::map<QString, bool>::value_type("dot", true),
std::map<QString, bool>::value_type("wps", true),

View File

@ -93,7 +93,7 @@ void InotifyIndex::DoSomething(const QFileInfo& fileInfo){
QQueue<QVector<QString> > tempFile;
tempFile.enqueue(QVector<QString>() << fileInfo.fileName() << fileInfo.absoluteFilePath() << QString((fileInfo.isDir() && (!fileInfo.isSymLink())) ? "1" : "0"));
IndexGenerator::getInstance()->creatAllIndex(&tempFile);
if ((!fileInfo.fileName().split(".").isEmpty()) && (true == targetFileTypeMap[fileInfo.fileName().split(".").last()])){
if ((fileInfo.fileName().split(".", QString::SkipEmptyParts).length() > 1) && (true == targetFileTypeMap[fileInfo.fileName().split(".").last()])){
QQueue<QString> tmp;
tmp.enqueue(fileInfo.absoluteFilePath());
IndexGenerator::getInstance()->creatAllIndex(&tmp);

View File

@ -65,9 +65,9 @@ private:
std::map<QString, bool>::value_type("doc", true),
std::map<QString, bool>::value_type("docx", true),
std::map<QString, bool>::value_type("ppt", true),
// std::map<QString, bool>::value_type(".pptx", true),
// std::map<QString, bool>::value_type("pptx", true),
std::map<QString, bool>::value_type("xls", true),
// std::map<QString, bool>::value_type(".xlsx", true),
// std::map<QString, bool>::value_type("xlsx", true),
std::map<QString, bool>::value_type("txt", true),
std::map<QString, bool>::value_type("dot", true),
std::map<QString, bool>::value_type("wps", true),

View File

@ -30,6 +30,7 @@ void Traverse_BFS::Traverse(){
bfs.enqueue(this->path);
QFileInfoList list;
QDir dir;
// QDir::Hidden
dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
dir.setSorting(QDir::DirsFirst);
while (!bfs.empty()) {