mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
Added context menu item to bookmarks toolbar for creating folder
This commit is contained in:
parent
742b20154b
commit
c978521e33
|
@ -30,6 +30,7 @@
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
#include <QInputDialog>
|
||||||
|
|
||||||
BookmarksToolbar::BookmarksToolbar(BrowserWindow* window, QWidget* parent)
|
BookmarksToolbar::BookmarksToolbar(BrowserWindow* window, QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
|
@ -73,6 +74,7 @@ void BookmarksToolbar::contextMenuRequested(const QPoint &pos)
|
||||||
QAction* actNewWindow = menu.addAction(IconProvider::newWindowIcon(), tr("Open in new window"));
|
QAction* actNewWindow = menu.addAction(IconProvider::newWindowIcon(), tr("Open in new window"));
|
||||||
QAction* actNewPrivateWindow = menu.addAction(IconProvider::privateBrowsingIcon(), tr("Open in new private window"));
|
QAction* actNewPrivateWindow = menu.addAction(IconProvider::privateBrowsingIcon(), tr("Open in new private window"));
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
QAction* actNewFolder = menu.addAction(QIcon::fromTheme("folder-new"), tr("New Folder"));
|
||||||
QAction* actEdit = menu.addAction(tr("Edit"));
|
QAction* actEdit = menu.addAction(tr("Edit"));
|
||||||
QAction* actDelete = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
QAction* actDelete = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
@ -88,6 +90,7 @@ void BookmarksToolbar::contextMenuRequested(const QPoint &pos)
|
||||||
connect(actNewTab, &QAction::triggered, this, &BookmarksToolbar::openBookmarkInNewTab);
|
connect(actNewTab, &QAction::triggered, this, &BookmarksToolbar::openBookmarkInNewTab);
|
||||||
connect(actNewWindow, &QAction::triggered, this, &BookmarksToolbar::openBookmarkInNewWindow);
|
connect(actNewWindow, &QAction::triggered, this, &BookmarksToolbar::openBookmarkInNewWindow);
|
||||||
connect(actNewPrivateWindow, &QAction::triggered, this, &BookmarksToolbar::openBookmarkInNewPrivateWindow);
|
connect(actNewPrivateWindow, &QAction::triggered, this, &BookmarksToolbar::openBookmarkInNewPrivateWindow);
|
||||||
|
connect(actNewFolder, &QAction::triggered, this, &BookmarksToolbar::createNewFolder);
|
||||||
connect(actEdit, &QAction::triggered, this, &BookmarksToolbar::editBookmark);
|
connect(actEdit, &QAction::triggered, this, &BookmarksToolbar::editBookmark);
|
||||||
connect(actDelete, &QAction::triggered, this, &BookmarksToolbar::deleteBookmark);
|
connect(actDelete, &QAction::triggered, this, &BookmarksToolbar::deleteBookmark);
|
||||||
|
|
||||||
|
@ -177,6 +180,25 @@ void BookmarksToolbar::openBookmarkInNewPrivateWindow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BookmarksToolbar::createNewFolder()
|
||||||
|
{
|
||||||
|
QString name = QInputDialog::getText(nullptr, tr("New Folder"), tr("Enter Folder Name:"));
|
||||||
|
|
||||||
|
if (!name.isEmpty()) {
|
||||||
|
BookmarkItem* parent;
|
||||||
|
|
||||||
|
if (m_clickedBookmark) {
|
||||||
|
parent = m_clickedBookmark;
|
||||||
|
} else {
|
||||||
|
parent = m_bookmarks->toolbarFolder();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto folder = new BookmarkItem(BookmarkItem::Folder);
|
||||||
|
folder->setTitle(name);
|
||||||
|
m_bookmarks->addBookmark(parent, folder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BookmarksToolbar::editBookmark()
|
void BookmarksToolbar::editBookmark()
|
||||||
{
|
{
|
||||||
if (m_clickedBookmark) {
|
if (m_clickedBookmark) {
|
||||||
|
|
|
@ -47,6 +47,7 @@ private Q_SLOTS:
|
||||||
void openBookmarkInNewTab();
|
void openBookmarkInNewTab();
|
||||||
void openBookmarkInNewWindow();
|
void openBookmarkInNewWindow();
|
||||||
void openBookmarkInNewPrivateWindow();
|
void openBookmarkInNewPrivateWindow();
|
||||||
|
void createNewFolder();
|
||||||
void editBookmark();
|
void editBookmark();
|
||||||
void deleteBookmark();
|
void deleteBookmark();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user