diff options
| author | Anton <anton@picapica> | 2019-04-27 20:59:48 +0400 |
|---|---|---|
| committer | Anton <anton@picapica> | 2019-04-27 20:59:48 +0400 |
| commit | 850b332e7e591064bd8b3245554a05752240408e (patch) | |
| tree | bb40b9caaa6f7a168896e9c34b88c59031399a1e /pica-client/chatwindow.cpp | |
| parent | 194a8e3dede66de73323d539e9fdd4136ac111ed (diff) | |
| download | pica-pica-850b332e7e591064bd8b3245554a05752240408e.tar.gz pica-pica-850b332e7e591064bd8b3245554a05752240408e.zip | |
pica-client: search in message history
Diffstat (limited to 'pica-client/chatwindow.cpp')
| -rw-r--r-- | pica-client/chatwindow.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/pica-client/chatwindow.cpp b/pica-client/chatwindow.cpp index f50d489..cf2eba8 100644 --- a/pica-client/chatwindow.cpp +++ b/pica-client/chatwindow.cpp @@ -26,6 +26,7 @@ #include <QMessageBox> #include <QDateTime> #include <QMessageBox> +#include <QInputDialog> ChatWindow::ChatWindow(QByteArray peer_id, QString status) : @@ -115,6 +116,7 @@ ChatWindow::ChatWindow(QByteArray peer_id, QString status) : hist24h = new QAction(tr("Last 24 &Hours"), this); hist1week = new QAction(tr("Last &Week"), this); histAll = new QAction(tr("&All"), this); + histSearch = new QAction(tr("&Search History..."), this); { QMenu *m; @@ -123,12 +125,14 @@ ChatWindow::ChatWindow(QByteArray peer_id, QString status) : m->addAction(hist24h); m->addAction(hist1week); m->addAction(histAll); + m->addAction(histSearch); } layout->insertSpacing(0, menu->size().height()); connect(hist24h, SIGNAL(triggered()), this, SLOT(show_history24h())); connect(hist1week, SIGNAL(triggered()), this, SLOT(show_history1w())); connect(histAll, SIGNAL(triggered()), this, SLOT(show_historyAll())); + connect(histSearch, SIGNAL(triggered()), this, SLOT(show_historySearch())); } @@ -359,6 +363,17 @@ void ChatWindow::show_historyAll() print_history(hist.GetMessages(peer_id_, 0, QDateTime::currentDateTime().toTime_t())); } +void ChatWindow::show_historySearch() +{ + bool ok; + QString keyword = QInputDialog::getText(this, tr("Search in message history"), + tr("Find:"), QLineEdit::Normal, + QString(), &ok); + + if (ok) + print_history(hist.GetMessages(peer_id_, keyword)); +} + void ChatWindow::addct_yes() { Contacts ct(config_dbname, Accounts::GetCurrentAccount().id); |
