diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-04-17 01:38:07 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-04-17 01:38:07 +0200 |
commit | 74a7ea3732853f954fcab7088acaa2413fc3e7c1 (patch) | |
tree | 02ca9dd6f0dd4ea1b18346d4c6004c74c504d04f /lib/bookmarks | |
parent | Multiple subwindows interface (diff) | |
download | smolbote-74a7ea3732853f954fcab7088acaa2413fc3e7c1.tar.xz |
Enabled address bar suggestions
Also fixed occasional bug when showing the completer.
Diffstat (limited to 'lib/bookmarks')
-rw-r--r-- | lib/bookmarks/bookmarkswidget.cpp | 12 | ||||
-rw-r--r-- | lib/bookmarks/bookmarkswidget.h | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/bookmarks/bookmarkswidget.cpp b/lib/bookmarks/bookmarkswidget.cpp index 733c0ef..b5bf471 100644 --- a/lib/bookmarks/bookmarkswidget.cpp +++ b/lib/bookmarks/bookmarkswidget.cpp @@ -128,3 +128,15 @@ void BookmarksWidget::save() bookmarksFile.close(); } } + +QStringList BookmarksWidget::search(const QString& term) const +{ + QStringList ret; + const QList<QTreeWidgetItem *> res = ui->treeWidget->findItems(term, Qt::MatchContains | Qt::MatchRecursive, 1); + for(const QTreeWidgetItem *i : res) { + if(!i->text(1).isEmpty()) + ret.append(i->text(1)); + } + + return ret; +} diff --git a/lib/bookmarks/bookmarkswidget.h b/lib/bookmarks/bookmarkswidget.h index df39e1c..f0cd73d 100644 --- a/lib/bookmarks/bookmarkswidget.h +++ b/lib/bookmarks/bookmarkswidget.h @@ -12,6 +12,7 @@ #include <QShortcut> #include <QWidget> #include <QFile> +#include <functional> namespace Ui { @@ -33,6 +34,9 @@ public: signals: void openUrl(const QUrl &url); +public slots: + QStringList search(const QString &term) const; + private: Ui::BookmarksDialog *ui; QString m_bookmarksPath; |