┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-06-20 20:48:36 +0000
committerPeter Penz <[email protected]>2007-06-20 20:48:36 +0000
commit15f50df9f6944bee79d5f81c8ccfc7bc206d9d99 (patch)
treebc1a7313f6ef5062422501f83f82fd879fa1c60a
parentcd780167c3921d3803d60f58564d2446325dd599 (diff)
don't pass a custom viewport URL to the context menu anymore, as this cannot work together with the menu actions
svn path=/trunk/KDE/kdebase/apps/; revision=678175
-rw-r--r--src/dolphincolumnview.cpp11
-rw-r--r--src/dolphincontroller.cpp4
-rw-r--r--src/dolphincontroller.h6
-rw-r--r--src/dolphindetailsview.cpp2
-rw-r--r--src/dolphiniconsview.cpp2
-rw-r--r--src/dolphinview.cpp8
-rw-r--r--src/dolphinview.h7
7 files changed, 21 insertions, 19 deletions
diff --git a/src/dolphincolumnview.cpp b/src/dolphincolumnview.cpp
index 2941cab87..81337cb20 100644
--- a/src/dolphincolumnview.cpp
+++ b/src/dolphincolumnview.cpp
@@ -231,8 +231,15 @@ void ColumnWidget::contextMenuEvent(QContextMenuEvent* event)
}
QListView::contextMenuEvent(event);
- const QPoint pos = m_view->viewport()->mapFromGlobal(event->globalPos());
- m_view->m_controller->triggerContextMenuRequest(pos, m_url);
+
+ const QModelIndex index = indexAt(event->pos());
+ const KUrl& navigatorUrl = m_view->m_controller->url();
+ if (index.isValid() || (m_url == navigatorUrl)) {
+ // Only open a context menu above an item or if the mouse is above
+ // the active column.
+ const QPoint pos = m_view->viewport()->mapFromGlobal(event->globalPos());
+ m_view->m_controller->triggerContextMenuRequest(pos);
+ }
}
void ColumnWidget::activate()
diff --git a/src/dolphincontroller.cpp b/src/dolphincontroller.cpp
index 413152522..1831c15c3 100644
--- a/src/dolphincontroller.cpp
+++ b/src/dolphincontroller.cpp
@@ -34,10 +34,10 @@ DolphinController::~DolphinController()
{
}
-void DolphinController::triggerContextMenuRequest(const QPoint& pos, const KUrl& url)
+void DolphinController::triggerContextMenuRequest(const QPoint& pos)
{
emit activated();
- emit requestContextMenu(pos, url);
+ emit requestContextMenu(pos);
}
void DolphinController::triggerActivation()
diff --git a/src/dolphincontroller.h b/src/dolphincontroller.h
index c45c55980..aa0eab22f 100644
--- a/src/dolphincontroller.h
+++ b/src/dolphincontroller.h
@@ -60,7 +60,7 @@ public:
inline void setUrl(const KUrl& url);
inline const KUrl& url() const;
- void triggerContextMenuRequest(const QPoint& pos, const KUrl& url);
+ void triggerContextMenuRequest(const QPoint& pos);
void triggerActivation();
@@ -116,10 +116,8 @@ signals:
* context menu should be opened. It is recommended
* to get the corresponding model index from
* this position.
- * @param url URL of the viewport, if there is no valid model
- * index on the given position.
*/
- void requestContextMenu(const QPoint& pos, const KUrl& url);
+ void requestContextMenu(const QPoint& pos);
/**
* Is emitted if the view has been activated by e. g. a mouse click.
diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp
index 3672fe18c..ba82fc901 100644
--- a/src/dolphindetailsview.cpp
+++ b/src/dolphindetailsview.cpp
@@ -150,7 +150,7 @@ QStyleOptionViewItem DolphinDetailsView::viewOptions() const
void DolphinDetailsView::contextMenuEvent(QContextMenuEvent* event)
{
QTreeView::contextMenuEvent(event);
- m_controller->triggerContextMenuRequest(event->pos(), m_controller->url());
+ m_controller->triggerContextMenuRequest(event->pos());
}
void DolphinDetailsView::mousePressEvent(QMouseEvent* event)
diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp
index 4a3bdfbbe..d2bac6b13 100644
--- a/src/dolphiniconsview.cpp
+++ b/src/dolphiniconsview.cpp
@@ -103,7 +103,7 @@ QStyleOptionViewItem DolphinIconsView::viewOptions() const
void DolphinIconsView::contextMenuEvent(QContextMenuEvent* event)
{
KListView::contextMenuEvent(event);
- m_controller->triggerContextMenuRequest(event->pos(), m_controller->url());
+ m_controller->triggerContextMenuRequest(event->pos());
}
void DolphinIconsView::mousePressEvent(QMouseEvent* event)
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp
index eb702393a..4964010c5 100644
--- a/src/dolphinview.cpp
+++ b/src/dolphinview.cpp
@@ -89,8 +89,8 @@ DolphinView::DolphinView(QWidget* parent,
m_controller = new DolphinController(this);
m_controller->setUrl(url);
- connect(m_controller, SIGNAL(requestContextMenu(const QPoint&, const KUrl&)),
- this, SLOT(openContextMenu(const QPoint&, const KUrl&)));
+ connect(m_controller, SIGNAL(requestContextMenu(const QPoint&)),
+ this, SLOT(openContextMenu(const QPoint&)));
connect(m_controller, SIGNAL(urlsDropped(const KUrl::List&, const QModelIndex&, QWidget*)),
this, SLOT(dropUrls(const KUrl::List&, const QModelIndex&, QWidget*)));
connect(m_controller, SIGNAL(sortingChanged(DolphinView::Sorting)),
@@ -698,7 +698,7 @@ void DolphinView::changeSelection(const KFileItemList& selection)
| QItemSelectionModel::Current);
}
-void DolphinView::openContextMenu(const QPoint& pos, const KUrl& url)
+void DolphinView::openContextMenu(const QPoint& pos)
{
KFileItem* item = 0;
@@ -707,7 +707,7 @@ void DolphinView::openContextMenu(const QPoint& pos, const KUrl& url)
item = fileItem(index);
}
- emit requestContextMenu(item, url);
+ emit requestContextMenu(item, url());
}
void DolphinView::dropUrls(const KUrl::List& urls,
diff --git a/src/dolphinview.h b/src/dolphinview.h
index 0d8ffea19..1a240be7a 100644
--- a/src/dolphinview.h
+++ b/src/dolphinview.h
@@ -413,12 +413,9 @@ private slots:
/**
* Opens the context menu on position \a pos. The position
* is used to check whether the context menu is related to an
- * item or to the viewport. If the context menu should be
- * opened on the viewport, the URL \a url should be taken
- * as viewport URL (the viewport URL can be different from
- * DolphinView::url() for e. g. the column view).
+ * item or to the viewport.
*/
- void openContextMenu(const QPoint& pos, const KUrl& url);
+ void openContextMenu(const QPoint& pos);
/**
* Drops the URLs \a urls to the index \a index. \a source