Fix the problem that path witch is hidden dir or is not exists can be choosen as search&block dir.

This commit is contained in:
JunjieBai 2023-04-25 10:14:43 +08:00
parent 94ea037203
commit 35818d321e
6 changed files with 253 additions and 210 deletions

View File

@ -445,25 +445,25 @@ void Search::initFileDialog()
qDebug() << "Selected a folder in onBtnAddClicked(): " << selectedDir;
int returnCode = setBlockDir(selectedDir, true);
switch (returnCode) {
case ReturnCode::Succeed :
case ReturnCode::Successful :
qDebug() << "Add blocked folder succeed! path = " << selectedDir;
getBlockDirs();
break;
case ReturnCode::PathEmpty :
qWarning() << "Add blocked folder failed, choosen path is empty! path = " << selectedDir;
QMessageBox::warning(m_pluginWidget, tr("Warning"), tr("Add blocked folder failed, choosen path is empty!"));
break;
// case ReturnCode::NotInHomeDir :
// qWarning() << "Add blocked folder failed, it is not in home path! path = " << selectedDir;
// QMessageBox::warning(m_pluginWidget, tr("Warning"), tr("Add blocked folder failed, it is not in home path!"));
// break;
case ReturnCode::ParentExist :
case ReturnCode::Duplicated :
qWarning() << "Add blocked folder failed, its parent dir is exist! path = " << selectedDir;
QMessageBox::warning(m_pluginWidget, tr("Warning"), tr("Add blocked folder failed, its parent dir is exist!"));
QMessageBox::warning(m_pluginWidget, tr("Warning"), tr("Add blocked folder failed, its parent dir has been added!"));
break;
case ReturnCode::NotExists :
qWarning() << "Add blocked folder failed, it's not exist! path = " << selectedDir;
QMessageBox::warning(m_pluginWidget, tr("Warning"), tr("Add blocked folder failed, choosen path is not exist!"));
break;
case ReturnCode::HasBeenBlocked :
qWarning() << "Add blocked folder failed, it has been already blocked! path = " << selectedDir;
QMessageBox::warning(m_pluginWidget, tr("Warning"), tr("Add blocked folder failed, it has been already blocked!"));
QMessageBox::warning(m_pluginWidget, tr("Warning"), tr("Add blocked folder failed, it has already been blocked!"));
break;
case ReturnCode::Hidden :
qWarning() << "Add blocked folder failed, it has been hidden! path = " << selectedDir;
QMessageBox::warning(m_pluginWidget, tr("Warning"), tr("Add search folder failed, hidden path is not supported!"));
break;
default:
break;
@ -488,24 +488,27 @@ void Search::initFileDialog()
qDebug() << "Selected a folder in onAddSearchDirBtnClicked(): " << selectedDir;
int returnCode = setSearchDir(selectedDir, true);
switch (returnCode) {
case 0:
case ReturnCode::Successful:
qDebug() << "Add search folder succeed! path = " << selectedDir;
break;
case 1:
case ReturnCode::Duplicated:
QMessageBox::warning(m_pluginWidget, tr("Warning"), tr("Add search folder failed, choosen path or its parent dir has been added!"));
break;
case 2:
case ReturnCode::UnderBlackList:
QMessageBox::warning(m_pluginWidget, tr("Warning"), tr("Add search folder failed, choosen path is not supported currently!"));
break;
case 3:
case ReturnCode::RepeatMount1:
QMessageBox::warning(m_pluginWidget, tr("Warning"), tr("Add search folder failed, choosen path is in repeat mounted devices and another path which is in the same device has been added!"));
break;
case 4:
case ReturnCode::RepeatMount2:
QMessageBox::warning(m_pluginWidget, tr("Warning"), tr("Add search folder failed, another path which is in the same device has been added!"));
break;
case 5:
case ReturnCode::NotExists:
QMessageBox::warning(m_pluginWidget, tr("Warning"), tr("Add search folder failed, choosen path is not exists!"));
break;
case ReturnCode::Hidden :
QMessageBox::warning(m_pluginWidget, tr("Warning"), tr("Add search folder failed, hidden path is not supported!"));
break;
default:
break;
}
@ -542,15 +545,23 @@ void Search::getBlockDirs()
*/
int Search::setBlockDir(const QString &dirPath, const bool &is_add)
{
if (!is_add) {
if (dirPath.isEmpty()) {
return ReturnCode::PathEmpty;
if (!QFile::exists(dirPath)) {
return ReturnCode::NotExists;
}
QStringList pathSections = dirPath.split("/");
for (const QString &section : pathSections) {
if (section.startsWith(".")) {
return ReturnCode::Hidden;
}
}
if (!is_add) {
//删除黑名单目录
m_dirSettings->remove(dirPath);
m_dirSettings->sync();
removeBlockDirFromList(dirPath);
return ReturnCode::Succeed;
return ReturnCode::Successful;
}
QStringList oldBlockList = m_blockDirs;
@ -561,14 +572,13 @@ int Search::setBlockDir(const QString &dirPath, const bool &is_add)
}
}
for (QString dir : m_blockDirs) {
if (dirPath == dir) {
return ReturnCode::HasBeenBlocked;
}
if (dirPath.startsWith(dir + "/") || dir == "/") {
return ReturnCode::ParentExist;
return ReturnCode::Duplicated;
}
//有它的子文件夹已被添加,删除这些子文件夹
@ -577,10 +587,10 @@ int Search::setBlockDir(const QString &dirPath, const bool &is_add)
removeBlockDirFromList(dir);
}
}
m_dirSettings->setValue(dirPath.right(dirPath.length() - 1), "0");
m_dirSettings->setValue(dirPath, "0");
m_dirSettings->sync();
appendBlockDirToList(dirPath);
return ReturnCode::Succeed;
return ReturnCode::Successful;
}
/**
@ -615,7 +625,14 @@ void Search::initSearchDirs()
int Search::setSearchDir(const QString &dirPath, const bool isAdd)
{
if (!m_setSearchDirInterface->isValid()) {
return -1;
return ReturnCode::DirWatcherError;
}
QStringList pathSections = dirPath.split("/");
for (const QString &section : pathSections) {
if (section.startsWith(".")) {
return ReturnCode::Hidden;
}
}
if (isAdd) {
@ -653,7 +670,7 @@ int Search::setSearchDir(const QString &dirPath, const bool isAdd)
}
}
return 0;
return ReturnCode::Successful;
}
void Search::appendSearchDirToList(const QString &path)

View File

@ -55,11 +55,15 @@
#define CONFIG_FILE "/.config/org.ukui/ukui-search/ukui-search-block-dirs.conf"
enum ReturnCode {
Succeed,
PathEmpty,
NotInHomeDir,
ParentExist,
HasBeenBlocked
DirWatcherError = -1,
Successful,
Duplicated,
UnderBlackList,
RepeatMount1,
RepeatMount2,
NotExists,
HasBeenBlocked,
Hidden
};
class Search : public QObject, CommonInterface

View File

@ -4,52 +4,52 @@
<context>
<name>Search</name>
<message>
<location filename="../search.cpp" line="13"/>
<location filename="../search.cpp" line="184"/>
<location filename="../search.cpp" line="32"/>
<location filename="../search.cpp" line="203"/>
<source>Search</source>
<translation></translation>
<extra-contents_path>/Search/Search</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="220"/>
<location filename="../search.cpp" line="239"/>
<source>Create index</source>
<translation></translation>
<extra-contents_path>/Search/Create index</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="221"/>
<location filename="../search.cpp" line="240"/>
<source>Creating index can help you getting results quickly.</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="189"/>
<location filename="../search.cpp" line="208"/>
<source>Default web searching engine</source>
<translation></translation>
<extra-contents_path>/Search/Default web searching engine</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="193"/>
<location filename="../search.cpp" line="212"/>
<source>baidu</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="194"/>
<location filename="../search.cpp" line="213"/>
<source>sougou</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="195"/>
<location filename="../search.cpp" line="214"/>
<source>360</source>
<translation>360</translation>
</message>
<message>
<location filename="../search.cpp" line="329"/>
<location filename="../search.cpp" line="348"/>
<source>Block Folders</source>
<translation></translation>
<extra-contents_path>/Search/Block Folders</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="334"/>
<location filename="../search.cpp" line="353"/>
<source>Following folders will not be searched. You can set it by adding and removing folders.</source>
<translation> </translation>
</message>
@ -58,147 +58,159 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../search.cpp" line="652"/>
<location filename="../search.cpp" line="723"/>
<location filename="../search.cpp" line="703"/>
<location filename="../search.cpp" line="774"/>
<source>delete</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="415"/>
<location filename="../search.cpp" line="459"/>
<location filename="../search.cpp" line="434"/>
<location filename="../search.cpp" line="478"/>
<source>Directories</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="251"/>
<location filename="../search.cpp" line="270"/>
<source>File Content Search</source>
<translation type="unfinished"></translation>
<extra-contents_path>/Search/File Content Search</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="269"/>
<location filename="../search.cpp" line="288"/>
<source>show more results that match the keyword</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../search.cpp" line="267"/>
<location filename="../search.cpp" line="286"/>
<source>Fuzzy Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../search.cpp" line="256"/>
<location filename="../search.cpp" line="275"/>
<source>Precise Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../search.cpp" line="258"/>
<location filename="../search.cpp" line="277"/>
<source>show the results that exactly match the keyword</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../search.cpp" line="296"/>
<location filename="../search.cpp" line="315"/>
<source>Search Folders</source>
<translation type="unfinished"></translation>
<extra-contents_path>/Search/Search Folders</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="302"/>
<location filename="../search.cpp" line="321"/>
<source>Following folders will be searched. You can set it by adding and removing folders.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../search.cpp" line="416"/>
<location filename="../search.cpp" line="435"/>
<source>select blocked folder</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="417"/>
<location filename="../search.cpp" line="461"/>
<location filename="../search.cpp" line="436"/>
<location filename="../search.cpp" line="480"/>
<source>Select</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="418"/>
<location filename="../search.cpp" line="462"/>
<location filename="../search.cpp" line="437"/>
<location filename="../search.cpp" line="481"/>
<source>Position: </source>
<translation> </translation>
</message>
<message>
<location filename="../search.cpp" line="419"/>
<location filename="../search.cpp" line="463"/>
<location filename="../search.cpp" line="438"/>
<location filename="../search.cpp" line="482"/>
<source>FileName: </source>
<translation> </translation>
</message>
<message>
<location filename="../search.cpp" line="420"/>
<location filename="../search.cpp" line="464"/>
<location filename="../search.cpp" line="439"/>
<location filename="../search.cpp" line="483"/>
<source>FileType: </source>
<translation> </translation>
</message>
<message>
<location filename="../search.cpp" line="421"/>
<location filename="../search.cpp" line="465"/>
<location filename="../search.cpp" line="440"/>
<location filename="../search.cpp" line="484"/>
<source>Cancel</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="435"/>
<location filename="../search.cpp" line="443"/>
<location filename="../search.cpp" line="447"/>
<location filename="../search.cpp" line="476"/>
<location filename="../search.cpp" line="479"/>
<location filename="../search.cpp" line="482"/>
<location filename="../search.cpp" line="485"/>
<location filename="../search.cpp" line="488"/>
<location filename="../search.cpp" line="454"/>
<location filename="../search.cpp" line="458"/>
<location filename="../search.cpp" line="462"/>
<location filename="../search.cpp" line="466"/>
<location filename="../search.cpp" line="495"/>
<location filename="../search.cpp" line="498"/>
<location filename="../search.cpp" line="501"/>
<location filename="../search.cpp" line="504"/>
<location filename="../search.cpp" line="507"/>
<location filename="../search.cpp" line="510"/>
<source>Warning</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="435"/>
<location filename="../search.cpp" line="466"/>
<location filename="../search.cpp" line="510"/>
<source>Add search folder failed, hidden&#x3000;path is not supported!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add blocked folder failed, choosen path is empty!</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<source>Add blocked folder failed, it is not in home path!</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../search.cpp" line="443"/>
<source>Add blocked folder failed, its parent dir is exist!</source>
<location filename="../search.cpp" line="454"/>
<source>Add blocked folder failed, its parent dir has been added!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="447"/>
<source>Add blocked folder failed, it has been already blocked!</source>
<location filename="../search.cpp" line="458"/>
<source>Add blocked folder failed, choosen path is not exist!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../search.cpp" line="462"/>
<source>Add blocked folder failed, it has already been blocked!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="460"/>
<location filename="../search.cpp" line="479"/>
<source>select search folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../search.cpp" line="479"/>
<location filename="../search.cpp" line="498"/>
<source>Add search folder failed, choosen path is not supported currently!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../search.cpp" line="485"/>
<location filename="../search.cpp" line="504"/>
<source>Add search folder failed, another path which is in the same device has been added!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../search.cpp" line="476"/>
<location filename="../search.cpp" line="495"/>
<source>Add search folder failed, choosen path or its parent dir has been added!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../search.cpp" line="482"/>
<location filename="../search.cpp" line="501"/>
<source>Add search folder failed, choosen path is in repeat mounted devices and another path which is in the same device has been added!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../search.cpp" line="488"/>
<location filename="../search.cpp" line="507"/>
<source>Add search folder failed, choosen path is not exists!</source>
<translation type="unfinished"></translation>
</message>

View File

@ -4,193 +4,201 @@
<context>
<name>Search</name>
<message>
<location filename="../search.cpp" line="13"/>
<location filename="../search.cpp" line="184"/>
<location filename="../search.cpp" line="32"/>
<location filename="../search.cpp" line="203"/>
<source>Search</source>
<translation>Search</translation>
<extra-contents_path>/Search/Search</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="189"/>
<location filename="../search.cpp" line="208"/>
<source>Default web searching engine</source>
<translation>Default web searching engine</translation>
<extra-contents_path>/Search/Default web searching engine</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="193"/>
<location filename="../search.cpp" line="212"/>
<source>baidu</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="194"/>
<location filename="../search.cpp" line="213"/>
<source>sougou</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="195"/>
<location filename="../search.cpp" line="214"/>
<source>360</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="220"/>
<location filename="../search.cpp" line="239"/>
<source>Create index</source>
<translation>Create index</translation>
<extra-contents_path>/Search/Create index</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="221"/>
<location filename="../search.cpp" line="240"/>
<source>Creating index can help you getting results quickly.</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="251"/>
<location filename="../search.cpp" line="270"/>
<source>File Content Search</source>
<translation>File Content Search</translation>
<extra-contents_path>/Search/File Content Search</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="256"/>
<location filename="../search.cpp" line="275"/>
<source>Precise Search</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="258"/>
<location filename="../search.cpp" line="277"/>
<source>show the results that exactly match the keyword</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="267"/>
<location filename="../search.cpp" line="286"/>
<source>Fuzzy Search</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="269"/>
<location filename="../search.cpp" line="288"/>
<source>show more results that match the keyword</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="296"/>
<location filename="../search.cpp" line="315"/>
<source>Search Folders</source>
<translation>Search Folders</translation>
<extra-contents_path>/Search/Search Folders</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="302"/>
<location filename="../search.cpp" line="321"/>
<source>Following folders will be searched. You can set it by adding and removing folders.</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="329"/>
<location filename="../search.cpp" line="348"/>
<source>Block Folders</source>
<translation>Block Folders</translation>
<extra-contents_path>/Search/Block Folders</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="334"/>
<location filename="../search.cpp" line="353"/>
<source>Following folders will not be searched. You can set it by adding and removing folders.</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="415"/>
<location filename="../search.cpp" line="459"/>
<location filename="../search.cpp" line="434"/>
<location filename="../search.cpp" line="478"/>
<source>Directories</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="416"/>
<location filename="../search.cpp" line="435"/>
<source>select blocked folder</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="417"/>
<location filename="../search.cpp" line="461"/>
<location filename="../search.cpp" line="436"/>
<location filename="../search.cpp" line="480"/>
<source>Select</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="418"/>
<location filename="../search.cpp" line="462"/>
<location filename="../search.cpp" line="437"/>
<location filename="../search.cpp" line="481"/>
<source>Position: </source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="419"/>
<location filename="../search.cpp" line="463"/>
<location filename="../search.cpp" line="438"/>
<location filename="../search.cpp" line="482"/>
<source>FileName: </source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="420"/>
<location filename="../search.cpp" line="464"/>
<location filename="../search.cpp" line="439"/>
<location filename="../search.cpp" line="483"/>
<source>FileType: </source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="421"/>
<location filename="../search.cpp" line="465"/>
<location filename="../search.cpp" line="440"/>
<location filename="../search.cpp" line="484"/>
<source>Cancel</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="435"/>
<location filename="../search.cpp" line="443"/>
<location filename="../search.cpp" line="447"/>
<location filename="../search.cpp" line="476"/>
<location filename="../search.cpp" line="479"/>
<location filename="../search.cpp" line="482"/>
<location filename="../search.cpp" line="485"/>
<location filename="../search.cpp" line="488"/>
<location filename="../search.cpp" line="454"/>
<location filename="../search.cpp" line="458"/>
<location filename="../search.cpp" line="462"/>
<location filename="../search.cpp" line="466"/>
<location filename="../search.cpp" line="495"/>
<location filename="../search.cpp" line="498"/>
<location filename="../search.cpp" line="501"/>
<location filename="../search.cpp" line="504"/>
<location filename="../search.cpp" line="507"/>
<location filename="../search.cpp" line="510"/>
<source>Warning</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="435"/>
<source>Add blocked folder failed, choosen path is empty!</source>
<location filename="../search.cpp" line="454"/>
<source>Add blocked folder failed, its parent dir has been added!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="443"/>
<source>Add blocked folder failed, its parent dir is exist!</source>
<translation></translation>
<location filename="../search.cpp" line="458"/>
<source>Add blocked folder failed, choosen path is not exist!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../search.cpp" line="447"/>
<source>Add blocked folder failed, it has been already blocked!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="460"/>
<source>select search folder</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="476"/>
<source>Add search folder failed, choosen path or its parent dir has been added!</source>
<location filename="../search.cpp" line="462"/>
<source>Add blocked folder failed, it has already been blocked!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="479"/>
<source>select search folder</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="495"/>
<source>Add search folder failed, choosen path or its parent dir has been added!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="498"/>
<source>Add search folder failed, choosen path is not supported currently!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="482"/>
<location filename="../search.cpp" line="501"/>
<source>Add search folder failed, choosen path is in repeat mounted devices and another path which is in the same device has been added!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="485"/>
<location filename="../search.cpp" line="504"/>
<source>Add search folder failed, another path which is in the same device has been added!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="488"/>
<location filename="../search.cpp" line="507"/>
<source>Add search folder failed, choosen path is not exists!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="652"/>
<location filename="../search.cpp" line="723"/>
<location filename="../search.cpp" line="466"/>
<location filename="../search.cpp" line="510"/>
<source>Add search folder failed, hidden&#x3000;path is not supported!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../search.cpp" line="703"/>
<location filename="../search.cpp" line="774"/>
<source>delete</source>
<translation></translation>
</message>

View File

@ -4,52 +4,52 @@
<context>
<name>Search</name>
<message>
<location filename="../search.cpp" line="13"/>
<location filename="../search.cpp" line="184"/>
<location filename="../search.cpp" line="32"/>
<location filename="../search.cpp" line="203"/>
<source>Search</source>
<translation></translation>
<extra-contents_path>/Search/Search</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="220"/>
<location filename="../search.cpp" line="239"/>
<source>Create index</source>
<translation></translation>
<extra-contents_path>/Search/Create index</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="221"/>
<location filename="../search.cpp" line="240"/>
<source>Creating index can help you getting results quickly.</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="189"/>
<location filename="../search.cpp" line="208"/>
<source>Default web searching engine</source>
<translation></translation>
<extra-contents_path>/Search/Default web searching engine</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="193"/>
<location filename="../search.cpp" line="212"/>
<source>baidu</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="194"/>
<location filename="../search.cpp" line="213"/>
<source>sougou</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="195"/>
<location filename="../search.cpp" line="214"/>
<source>360</source>
<translation>360</translation>
</message>
<message>
<location filename="../search.cpp" line="329"/>
<location filename="../search.cpp" line="348"/>
<source>Block Folders</source>
<translation></translation>
<extra-contents_path>/Search/Block Folders</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="334"/>
<location filename="../search.cpp" line="353"/>
<source>Following folders will not be searched. You can set it by adding and removing folders.</source>
<translation></translation>
</message>
@ -58,151 +58,151 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../search.cpp" line="652"/>
<location filename="../search.cpp" line="723"/>
<location filename="../search.cpp" line="703"/>
<location filename="../search.cpp" line="774"/>
<source>delete</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="415"/>
<location filename="../search.cpp" line="459"/>
<location filename="../search.cpp" line="434"/>
<location filename="../search.cpp" line="478"/>
<source>Directories</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="251"/>
<location filename="../search.cpp" line="270"/>
<source>File Content Search</source>
<translation></translation>
<extra-contents_path>/Search/File Content Search</extra-contents_path>
</message>
<message>
<source>precise Search</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../search.cpp" line="269"/>
<location filename="../search.cpp" line="288"/>
<source>show more results that match the keyword</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="267"/>
<location filename="../search.cpp" line="286"/>
<source>Fuzzy Search</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="256"/>
<location filename="../search.cpp" line="275"/>
<source>Precise Search</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="258"/>
<location filename="../search.cpp" line="277"/>
<source>show the results that exactly match the keyword</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="296"/>
<location filename="../search.cpp" line="315"/>
<source>Search Folders</source>
<translation></translation>
<extra-contents_path>/Search/Search Folders</extra-contents_path>
</message>
<message>
<location filename="../search.cpp" line="302"/>
<location filename="../search.cpp" line="321"/>
<source>Following folders will be searched. You can set it by adding and removing folders.</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="416"/>
<location filename="../search.cpp" line="435"/>
<source>select blocked folder</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="417"/>
<location filename="../search.cpp" line="461"/>
<location filename="../search.cpp" line="436"/>
<location filename="../search.cpp" line="480"/>
<source>Select</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="418"/>
<location filename="../search.cpp" line="462"/>
<location filename="../search.cpp" line="437"/>
<location filename="../search.cpp" line="481"/>
<source>Position: </source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="419"/>
<location filename="../search.cpp" line="463"/>
<location filename="../search.cpp" line="438"/>
<location filename="../search.cpp" line="482"/>
<source>FileName: </source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="420"/>
<location filename="../search.cpp" line="464"/>
<location filename="../search.cpp" line="439"/>
<location filename="../search.cpp" line="483"/>
<source>FileType: </source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="421"/>
<location filename="../search.cpp" line="465"/>
<location filename="../search.cpp" line="440"/>
<location filename="../search.cpp" line="484"/>
<source>Cancel</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="435"/>
<location filename="../search.cpp" line="443"/>
<location filename="../search.cpp" line="447"/>
<location filename="../search.cpp" line="476"/>
<location filename="../search.cpp" line="479"/>
<location filename="../search.cpp" line="482"/>
<location filename="../search.cpp" line="485"/>
<location filename="../search.cpp" line="488"/>
<location filename="../search.cpp" line="454"/>
<location filename="../search.cpp" line="458"/>
<location filename="../search.cpp" line="462"/>
<location filename="../search.cpp" line="466"/>
<location filename="../search.cpp" line="495"/>
<location filename="../search.cpp" line="498"/>
<location filename="../search.cpp" line="501"/>
<location filename="../search.cpp" line="504"/>
<location filename="../search.cpp" line="507"/>
<location filename="../search.cpp" line="510"/>
<source>Warning</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="435"/>
<source>Add blocked folder failed, choosen path is empty!</source>
<translation></translation>
<location filename="../search.cpp" line="466"/>
<location filename="../search.cpp" line="510"/>
<source>Add search folder failed, hidden&#x3000;path is not supported!</source>
<translation></translation>
</message>
<message>
<source>Add blocked folder failed, it is not in home path!</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../search.cpp" line="443"/>
<source>Add blocked folder failed, its parent dir is exist!</source>
<location filename="../search.cpp" line="454"/>
<source>Add blocked folder failed, its parent dir has been added!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="447"/>
<source>Add blocked folder failed, it has been already blocked!</source>
<location filename="../search.cpp" line="458"/>
<source>Add blocked folder failed, choosen path is not exist!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="462"/>
<source>Add blocked folder failed, it has already been blocked!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="460"/>
<location filename="../search.cpp" line="479"/>
<source>select search folder</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="479"/>
<location filename="../search.cpp" line="498"/>
<source>Add search folder failed, choosen path is not supported currently!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="485"/>
<location filename="../search.cpp" line="504"/>
<source>Add search folder failed, another path which is in the same device has been added!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="476"/>
<location filename="../search.cpp" line="495"/>
<source>Add search folder failed, choosen path or its parent dir has been added!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="482"/>
<location filename="../search.cpp" line="501"/>
<source>Add search folder failed, choosen path is in repeat mounted devices and another path which is in the same device has been added!</source>
<translation></translation>
</message>
<message>
<location filename="../search.cpp" line="488"/>
<location filename="../search.cpp" line="507"/>
<source>Add search folder failed, choosen path is not exists!</source>
<translation></translation>
</message>

View File

@ -134,11 +134,13 @@ void SearchDir::handleBlackListGenerate()
{
QStringList searchDirs = Config::self()->searchDirs();
//目录已被索引
if (searchDirs.contains(m_path)) {
//目录已被索引(根目录被添加过直接返回)
for (const QString searchDir : searchDirs) {
if (searchDir == m_path || searchDir == "/") {
m_error = Duplicated;
return;
}
}
//根目录特殊处理
if (m_path == "/") {