From fee55330b612721e0098b93445a533e95865a779 Mon Sep 17 00:00:00 2001 From: aqua Date: Sat, 24 Sep 2022 21:48:39 +0300 Subject: Add BookmarksContextMenu --- src/panels/bookmarkspanel.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src/panels/bookmarkspanel.cpp') diff --git a/src/panels/bookmarkspanel.cpp b/src/panels/bookmarkspanel.cpp index dab99203..dc55954a 100644 --- a/src/panels/bookmarkspanel.cpp +++ b/src/panels/bookmarkspanel.cpp @@ -7,6 +7,7 @@ #include "bookmarkspanel.hpp" #include "bookmarks/bookmarkstreemodel.hpp" +#include "bookmarkscontextmenu.hpp" #include BookmarksPanel::BookmarksPanel(QWidget *parent) : QTreeView(parent) @@ -27,17 +28,7 @@ BookmarksTreeModel *BookmarksPanel::model() const void BookmarksPanel::customContextMenu(const QPoint &pos) { - const auto index = indexAt(pos); - auto *item = model()->item(indexAt(pos)); - Q_CHECK_PTR(item); - - auto *menu = new QMenu(this); - menu->addAction(tr("Open in current tab"), this, [this, index]() { open(index); }); - menu->addAction(tr("Open in new tab"), this, [this, index]() { open(index, rekonq::NewTab); }); - menu->addAction(tr("Edit")); - menu->addAction(tr("Remove"), this, [this, index]() { remove(index); }); - - menu->popup(mapToGlobal(pos)); + (new BookmarksContextMenu(indexAt(pos), model(), this))->popup(mapToGlobal(pos)); } void BookmarksPanel::open(const QModelIndex &index, rekonq::OpenType type) @@ -46,5 +37,3 @@ void BookmarksPanel::open(const QModelIndex &index, rekonq::OpenType type) const auto url = item->data(BookmarksTreeItem::Href).toUrl(); emit loadUrl(url, type); } - -void BookmarksPanel::remove(const QModelIndex &index) { model()->removeRow(index.row(), index.parent()); } -- cgit v1.2.1