┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphincontextmenu.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2011-10-08 21:40:34 +0200
committerPeter Penz <[email protected]>2011-10-08 21:43:55 +0200
commit6551c000fc68134932cdc21f2cc7086b34bff30b (patch)
treef4892d247c13f988ee68de37ea1700aaf6e80ab2 /src/dolphincontextmenu.cpp
parentb1b5a6db2e8b9b1fc175d068ba393925d95c9dc6 (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/dolphincontextmenu.cpp')
-rw-r--r--src/dolphincontextmenu.cpp11
1 files changed, 7 insertions, 4 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()) {