Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit 5bee1889 authored by Andreas Krutzler's avatar Andreas Krutzler Committed by Nathaniel Graham

Fix scrolling during inline renaming causes rename of wrong file

Scrolling during inline renaming accepts the renaming now, like if one would hit Return for example. I chose this approach because it seems the easiest way to fix this.
This also fixes the “possible” Ui glitch where the renaming KTextField doesn’t move along with the list item. Possible glitch, because I don’t know if this is intentional, but for me it looks broken.

BUG: 378786
Fixes T7443

Test Plan:
* Enable "Rename inline" in dolphin settings
* Go to a folder where you have to scroll through items (many files, big zoom,…)
* Start to rename a file (context menu, F2, …)
* Scroll with mouse wheel
* Rename  accepted -> file is renamed

Reviewers: ngraham, rkflx, #dolphin, elvisangelaccio

Reviewed By: ngraham, rkflx, #dolphin, elvisangelaccio

Subscribers: anthonyfieroni, elvisangelaccio, #dolphin

Maniphest Tasks: T7443

Differential Revision:
parent e60e3f07
......@@ -27,7 +27,7 @@
#include "kitemlistcontroller.h"
#include "kitemlistheader.h"
#include "kitemlistselectionmanager.h"
#include "kitemlistwidget.h"
#include "kstandarditemlistwidget.h"
#include "private/kitemlistheaderwidget.h"
#include "private/kitemlistrubberband.h"
......@@ -642,7 +642,7 @@ QPixmap KItemListView::createDragPixmap(const KItemSet& indexes) const
void KItemListView::editRole(int index, const QByteArray& role)
KItemListWidget* widget = m_visibleItems.value(index);
KStandardItemListWidget* widget = qobject_cast<KStandardItemListWidget *>(m_visibleItems.value(index));
if (!widget || m_editingRole) {
......@@ -654,6 +654,9 @@ void KItemListView::editRole(int index, const QByteArray& role)
this, &KItemListView::slotRoleEditingCanceled);
connect(widget, &KItemListWidget::roleEditingFinished,
this, &KItemListView::slotRoleEditingFinished);
connect(this, &KItemListView::scrollOffsetChanged,
widget, &KStandardItemListWidget::finishRoleEditing);
void KItemListView::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
......@@ -2639,13 +2642,14 @@ bool KItemListView::hasSiblingSuccessor(int index) const
void KItemListView::disconnectRoleEditingSignals(int index)
KItemListWidget* widget = m_visibleItems.value(index);
KStandardItemListWidget* widget = qobject_cast<KStandardItemListWidget *>(m_visibleItems.value(index));
if (!widget) {
disconnect(widget, &KItemListWidget::roleEditingCanceled, this, nullptr);
disconnect(widget, &KItemListWidget::roleEditingFinished, this, nullptr);
disconnect(this, &KItemListView::scrollOffsetChanged, widget, nullptr);
int KItemListView::calculateAutoScrollingIncrement(int pos, int range, int oldInc)
......@@ -860,6 +860,13 @@ bool KStandardItemListWidget::event(QEvent *event)
return KItemListWidget::event(event);
void KStandardItemListWidget::finishRoleEditing()
if (!editedRole().isEmpty() && m_roleEditor) {
slotRoleEditingFinished(editedRole(), KIO::encodeFileName(m_roleEditor->toPlainText()));
void KStandardItemListWidget::slotCutItemsChanged()
const QUrl itemUrl = data().value("url").toUrl();
......@@ -185,6 +185,9 @@ protected:
virtual void hideEvent(QHideEvent* event) Q_DECL_OVERRIDE;
bool event(QEvent *event) Q_DECL_OVERRIDE;
public slots:
void finishRoleEditing();
private slots:
void slotCutItemsChanged();
void slotRoleEditingCanceled(const QByteArray& role, const QVariant& value);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment