Merge branch '0601ukss' into 'ukss-dev'

Added the transmission of the removeIndexItem signal during umounting.

See merge request kylin-desktop/ukui-search!323
This commit is contained in:
PengfeiZhang 2022-06-02 02:45:15 +00:00
commit e6cf930be3
1 changed files with 9 additions and 1 deletions

View File

@ -247,10 +247,18 @@ void DirWatcher::mountRemoveCallback(GVolumeMonitor *monitor, GMount *gmount, Di
if (removedUri.isEmpty()) { if (removedUri.isEmpty()) {
return; return;
} }
//处理uri转码,处理子卷情况 //处理uri转码
if (removedUri.startsWith("file:///")) { if (removedUri.startsWith("file:///")) {
QString removedMountPoint = g_filename_from_uri(removedUri.toUtf8().constData(), nullptr, nullptr); QString removedMountPoint = g_filename_from_uri(removedUri.toUtf8().constData(), nullptr, nullptr);
pThis->m_blackListOfIndex.removeAll(removedMountPoint); pThis->m_blackListOfIndex.removeAll(removedMountPoint);
QStringList indexableDirList = pThis->currentIndexableDir();
//卸载目录下存在已索引目录时,通知索引服务删除对应目录
for (const QString &indexableDir : indexableDirList) {
if (indexableDir.startsWith(removedMountPoint + "/") or !indexableDir.compare(removedMountPoint)) {
Q_EMIT pThis->removeIndexItem(indexableDir);
}
}
//处理子卷情况
for (auto t = pThis->m_infoOfSubvolume.constBegin(); t != pThis->m_infoOfSubvolume.constEnd(); t++) { for (auto t = pThis->m_infoOfSubvolume.constBegin(); t != pThis->m_infoOfSubvolume.constEnd(); t++) {
if (removedMountPoint.startsWith(t.value() + "/")) { if (removedMountPoint.startsWith(t.value() + "/")) {
pThis->m_blackListOfIndex.removeAll(removedMountPoint.replace(t.value(), t.key())); pThis->m_blackListOfIndex.removeAll(removedMountPoint.replace(t.value(), t.key()));