┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphiniconsview.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2006-12-02 21:51:36 +0000
committerPeter Penz <[email protected]>2006-12-02 21:51:36 +0000
commitc94276725b1452d9f899dec192a8e66ecb9a516d (patch)
tree3694c3570d7e9c1007cd59f09971275ddb435b7d /src/dolphiniconsview.cpp
parent4f951f75e2f21e3c1748e13e1978d5770daabb8c (diff)
reanimated the context menu
svn path=/trunk/playground/utils/dolphin/; revision=609962
Diffstat (limited to 'src/dolphiniconsview.cpp')
-rw-r--r--src/dolphiniconsview.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp
index 9372ae9e0..4cd4bdddc 100644
--- a/src/dolphiniconsview.cpp
+++ b/src/dolphiniconsview.cpp
@@ -21,6 +21,9 @@
#include "dolphiniconsview.h"
#include "dolphinview.h"
+#include <kdirmodel.h>
+#include <kfileitem.h>
+
DolphinIconsView::DolphinIconsView(DolphinView* parent) :
QListView(parent),
m_parentView( parent )
@@ -32,9 +35,28 @@ DolphinIconsView::~DolphinIconsView()
{
}
-void DolphinIconsView::mouseReleaseEvent(QMouseEvent *e)
+void DolphinIconsView::mousePressEvent(QMouseEvent* event)
+{
+ QListView::mousePressEvent(event);
+
+ if (event->button() != Qt::RightButton) {
+ return;
+ }
+
+ KFileItem* item = 0;
+
+ const QModelIndex index = indexAt(event->pos());
+ if (index.isValid()) {
+ KDirModel* dirModel = static_cast<KDirModel*>(model());
+ item = dirModel->itemForIndex(index);
+ }
+
+ m_parentView->openContextMenu(item, event->globalPos());
+}
+
+void DolphinIconsView::mouseReleaseEvent(QMouseEvent* event)
{
- QListView::mouseReleaseEvent(e);
+ QListView::mouseReleaseEvent(event);
m_parentView->declareViewActive();
}