diff options
| author | Peter Penz <[email protected]> | 2008-03-23 15:53:12 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-03-23 15:53:12 +0000 |
| commit | cfb135f24e6b1b3eb1253c8ebf7c8e7307974eea (patch) | |
| tree | 4a40a81a98197fa220256fd229f17ef8a40229fc /src/dolphinview.cpp | |
| parent | 71afbc513b7894ca86b89a1a3b3b55ff93d662bd (diff) | |
provide an option to rename files inline
CCMAIL: [email protected]
svn path=/trunk/KDE/kdebase/apps/; revision=789208
Diffstat (limited to 'src/dolphinview.cpp')
| -rw-r--r-- | src/dolphinview.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 4800b9e9a..3f8933bd3 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -31,6 +31,7 @@ #include <kactioncollection.h> #include <kcolorscheme.h> #include <kdirlister.h> +#include <kfileitemdelegate.h> #include <kiconeffect.h> #include <klocale.h> #include <kio/deletejob.h> @@ -49,7 +50,6 @@ #include "dolphinmodel.h" #include "dolphincolumnview.h" #include "dolphincontroller.h" -#include "dolphinfileitemdelegate.h" #include "dolphinsortfilterproxymodel.h" #include "dolphindetailsview.h" #include "dolphiniconsview.h" @@ -866,16 +866,12 @@ void DolphinView::emitContentsMoved() void DolphinView::showHoverInformation(const KFileItem& item) { - if (!hasSelection()) { - emit requestItemInfo(item); - } + emit requestItemInfo(item); } void DolphinView::clearHoverInformation() { - if (m_active) { - emit requestItemInfo(KFileItem()); - } + emit requestItemInfo(KFileItem()); } void DolphinView::createView() @@ -909,7 +905,7 @@ void DolphinView::createView() m_controller->setItemView(view); - m_fileItemDelegate = new DolphinFileItemDelegate(view); + m_fileItemDelegate = new KFileItemDelegate(view); view->setItemDelegate(m_fileItemDelegate); view->setModel(m_proxyModel); @@ -1021,14 +1017,19 @@ void DolphinView::renameSelectedItems() } } } + } else if (DolphinSettings::instance().generalSettings()->renameInline()) { + Q_ASSERT(items.count() == 1); + + if (isColumnViewActive()) { + m_columnView->editItem(items.first()); + } else { + const QModelIndex dirIndex = m_dolphinModel->indexForItem(items.first()); + const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex); + itemView()->edit(proxyIndex); + } } else { - // Only one item has been selected for renaming. Use the custom - // renaming mechanism from the views. Q_ASSERT(items.count() == 1); - // TODO: Think about using KFileItemDelegate as soon as it supports editing. - // Currently the RenameDialog is used, but I'm not sure whether inline renaming - // is a benefit for the user at all -> let's wait for some input first... RenameDialog dialog(this, items); if (dialog.exec() == QDialog::Rejected) { return; |
