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

Method copyFile

src/DefaultFileAccessJobHandler.cpp:351–372  ·  view source on GitHub ↗

Copy local or remote files.

Source from the content-addressed store, hash-verified

349
350// Copy local or remote files.
351bool DefaultFileAccessJobHandler::copyFile(const QString& inDest)
352{
353 ProgressProxyExtender pp;
354 FileAccess dest;
355 dest.setFile(inDest);
356
357 mFileAccess->setStatusText(QString());
358 if(!mFileAccess->isNormal() || !dest.isNormal()) return false;
359
360 qint32 permissions = (mFileAccess->isExecutable() ? 0111 : 0) + (mFileAccess->isWritable() ? 0222 : 0) + (mFileAccess->isReadable() ? 0444 : 0);
361 m_bSuccess = false;
362 KIO::FileCopyJob* pJob = KIO::file_copy(mFileAccess->url(), dest.url(), permissions, KIO::HideProgressInfo|KIO::Overwrite);
363 chk_connect(pJob, &KIO::FileCopyJob::result, this, &DefaultFileAccessJobHandler::slotSimpleJobResult);
364 chk_connect(pJob, &KIO::FileCopyJob::percentChanged, &pp, &ProgressProxyExtender::slotPercent);
365 chk_connect(pJob, &KIO::FileCopyJob::finished, this, &DefaultFileAccessJobHandler::slotJobEnded);
366
367 ProgressProxy::enterEventLoop(pJob,
368 i18n("Copying file: %1 -> %2", mFileAccess->prettyAbsPath(), dest.prettyAbsPath()));
369
370 return m_bSuccess;
371 // Note that the KIO-slave preserves the original date, if this is supported.
372}
373
374bool DefaultFileAccessJobHandler::listDir(DirectoryList* pDirList, bool bRecursive, bool bFindHidden, const QString& filePattern,
375 const QString& fileAntiPattern, const QString& dirAntiPattern, bool bFollowDirLinks, IgnoreList& ignoreList)

Callers

nothing calls this directly

Calls 7

setFileMethod · 0.80
setStatusTextMethod · 0.80
isNormalMethod · 0.80
isExecutableMethod · 0.45
isWritableMethod · 0.45
isReadableMethod · 0.45
prettyAbsPathMethod · 0.45

Tested by

no test coverage detected