From 15b34a0d05e62f2056120003423a33e79329b0c4 Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Mon, 10 Jun 2013 21:15:53 +0200 Subject: Do not rename files unexpectedly when changing the URL If the role editor loses focus, it considers the current renaming operation finished, and tells DolphinView to rename the file. This is a problem when changing the directory, because the URL change happens before DolphinView receives the signal, which results in a file in the new directory being renamed unexpectedly. The solution is to establish the connection to the slotRoleEditingFinished signal only when the "rename inline" editor is opened, and disconnect it when renaming is finished or canceled or the URL changes. BUG: 319912 FIXED-IN: 4.10.5 REVIEW: 110908 --- src/kitemviews/private/kitemlistroleeditor.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src/kitemviews/private/kitemlistroleeditor.cpp') diff --git a/src/kitemviews/private/kitemlistroleeditor.cpp b/src/kitemviews/private/kitemlistroleeditor.cpp index 9f3b53c05..9f20afea2 100644 --- a/src/kitemviews/private/kitemlistroleeditor.cpp +++ b/src/kitemviews/private/kitemlistroleeditor.cpp @@ -25,7 +25,6 @@ KItemListRoleEditor::KItemListRoleEditor(QWidget *parent) : KTextEdit(parent), - m_index(0), m_role(), m_blockFinishedSignal(false) { @@ -46,16 +45,6 @@ KItemListRoleEditor::~KItemListRoleEditor() { } -void KItemListRoleEditor::setIndex(int index) -{ - m_index = index; -} - -int KItemListRoleEditor::index() const -{ - return m_index; -} - void KItemListRoleEditor::setRole(const QByteArray& role) { m_role = role; @@ -95,7 +84,7 @@ void KItemListRoleEditor::keyPressEvent(QKeyEvent* event) // a roleEditingFinished signal (see KItemListRoleEditor::event), // which is not wanted in this case. m_blockFinishedSignal = true; - emit roleEditingCanceled(m_index, m_role, KIO::encodeFileName(toPlainText())); + emit roleEditingCanceled(m_role, KIO::encodeFileName(toPlainText())); m_blockFinishedSignal = false; event->accept(); return; @@ -139,7 +128,7 @@ void KItemListRoleEditor::autoAdjustSize() void KItemListRoleEditor::emitRoleEditingFinished() { if (!m_blockFinishedSignal) { - emit roleEditingFinished(m_index, m_role, KIO::encodeFileName(toPlainText())); + emit roleEditingFinished(m_role, KIO::encodeFileName(toPlainText())); } } -- cgit v1.3