summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <peter.penz19@gmail.com>2012-05-05 19:51:26 (GMT)
committerPeter Penz <peter.penz19@gmail.com>2012-05-05 19:58:08 (GMT)
commit0139537a35d636356fa088c61557baf13bb2e71b (patch)
tree3510f690e5d7ef161c9c6122a1f55576c70f4ab3
parentd9b4bc1a5a5b708755fc1919fe8c6a5f0d0c9878 (diff)
Assure that a newly created item gets selected/focused and visible
Thanks to Franz Fellner for the patch! BUG: 291064 FIXED-IN: 4.8.4 CCMAIL: alpine.art.de@googlemail.com
-rw-r--r--dolphin/src/views/dolphinview.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/dolphin/src/views/dolphinview.cpp b/dolphin/src/views/dolphinview.cpp
index 3a220e7..c5b2004 100644
--- a/dolphin/src/views/dolphinview.cpp
+++ b/dolphin/src/views/dolphinview.cpp
@@ -1015,23 +1015,23 @@ KFileItem DolphinView::rootItem() const
void DolphinView::observeCreatedItem(const KUrl& url)
{
m_createdItemUrl = url;
- //connect(m_dirModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
- // this, SLOT(selectAndScrollToCreatedItem()));
+ connect(fileItemModel(), SIGNAL(loadingCompleted()),
+ this, SLOT(selectAndScrollToCreatedItem()));
}
void DolphinView::selectAndScrollToCreatedItem()
{
- /*const QModelIndex dirIndex = m_viewAccessor.dirModel()->indexForUrl(m_createdItemUrl);
- if (dirIndex.isValid()) {
- const QModelIndex proxyIndex = m_viewAccessor.proxyModel()->mapFromSource(dirIndex);
- QAbstractItemView* view = m_viewAccessor.itemView();
- if (view) {
- view->setCurrentIndex(proxyIndex);
- }
+ KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
+ const int index = fileItemModel()->index(m_createdItemUrl);
+ if (index != -1) {
+ selectionManager->setCurrentItem(index);
+ selectionManager->clearSelection();
+ selectionManager->setSelected(index);
+ m_container->controller()->view()->scrollToItem(index);
}
- disconnect(m_viewAccessor.dirModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
- this, SLOT(selectAndScrollToCreatedItem()));*/
+ disconnect(fileItemModel(), SIGNAL(loadingCompleted()),
+ this, SLOT(selectAndScrollToCreatedItem()));
m_createdItemUrl = KUrl();
}