verticalLayout = new QVBoxLayout(this);
setLayout(verticalLayout);
+ #ifndef Q_WS_MAEMO_5
+ setWindowFlags(Qt::Popup);
+ QLabel* title = new QLabel(tr("History"));
+ verticalLayout->addWidget(title,0, Qt::AlignCenter);
+ #endif
+
oryginalList = words;
historyListWidget = new QListWidget(this);
#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());
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()));
void addToHistory(QList<Translation*>);
//! Shows history dialog
- void showHistory();
+ void showHistory(QPoint);
//! Shows translation of next word in history
/*!
this, SIGNAL(historyPrev()));
connect(historyShowToolButton, SIGNAL(clicked()),
- this, SIGNAL(historyShow()));
+ this, SLOT(showHistoryButtonClicked()));
connect(clearSearchWordToolButton, SIGNAL(clicked()),
this, SLOT(clearSearchWordToolButtonClicked()));
historyShowToolButton->setEnabled(list);
}
}
+
+void SearchBarWidget::showHistoryButtonClicked() {
+ #ifndef Q_WS_MAEMO_5
+ QPoint p = historyShowToolButton->pos();
+ p.setY(p.y());
+ emit historyShow(mapToGlobal(p));
+ #else
+ emit historyShow();
+ #endif
+}
void historyNext();
//! Requests to show history list
- void historyShow();
+ void historyShow(QPoint p = QPoint(-1,-1));
//! Requests to refresh state of history buttons
void refreshHistoryButtons();
void clearSearchWordToolButtonClicked();
void searchPushButtonClicked();
void delaySearchTimeout();
+ void showHistoryButtonClicked();
private:
virtual void addToHistory(QList<Translation*>) = 0;
//! Shows history dialog
- virtual void showHistory() = 0;
+ virtual void showHistory(QPoint) = 0;
//! Shows translation of next word in history
/*!