From 0967eafc65dbdc3ad9a0b7a69a3da5b0bc1972b3 Mon Sep 17 00:00:00 2001 From: JunjieBai Date: Wed, 13 Sep 2023 17:34:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(ukccPlugin):=E4=BF=AE=E6=94=B9=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E7=9B=AE=E5=BD=95=E7=9A=84ui=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E9=81=BF=E5=85=8D=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8E=E8=A2=AB=E5=88=A0=E9=99=A4=E7=9A=84=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9=E6=97=A0=E6=B3=95=E4=BB=8Eui=E4=B8=8A=E7=A7=BB?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- search-ukcc-plugin/search.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/search-ukcc-plugin/search.cpp b/search-ukcc-plugin/search.cpp index 4ad3a6a..fae356e 100644 --- a/search-ukcc-plugin/search.cpp +++ b/search-ukcc-plugin/search.cpp @@ -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 indexDirsRpl = m_interface->call("currentIndexableDir"); + QDBusReply indexDirsRpl = m_interface->call("currentSearchDirs"); QStringList indexDirs; if (indexDirsRpl.isValid()) { indexDirs = indexDirsRpl.value(); } - QDBusReply appendIndexRpl = m_setSearchDirInterface->call("appendIndexableListItem", dirPath); + QDBusReply 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 reply = m_setSearchDirInterface->call("removeIndexableListItem", dirPath); - if (reply.isValid()) { - if (reply.value()) { - this->removeSearchDirFromList(dirPath); - } - return reply.value(); - } + this->removeSearchDirFromList(dirPath); + m_setSearchDirInterface->call("removeSearchDir", dirPath); } return ReturnCode::Successful;