Merge pull request #236 from iaom/0512-dev

Fix: Block list conf won't work.
This commit is contained in:
Mouse Zhang 2021-05-18 11:08:09 +08:00 committed by GitHub
commit 987611efe5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;