Add connections between DictManagerWidget qml, model and c++ code
[mdictionary] / src / mdictionary / gui / DictManagerWidget.cpp
index 692ea26..62d971c 100644 (file)
@@ -112,7 +112,33 @@ void DictManagerWidget::initalizeUI() {
     #endif
 
     #ifndef Q_WS_MAEMO_5
-    //pozmieniać connecty
+    connect(rootObject, SIGNAL(addButtonClicked()),
+            this, SLOT(saveChanges()));
+    connect(rootObject, SIGNAL(addButtonClicked()),
+            this, SLOT(addNewDictButtonClicked()));
+
+    connect(rootObject, SIGNAL(removeButtonClicked()),
+            this, SLOT(saveChanges()));
+    connect(rootObject, SIGNAL(removeButtonClicked()),
+            this, SLOT(removeButtonClicked()));
+
+    connect(rootObject, SIGNAL(settingsButtonClicked()),
+            this, SLOT(saveChanges()));
+    connect(rootObject, SIGNAL(settingsButtonClicked()),
+            this, SLOT(settingsButtonClicked()));
+
+    //z modelu sygnał, oraz z okienka zmian ustawień w pluginie, gdy są zmiany
+//    oryginalnie:
+//    connect(dictList, SIGNAL(itemChanged(QListWidgetItem*)),
+//            this, SLOT(changed()));
+    connect(model, SIGNAL(itemChanged()),
+                this, SLOT(changed()));
+    //pozmieniać connecty, to jest na dwuklik mysza na liście, sprawdzić, zrobic alternatywne sloty
+            connect(rootObject, SIGNAL(itemActivated(int)),
+                    this, SLOT(saveChanges()));
+            connect(rootObject, SIGNAL(itemActivated(int)),
+                    settingsButton, SIGNAL(clicked()));
+
 //        connect(dictList, SIGNAL(itemActivated(QListWidgetItem*)),
 //                this, SLOT(saveChanges()));
 //        connect(dictList, SIGNAL(itemActivated(QListWidgetItem*)),
@@ -135,6 +161,7 @@ void DictManagerWidget::initalizeUI() {
 //        setMinimumHeight(sizeHint().height());
 //        setMaximumHeight(sizeHint().height()*2);
         //connect(closeButton, SIGNAL(clicked()), this, SLOT(save()));
+        connect(rootObject, SIGNAL(saveButtonClicked()), this, SLOT(save()));
     #endif
 }
 
@@ -145,10 +172,8 @@ void DictManagerWidget::refreshDictsList() {
     QHash<CommonDictInterface*, bool> dicts = guiInterface->getDictionaries();
 
     if (model == 0){
-        qDebug("ok");
         model = new DictManagerModel(dicts, this);
     } else {
-        qDebug("lol");
         model->clear();
         model->setDictionaries(dicts);
     }