aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/bookmarks/bookmarkswidget.cpp12
-rw-r--r--lib/bookmarks/bookmarkswidget.h4
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;