diff options
| author | Peter Penz <[email protected]> | 2011-10-08 21:40:34 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-10-08 21:43:55 +0200 |
| commit | 6551c000fc68134932cdc21f2cc7086b34bff30b (patch) | |
| tree | f4892d247c13f988ee68de37ea1700aaf6e80ab2 /src/dolphinmainwindow.cpp | |
| parent | b1b5a6db2e8b9b1fc175d068ba393925d95c9dc6 (diff) | |
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.
Diffstat (limited to 'src/dolphinmainwindow.cpp')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
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<QAction*>& customActions) { - QPointer<DolphinContextMenu> contextMenu = new DolphinContextMenu(this, item, url); - contextMenu->setCustomActions(customActions); - const DolphinContextMenu::Command command = contextMenu->open(); + QWeakPointer<DolphinContextMenu> 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<QAction*>)), - this, SLOT(openContextMenu(KFileItem,KUrl,QList<QAction*>))); + connect(view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)), + this, SLOT(openContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>))); connect(view, SIGNAL(startedPathLoading(KUrl)), this, SLOT(enableStopAction())); connect(view, SIGNAL(finishedPathLoading(KUrl)), |
