From 9348f1d4fcaec388d6f067e7ead6904c09b179e6 Mon Sep 17 00:00:00 2001 From: nowrep Date: Sat, 8 Feb 2014 20:01:07 +0100 Subject: [PATCH] [Bookmarks] BookmarksManager now supports adding & removing bookmarks --- src/lib/bookmarks/bookmarkitem.cpp | 2 +- src/lib/bookmarks/bookmarkitem.h | 2 +- src/lib/bookmarks/bookmarks.cpp | 21 +- src/lib/bookmarks/bookmarks.h | 3 + src/lib/bookmarks/bookmarksmanager.cpp | 274 ++++++++++++++---------- src/lib/bookmarks/bookmarksmanager.h | 19 +- src/lib/bookmarks/bookmarksmodel.cpp | 2 +- src/lib/bookmarks/bookmarkstreeview.cpp | 60 +++--- src/lib/bookmarks/bookmarkstreeview.h | 6 +- 9 files changed, 239 insertions(+), 150 deletions(-) diff --git a/src/lib/bookmarks/bookmarkitem.cpp b/src/lib/bookmarks/bookmarkitem.cpp index 8683e317c..bc1627dda 100644 --- a/src/lib/bookmarks/bookmarkitem.cpp +++ b/src/lib/bookmarks/bookmarkitem.cpp @@ -52,7 +52,7 @@ bool BookmarkItem::isUrl() const return m_type == Url; } -bool BookmarkItem::isSeparator() +bool BookmarkItem::isSeparator() const { return m_type == Separator; } diff --git a/src/lib/bookmarks/bookmarkitem.h b/src/lib/bookmarks/bookmarkitem.h index 8827e6a4b..6ee5f1fe9 100644 --- a/src/lib/bookmarks/bookmarkitem.h +++ b/src/lib/bookmarks/bookmarkitem.h @@ -43,7 +43,7 @@ public: bool isFolder() const; bool isUrl() const; - bool isSeparator(); + bool isSeparator() const; BookmarkItem* parent() const; QList children() const; diff --git a/src/lib/bookmarks/bookmarks.cpp b/src/lib/bookmarks/bookmarks.cpp index 7898fb935..50f604f85 100644 --- a/src/lib/bookmarks/bookmarks.cpp +++ b/src/lib/bookmarks/bookmarks.cpp @@ -758,6 +758,21 @@ BookmarkItem* Bookmarks::rootItem() const return m_root; } +BookmarkItem* Bookmarks::toolbarFolder() const +{ + return m_folderToolbar; +} + +BookmarkItem* Bookmarks::menuFolder() const +{ + return m_folderMenu; +} + +BookmarkItem* Bookmarks::unsortedFolder() const +{ + return m_folderUnsorted; +} + bool Bookmarks::removeBookmark(BookmarkItem* item) { if (!canBeModified(item)) { @@ -777,7 +792,11 @@ void Bookmarks::notifyBookmarkChanged(BookmarkItem* item) bool Bookmarks::canBeModified(BookmarkItem* item) const { - return item != m_root && item != m_folderToolbar && item != m_folderMenu && item != m_folderUnsorted; + return item && + item != m_root && + item != m_folderToolbar && + item != m_folderMenu && + item != m_folderUnsorted; } void Bookmarks::addBookmark(BookmarkItem* parent, BookmarkItem* item) diff --git a/src/lib/bookmarks/bookmarks.h b/src/lib/bookmarks/bookmarks.h index bd116d616..9fbffa2c6 100644 --- a/src/lib/bookmarks/bookmarks.h +++ b/src/lib/bookmarks/bookmarks.h @@ -101,6 +101,9 @@ public: BookmarksModel* model() const; BookmarkItem* rootItem() const; + BookmarkItem* toolbarFolder() const; + BookmarkItem* menuFolder() const; + BookmarkItem* unsortedFolder() const; bool canBeModified(BookmarkItem* item) const; void addBookmark(BookmarkItem* parent, BookmarkItem* item); diff --git a/src/lib/bookmarks/bookmarksmanager.cpp b/src/lib/bookmarks/bookmarksmanager.cpp index 83a7f13ef..8a1e6e88d 100644 --- a/src/lib/bookmarks/bookmarksmanager.cpp +++ b/src/lib/bookmarks/bookmarksmanager.cpp @@ -48,7 +48,9 @@ BookmarksManager::BookmarksManager(QupZilla* mainClass, QWidget* parent) , ui(new Ui::BookmarksManager) , p_QupZilla(mainClass) , m_bookmarks(mApp->bookmarks()) + , m_selectedBookmark(0) , m_blockDescriptionChangedSignal(false) + , m_adjustHeaderSizesOnShow(true) { ui->setupUi(this); @@ -56,52 +58,14 @@ BookmarksManager::BookmarksManager(QupZilla* mainClass, QWidget* parent) connect(ui->tree, SIGNAL(bookmarkCtrlActivated(BookmarkItem*)), this, SLOT(bookmarkCtrlActivated(BookmarkItem*))); connect(ui->tree, SIGNAL(bookmarkShiftActivated(BookmarkItem*)), this, SLOT(bookmarkShiftActivated(BookmarkItem*))); connect(ui->tree, SIGNAL(bookmarksSelected(QList)), this, SLOT(bookmarksSelected(QList))); + connect(ui->tree, SIGNAL(contextMenuRequested(QPoint)), this, SLOT(createContextMenu(QPoint))); - // Disable edit box + // Box for editing bookmarks updateEditBox(0); - connect(ui->title, SIGNAL(textEdited(QString)), this, SLOT(bookmarkEdited())); connect(ui->address, SIGNAL(textEdited(QString)), this, SLOT(bookmarkEdited())); connect(ui->keyword, SIGNAL(textEdited(QString)), this, SLOT(bookmarkEdited())); connect(ui->description, SIGNAL(textChanged()), this, SLOT(descriptionEdited())); - -#if 0 - ui->bookmarksTree->setViewType(BookmarksTree::ManagerView); - - ui->bookmarksTree->setSelectionBehavior(QAbstractItemView::SelectRows); - ui->bookmarksTree->setDragDropReceiver(true, m_bookmarks); - ui->bookmarksTree->setMimeType(QLatin1String("application/qupzilla.treewidgetitem.bookmarks")); - - connect(ui->bookmarksTree, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(itemChanged(QTreeWidgetItem*))); - connect(ui->addFolder, SIGNAL(clicked()), this, SLOT(addFolder())); - connect(ui->bookmarksTree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint))); - connect(ui->bookmarksTree, SIGNAL(itemControlClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*))); - connect(ui->bookmarksTree, SIGNAL(itemMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*))); - connect(ui->collapseAll, SIGNAL(clicked()), ui->bookmarksTree, SLOT(collapseAll())); - connect(ui->expandAll, SIGNAL(clicked()), ui->bookmarksTree, SLOT(expandAll())); - - connect(m_bookmarks, SIGNAL(bookmarkAdded(Bookmarks::Bookmark)), this, SLOT(addBookmark(Bookmarks::Bookmark))); - connect(m_bookmarks, SIGNAL(bookmarkDeleted(Bookmarks::Bookmark)), this, SLOT(removeBookmark(Bookmarks::Bookmark))); - connect(m_bookmarks, SIGNAL(bookmarkEdited(Bookmarks::Bookmark,Bookmarks::Bookmark)), this, SLOT(bookmarkEdited(Bookmarks::Bookmark,Bookmarks::Bookmark))); - connect(m_bookmarks, SIGNAL(subfolderAdded(QString)), this, SLOT(addSubfolder(QString))); - connect(m_bookmarks, SIGNAL(folderAdded(QString)), this, SLOT(addFolder(QString))); - connect(m_bookmarks, SIGNAL(folderDeleted(QString)), this, SLOT(removeFolder(QString))); - connect(m_bookmarks, SIGNAL(folderRenamed(QString,QString)), this, SLOT(renameFolder(QString,QString))); - connect(m_bookmarks, SIGNAL(folderParentChanged(QString,bool)), this, SLOT(changeFolderParent(QString,bool))); - connect(m_bookmarks, SIGNAL(bookmarkParentChanged(QString,QByteArray,int,QUrl,QString,QString)), this, SLOT(changeBookmarkParent(QString,QByteArray,int,QUrl,QString,QString))); - - QMenu* menu = new QMenu; - menu->addAction(tr("Import Bookmarks..."), this, SLOT(importBookmarks())); - menu->addAction(tr("Export Bookmarks to HTML..."), this, SLOT(exportBookmarks())); - - ui->importExport->setMenu(menu); - - QShortcut* deleteAction = new QShortcut(QKeySequence("Del"), ui->bookmarksTree); - connect(deleteAction, SIGNAL(activated()), this, SLOT(deleteItem())); - - ui->bookmarksTree->setDefaultItemShowMode(TreeWidget::ItemsExpanded); - ui->bookmarksTree->sortByColumn(-1); -#endif } BookmarksManager::~BookmarksManager() @@ -111,39 +75,136 @@ BookmarksManager::~BookmarksManager() void BookmarksManager::bookmarkActivated(BookmarkItem* item) { + openBookmark(item); +} + +void BookmarksManager::bookmarkCtrlActivated(BookmarkItem* item) +{ + openBookmarkInNewTab(item); +} + +void BookmarksManager::bookmarkShiftActivated(BookmarkItem* item) +{ + openBookmarkInNewWindow(item); +} + +void BookmarksManager::bookmarksSelected(const QList &items) +{ + if (items.size() != 1) { + m_selectedBookmark = 0; + updateEditBox(0); + } + else { + m_selectedBookmark = items.first(); + updateEditBox(m_selectedBookmark); + } +} + +void BookmarksManager::createContextMenu(const QPoint &pos) +{ + QMenu menu; + QAction* actNewTab = menu.addAction(QIcon::fromTheme("tab-new", QIcon(":/icons/menu/tab-new.png")), tr("Open in new tab")); + QAction* actNewWindow = menu.addAction(QIcon::fromTheme("window-new"), tr("Open in new window")); + menu.addSeparator(); + menu.addAction(tr("New Bookmark"), this, SLOT(addBookmark())); + menu.addAction(tr("New Folder"), this, SLOT(addFolder())); + menu.addAction(tr("New Separator"), this, SLOT(addSeparator())); + menu.addSeparator(); + QAction* actDelete = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); + + connect(actNewTab, SIGNAL(triggered()), this, SLOT(openBookmarkInNewTab())); + connect(actNewWindow, SIGNAL(triggered()), this, SLOT(openBookmarkInNewWindow())); + connect(actDelete, SIGNAL(triggered()), this, SLOT(deleteBookmarks())); + + bool canBeDeleted = false; + QList items = ui->tree->selectedBookmarks(); + + foreach (BookmarkItem* item, items) { + if (m_bookmarks->canBeModified(item)) { + canBeDeleted = true; + break; + } + } + + if (!canBeDeleted) { + actDelete->setDisabled(true); + } + + if (!m_selectedBookmark || !m_selectedBookmark->isUrl()) { + actNewTab->setDisabled(true); + actNewWindow->setDisabled(true); + } + + menu.exec(pos); +} + +void BookmarksManager::openBookmark(BookmarkItem* item) +{ + item = item ? item : m_selectedBookmark; + // TODO: Open all children in tabs for folder? - if (!item->isUrl()) { + if (!item || !item->isUrl()) { return; } getQupZilla()->loadAddress(item->url()); } -void BookmarksManager::bookmarkCtrlActivated(BookmarkItem* item) +void BookmarksManager::openBookmarkInNewTab(BookmarkItem* item) { - if (!item->isUrl()) { + item = item ? item : m_selectedBookmark; + + // TODO: Open all children in tabs for folder? + if (!item || !item->isUrl()) { return; } getQupZilla()->tabWidget()->addView(item->url(), item->title(), qzSettings->newTabPosition); } -void BookmarksManager::bookmarkShiftActivated(BookmarkItem* item) +void BookmarksManager::openBookmarkInNewWindow(BookmarkItem* item) { - if (!item->isUrl()) { + item = item ? item : m_selectedBookmark; + + if (!item || !item->isUrl()) { return; } mApp->makeNewWindow(Qz::BW_NewWindow, item->url()); } -void BookmarksManager::bookmarksSelected(const QList &items) +void BookmarksManager::addBookmark() { - if (items.size() != 1) { - updateEditBox(0); - } - else { - updateEditBox(items.first()); + BookmarkItem* item = new BookmarkItem(BookmarkItem::Url); + item->setTitle(tr("New Bookmark")); + item->setUrl(QUrl("http://")); + + addBookmark(item); +} + +void BookmarksManager::addFolder() +{ + BookmarkItem* item = new BookmarkItem(BookmarkItem::Folder); + item->setTitle(tr("New Folder")); + + addBookmark(item); +} + +void BookmarksManager::addSeparator() +{ + BookmarkItem* item = new BookmarkItem(BookmarkItem::Separator); + + addBookmark(item); +} + +void BookmarksManager::deleteBookmarks() +{ + QList items = ui->tree->selectedBookmarks(); + + foreach (BookmarkItem* item, items) { + if (m_bookmarks->canBeModified(item)) { + m_bookmarks->removeBookmark(item); + } } } @@ -189,7 +250,7 @@ void BookmarksManager::updateEditBox(BookmarkItem* item) setUpdatesEnabled(false); m_blockDescriptionChangedSignal = true; - bool editable = item && !item->isSeparator() && m_bookmarks->canBeModified(item); + bool editable = bookmarkEditable(item); bool showAddressAndKeyword = item && item->isUrl(); bool clearBox = !item; @@ -241,6 +302,44 @@ void BookmarksManager::updateEditBox(BookmarkItem* item) setUpdatesEnabled(true); } +bool BookmarksManager::bookmarkEditable(BookmarkItem* item) const +{ + return item && (item->isFolder() || item->isUrl()) && m_bookmarks->canBeModified(item); +} + +void BookmarksManager::addBookmark(BookmarkItem* item) +{ + BookmarkItem* parent = parentForNewBookmark(); + Q_ASSERT(parent); + + // TODO: Make sure parent is expanded + m_bookmarks->addBookmark(parent, item); +} + +BookmarkItem* BookmarksManager::parentForNewBookmark() const +{ + if (m_selectedBookmark && m_selectedBookmark->isFolder()) { + return m_selectedBookmark; + } + + if (!m_selectedBookmark || m_selectedBookmark->parent() == m_bookmarks->rootItem()) { + return m_bookmarks->unsortedFolder(); + } + + return m_selectedBookmark->parent(); +} + +void BookmarksManager::keyPressEvent(QKeyEvent* event) +{ + switch (event->key()) { + case Qt::Key_Delete: + deleteBookmarks(); + break; + } + + QWidget::keyPressEvent(event); +} + QupZilla* BookmarksManager::getQupZilla() { if (!p_QupZilla) { @@ -249,6 +348,16 @@ QupZilla* BookmarksManager::getQupZilla() return p_QupZilla.data(); } +void BookmarksManager::showEvent(QShowEvent* event) +{ + QWidget::showEvent(event); + + if (m_adjustHeaderSizesOnShow) { + ui->tree->header()->resizeSection(0, ui->tree->header()->width() / 1.9); + m_adjustHeaderSizesOnShow = false; + } +} + void BookmarksManager::setMainWindow(QupZilla* window) { if (window) { @@ -256,67 +365,6 @@ void BookmarksManager::setMainWindow(QupZilla* window) } } -#if 0 -void BookmarksManager::contextMenuRequested(const QPoint &position) -{ - if (!ui->bookmarksTree->itemAt(position)) { - return; - } - - QUrl link = ui->bookmarksTree->itemAt(position)->data(0, Qt::UserRole + 11).toUrl(); - if (link.isEmpty()) { - QString folderName = ui->bookmarksTree->itemAt(position)->text(0); - QMenu menu; - if (folderName == _bookmarksToolbar) { - menu.addAction(tr("Add Subfolder"), this, SLOT(addSubfolder())); - menu.addSeparator(); - } - - if (folderName != _bookmarksToolbar && folderName != _bookmarksMenu) { - menu.addAction(tr("Rename folder"), this, SLOT(renameFolder())); - menu.addAction(tr("Remove folder"), this, SLOT(deleteItem())); - } - - if (menu.actions().count() == 0) { - return; - } - - //Prevent choosing first option with double rightclick - QPoint pos = ui->bookmarksTree->viewport()->mapToGlobal(position); - QPoint p(pos.x(), pos.y() + 1); - menu.exec(p); - return; - } - - QMenu menu; - menu.addAction(tr("Open link in current &tab"), getQupZilla(), SLOT(loadActionUrl()))->setData(link); - menu.addAction(tr("Open link in &new tab"), this, SLOT(loadInNewTab()))->setData(link); - menu.addSeparator(); - - QMenu moveMenu; - moveMenu.setTitle(tr("Move bookmark to &folder")); - moveMenu.addAction(QIcon(":icons/theme/unsortedbookmarks.png"), _bookmarksUnsorted, this, SLOT(moveBookmark()))->setData("unsorted"); - moveMenu.addAction(style()->standardIcon(QStyle::SP_DirOpenIcon), _bookmarksMenu, this, SLOT(moveBookmark()))->setData("bookmarksMenu"); - moveMenu.addAction(style()->standardIcon(QStyle::SP_DirOpenIcon), _bookmarksToolbar, this, SLOT(moveBookmark()))->setData("bookmarksToolbar"); - QSqlQuery query; - query.exec("SELECT name FROM folders"); - while (query.next()) { - moveMenu.addAction(style()->standardIcon(QStyle::SP_DirIcon), query.value(0).toString(), this, SLOT(moveBookmark()))->setData(query.value(0).toString()); - } - menu.addMenu(&moveMenu); - - menu.addSeparator(); - menu.addAction(tr("Change icon"), this, SLOT(changeIcon())); - menu.addAction(tr("Rename bookmark"), this, SLOT(renameBookmark())); - menu.addAction(tr("Remove bookmark"), this, SLOT(deleteItem())); - - //Prevent choosing first option with double rightclick - QPoint pos = ui->bookmarksTree->viewport()->mapToGlobal(position); - QPoint p(pos.x(), pos.y() + 1); - menu.exec(p); -} -#endif - // OLD void BookmarksManager::addBookmark(WebView* view) diff --git a/src/lib/bookmarks/bookmarksmanager.h b/src/lib/bookmarks/bookmarksmanager.h index 3d9e3dc56..2ef710867 100644 --- a/src/lib/bookmarks/bookmarksmanager.h +++ b/src/lib/bookmarks/bookmarksmanager.h @@ -50,6 +50,16 @@ private slots: void bookmarkCtrlActivated(BookmarkItem* item); void bookmarkShiftActivated(BookmarkItem* item); void bookmarksSelected(const QList &items); + void createContextMenu(const QPoint &pos); + + void openBookmark(BookmarkItem* item = 0); + void openBookmarkInNewTab(BookmarkItem* item = 0); + void openBookmarkInNewWindow(BookmarkItem* item = 0); + + void addBookmark(); + void addFolder(); + void addSeparator(); + void deleteBookmarks(); void bookmarkEdited(); void descriptionEdited(); @@ -59,14 +69,21 @@ private slots: private: void updateEditBox(BookmarkItem* item); - + bool bookmarkEditable(BookmarkItem* item) const; + void addBookmark(BookmarkItem* item); + BookmarkItem* parentForNewBookmark() const; QupZilla* getQupZilla(); + void showEvent(QShowEvent* event); + void keyPressEvent(QKeyEvent* event); + Ui::BookmarksManager* ui; QPointer p_QupZilla; Bookmarks* m_bookmarks; + BookmarkItem* m_selectedBookmark; bool m_blockDescriptionChangedSignal; + bool m_adjustHeaderSizesOnShow; public: void addBookmark(WebView* view); diff --git a/src/lib/bookmarks/bookmarksmodel.cpp b/src/lib/bookmarks/bookmarksmodel.cpp index 9c48f3d73..d1a07be68 100644 --- a/src/lib/bookmarks/bookmarksmodel.cpp +++ b/src/lib/bookmarks/bookmarksmodel.cpp @@ -24,7 +24,7 @@ #include #include -#define BOOKMARKSMODEL_DEBUG +//#define BOOKMARKSMODEL_DEBUG #ifdef BOOKMARKSMODEL_DEBUG #include "modeltest.h" diff --git a/src/lib/bookmarks/bookmarkstreeview.cpp b/src/lib/bookmarks/bookmarkstreeview.cpp index 6a5d73f41..b9a213a66 100644 --- a/src/lib/bookmarks/bookmarkstreeview.cpp +++ b/src/lib/bookmarks/bookmarkstreeview.cpp @@ -77,9 +77,7 @@ void BookmarksTreeView::selectionChanged() void BookmarksTreeView::createContextMenu(const QPoint &point) { - QModelIndex index = indexAt(point); - BookmarkItem* item = index.isValid() ? m_model->item(index) : 0; - emit contextMenuRequested(item); + emit contextMenuRequested(viewport()->mapToGlobal(point)); } void BookmarksTreeView::restoreExpandedState(const QModelIndex &parent) @@ -100,46 +98,52 @@ void BookmarksTreeView::rowsInserted(const QModelIndex &parent, int start, int e void BookmarksTreeView::mousePressEvent(QMouseEvent* event) { - QModelIndex index = indexAt(event->pos()); + QTreeView::mousePressEvent(event); - if (index.isValid()) { - BookmarkItem* item = m_model->item(index); - Qt::MouseButtons buttons = event->buttons(); - Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers(); + if (selectionModel()->selectedRows().count() == 1) { + QModelIndex index = indexAt(event->pos()); - if (buttons == Qt::LeftButton && modifiers == Qt::ShiftModifier) { - emit bookmarkShiftActivated(item); - } - else if (buttons == Qt::MiddleButton || modifiers == Qt::ControlModifier) { - emit bookmarkCtrlActivated(item); + if (index.isValid()) { + BookmarkItem* item = m_model->item(index); + Qt::MouseButtons buttons = event->buttons(); + Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers(); + + if (buttons == Qt::LeftButton && modifiers == Qt::ShiftModifier) { + emit bookmarkShiftActivated(item); + } + else if (buttons == Qt::MiddleButton || modifiers == Qt::ControlModifier) { + emit bookmarkCtrlActivated(item); + } } } - - QTreeView::mousePressEvent(event); } void BookmarksTreeView::mouseDoubleClickEvent(QMouseEvent* event) { - QModelIndex index = indexAt(event->pos()); + QTreeView::mouseDoubleClickEvent(event); - if (index.isValid()) { - BookmarkItem* item = m_model->item(index); - Qt::MouseButtons buttons = event->buttons(); - Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers(); + if (selectionModel()->selectedRows().count() == 1) { + QModelIndex index = indexAt(event->pos()); - if (buttons == Qt::LeftButton && modifiers == Qt::NoModifier) { - emit bookmarkActivated(item); - } - else if (buttons == Qt::LeftButton && modifiers == Qt::ShiftModifier) { - emit bookmarkShiftActivated(item); + if (index.isValid()) { + BookmarkItem* item = m_model->item(index); + Qt::MouseButtons buttons = event->buttons(); + Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers(); + + if (buttons == Qt::LeftButton && modifiers == Qt::NoModifier) { + emit bookmarkActivated(item); + } + else if (buttons == Qt::LeftButton && modifiers == Qt::ShiftModifier) { + emit bookmarkShiftActivated(item); + } } } - - QTreeView::mouseDoubleClickEvent(event); } void BookmarksTreeView::keyPressEvent(QKeyEvent* event) { + QTreeView::keyPressEvent(event); + if (selectionModel()->selectedRows().count() == 1) { QModelIndex index = selectionModel()->selectedRows().first(); BookmarkItem* item = m_model->item(index); @@ -166,6 +170,4 @@ void BookmarksTreeView::keyPressEvent(QKeyEvent* event) break; } } - - QTreeView::keyPressEvent(event); } diff --git a/src/lib/bookmarks/bookmarkstreeview.h b/src/lib/bookmarks/bookmarkstreeview.h index eea6e8263..fd9610eb8 100644 --- a/src/lib/bookmarks/bookmarkstreeview.h +++ b/src/lib/bookmarks/bookmarkstreeview.h @@ -41,9 +41,9 @@ signals: void bookmarkCtrlActivated(BookmarkItem* item); // Open bookmark in new window void bookmarkShiftActivated(BookmarkItem* item); - - // If item is null, context menu was requested on empty place - void contextMenuRequested(BookmarkItem* item); + // Context menu signal with point mapped to global + void contextMenuRequested(const QPoint &point); + // If all bookmarks have been deselected, items is empty void bookmarksSelected(QList items); private slots: