Commit 99b1d147 authored by Kevin Kofler's avatar Kevin Kofler
Browse files

Set correct file mode when saving changes (#402363)

src/komparemodellist.cpp (KompareModelList::saveDestination): Get
permissions of existing file and copy temporary file with the same
permissions.

Patch by Terry Barnaby.

BUG: 402363
FIXED-IN: 21.07.90
parent 36da81fd
Pipeline #78018 skipped
......@@ -415,7 +415,15 @@ bool KompareModelList::saveDestination(DiffModel* model)
{
qCDebug(LIBKOMPAREDIFF2) << "Tempfilename : " << temp.fileName();
qCDebug(LIBKOMPAREDIFF2) << "DestinationURL : " << m_info->destination;
KIO::FileCopyJob* copyJob = KIO::file_copy(QUrl::fromLocalFile(temp.fileName()), m_info->destination , -1, KIO::Overwrite);
// Get permissions of existing file and copy temporary file with the same permissions
int permissions = -1;
KIO::StatJob* statJob = KIO::stat(m_info->destination);
result = statJob->exec();
if (result)
permissions = statJob->statResult().numberValue(KIO::UDSEntry::UDS_ACCESS);
KIO::FileCopyJob* copyJob = KIO::file_copy(QUrl::fromLocalFile(temp.fileName()), m_info->destination , permissions, KIO::Overwrite);
result = copyJob->exec();
qCDebug(LIBKOMPAREDIFF2) << "true or false?" << result;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment