diff --git a/libsearch/global-settings.cpp b/libsearch/global-settings.cpp index 838ac79..32df70c 100644 --- a/libsearch/global-settings.cpp +++ b/libsearch/global-settings.cpp @@ -37,6 +37,14 @@ GlobalSettings::GlobalSettings(QObject *parent) : QObject(parent) { // m_settings->setAtomicSyncRequired(false); m_block_dirs_settings = new QSettings(BLOCK_DIRS, QSettings::IniFormat, this); m_block_dirs_settings->setIniCodec(QTextCodec::codecForName("UTF-8")); + m_block_dirs_settings->setValue("These_are_block_dirs_conf_for_ukui_search","0"); + m_block_dirs_settings->sync(); + m_confWatcher = new QFileSystemWatcher(this); + m_confWatcher->addPath(BLOCK_DIRS); + connect(m_confWatcher, &QFileSystemWatcher::fileChanged, this, [ & ]() { + m_block_dirs_settings->sync(); + m_confWatcher->addPath(BLOCK_DIRS); + }); m_search_record_settings = new QSettings(SEARCH_HISTORY, QSettings::IniFormat, this); m_search_record_settings->setIniCodec(QTextCodec::codecForName("UTF-8")); diff --git a/libsearch/global-settings.h b/libsearch/global-settings.h index 3de9ded..4a61cc2 100644 --- a/libsearch/global-settings.h +++ b/libsearch/global-settings.h @@ -26,6 +26,7 @@ #include #include #include +#include //#include //If use pkg_config, it wont build succes,why????????? //My demo can build access yet. @@ -102,6 +103,7 @@ private: QSettings *m_search_record_settings; QMap m_cache; QStringList m_history; + QFileSystemWatcher *m_confWatcher; QMutex m_mutex; // size_t test = 0;