Fixed loading same plugin multiple times 0.4 alpha
authorBartosz Szatkowski <bulislaw@linux.com>
Fri, 27 Aug 2010 09:31:04 +0000 (11:31 +0200)
committerBartosz Szatkowski <bulislaw@linux.com>
Fri, 27 Aug 2010 09:31:04 +0000 (11:31 +0200)
trunk/src/base/backbone/backbone.cpp
trunk/src/plugins/google/src/GooglePlugin.cpp
trunk/src/plugins/xdxf/src/xdxfplugin.cpp

index e05b042..a458852 100644 (file)
@@ -346,8 +346,15 @@ void Backbone::loadPlugins() {
         }
         QObject *pl = loader.instance();
 
+        bool exists = 0;
         CommonDictInterface *plugin = qobject_cast<CommonDictInterface*>(pl);
-        _plugins.append(plugin);
+        foreach(CommonDictInterface* pl, _plugins)
+            if(pl->type() == plugin->type()) {
+                exists = 1;
+                break;
+           }
+        if(!exists)
+            _plugins.append(plugin);
     }
 }
 
index c0e89c5..607c41c 100644 (file)
@@ -30,7 +30,7 @@
 
 GooglePlugin::GooglePlugin(QObject *parent): CommonDictInterface(parent),
                     _langFrom(tr("")), _langTo(tr("")),_name(tr("")),
-                    _type(tr("google")), _infoNote(tr("")) {
+                    _type("google"), _infoNote(tr("")) {
 
     stopped = false;
     _connectionAccept = false;
index e9932d3..ae9f35e 100644 (file)
@@ -29,7 +29,7 @@
 
 XdxfPlugin::XdxfPlugin(QObject *parent) : CommonDictInterface(parent),
                     _langFrom(tr("")), _langTo(tr("")),_name(tr("")),
-                    _type(tr("xdxf")), _infoNote(tr("")) {
+                    _type("xdxf"), _infoNote(tr("")) {
     _wordsCount = -1;
     _settings = new Settings();
     _dictDialog = new XdxfDictDialog(this);