#include "viewproperties.h"
#include "zoomlevelinfo.h"
-#include <kdebug.h>
-
/**
* Helper function for sorting items with qSort() in
* DolphinView::renameSelectedItems().
m_previewGenerator(0),
m_toolTipManager(0),
m_rootUrl(),
- m_currentItemUrl(),
+ m_activeItemUrl(),
m_createdItemUrl(),
m_selectedItems(),
m_newFileNames(),
const QModelIndex currentIndex = selModel->currentIndex();
selModel->setCurrentIndex(currentIndex, QItemSelectionModel::Current |
QItemSelectionModel::Clear);
+ m_selectedItems.clear();
}
KFileItemList DolphinView::selectedItems() const
return m_columnView->selectedItems().count();
}
- return itemView()->selectionModel()->selection().count();
+ return itemView()->selectionModel()->selectedIndexes().count();
}
void DolphinView::setContentsPosition(int x, int y)
void DolphinView::setUrl(const KUrl& url)
{
m_newFileNames.clear();
-
- // remember current item candidate (see slotDirListerCompleted())
- m_currentItemUrl = url;
updateView(url, KUrl());
}
return;
}
delete dialog;
+
+ // the selection would be invalid after renaming the items, so just clear
+ // it before
+ clearSelection();
// TODO: check how this can be integrated into KIO::FileUndoManager/KonqOperations
// as one operation instead of n rename operations like it is done now...
return m_tabsForFiles;
}
+void DolphinView::activateItem(const KUrl& url)
+{
+ m_activeItemUrl = url;
+}
+
bool DolphinView::itemsExpandable() const
{
return (m_detailsView != 0) && m_detailsView->itemsExpandable();
void DolphinView::slotDirListerCompleted()
{
- if (!m_currentItemUrl.isEmpty()) {
+ if (!m_activeItemUrl.isEmpty()) {
// assure that the current item remains visible
- const QModelIndex dirIndex = m_dolphinModel->indexForUrl(m_currentItemUrl);
+ const QModelIndex dirIndex = m_dolphinModel->indexForUrl(m_activeItemUrl);
if (dirIndex.isValid()) {
const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex);
QAbstractItemView* view = itemView();
if (clearSelection) {
view->clearSelection();
}
+ m_activeItemUrl.clear();
}
- m_currentItemUrl.clear();
}
if (!m_newFileNames.isEmpty()) {