diff options
author | aqua <aqua@iserlohn-fortress.net> | 2022-09-24 21:48:39 +0300 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2022-09-24 21:48:39 +0300 |
commit | fee55330b612721e0098b93445a533e95865a779 (patch) | |
tree | 88616e3c5b8e2e29700a3345a59e70b63767ac8d /src/panels/bookmarkspanel.cpp | |
parent | Add validate_xml script (diff) | |
download | rekonq-fee55330b612721e0098b93445a533e95865a779.tar.xz |
Add BookmarksContextMenustagingRKNQ-2-bookmarks
Diffstat (limited to 'src/panels/bookmarkspanel.cpp')
-rw-r--r-- | src/panels/bookmarkspanel.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
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 <QMenu> 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()); } |