diff --git a/ukui-search-service-dir-manager/dirwatcher/search-dir.cpp b/ukui-search-service-dir-manager/dirwatcher/search-dir.cpp index a010655..e7eee32 100644 --- a/ukui-search-service-dir-manager/dirwatcher/search-dir.cpp +++ b/ukui-search-service-dir-manager/dirwatcher/search-dir.cpp @@ -86,6 +86,8 @@ void SearchDir::generateBlackList() QStringList SearchDir::blackListOfDir(const QString &dirPath) { + //手动刷新挂载信息 + VolumeManager::self()->refresh(); QStringList blackListOfDir; for (const QStringList & mountPoints: VolumeManager::self()->getDuplicates()) { QString topRepeatedMountPoint; @@ -113,6 +115,8 @@ QStringList SearchDir::blackListOfDir(const QString &dirPath) void SearchDir::handleBlackListGenerate() { + //手动刷新挂载信息 + VolumeManager::self()->refresh(); QStringList searchDirs = Config::self()->searchDirs(); //目录已被索引(根目录被添加过直接返回) diff --git a/ukui-search-service-dir-manager/dirwatcher/volume-manager.h b/ukui-search-service-dir-manager/dirwatcher/volume-manager.h index 10e8792..7f75e1f 100644 --- a/ukui-search-service-dir-manager/dirwatcher/volume-manager.h +++ b/ukui-search-service-dir-manager/dirwatcher/volume-manager.h @@ -58,12 +58,12 @@ public: QVector getDuplicates(); QVector volumesHaveSubVolumes(); QVector volumes(); + void refresh(); Q_SIGNALS: void VolumeDataUpdated(); private: explicit VolumeManager(QObject *parent = nullptr); - void refresh(); static void mountAddCallback(GVolumeMonitor *monitor, GMount *gmount, VolumeManager *pThis); static void mountRemoveCallback(GVolumeMonitor *monitor, GMount *gmount, VolumeManager *pThis); GVolumeMonitor* m_volumeMonitor = nullptr;