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)
|
int Search::setBlockDir(const QString &dirPath, const bool &is_add)
|
||||||
{
|
{
|
||||||
if (!QFile::exists(dirPath)) {
|
if (!QFile::exists(dirPath)) {
|
||||||
|
removeBlockDirFromList(dirPath);
|
||||||
return ReturnCode::NotExists;
|
return ReturnCode::NotExists;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,6 +628,10 @@ int Search::setSearchDir(const QString &dirPath, const bool isAdd)
|
||||||
{
|
{
|
||||||
QFileInfo info(dirPath);
|
QFileInfo info(dirPath);
|
||||||
if (!(info.isExecutable() && info.isReadable())) {
|
if (!(info.isExecutable() && info.isReadable())) {
|
||||||
|
//路径不存在时从ui上删除
|
||||||
|
if (!isAdd) {
|
||||||
|
this->removeSearchDirFromList(dirPath);
|
||||||
|
}
|
||||||
return ReturnCode::PermissionDenied;
|
return ReturnCode::PermissionDenied;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,18 +647,18 @@ int Search::setSearchDir(const QString &dirPath, const bool isAdd)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAdd) {
|
if (isAdd) {
|
||||||
QDBusReply<QStringList> indexDirsRpl = m_interface->call("currentIndexableDir");
|
QDBusReply<QStringList> indexDirsRpl = m_interface->call("currentSearchDirs");
|
||||||
QStringList indexDirs;
|
QStringList indexDirs;
|
||||||
if (indexDirsRpl.isValid()) {
|
if (indexDirsRpl.isValid()) {
|
||||||
indexDirs = indexDirsRpl.value();
|
indexDirs = indexDirsRpl.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
QDBusReply<int> appendIndexRpl = m_setSearchDirInterface->call("appendIndexableListItem", dirPath);
|
QDBusReply<int> appendIndexRpl = m_setSearchDirInterface->call("appendSearchDir", dirPath);
|
||||||
if (appendIndexRpl.isValid()) {
|
if (appendIndexRpl.isValid()) {
|
||||||
if (appendIndexRpl.value() == 0) {
|
if (appendIndexRpl.value() == 0) {
|
||||||
this->appendSearchDirToList(dirPath);
|
this->appendSearchDirToList(dirPath);
|
||||||
if (!indexDirs.isEmpty()) {
|
if (!indexDirs.isEmpty()) {
|
||||||
indexDirsRpl = m_interface->call("currentIndexableDir");
|
indexDirsRpl = m_interface->call("currentSearchDirs");
|
||||||
if (indexDirsRpl.isValid() && (indexDirsRpl.value().size() < indexDirs.size() + 1)) {
|
if (indexDirsRpl.isValid() && (indexDirsRpl.value().size() < indexDirs.size() + 1)) {
|
||||||
QStringList dirsAfterAppend = indexDirsRpl.value();
|
QStringList dirsAfterAppend = indexDirsRpl.value();
|
||||||
for (const QString& dir : indexDirs) {
|
for (const QString& dir : indexDirs) {
|
||||||
|
@ -667,13 +672,8 @@ int Search::setSearchDir(const QString &dirPath, const bool isAdd)
|
||||||
return appendIndexRpl.value();
|
return appendIndexRpl.value();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QDBusReply<bool> reply = m_setSearchDirInterface->call("removeIndexableListItem", dirPath);
|
|
||||||
if (reply.isValid()) {
|
|
||||||
if (reply.value()) {
|
|
||||||
this->removeSearchDirFromList(dirPath);
|
this->removeSearchDirFromList(dirPath);
|
||||||
}
|
m_setSearchDirInterface->call("removeSearchDir", dirPath);
|
||||||
return reply.value();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ReturnCode::Successful;
|
return ReturnCode::Successful;
|
||||||
|
|
Loading…
Reference in New Issue