From b8a4e0fac2820ec8fc442c2abeea700ae4947e01 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Wed, 18 Jun 2008 19:34:03 +0000 Subject: Assure that when requesting the context menu for the column-view, that the correct items are used. TODO for 4.2: get rid of those 'if (isColumnViewActive())' special cases and provide a generic model which also works with the way the column view is implemented BUG: 164146 svn path=/trunk/KDE/kdebase/apps/; revision=821903 --- src/dolphinview.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/dolphinview.cpp') diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 573abf85a..221d20376 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -295,6 +295,10 @@ void DolphinView::clearSelection() KFileItemList DolphinView::selectedItems() const { + if (isColumnViewActive()) { + return m_columnView->selectedItems(); + } + const QAbstractItemView* view = itemView(); // Our view has a selection, we will map them back to the DolphinModel @@ -325,12 +329,6 @@ KUrl::List DolphinView::selectedUrls() const return urls; } -KFileItem DolphinView::fileItem(const QModelIndex& index) const -{ - const QModelIndex dolphinModelIndex = m_proxyModel->mapToSource(index); - return m_dolphinModel->itemForIndex(dolphinModelIndex); -} - void DolphinView::setContentsPosition(int x, int y) { QAbstractItemView* view = itemView(); @@ -774,10 +772,14 @@ void DolphinView::emitSelectionChangedSignal() void DolphinView::openContextMenu(const QPoint& pos) { KFileItem item; - - const QModelIndex index = itemView()->indexAt(pos); - if (index.isValid() && (index.column() == DolphinModel::Name)) { - item = fileItem(index); + if (isColumnViewActive()) { + item = m_columnView->itemAt(pos); + } else { + const QModelIndex index = itemView()->indexAt(pos); + if (index.isValid() && (index.column() == DolphinModel::Name)) { + const QModelIndex dolphinModelIndex = m_proxyModel->mapToSource(index); + item = m_dolphinModel->itemForIndex(dolphinModelIndex); + } } if (m_toolTipManager != 0) { -- cgit v1.3