┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphincontextmenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dolphincontextmenu.cpp')
-rw-r--r--src/dolphincontextmenu.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp
index 7d195df66..8fbcbf3f5 100644
--- a/src/dolphincontextmenu.cpp
+++ b/src/dolphincontextmenu.cpp
@@ -65,7 +65,8 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent,
m_customActions(),
m_popup(new KMenu(m_mainWindow)),
m_showDeleteCommand(false),
- m_shiftIsPressed(false)
+ m_shiftPressed(false),
+ m_keyInfo()
{
// The context menu either accesses the URLs of the selected items
// or the items itself. To increase the performance both lists are cached.
@@ -74,6 +75,12 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent,
m_selectedItems = view->selectedItems();
m_showDeleteCommand = KGlobal::config()->group("KDE").readEntry("ShowDeleteCommand", false);
+
+ if (m_keyInfo.isKeyPressed(Qt::Key_Shift) || m_keyInfo.isKeyLatched(Qt::Key_Shift)) {
+ m_shiftPressed = true;
+ }
+
+ connect(&m_keyInfo, SIGNAL(keyPressed(Qt::Key, bool)), this, SLOT(deleteOrTrashMenuEntry(Qt::Key, bool)));
}
DolphinContextMenu::~DolphinContextMenu()
@@ -336,8 +343,8 @@ void DolphinContextMenu::insertDefaultItemActions()
collection->action("delete")->setVisible(true);
}
- if(m_shiftIsPressed) {
- deleteOrTrashMenuEntry(Qt::Key_Shift, m_shiftIsPressed);
+ if(m_shiftPressed) {
+ deleteOrTrashMenuEntry(Qt::Key_Shift, m_shiftPressed);
}
}
@@ -432,11 +439,6 @@ void DolphinContextMenu::addCustomActions()
}
}
-void DolphinContextMenu::setShiftIsPressed(bool pressed)
-{
- m_shiftIsPressed = pressed;
-}
-
void DolphinContextMenu::deleteOrTrashMenuEntry(Qt::Key key, bool pressed)
{
if(m_mainWindow->activeViewContainer()->url().isLocalFile() && !m_showDeleteCommand && key == Qt::Key_Shift) {