Fix random error when remove word from bookmark. Fix show all bookmark feature.
[mdictionary] / src / mdictionary / gui / MainWindow.cpp
index b7e4dca..f8582dd 100644 (file)
 
 *******************************************************************************/
 
-//! \file MainWindow.cpp
-//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+/*! \file MainWindow.cpp
+    \brief Implements interface for GUI
+
+    \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+*/
 
 #include "MainWindow.h"
 #include <QtGui>
@@ -113,7 +116,8 @@ void MainWindow::initializeSearchWidgets() {
         splitter->setStretchFactor(1, 150);
 
         mainLayout->addWidget(splitter, 1);
-        mainLayout->addWidget(searchBarWidget, 0, Qt::AlignBottom);
+
+        mainLayout->addWidget(searchBarWidget,0, Qt::AlignBottom);
     #endif
 }
 
@@ -231,7 +235,6 @@ void MainWindow::wordListReady() {
             setExactSearch(false);
         }
     }
-
     wordListWidget->setFocus();
 }
 
@@ -291,7 +294,7 @@ QHash<CommonDictInterface*, bool> MainWindow::getDictionaries() {
     return backbone->getDictionaries();
 }
 
-
+/**/
 void MainWindow::search(QString word) {
     setExactSearch(false);
     searchBarWidget->search(word);
@@ -368,16 +371,11 @@ void MainWindow::enableMenu() {
 }
 
 void MainWindow::showHistory(QPoint p) {
-
-    HistoryListDialog historyDialog(backbone->history()->list(), searchBarWidget);
-
+    HistoryListDialog historyDialog(backbone->history()->list(), this );// 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);
+        p.setX(p.x() - historyDialog.sizeHint().width() + 5);
+        p.setY(p.y() - historyDialog.sizeHint().height()- 10); //- 80);
+        historyDialog.move(p);
     #endif
 
     if(historyDialog.exec() == QDialog::Accepted) {
@@ -464,6 +462,16 @@ void MainWindow::connectBackbone() {
 
     connect(backbone, SIGNAL(closeOk()),
             this, SLOT(close()));
+
+    connect(backbone, SIGNAL(bookmarkMode()),
+            this, SIGNAL(bookmarkMode()));
+
+
+    //connect(wordListWidget, SIGNAL(addBookmark(QList<Translation*>)),
+    //       this, SIGNAL(setBusy()));
+
+    //connect(backbone, SIGNAL(bookmarkReady()),
+    //        this, SIGNAL(setIdle()));
 }
 
 void MainWindow::connectSearchBar() {
@@ -513,6 +521,9 @@ void MainWindow::connectWordList() {
     connect(this, SIGNAL(setIdle()),
             wordListWidget, SLOT(unlockList()));
 
+    connect(this, SIGNAL(bookmarkMode()),
+            wordListWidget, SLOT(bookmarkModeActive()));
+
     connect(wordListWidget, SIGNAL(addBookmark(QList<Translation*>)),
             backbone, SLOT(addBookmark(QList<Translation*>)));
 
@@ -527,12 +538,14 @@ void MainWindow::connectTranslationWidget() {
      #ifdef Q_WS_MAEMO_5
         connect(translationWidget, SIGNAL(search(QString)),
                 this, SLOT(search(QString)));
+
+        connect(translationWidget, SIGNAL(notify(Notify::NotifyType, QString)),
+                this, SLOT(showNotification(Notify::NotifyType,QString)));
     #else
         connect(translationWidget, SIGNAL(search(QString)),
                 this, SLOT(searchExact(QString)));
     #endif
 
-
 }
 
 void MainWindow::connectDictManager() {
@@ -593,6 +606,4 @@ void MainWindow::removeBookmarks() {
         backbone->removeAllBookmarks();
         ((WordListWidget*)wordListWidget)->clear();
     }
-
-
 }