MCPcopy Create free account
hub / github.com/KDE/kdiff3 / rename

Method rename

src/DefaultFileAccessJobHandler.cpp:307–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305}
306
307bool DefaultFileAccessJobHandler::rename(const FileAccess& destFile)
308{
309 if(destFile.fileName().isEmpty())
310 return false;
311
312 if(mFileAccess->isLocal() && destFile.isLocal())
313 {
314 return QDir().rename(mFileAccess->absoluteFilePath(), destFile.absoluteFilePath());
315 }
316 else
317 {
318 ProgressProxyExtender pp;
319 qint32 permissions = -1;
320 m_bSuccess = false;
321 KIO::FileCopyJob* pJob = KIO::file_move(mFileAccess->url(), destFile.url(), permissions, KIO::HideProgressInfo);
322 chk_connect(pJob, &KIO::FileCopyJob::result, this, &DefaultFileAccessJobHandler::slotSimpleJobResult);
323 chk_connect(pJob, &KIO::FileCopyJob::percentChanged, &pp, &ProgressProxyExtender::slotPercent);
324 chk_connect(pJob, &KIO::FileCopyJob::finished, this, &DefaultFileAccessJobHandler::slotJobEnded);
325
326 ProgressProxy::enterEventLoop(pJob,
327 i18n("Renaming file: %1 -> %2", mFileAccess->prettyAbsPath(), destFile.prettyAbsPath()));
328 return m_bSuccess;
329 }
330}
331
332void DefaultFileAccessJobHandler::slotJobEnded([[maybe_unused]] KJob* pJob)
333{

Callers

nothing calls this directly

Calls 5

fileNameMethod · 0.80
isEmptyMethod · 0.45
isLocalMethod · 0.45
absoluteFilePathMethod · 0.45
prettyAbsPathMethod · 0.45

Tested by

no test coverage detected