fix(ukccPlugin):修改删除目录的ui触发逻辑,避免添加后被删除的文件夹无法从ui上移除
This commit is contained in:
parent
b328bc8cb8
commit
0967eafc65
|
@ -546,6 +546,7 @@ void Search::getBlockDirs()
|
|||
int Search::setBlockDir(const QString &dirPath, const bool &is_add)
|
||||
{
|
||||
if (!QFile::exists(dirPath)) {
|
||||
removeBlockDirFromList(dirPath);
|
||||
return ReturnCode::NotExists;
|
||||
}
|
||||
|
||||
|
@ -627,6 +628,10 @@ int Search::setSearchDir(const QString &dirPath, const bool isAdd)
|
|||
{
|
||||
QFileInfo info(dirPath);
|
||||
if (!(info.isExecutable() && info.isReadable())) {
|
||||
//路径不存在时从ui上删除
|
||||
if (!isAdd) {
|
||||
this->removeSearchDirFromList(dirPath);
|
||||
}
|
||||
return ReturnCode::PermissionDenied;
|
||||
}
|
||||
|
||||
|
@ -642,18 +647,18 @@ int Search::setSearchDir(const QString &dirPath, const bool isAdd)
|
|||
}
|
||||
|
||||
if (isAdd) {
|
||||
QDBusReply<QStringList> indexDirsRpl = m_interface->call("currentIndexableDir");
|
||||
QDBusReply<QStringList> indexDirsRpl = m_interface->call("currentSearchDirs");
|
||||
QStringList indexDirs;
|
||||
if (indexDirsRpl.isValid()) {
|
||||
indexDirs = indexDirsRpl.value();
|
||||
}
|
||||
|
||||
QDBusReply<int> appendIndexRpl = m_setSearchDirInterface->call("appendIndexableListItem", dirPath);
|
||||
QDBusReply<int> appendIndexRpl = m_setSearchDirInterface->call("appendSearchDir", dirPath);
|
||||
if (appendIndexRpl.isValid()) {
|
||||
if (appendIndexRpl.value() == 0) {
|
||||
this->appendSearchDirToList(dirPath);
|
||||
if (!indexDirs.isEmpty()) {
|
||||
indexDirsRpl = m_interface->call("currentIndexableDir");
|
||||
indexDirsRpl = m_interface->call("currentSearchDirs");
|
||||
if (indexDirsRpl.isValid() && (indexDirsRpl.value().size() < indexDirs.size() + 1)) {
|
||||
QStringList dirsAfterAppend = indexDirsRpl.value();
|
||||
for (const QString& dir : indexDirs) {
|
||||
|
@ -667,13 +672,8 @@ int Search::setSearchDir(const QString &dirPath, const bool isAdd)
|
|||
return appendIndexRpl.value();
|
||||
}
|
||||
} else {
|
||||
QDBusReply<bool> reply = m_setSearchDirInterface->call("removeIndexableListItem", dirPath);
|
||||
if (reply.isValid()) {
|
||||
if (reply.value()) {
|
||||
this->removeSearchDirFromList(dirPath);
|
||||
}
|
||||
return reply.value();
|
||||
}
|
||||
m_setSearchDirInterface->call("removeSearchDir", dirPath);
|
||||
}
|
||||
|
||||
return ReturnCode::Successful;
|
||||
|
|
Loading…
Reference in New Issue