summaryrefslogtreecommitdiff
path: root/src/panels/bookmarkspanel.cpp
blob: ee7ae717ce3537c7fae4650d71c662b8e9ed2510 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* ============================================================
 *     The rekonq project
 * ============================================================
 * SPDX-License-Identifier: GPL-3.0-only
 * Copyright (C) 2022 aqua <aqua@iserlohn-fortress.net>
 * ============================================================ */

#include "bookmarkspanel.hpp"
#include "bookmarks/bookmarkstreemodel.hpp"

BookmarksPanel::BookmarksPanel(QWidget *parent) : QTreeView(parent)
{
  connect(this, &QTreeView::activated, this, [this](const QModelIndex &index) {
    auto *item = model()->item(index);
    const auto url = item->data(BookmarksTreeItem::Href).toUrl();
    emit loadUrl(url, rekonq::CurrentTab);
  });
}

BookmarkModel *BookmarksPanel::model() const
{
  auto *m = qobject_cast<BookmarkModel *>(QTreeView::model());
  Q_CHECK_PTR(m);
  return m;
}