mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
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
This commit is contained in:
parent
ca6e6a342e
commit
7c4d91c465
|
@ -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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -632,6 +632,8 @@ private slots:
|
|||
*/
|
||||
void slotDeleteFileFinished(KJob* job);
|
||||
|
||||
void slotRenamingFailed(const KUrl& oldUrl, const KUrl& newUrl);
|
||||
|
||||
/**
|
||||
* Invoked when the file item model has started the loading
|
||||
* of the directory specified by DolphinView::url().
|
||||
|
|
Loading…
Reference in a new issue