diff options
| author | Peter Penz <[email protected]> | 2012-05-05 22:02:21 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-05-05 22:03:21 +0200 |
| commit | 8e68c4235daee7ab269f6b497a28ea15b11ac543 (patch) | |
| tree | efb19a7935795d5f4cde2478bd56286180261c59 /src/views | |
| parent | 23fff35aeb4143b73666471d7f79f30d808e2cf2 (diff) | |
Assure that a newly created item gets selected/focused and visible
Thanks to Franz Fellner for the patch!
CCBUG: 291064
CCMAIL: [email protected]
Diffstat (limited to 'src/views')
| -rw-r--r-- | src/views/dolphinview.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 2f744386f..f738dc078 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1124,23 +1124,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(m_model, SIGNAL(directoryLoadingCompleted()), + 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 = m_model->index(m_createdItemUrl); + if (index != -1) { + selectionManager->setCurrentItem(index); + selectionManager->clearSelection(); + selectionManager->setSelected(index); + m_view->scrollToItem(index); } - disconnect(m_viewAccessor.dirModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(selectAndScrollToCreatedItem()));*/ + disconnect(m_model, SIGNAL(directoryLoadingCompleted()), + this, SLOT(selectAndScrollToCreatedItem())); m_createdItemUrl = KUrl(); } |
