┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/dolphinview.cpp
diff options
context:
space:
mode:
authorEmmanuel Pescosta <[email protected]>2013-06-10 11:16:21 +0200
committerEmmanuel Pescosta <[email protected]>2013-06-10 11:16:21 +0200
commit7c4d91c465d3e7383e8d0f7583018118efef40ef (patch)
treea2ccfd9467ce8a4a3410285abc2cb2f3e0031cc2 /src/views/dolphinview.cpp
parentca6e6a342e6940b8651b98dec28d68c471335453 (diff)
Fix Bug 319119 - Dolphin doesn't notice when renaming failed
Change the data in the model before the real renaming is done by KonqOperations::rename(), but when the rename operation fails, revert the data changes in the model. BUG: 319119 REVIEW: 110922
Diffstat (limited to 'src/views/dolphinview.cpp')
-rw-r--r--src/views/dolphinview.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index 9a4b8633e..53d327708 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -1363,6 +1363,16 @@ void DolphinView::slotDeleteFileFinished(KJob* job)
}
}
+void DolphinView::slotRenamingFailed(const KUrl& oldUrl, const KUrl& newUrl)
+{
+ const int index = m_model->index(newUrl);
+ if (index >= 0) {
+ QHash<QByteArray, QVariant> data;
+ data.insert("text", oldUrl.fileName());
+ m_model->setData(index, data);
+ }
+}
+
void DolphinView::slotDirectoryLoadingStarted()
{
// Disable the writestate temporary until it can be determined in a fast way
@@ -1454,7 +1464,10 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con
m_model->setData(index, data);
}
- KonqOperations::rename(this, oldUrl, newName);
+ KonqOperations* op = KonqOperations::renameV2(this, oldUrl, newName);
+ if (op) {
+ connect(op, SIGNAL(renamingFailed(KUrl,KUrl)), SLOT(slotRenamingFailed(KUrl,KUrl)));
+ }
}
}
}