Fixed displaying translation of the same keyword from different dictionaries
[mdictionary] / trunk / src / base / gui / TranslationWidget.cpp
index 51a8547..8317835 100644 (file)
@@ -40,6 +40,7 @@ TranslationWidget::TranslationWidget(Backbone *backbone, QWidget *parent):
     connect(textEdit, SIGNAL(customContextMenuRequested(QPoint)),
             this, SLOT(showContextMenu(QPoint)));
 
+    setWindowTitle(tr("Translation"));
 
 }
 
@@ -48,15 +49,19 @@ void TranslationWidget::show() {
     QWidget::show();
 }
 
-void TranslationWidget::show(QModelIndex index) {
+void TranslationWidget::show(QList<Translation*> translations) {
 
     show();
-    QString v = index.model()->data(index, Qt::DisplayRole).toString();
-    Translation* t = backbone->result().value(v);
 
     textEdit->clear();
 
-    textEdit->setPlainText(t->toHtml());
+    QString trans;
+    Translation* t;
+    foreach(t, translations) {
+        trans += t->toHtml() + "\n";
+    }
+
+    textEdit->setPlainText(trans);
 
     textEdit->repaint(this->rect());