┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphincolumnview.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-09-21 19:39:43 +0000
committerPeter Penz <[email protected]>2007-09-21 19:39:43 +0000
commitbcbf0b44d62691f9bbbe8db8b0d006a5c996ed60 (patch)
tree4a8981cb3e0121235299c78c638876e5b27d83ba /src/dolphincolumnview.cpp
parent717823ffefa4abe4ba252700212ce1ea06193684 (diff)
restore the focus of the active column after the reloading has been finished
svn path=/trunk/KDE/kdebase/apps/; revision=715305
Diffstat (limited to 'src/dolphincolumnview.cpp')
-rw-r--r--src/dolphincolumnview.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/dolphincolumnview.cpp b/src/dolphincolumnview.cpp
index 6d4f58425..d5e1e47be 100644
--- a/src/dolphincolumnview.cpp
+++ b/src/dolphincolumnview.cpp
@@ -384,6 +384,7 @@ void ColumnWidget::deactivate()
DolphinColumnView::DolphinColumnView(QWidget* parent, DolphinController* controller) :
QAbstractItemView(parent),
m_controller(controller),
+ m_restoreActiveColumnFocus(false),
m_index(-1),
m_contentX(0),
m_columns(),
@@ -473,11 +474,18 @@ void DolphinColumnView::reload()
// the same content as the first column. As this is not wanted, all columns
// except of the first column are temporary hidden until the root index can
// be updated again.
+ m_restoreActiveColumnFocus = false;
QList<ColumnWidget*>::iterator start = m_columns.begin() + 1;
QList<ColumnWidget*>::iterator end = m_columns.end();
for (QList<ColumnWidget*>::iterator it = start; it != end; ++it) {
- (*it)->hide();
- (*it)->setRootIndex(QModelIndex());
+ ColumnWidget* column = (*it);
+ if (column->isActive() && column->hasFocus()) {
+ // because of hiding the column, it will lose the focus
+ // -> remember that the focus should be restored after reloading
+ m_restoreActiveColumnFocus = true;
+ }
+ column->hide();
+ column->setRootIndex(QModelIndex());
}
// all columns are hidden, now reload the directory lister
@@ -714,8 +722,8 @@ void DolphinColumnView::triggerReloadColumns(const QModelIndex& index)
void DolphinColumnView::reloadColumns()
{
- const int count = m_columns.count() - 1; // ignore the last column
- for (int i = 0; i < count; ++i) {
+ const int end = m_columns.count() - 2; // next to last column
+ for (int i = 0; i <= end; ++i) {
ColumnWidget* nextColumn = m_columns[i + 1];
const QModelIndex rootIndex = nextColumn->rootIndex();
if (!rootIndex.isValid()) {
@@ -724,6 +732,10 @@ void DolphinColumnView::reloadColumns()
if (proxyIndex.isValid()) {
nextColumn->setRootIndex(proxyIndex);
nextColumn->show();
+ if (nextColumn->isActive() && m_restoreActiveColumnFocus) {
+ nextColumn->setFocus();
+ m_restoreActiveColumnFocus = false;
+ }
}
}
}