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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/* ============================================================
* The rekonq project
* ============================================================
* SPDX-License-Identifier: GPL-3.0-only
* Copyright (C) 2022 aqua <aqua@iserlohn-fortress.net>
* ============================================================ */
#include "bookmarkscontextmenu.hpp"
#include "bookmarks/bookmarkstreemodel.hpp"
#include "rekonqwindow.hpp"
BookmarksContextMenu::BookmarksContextMenu(const QModelIndex &index, BookmarksTreeModel *model, QWidget *parent)
: QMenu(parent)
{
auto *w = qobject_cast<RekonqWindow *>(parent->window());
Q_CHECK_PTR(w);
auto *item = model->item(index);
Q_CHECK_PTR(item);
addAction(tr("Open in current tab"), this,
[item, w]() { w->loadRequestedUrl(item->data(BookmarksTreeItem::Href).toUrl()); });
addAction(tr("Open in new tab"), this,
[item, w]() { w->loadRequestedUrl(item->data(BookmarksTreeItem::Href).toUrl(), rekonq::NewTab); });
// TODO Open in new window
addSeparator();
addAction(tr("Edit"));
addAction(tr("Remove"), this, [index, model]() { model->removeRow(index.row(), index.parent()); });
addSeparator();
addAction(tr("New Bookmark"), this,
[index, model]() { model->appendItem(BookmarksTreeItem::Bookmark, {}, model->parentFolder(index)); });
addAction(tr("New Folder"), this, [index, model]() { model->appendItem(BookmarksTreeItem::Folder, {}, index); });
addAction(tr("New Separator"), this,
[index, model]() { model->appendItem(BookmarksTreeItem::Separator, {}, index); });
}
|