diff options
| author | Peter Penz <[email protected]> | 2007-07-28 23:35:53 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-07-28 23:35:53 +0000 |
| commit | 83e0633d3522d330027fa723be6c85ceb5603578 (patch) | |
| tree | 624700528212081956bbf239ab98eee0db2b31ea /src/dolphincolumnview.cpp | |
| parent | 14783157baf0d812b8c168aed67aeca362c5710e (diff) | |
fix some drag & drop issues
svn path=/trunk/KDE/kdebase/apps/; revision=693766
Diffstat (limited to 'src/dolphincolumnview.cpp')
| -rw-r--r-- | src/dolphincolumnview.cpp | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/dolphincolumnview.cpp b/src/dolphincolumnview.cpp index 3c8a43e2b..f7f348cdf 100644 --- a/src/dolphincolumnview.cpp +++ b/src/dolphincolumnview.cpp @@ -165,23 +165,24 @@ void ColumnWidget::updateSelection(const KUrl& url) setSelectionMode(SingleSelection); QItemSelectionModel* selModel = selectionModel(); if (url.isEmpty()) { - selModel->clear(); - return; - } - - const QAbstractProxyModel* proxyModel = static_cast<const QAbstractProxyModel*>(m_view->model()); - const KDirModel* dirModel = static_cast<const KDirModel*>(proxyModel->sourceModel()); - const QModelIndex dirIndex = dirModel->indexForUrl(url); - const QModelIndex proxyIndex = proxyModel->mapFromSource(dirIndex); + if (!m_active) { + selModel->clear(); + } + } else { + const QAbstractProxyModel* proxyModel = static_cast<const QAbstractProxyModel*>(m_view->model()); + const KDirModel* dirModel = static_cast<const KDirModel*>(proxyModel->sourceModel()); + const QModelIndex dirIndex = dirModel->indexForUrl(url); + const QModelIndex proxyIndex = proxyModel->mapFromSource(dirIndex); - const QItemSelection selection = selModel->selection(); - const bool isIndexSelected = selModel->isSelected(proxyIndex); + const QItemSelection selection = selModel->selection(); + const bool isIndexSelected = selModel->isSelected(proxyIndex); - if (!m_active && ((selection.count() > 1) || !isIndexSelected)) { - selModel->clear(); - } - if (!isIndexSelected) { - selModel->select(proxyIndex, QItemSelectionModel::Select); + if (!m_active && ((selection.count() > 1) || !isIndexSelected)) { + selModel->clear(); + } + if (!isIndexSelected) { + selModel->select(proxyIndex, QItemSelectionModel::Select); + } } } @@ -234,10 +235,6 @@ void ColumnWidget::dropEvent(QDropEvent* event) void ColumnWidget::mousePressEvent(QMouseEvent* event) { - if (m_active) { - selectionModel()->clear(); - } - QListView::mousePressEvent(event); const QModelIndex index = indexAt(event->pos()); |
