┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-07-29 20:30:16 +0000
committerPeter Penz <[email protected]>2007-07-29 20:30:16 +0000
commit7230f4bb55b0f1b3e7d57d0538d49d01b3ead56e (patch)
treea34e6f616dee27ae0eda2e277b0c6887ace9ea2a /src
parent465528755c2f15d6c2fe4fedaf3b16994ab81f4c (diff)
minor fixes regarding inactive columns
svn path=/trunk/KDE/kdebase/apps/; revision=694026
Diffstat (limited to 'src')
-rw-r--r--src/dolphincolumnview.cpp56
1 files changed, 33 insertions, 23 deletions
diff --git a/src/dolphincolumnview.cpp b/src/dolphincolumnview.cpp
index 126806415..3389e15bf 100644
--- a/src/dolphincolumnview.cpp
+++ b/src/dolphincolumnview.cpp
@@ -69,6 +69,9 @@ protected:
virtual void paintEvent(QPaintEvent* event);
virtual void contextMenuEvent(QContextMenuEvent* event);
+protected slots:
+ virtual void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
+
private:
/** Used by ColumnWidget::setActive(). */
void activate();
@@ -204,9 +207,6 @@ void ColumnWidget::dropEvent(QDropEvent* event)
void ColumnWidget::mousePressEvent(QMouseEvent* event)
{
- QListView::mousePressEvent(event);
-
- bool requestActivation = false;
const QModelIndex index = indexAt(event->pos());
if (index.isValid()) {
// A click on an item has been done. Only request an activation
@@ -218,22 +218,21 @@ void ColumnWidget::mousePressEvent(QMouseEvent* event)
if (item != 0) {
if (item->isDir()) {
m_childUrl = item->url();
+ viewport()->update();
} else {
- requestActivation = true;
+ m_view->requestActivation(this);
}
}
} else {
// a click on the viewport has been done
- requestActivation = true;
+ m_view->requestActivation(this);
// Swallow mouse move events if a click is done on the viewport. Otherwise the QColumnView
// triggers an unwanted loading of directories on hovering folder items.
m_swallowMouseMoveEvents = true;
}
- if (requestActivation) {
- m_view->requestActivation(this);
- }
+ QListView::mousePressEvent(event);
}
void ColumnWidget::mouseMoveEvent(QMouseEvent* event)
@@ -253,23 +252,25 @@ void ColumnWidget::mouseReleaseEvent(QMouseEvent* event)
void ColumnWidget::paintEvent(QPaintEvent* event)
{
- // indicate the shown URL of the next column by highlighting the shown folder item
- const QAbstractProxyModel* proxyModel = static_cast<const QAbstractProxyModel*>(m_view->model());
- const KDirModel* dirModel = static_cast<const KDirModel*>(proxyModel->sourceModel());
- const QModelIndex dirIndex = dirModel->indexForUrl(m_childUrl);
- const QModelIndex proxyIndex = proxyModel->mapFromSource(dirIndex);
- if (proxyIndex.isValid()) {
- const QRect itemRect = visualRect(proxyIndex);
- QPainter painter(viewport());
- painter.save();
+ if (!m_childUrl.isEmpty()) {
+ // indicate the shown URL of the next column by highlighting the shown folder item
+ const QAbstractProxyModel* proxyModel = static_cast<const QAbstractProxyModel*>(m_view->model());
+ const KDirModel* dirModel = static_cast<const KDirModel*>(proxyModel->sourceModel());
+ const QModelIndex dirIndex = dirModel->indexForUrl(m_childUrl);
+ const QModelIndex proxyIndex = proxyModel->mapFromSource(dirIndex);
+ if (proxyIndex.isValid() && !selectionModel()->isSelected(proxyIndex)) {
+ const QRect itemRect = visualRect(proxyIndex);
+ QPainter painter(viewport());
+ painter.save();
- QColor color = KColorScheme(KColorScheme::View).foreground();
- color.setAlpha(32);
- painter.setPen(Qt::NoPen);
- painter.setBrush(color);
- painter.drawRect(itemRect);
+ QColor color = KColorScheme(KColorScheme::View).foreground();
+ color.setAlpha(32);
+ painter.setPen(Qt::NoPen);
+ painter.setBrush(color);
+ painter.drawRect(itemRect);
- painter.restore();
+ painter.restore();
+ }
}
QListView::paintEvent(event);
@@ -298,6 +299,15 @@ void ColumnWidget::contextMenuEvent(QContextMenuEvent* event)
}
}
+void ColumnWidget::selectionChanged(const QItemSelection& selected, const QItemSelection& deselected)
+{
+ // inactive views should not have any selection
+ if (!m_active) {
+ clearSelection();
+ }
+ QListView::selectionChanged(selected, deselected);
+}
+
void ColumnWidget::activate()
{
const QColor bgColor = KColorScheme(KColorScheme::View).background();