assureVisibleActiveColumn();
}
+void DolphinColumnView::editItem(const KFileItem& item)
+{
+ activeColumn()->editItem(item);
+}
+
void DolphinColumnView::selectAll()
{
activeColumn()->selectAll();
{
Q_UNUSED(rect);
Q_UNUSED(flags);
- //activeColumn()->setSelection(rect, flags);
}
QRegion DolphinColumnView::visualRegionForSelection(const QItemSelection& selection) const
{
Q_UNUSED(selection);
- return QRegion(); //activeColumn()->visualRegionForSelection(selection);
+ return QRegion();
}
int DolphinColumnView::horizontalOffset() const
*/
void showColumn(const KUrl& url);
+ /**
+ * Does an inline editing for the item \a item
+ * inside the active column.
+ */
+ void editItem(const KFileItem& item);
+
public slots:
/** @see QAbstractItemView::selectAll() */
virtual void selectAll();
m_proxyModel->setFilterRegExp(nameFilter);
}
+void DolphinColumnWidget::editItem(const KFileItem& item)
+{
+ const QModelIndex dirIndex = m_dolphinModel->indexForItem(item);
+ const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex);
+ if (proxyIndex.isValid()) {
+ edit(proxyIndex);
+ }
+}
QStyleOptionViewItem DolphinColumnWidget::viewOptions() const
{
if (proxyIndex.isValid() && !selectionModel()->isSelected(proxyIndex)) {
const QRect itemRect = visualRect(proxyIndex);
QPainter painter(viewport());
- painter.save();
-
QColor color = KColorScheme(QPalette::Active, KColorScheme::View).foreground().color();
color.setAlpha(32);
painter.setPen(Qt::NoPen);
painter.setBrush(color);
painter.drawRect(itemRect);
-
- painter.restore();
}
}
*/
void setNameFilter(const QString& nameFilter);
+ /**
+ * Does an inline editing for the item \a item.
+ */
+ void editItem(const KFileItem& item);
+
protected:
virtual QStyleOptionViewItem viewOptions() const;
virtual void startDrag(Qt::DropActions supportedActions);
IconManager* m_iconManager;
QRect m_dropRect;
+
+ friend class DolphinColumnView;
};
inline bool DolphinColumnWidget::isActive() const
#include <kactioncollection.h>
#include <kcolorscheme.h>
#include <kdirlister.h>
+#include <kfileitemdelegate.h>
#include <kiconeffect.h>
#include <klocale.h>
#include <kio/deletejob.h>
#include "dolphinmodel.h"
#include "dolphincolumnview.h"
#include "dolphincontroller.h"
-#include "dolphinfileitemdelegate.h"
#include "dolphinsortfilterproxymodel.h"
#include "dolphindetailsview.h"
#include "dolphiniconsview.h"
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()
m_controller->setItemView(view);
- m_fileItemDelegate = new DolphinFileItemDelegate(view);
+ m_fileItemDelegate = new KFileItemDelegate(view);
view->setItemDelegate(m_fileItemDelegate);
view->setModel(m_proxyModel);
}
}
}
+ } 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;
class DolphinController;
class DolphinColumnView;
class DolphinDetailsView;
-class DolphinFileItemDelegate;
class DolphinIconsView;
class DolphinMainWindow;
class DolphinModel;
DolphinIconsView* m_iconsView;
DolphinDetailsView* m_detailsView;
DolphinColumnView* m_columnView;
- DolphinFileItemDelegate* m_fileItemDelegate;
+ KFileItemDelegate* m_fileItemDelegate;
QItemSelectionModel* m_selectionModel;
DolphinModel* m_dolphinModel;