------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. http://bugs.kde.org/show_bug.cgi?id=54459 faure@kde.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED ------- Additional Comments From faure@kde.org 2003-04-11 11:22 ------- Subject: koffice/lib/kofficecore CVS commit by faure: Preserve permissions when creating backup file (only for local files currently) CCMAIL: 54459-done@bugs.kde.org M +17 -9 koDocument.cc 1.268 --- koffice/lib/kofficecore/koDocument.cc #1.267:1.268 @@ -53,4 +53,5 @@ #include #include +#include #include #include @@ -298,14 +299,21 @@ bool KoDocument::saveFile() QApplication::setOverrideCursor( waitCursor ); - if ( KIO::NetAccess::exists( url() ) ) { // this file exists => backup + if ( backupFile() ) { + KIO::UDSEntry entry; + if ( KIO::NetAccess::stat( url(), entry ) ) { // this file exists => backup + KFileItem item( entry, url() ); + Q_ASSERT( item.name() == url().fileName() ); KURL backup; if ( d->m_backupPath.isEmpty()) - backup= url(); + backup = url(); else backup = d->m_backupPath +"/"+url().fileName(); backup.setPath( backup.path() + QString::fromLatin1("~") ); - if ( backupFile() ) { KIO::NetAccess::del( backup ); // Copy does not remove existing destination file KIO::NetAccess::copy( url(), backup ); + // Not network transparent. TODO: use NetAccess::file_copy once KDE-3.2 is required, + // or implement KIO::NetAccess::chmod (or fire an async ChmodJob?). + if ( backup.isLocalFile() ) + ::chmod( QFile::encodeName( backup.path() ), item.permissions() ); } } _______________________________________________ koffice-devel mailing list koffice-devel@mail.kde.org http://mail.kde.org/mailman/listinfo/koffice-devel