From 25546d6b6b3518d1de8ea69cf660eb559a3db31f Mon Sep 17 00:00:00 2001 From: Bartosz Szatkowski Date: Wed, 11 Aug 2010 14:31:09 +0200 Subject: [PATCH] Fixed phantom errors linked with saving/loading settings --- data/mdictionary.defaults | 12 +++++++++++- trunk/src/base/backbone/backbone.cpp | 9 ++++++--- trunk/src/base/backbone/backbone.h | 3 ++- trunk/tests/mDictionaryTests/tst_Backbone.cpp | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/data/mdictionary.defaults b/data/mdictionary.defaults index 16de5f6..33db5c9 100644 --- a/data/mdictionary.defaults +++ b/data/mdictionary.defaults @@ -1,4 +1,14 @@ [%General] -plugin_path=/usr/lib/mdictiona +plugin_path=/usr/lib/mdictionary history_length=10 search_limit=15 + +[dictionary_0] +type=xdxf +path=/usr/lib/mdictionary/en-fin.xdxf +_default_=true + +[dictionary_1] +type=xdxf +path=/usr/lib/mdictionary/pol-eng.xdxf +_default_=true diff --git a/trunk/src/base/backbone/backbone.cpp b/trunk/src/base/backbone/backbone.cpp index ce169e9..97e302f 100644 --- a/trunk/src/base/backbone/backbone.cpp +++ b/trunk/src/base/backbone/backbone.cpp @@ -55,14 +55,16 @@ void Backbone::init() { _history = new History(5, this); } -Backbone::Backbone(QString pluginPath, QString configPath, QObject *parent) +Backbone::Backbone(QString pluginPath, QString configPath, bool dry, + QObject *parent) : QObject(parent) { - init(); - dryRun = true; _pluginPath = pluginPath; _configPath = configPath; _defaultConfigPath = configPath; + init(); + if(dry) + dryRun = true; } @@ -356,6 +358,7 @@ void Backbone::loadDicts(QString fileName, bool _default) { void Backbone::dictUpdated() { if(dryRun) return; + qDebug() << "UPDATE"; QFileInfo file(QDir::toNativeSeparators(_configPath)); QDir confDir(file.dir()); if(!confDir.exists()) diff --git a/trunk/src/base/backbone/backbone.h b/trunk/src/base/backbone/backbone.h index 74a3737..685569f 100644 --- a/trunk/src/base/backbone/backbone.h +++ b/trunk/src/base/backbone/backbone.h @@ -57,7 +57,8 @@ class Backbone : public QObject public: /*!\param pluginPath path to plugins (leave blank for default) \param configPath path to folder with configuration files*/ - Backbone(QString pluginPath="", QString configPath="", QObject *parent = 0); + Backbone(QString pluginPath="", QString configPath="", + bool dry = 0, QObject *parent = 0); ~Backbone(); Backbone(const Backbone& b); diff --git a/trunk/tests/mDictionaryTests/tst_Backbone.cpp b/trunk/tests/mDictionaryTests/tst_Backbone.cpp index 9f615fe..013f98b 100644 --- a/trunk/tests/mDictionaryTests/tst_Backbone.cpp +++ b/trunk/tests/mDictionaryTests/tst_Backbone.cpp @@ -76,7 +76,7 @@ void BackboneTest::init() cd->namev = QString("name%1").arg(i); cd->typev = QString("type%1").arg(i); } - back = new Backbone("empty","empty"); + back = new Backbone("empty","empty", 1); qDebug() << back->getDictionaries().size(); addDicts(); } -- 1.7.9.5