Fix bug with app crash on exit. Add keyboard support in wordList, DictTypeSelectDialo...
[mdictionary] / src / mdictionary / gui / DictManagerWidget.cpp
index 86459b7..1e5a73e 100644 (file)
@@ -133,6 +133,8 @@ void DictManagerWidget::initalizeUI() {
     connect(rootObject, SIGNAL(itemActivated(int)),
             this, SLOT(settingsButtonClicked()));
 
+    connect(this, SIGNAL(setFocusOnQML()), rootObject, SLOT(setFocus()));
+
     #endif
 
     #ifdef Q_WS_MAEMO_5
@@ -164,6 +166,7 @@ void DictManagerWidget::refreshDictsList() {
         model->clear();
         model->setDictionaries(dicts);
     }
+    setFocusOnElement();
 
     #endif
 
@@ -257,11 +260,9 @@ void DictManagerWidget::hideEvent(QHideEvent *e) {
 
 void DictManagerWidget::addNewDictButtonClicked() {
     #ifndef Q_WS_MAEMO_5
-    qDebug()<<"1 "<<_changed;
     if(!_changed || QMessageBox::question(this,
             tr("Save"), tr("Do you want to save changes?"),
             QMessageBox::Save, QMessageBox::Cancel) == QMessageBox::Save) {
-        qDebug()<<"2";
         _save = true;
         saveChanges();
         _save = false;
@@ -335,10 +336,14 @@ void DictManagerWidget::changed() {
 
 
 #ifndef Q_WS_MAEMO_5
-    void DictManagerWidget::save() {
-        _save = true;
-        hide();
-    }
+void DictManagerWidget::save() {
+    _save = true;
+    hide();
+}
+
+void DictManagerWidget::setFocusOnElement(){
+    Q_EMIT setFocusOnQML();
+}
 #endif