fixed minor bugs with gui, added secon dictionary file
[mdictionary] / trunk / src / base / gui / WordListWidget.cpp
index 94fcde3..6536d6e 100644 (file)
@@ -40,6 +40,9 @@ WordListWidget::WordListWidget(Backbone *backbone, QWidget *parent):
     connect(this, SIGNAL(clicked(QModelIndex)),
             this, SLOT(itemClicked(QModelIndex)));
 
+    connect(backbone, SIGNAL(htmlReady()),
+            this, SLOT(unlockList()));
+
     setModel(wordListModel);
 }
 
@@ -75,8 +78,22 @@ void WordListWidget::showSearchResults() {
     }
 
     wordListModel->sort(0, Qt::AscendingOrder);
+
+    scrollTo(model()->index(0,0));
+
+    unlockList();
 }
 
 void WordListWidget::itemClicked(QModelIndex index) {
     backbone->searchHtml(searchResult[index.model()->data(index).toString()]);
+    lockList();
+    emit selectedWord(index.model()->data(index).toString());
+}
+
+void WordListWidget::lockList() {
+    setEnabled(false);
+}
+
+void WordListWidget::unlockList() {
+    setEnabled(true);
 }