From 6551c000fc68134932cdc21f2cc7086b34bff30b Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 8 Oct 2011 21:40:34 +0200 Subject: [PATCH] Context menu cleanups - Open the context menu on the mouse-press event, not on the mouse-release event. - Provide an explicit position-information and don't use QCursor::pos(). This fixes the issue that opening a context-menu by the keyboard opens below the cursor. - Provide different signals in the KItemListController for the different context-menu types (item vs. view vs. header). - Implement turning on/off roles by the header-context-menu. --- src/dolphincontextmenu.cpp | 11 +-- src/dolphincontextmenu.h | 3 + src/dolphinmainwindow.cpp | 15 ++-- src/dolphinmainwindow.h | 4 +- src/dolphinpart.cpp | 9 +-- src/dolphinpart.h | 4 +- src/dolphinviewcontainer.cpp | 1 - src/kitemviews/kitemlistcontroller.cpp | 52 ++++++++------ src/kitemviews/kitemlistcontroller.h | 17 ++++- src/kitemviews/kitemlistheader.cpp | 16 +++-- src/kitemviews/kitemlistview.cpp | 60 +++++++++------- src/kitemviews/kitemlistview.h | 19 +++-- src/views/dolphinview.cpp | 97 +++++++++++++++----------- src/views/dolphinview.h | 16 ++--- 14 files changed, 196 insertions(+), 128 deletions(-) diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index 617189715..848ba7de0 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -61,8 +61,11 @@ K_GLOBAL_STATIC(KModifierKeyInfo, m_keyInfo) DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent, + const QPoint& pos, const KFileItem& fileInfo, const KUrl& baseUrl) : + QObject(parent), + m_pos(pos), m_mainWindow(parent), m_fileInfo(fileInfo), m_baseUrl(baseUrl), @@ -187,7 +190,7 @@ void DolphinContextMenu::openTrashContextMenu() addShowMenuBarAction(); - QAction *action = m_popup->exec(QCursor::pos()); + QAction *action = m_popup->exec(m_pos); if (action == emptyTrashAction) { KonqOperations::emptyTrash(m_mainWindow); } else if (action == addToPlacesAction) { @@ -212,7 +215,7 @@ void DolphinContextMenu::openTrashItemContextMenu() QAction* propertiesAction = m_mainWindow->actionCollection()->action("properties"); m_popup->addAction(propertiesAction); - if (m_popup->exec(QCursor::pos()) == restoreAction) { + if (m_popup->exec(m_pos) == restoreAction) { KUrl::List selectedUrls; foreach (const KFileItem &item, m_selectedItems) { selectedUrls.append(item.url()); @@ -299,7 +302,7 @@ void DolphinContextMenu::openItemContextMenu() QAction* propertiesAction = m_mainWindow->actionCollection()->action("properties"); m_popup->addAction(propertiesAction); - QAction* activatedAction = m_popup->exec(QCursor::pos()); + QAction* activatedAction = m_popup->exec(m_pos); if (activatedAction) { if (activatedAction == addToPlacesAction) { const KUrl selectedUrl(m_fileInfo.url()); @@ -361,7 +364,7 @@ void DolphinContextMenu::openViewportContextMenu() addShowMenuBarAction(); - QAction* action = m_popup->exec(QCursor::pos()); + QAction* action = m_popup->exec(m_pos); if (addToPlacesAction && (action == addToPlacesAction)) { const KUrl url = m_mainWindow->activeViewContainer()->url(); if (url.isValid()) { diff --git a/src/dolphincontextmenu.h b/src/dolphincontextmenu.h index 50fce4439..7f43de368 100644 --- a/src/dolphincontextmenu.h +++ b/src/dolphincontextmenu.h @@ -65,6 +65,7 @@ public: /** * @parent Pointer to the main window the context menu * belongs to. + * @pos Position in screen coordinates. * @fileInfo Pointer to the file item the context menu * is applied. If 0 is passed, the context menu * is above the viewport. @@ -72,6 +73,7 @@ public: * should be opened. */ DolphinContextMenu(DolphinMainWindow* parent, + const QPoint& pos, const KFileItem& fileInfo, const KUrl& baseUrl); @@ -190,6 +192,7 @@ private: TrashContext = 2 }; + QPoint m_pos; DolphinMainWindow* m_mainWindow; KFileItem m_fileInfo; diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 6ca6e59f7..1150b7488 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1374,13 +1374,14 @@ void DolphinMainWindow::slotSearchModeChanged(bool enabled) #endif } -void DolphinMainWindow::openContextMenu(const KFileItem& item, +void DolphinMainWindow::openContextMenu(const QPoint& pos, + const KFileItem& item, const KUrl& url, const QList& customActions) { - QPointer contextMenu = new DolphinContextMenu(this, item, url); - contextMenu->setCustomActions(customActions); - const DolphinContextMenu::Command command = contextMenu->open(); + QWeakPointer contextMenu = new DolphinContextMenu(this, pos, item, url); + contextMenu.data()->setCustomActions(customActions); + const DolphinContextMenu::Command command = contextMenu.data()->open(); switch (command) { case DolphinContextMenu::OpenParentFolderInNewWindow: { @@ -1397,7 +1398,7 @@ void DolphinMainWindow::openContextMenu(const KFileItem& item, break; } - delete contextMenu; + delete contextMenu.data(); } void DolphinMainWindow::updateToolBarMenu() @@ -2111,8 +2112,8 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) this, SLOT(toggleActiveView())); connect(view, SIGNAL(tabRequested(KUrl)), this, SLOT(openNewTab(KUrl))); - connect(view, SIGNAL(requestContextMenu(KFileItem,KUrl,QList)), - this, SLOT(openContextMenu(KFileItem,KUrl,QList))); + connect(view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList)), + this, SLOT(openContextMenu(QPoint,KFileItem,KUrl,QList))); connect(view, SIGNAL(startedPathLoading(KUrl)), this, SLOT(enableStopAction())); connect(view, SIGNAL(finishedPathLoading(KUrl)), diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index 9fb83bfa0..6736e24aa 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -439,13 +439,15 @@ private slots: /** * Opens the context menu on the current mouse position. + * @pos Position in screen coordinates. * @item File item context. If item is null, the context menu * should be applied to \a url. * @url URL which contains \a item. * @customActions Actions that should be added to the context menu, * if the file item is null. */ - void openContextMenu(const KFileItem& item, + void openContextMenu(const QPoint& pos, + const KFileItem& item, const KUrl& url, const QList& customActions); diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index 89ea457ca..ee05d7784 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -86,8 +86,8 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL this, SLOT(slotItemActivated(KFileItem))); connect(m_view, SIGNAL(tabRequested(KUrl)), this, SLOT(createNewWindow(KUrl))); - connect(m_view, SIGNAL(requestContextMenu(KFileItem,KUrl,QList)), - this, SLOT(slotOpenContextMenu(KFileItem,KUrl,QList))); + connect(m_view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList)), + this, SLOT(slotOpenContextMenu(QPoint,KFileItem,KUrl,QList))); connect(m_view, SIGNAL(selectionChanged(KFileItemList)), m_extension, SIGNAL(selectionInfo(KFileItemList))); connect(m_view, SIGNAL(selectionChanged(KFileItemList)), @@ -352,7 +352,8 @@ void DolphinPart::createNewWindow(const KUrl& url) emit m_extension->createNewWindow(url); } -void DolphinPart::slotOpenContextMenu(const KFileItem& _item, +void DolphinPart::slotOpenContextMenu(const QPoint& pos, + const KFileItem& _item, const KUrl&, const QList& customActions) { @@ -430,7 +431,7 @@ void DolphinPart::slotOpenContextMenu(const KFileItem& _item, actionGroups.insert("editactions", editActions); - emit m_extension->popupMenu(QCursor::pos(), + emit m_extension->popupMenu(pos, items, KParts::OpenUrlArguments(), KParts::BrowserArguments(), diff --git a/src/dolphinpart.h b/src/dolphinpart.h index fb4ed0afc..92ee71d2c 100644 --- a/src/dolphinpart.h +++ b/src/dolphinpart.h @@ -135,13 +135,15 @@ private Q_SLOTS: void createNewWindow(const KUrl& url); /** * Opens the context menu on the current mouse position. + * @pos Position in screen coordinates. * @item File item context. If item is null, the context menu * should be applied to \a url. * @url URL which contains \a item. * @customActions Actions that should be added to the context menu, * if the file item is null. */ - void slotOpenContextMenu(const KFileItem& item, + void slotOpenContextMenu(const QPoint& pos, + const KFileItem& item, const KUrl& url, const QList& customActions); diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index b670aa540..f3c536b52 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index 13ced1aac..deefe8e3c 100644 --- a/src/kitemviews/kitemlistcontroller.cpp +++ b/src/kitemviews/kitemlistcontroller.cpp @@ -322,33 +322,45 @@ bool KItemListController::mousePressEvent(QGraphicsSceneMouseEvent* event, const break; } - return true; - } else { if (event->buttons() & Qt::RightButton) { - m_selectionManager->clearSelection(); + emit itemContextMenuRequested(m_pressedIndex, event->screenPos()); } - KItemListRubberBand* rubberBand = m_view->rubberBand(); - QPointF startPos = m_pressedMousePos; - if (m_view->scrollOrientation() == Qt::Vertical) { - startPos.ry() += m_view->scrollOffset(); - if (m_view->itemSize().width() < 0) { - // Use a special rubberband for views that have only one column and - // expand the rubberband to use the whole width of the view. - startPos.setX(0); - } + return true; + } + + if (event->buttons() & Qt::RightButton) { + m_selectionManager->clearSelection(); + + const QRectF headerBounds = m_view->headerBoundaries(); + if (headerBounds.contains(event->pos())) { + emit headerContextMenuRequested(event->screenPos()); } else { - startPos.rx() += m_view->scrollOffset(); + emit viewContextMenuRequested(event->screenPos()); } + return true; + } - m_oldSelection = m_selectionManager->selectedItems(); - rubberBand->setStartPosition(startPos); - rubberBand->setEndPosition(startPos); - rubberBand->setActive(true); - connect(rubberBand, SIGNAL(endPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandChanged())); - m_view->setAutoScroll(true); + KItemListRubberBand* rubberBand = m_view->rubberBand(); + QPointF startPos = m_pressedMousePos; + if (m_view->scrollOrientation() == Qt::Vertical) { + startPos.ry() += m_view->scrollOffset(); + if (m_view->itemSize().width() < 0) { + // Use a special rubberband for views that have only one column and + // expand the rubberband to use the whole width of the view. + startPos.setX(0); + } + } else { + startPos.rx() += m_view->scrollOffset(); } + m_oldSelection = m_selectionManager->selectedItems(); + rubberBand->setStartPosition(startPos); + rubberBand->setEndPosition(startPos); + rubberBand->setActive(true); + connect(rubberBand, SIGNAL(endPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandChanged())); + m_view->setAutoScroll(true); + return false; } @@ -437,8 +449,6 @@ bool KItemListController::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, con } } else if (event->button() & Qt::MidButton) { emit itemMiddleClicked(index); - } else if (event->button() & Qt::RightButton) { - emit contextMenuRequested(index, QPointF(event->pos())); } } else if (clearSelection) { m_selectionManager->clearSelection(); diff --git a/src/kitemviews/kitemlistcontroller.h b/src/kitemviews/kitemlistcontroller.h index 8ef045ea3..d6205ea0a 100644 --- a/src/kitemviews/kitemlistcontroller.h +++ b/src/kitemviews/kitemlistcontroller.h @@ -108,7 +108,22 @@ public: signals: void itemActivated(int index); void itemMiddleClicked(int index); - void contextMenuRequested(int index, const QPointF& pos); + + /** + * Emitted if a context-menu is requested for the item with + * the index \a index. It is assured that the index is valid. + */ + void itemContextMenuRequested(int index, const QPointF& pos); + + /** + * Emitted if a context-menu is requested for the KItemListView. + */ + void viewContextMenuRequested(const QPointF& pos); + + /** + * Emitted if a context-menu is requested for the header of the KItemListView. + */ + void headerContextMenuRequested(const QPointF& pos); /** * Is emitted if the item with the index \p index gets hovered. diff --git a/src/kitemviews/kitemlistheader.cpp b/src/kitemviews/kitemlistheader.cpp index 0b94f327b..3187d2c36 100644 --- a/src/kitemviews/kitemlistheader.cpp +++ b/src/kitemviews/kitemlistheader.cpp @@ -19,6 +19,8 @@ #include "kitemlistheader_p.h" +#include +#include #include "kitemmodelbase.h" #include @@ -143,11 +145,15 @@ void KItemListHeader::paint(QPainter* painter, const QStyleOptionGraphicsItem* o void KItemListHeader::mousePressEvent(QGraphicsSceneMouseEvent* event) { - event->accept(); - updatePressedRoleIndex(event->pos()); - m_pressedMousePos = event->pos(); - m_roleOperation = isAboveRoleGrip(m_pressedMousePos, m_pressedRoleIndex) ? - ResizeRoleOperation : NoRoleOperation; + if (event->button() & Qt::LeftButton) { + updatePressedRoleIndex(event->pos()); + m_pressedMousePos = event->pos(); + m_roleOperation = isAboveRoleGrip(m_pressedMousePos, m_pressedRoleIndex) ? + ResizeRoleOperation : NoRoleOperation; + event->accept(); + } else { + event->ignore(); + } } void KItemListHeader::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index d5926c0f7..08c92e551 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -434,6 +434,37 @@ bool KItemListView::isTransactionActive() const return m_activeTransactions > 0; } + +void KItemListView::setHeaderShown(bool show) +{ + + if (show && !m_header) { + m_header = new KItemListHeader(this); + m_header->setPos(0, 0); + m_header->setModel(m_model); + m_header->setVisibleRoles(m_visibleRoles); + m_header->setVisibleRolesWidths(headerRolesWidths()); + m_header->setZValue(1); + + m_useHeaderWidths = false; + + connect(m_header, SIGNAL(visibleRoleWidthChanged(QByteArray,qreal,qreal)), + this, SLOT(slotVisibleRoleWidthChanged(QByteArray,qreal,qreal))); + + m_layouter->setHeaderHeight(m_header->size().height()); + } else if (!show && m_header) { + delete m_header; + m_header = 0; + m_useHeaderWidths = false; + m_layouter->setHeaderHeight(0); + } +} + +bool KItemListView::isHeaderShown() const +{ + return m_header != 0; +} + QPixmap KItemListView::createDragPixmap(const QSet& indexes) const { Q_UNUSED(indexes); @@ -1519,30 +1550,6 @@ void KItemListView::updateStretchedVisibleRolesSizes() } } -void KItemListView::setHeaderShown(bool show) -{ - if (show && !m_header) { - m_header = new KItemListHeader(this); - m_header->setPos(0, 0); - m_header->setModel(m_model); - m_header->setVisibleRoles(m_visibleRoles); - m_header->setVisibleRolesWidths(headerRolesWidths()); - m_header->setZValue(1); - - m_useHeaderWidths = false; - - connect(m_header, SIGNAL(visibleRoleWidthChanged(QByteArray,qreal,qreal)), - this, SLOT(slotVisibleRoleWidthChanged(QByteArray,qreal,qreal))); - - m_layouter->setHeaderHeight(m_header->size().height()); - } else if (!show && m_header) { - delete m_header; - m_header = 0; - m_useHeaderWidths = false; - m_layouter->setHeaderHeight(0); - } -} - qreal KItemListView::visibleRolesSizesWidthSum() const { qreal widthSum = 0; @@ -1565,6 +1572,11 @@ qreal KItemListView::visibleRolesSizesHeightSum() const return heightSum; } +QRectF KItemListView::headerBoundaries() const +{ + return m_header ? m_header->geometry() : QRectF(); +} + int KItemListView::calculateAutoScrollingIncrement(int pos, int range, int oldInc) { int inc = 0; diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h index 47de53e20..e1678145d 100644 --- a/src/kitemviews/kitemlistview.h +++ b/src/kitemviews/kitemlistview.h @@ -180,6 +180,13 @@ public: void endTransaction(); bool isTransactionActive() const; + /** + * Turns on the header if \p show is true. Per default the + * header is not shown. + */ + void setHeaderShown(bool show); + bool isHeaderShown() const; + /** * @return Pixmap that is used for a drag operation based on the * items given by \a indexes. The default implementation returns @@ -346,12 +353,6 @@ private: */ void updateStretchedVisibleRolesSizes(); - /** - * Turns on the header if \p show is true. Per default the - * header is not shown. - */ - void setHeaderShown(bool show); - /** * @return Sum of the widths of all visible roles. */ @@ -362,6 +363,12 @@ private: */ qreal visibleRolesSizesHeightSum() const; + /** + * @return Boundaries of the header. An empty rectangle is returned + * if no header is shown. + */ + QRectF headerBoundaries() const; + /** * Helper function for triggerAutoScrolling(). * @param pos Logical position of the mouse relative to the range. diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index a82008d25..83bf3a678 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -170,7 +170,9 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) : connect(controller, SIGNAL(itemActivated(int)), this, SLOT(slotItemActivated(int))); connect(controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int))); - connect(controller, SIGNAL(contextMenuRequested(int,QPointF)), this, SLOT(slotContextMenuRequested(int,QPointF))); + connect(controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF))); + connect(controller, SIGNAL(viewContextMenuRequested(QPointF)), this, SLOT(slotViewContextMenuRequested(QPointF))); + connect(controller, SIGNAL(headerContextMenuRequested(QPointF)), this, SLOT(slotHeaderContextMenuRequested(QPointF))); connect(controller, SIGNAL(itemExpansionToggleClicked(int)), this, SLOT(slotItemExpansionToggleClicked(int))); connect(controller, SIGNAL(itemHovered(int)), this, SLOT(slotItemHovered(int))); connect(controller, SIGNAL(itemUnhovered(int)), this, SLOT(slotItemUnhovered(int))); @@ -699,32 +701,6 @@ void DolphinView::mouseReleaseEvent(QMouseEvent* event) setActive(true); } -void DolphinView::contextMenuEvent(QContextMenuEvent* event) -{ - Q_UNUSED(event); - - const QPoint pos = m_container->mapFromGlobal(QCursor::pos()); - const KItemListView* view = m_container->controller()->view(); - if (view->itemAt(pos) < 0) { - // Only open the context-menu if the cursor is above the viewport - // (the context-menu for items is handled in slotContextMenuRequested()) - requestContextMenu(KFileItem(), url(), QList()); - } -} - -void DolphinView::wheelEvent(QWheelEvent* event) -{ - if (event->modifiers().testFlag(Qt::ControlModifier)) { - const int numDegrees = event->delta() / 8; - const int numSteps = numDegrees / 15; - - setZoomLevel(zoomLevel() + numSteps); - event->accept(); - } else { - event->ignore(); - } -} - void DolphinView::activate() { setActive(true); @@ -760,14 +736,63 @@ void DolphinView::slotItemMiddleClicked(int index) } } -void DolphinView::slotContextMenuRequested(int index, const QPointF& pos) +void DolphinView::slotItemContextMenuRequested(int index, const QPointF& pos) { - Q_UNUSED(pos); if (GeneralSettings::showToolTips()) { m_toolTipManager->hideToolTip(); } const KFileItem item = fileItemModel()->fileItem(index); - emit requestContextMenu(item, url(), QList()); + emit requestContextMenu(pos.toPoint(), item, url(), QList()); +} + +void DolphinView::slotViewContextMenuRequested(const QPointF& pos) +{ + if (GeneralSettings::showToolTips()) { + m_toolTipManager->hideToolTip(); + } + emit requestContextMenu(pos.toPoint(), KFileItem(), url(), QList()); +} + +void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos) +{ + QWeakPointer menu = new KMenu(QApplication::activeWindow()); + + KItemListView* view = m_container->controller()->view(); + const QSet visibleRolesSet = view->visibleRoles().toSet(); + + // Add all roles to the menu that can be shown or hidden by the user + const AdditionalInfoAccessor& infoAccessor = AdditionalInfoAccessor::instance(); + const QList keys = infoAccessor.keys(); + foreach (const DolphinView::AdditionalInfo info, keys) { + const QByteArray& role = infoAccessor.role(info); + if (role != "name") { + const QString text = fileItemModel()->roleDescription(role); + + QAction* action = menu.data()->addAction(text); + action->setCheckable(true); + action->setChecked(visibleRolesSet.contains(role)); + action->setData(info); + } + } + + QAction* action = menu.data()->exec(pos.toPoint()); + if (action) { + // Show or hide the selected role + const DolphinView::AdditionalInfo info = + static_cast(action->data().toInt()); + + const QByteArray selectedRole = infoAccessor.role(info); + QList visibleRoles = view->visibleRoles(); + if (action->isChecked()) { + const int index = keys.indexOf(info); + visibleRoles.insert(index + 1, selectedRole); + } else { + visibleRoles.removeOne(selectedRole); + } + view->setVisibleRoles(visibleRoles); + } + + delete menu.data(); } void DolphinView::slotItemExpansionToggleClicked(int index) @@ -851,18 +876,6 @@ void DolphinView::emitSelectionChangedSignal() emit selectionChanged(selectedItems()); } -void DolphinView::openContextMenu(const QPoint& pos, - const QList& customActions) -{ - KFileItem item; - const int index = m_container->controller()->view()->itemAt(pos); - if (index >= 0) { - item = fileItemModel()->fileItem(index); - } - - emit requestContextMenu(item, url(), customActions); -} - void DolphinView::dropUrls(const KFileItem& destItem, const KUrl& destPath, QDropEvent* event) diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index da74011a7..6ebd91c53 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -488,7 +488,8 @@ signals: * for the URL should be shown and the custom actions \a customActions * will be added. */ - void requestContextMenu(const KFileItem& item, + void requestContextMenu(const QPoint& pos, + const KFileItem& item, const KUrl& url, const QList& customActions); @@ -551,8 +552,6 @@ signals: protected: virtual void mouseReleaseEvent(QMouseEvent* event); - virtual void contextMenuEvent(QContextMenuEvent* event); - virtual void wheelEvent(QWheelEvent* event); private slots: /** @@ -563,7 +562,9 @@ private slots: void slotItemActivated(int index); void slotItemMiddleClicked(int index); - void slotContextMenuRequested(int index, const QPointF& pos); + void slotItemContextMenuRequested(int index, const QPointF& pos); + void slotViewContextMenuRequested(const QPointF& pos); + void slotHeaderContextMenuRequested(const QPointF& pos); void slotItemExpansionToggleClicked(int index); void slotItemHovered(int index); void slotItemUnhovered(int index); @@ -585,13 +586,6 @@ private slots: */ void emitSelectionChangedSignal(); - /** - * Opens the context menu on position \a pos. The position - * is used to check whether the context menu is related to an - * item or to the viewport. - */ - void openContextMenu(const QPoint& pos, const QList& customActions); - /** * Drops dragged URLs to the destination path \a destPath. If * the URLs are dropped above an item inside the destination path, -- 2.47.3