Fix: Block list conf won't work.

This commit is contained in:
iaom 2021-05-17 20:54:48 +08:00
parent abce24773c
commit 70a8ced4b8
2 changed files with 10 additions and 0 deletions

View File

@ -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"));

View File

@ -26,6 +26,7 @@
#include <QMutex>
#include <QVector>
#include <QDir>
#include <QFileSystemWatcher>
//#include <QGSettings>
//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<QString, QVariant> m_cache;
QStringList m_history;
QFileSystemWatcher *m_confWatcher;
QMutex m_mutex;
// size_t test = 0;