Merge branch 'master' of ssh://drop.maemo.org/git/mdictionary
[mdictionary] / trunk / src / base / gui / MainWindow.cpp
index aa48cc2..349c5e4 100644 (file)
@@ -310,8 +310,18 @@ void MainWindow::enableMenu() {
     #endif
 }
 
-void MainWindow::showHistory() {
-    HistoryListDialog historyDialog(backbone->history()->list(), this);
+void MainWindow::showHistory(QPoint p) {
+    HistoryListDialog historyDialog(backbone->history()->list(), searchBarWidget);
+
+    #ifndef Q_WS_MAEMO_5
+        QPoint newPos = mapFromGlobal(p);
+        newPos.setY(searchBarWidget->pos().y() -
+                    historyDialog.sizeHint().height());
+        newPos.setX(width() - historyDialog.sizeHint().width());
+
+        historyDialog.move(newPos);
+    #endif
+
     if(historyDialog.exec() == QDialog::Accepted) {
         backbone->history()->setCurrentElement(historyDialog.selectedRow());
         searchExact(historyDialog.selectedWord());
@@ -443,8 +453,8 @@ void MainWindow::connectSearchBar() {
     connect(searchBarWidget, SIGNAL(historyPrev()),
             this, SLOT(historyPrev()));
 
-    connect(searchBarWidget, SIGNAL(historyShow()),
-            this, SLOT(showHistory()));
+    connect(searchBarWidget, SIGNAL(historyShow(QPoint)),
+            this, SLOT(showHistory(QPoint)));
 
     connect(searchBarWidget, SIGNAL(refreshHistoryButtons()),
             backbone->history(), SLOT(refreshStatus()));