[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kde-baseapps/KDE/4.9] dolphin/src/views: Do not show an incorrect file name after a failed rename o
From: Frank Reininghaus <frank78ac () googlemail ! com>
Date: 2012-10-31 22:07:43
Message-ID: 20121031220743.8AAB7A6078 () git ! kde ! org
[Download RAW message or body]
Git commit 7cff47b01254f35bf413eac5d9d336f77c6f5fd9 by Frank Reininghaus.
Committed on 31/10/2012 at 23:06.
Pushed by freininghaus into branch 'KDE/4.9'.
Do not show an incorrect file name after a failed rename operation
BUG: 303742
FIXED-IN: 4.9.3
M +12 -3 dolphin/src/views/dolphinview.cpp
http://commits.kde.org/kde-baseapps/7cff47b01254f35bf413eac5d9d336f77c6f5fd9
diff --git a/dolphin/src/views/dolphinview.cpp b/dolphin/src/views/dolphinview.cpp
index 624aa18..8e1a191 100644
--- a/dolphin/src/views/dolphinview.cpp
+++ b/dolphin/src/views/dolphinview.cpp
@@ -1348,9 +1348,18 @@ void DolphinView::slotRoleEditingFinished(int index, const \
QByteArray& role, con
if (!newName.isEmpty() && newName != oldItem.text() && newName != \
QLatin1String(".") && newName != QLatin1String("..")) { const KUrl oldUrl = \
oldItem.url();
- QHash<QByteArray, QVariant> data;
- data.insert(role, value);
- m_model->setData(index, data);
+ const KUrl newUrl(url().path(KUrl::AddTrailingSlash) + newName);
+ const bool newNameExistsAlready = (m_model->index(newUrl) >= 0);
+ if (!newNameExistsAlready) {
+ // Only change the data in the model if no item with the new name
+ // is in the model yet. If there is an item with the new name
+ // already, calling KonqOperations::rename() will open a dialog
+ // asking for a new name, and KFileItemModel will update the
+ // data when the dir lister signals that the file name has changed.
+ QHash<QByteArray, QVariant> data;
+ data.insert(role, value);
+ m_model->setData(index, data);
+ }
KonqOperations::rename(this, oldUrl, newName);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic