diff options
| author | Peter Penz <[email protected]> | 2010-09-20 19:52:40 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2010-09-20 19:52:40 +0000 |
| commit | c7e8c4af3dbcec9973a161c319fcd63fd1086f23 (patch) | |
| tree | ab9b3374638b1be7352b9329b9ca0329f43d9710 /src/dolphincontextmenu.cpp | |
| parent | 4822c2cc3bcdc70d73bb76dd627b04312d463265 (diff) | |
Workaround for a X11-issue in combination with KModifierKeyInfo: When constructing KModifierKeyInfo in the constructor of the context menu, the user interface might freeze. Thanks to Mark Gaiser for clarifying this with the KModifierKeyInfo maintainer and testing the workaround!
CCMAIL: [email protected]
svn path=/trunk/KDE/kdebase/apps/; revision=1177658
Diffstat (limited to 'src/dolphincontextmenu.cpp')
| -rw-r--r-- | src/dolphincontextmenu.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index 2a2994086..116edf4f0 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -53,6 +53,8 @@ #include "views/dolphinview.h" #include "views/viewmodecontroller.h" +KModifierKeyInfo* DolphinContextMenu::m_keyInfo = 0; + DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent, const KFileItem& fileInfo, const KUrl& baseUrl) : @@ -65,7 +67,6 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent, m_customActions(), m_popup(new KMenu(m_mainWindow)), m_shiftPressed(false), - m_keyInfo(), m_removeAction(0) { // The context menu either accesses the URLs of the selected items @@ -74,13 +75,14 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent, m_selectedUrls = view->selectedUrls(); m_selectedItems = view->selectedItems(); - if (m_keyInfo.isKeyPressed(Qt::Key_Shift) || m_keyInfo.isKeyLatched(Qt::Key_Shift)) { - m_shiftPressed = true; + if (m_keyInfo != 0) { + 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(slotKeyModifierPressed(Qt::Key, bool))); } - connect(&m_keyInfo, SIGNAL(keyPressed(Qt::Key, bool)), - this, SLOT(slotKeyModifierPressed(Qt::Key, bool))); - m_removeAction = new QAction(this); connect(m_removeAction, SIGNAL(triggered()), this, SLOT(slotRemoveActionTriggered())); } @@ -123,6 +125,13 @@ void DolphinContextMenu::open() } } +void DolphinContextMenu::initializeModifierKeyInfo() +{ + if (m_keyInfo == 0) { + m_keyInfo = new KModifierKeyInfo(); + } +} + void DolphinContextMenu::slotKeyModifierPressed(Qt::Key key, bool pressed) { m_shiftPressed = (key == Qt::Key_Shift) && pressed; |
