diff options
| author | Frank Reininghaus <[email protected]> | 2012-11-05 22:12:45 +0100 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2012-11-05 22:12:45 +0100 |
| commit | 15faff457dd5ff609b3d6d824e0366beae1abe28 (patch) | |
| tree | 518a559c977bdb116939c0b57d8977f04db916ae /src/views/dolphinview.cpp | |
| parent | c6eb4866d8bb601d63acedd78edaf37a8c5c3c2f (diff) | |
| parent | c0559a2a1d7d66b26e1d00b4ff59c7fce8848566 (diff) | |
Merge remote-tracking branch 'origin/KDE/4.9'
Diffstat (limited to 'src/views/dolphinview.cpp')
| -rw-r--r-- | src/views/dolphinview.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 5b3d074c9..e2ccc7ff1 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1357,9 +1357,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); } |
