diff --git a/libsearch/file-utils.cpp b/libsearch/file-utils.cpp index 21c5c83..8830f44 100644 --- a/libsearch/file-utils.cpp +++ b/libsearch/file-utils.cpp @@ -10,6 +10,8 @@ #include #include #include +size_t FileUtils::_max_index_count = 0; +size_t FileUtils::_current_index_count = 0; QMap FileUtils::map_chinese2pinyin = QMap(); FileUtils::FileUtils() diff --git a/libsearch/file-utils.h b/libsearch/file-utils.h index 3e9271b..d9f707e 100644 --- a/libsearch/file-utils.h +++ b/libsearch/file-utils.h @@ -29,6 +29,8 @@ public: static QString getMimetype(QString &path, bool getsuffix = false); static QString *getDocxTextContent(QString &path); static QString *getTxtContent(QString &path); + static size_t _max_index_count; + static size_t _current_index_count; private: FileUtils(); diff --git a/libsearch/global-settings.cpp b/libsearch/global-settings.cpp index 2511b3e..a0eee27 100644 --- a/libsearch/global-settings.cpp +++ b/libsearch/global-settings.cpp @@ -80,22 +80,28 @@ void GlobalSettings::resetAll() }); } -bool GlobalSettings::setBlockDirs(const QString &path, QString &returnMessage) +bool GlobalSettings::setBlockDirs(const QString &path, QString &returnMessage, bool remove) { + //why QSetting's key can't start with "/"?? + QString pathKey = path.right(path.length()-1); + if(remove) + { + m_block_dirs_settings->remove(pathKey); + return true; + } QStringList blockDirs = m_block_dirs_settings->allKeys(); for(QString i:blockDirs) { -// qWarning()<remove(i); } - m_block_dirs_settings->setValue(path.right(path.length()-1),"0"); + m_block_dirs_settings->setValue(pathKey,"0"); return true; } diff --git a/libsearch/global-settings.h b/libsearch/global-settings.h index 6685db2..a4d13d5 100644 --- a/libsearch/global-settings.h +++ b/libsearch/global-settings.h @@ -39,9 +39,10 @@ public Q_SLOTS: * set path for blacklist,return true if success,otherwise return false. * @param path path to be blocked * @param returnMessage this message will be set when return false. + * @param true to remove blocking,false to set blocking,default set false. * @return */ - bool setBlockDirs(const QString& path, QString &returnMessage); + bool setBlockDirs(const QString& path, QString &returnMessage,bool remove = false); QStringList getBlockDirs(); void forceSync(const QString& = nullptr);