[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kio/kio
From:       Vlad Codrea <vladc6 () yahoo ! com>
Date:       2008-05-09 3:22:00
Message-ID: 1210303320.499221.3993.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 805658 by codrea:

Fix KIO::file_move to respect its permissions parameter instead of
just ignoring it. KIO::file_copy already respects the user-specified permissions. If \
the user-specified permissions == -1, keep the default permissions of the file.



 M  +21 -2     job.cpp  


--- trunk/KDE/kdelibs/kio/kio/job.cpp #805657:805658
@@ -1638,8 +1638,8 @@
     FileCopyJobPrivate(const KUrl& src, const KUrl& dest, int permissions,
                        bool move, JobFlags flags)
         : m_sourceSize(filesize_t(-1)), m_src(src), m_dest(dest), m_moveJob(0), \
                m_copyJob(0), m_delJob(0),
-          m_getJob(0), m_putJob(0), m_permissions(permissions),
-          m_move(move), m_flags(flags)
+          m_chmodJob(0), m_getJob(0), m_putJob(0), m_permissions(permissions),
+          m_move(move), m_mustChmod(0), m_flags(flags)
         {
         }
     KIO::filesize_t m_sourceSize;
@@ -1650,12 +1650,14 @@
     SimpleJob *m_moveJob;
     SimpleJob *m_copyJob;
     SimpleJob *m_delJob;
+    SimpleJob *m_chmodJob;
     TransferJob *m_getJob;
     TransferJob *m_putJob;
     int m_permissions;
     bool m_move:1;
     bool m_canResume:1;
     bool m_resumeAnswerSent:1;
+    bool m_mustChmod:1;
     JobFlags m_flags;
 
     void startBestCopyMethod();
@@ -1831,6 +1833,7 @@
 void FileCopyJobPrivate::startRenameJob(const KUrl &slave_url)
 {
     Q_Q(FileCopyJob);
+    m_mustChmod = true;  // CMD_RENAME by itself doesn't change permissions
     KIO_ARGS << m_src << m_dest << (qint8) (m_flags & Overwrite);
     m_moveJob = SimpleJobPrivate::newJob(slave_url, CMD_RENAME, packedArgs);
     q->addSubjob( m_moveJob );
@@ -2110,6 +2113,16 @@
       return;
    }
 
+   if (d->m_mustChmod)
+   {
+       // If d->m_permissions == -1, keep the default permissions
+       if (d->m_permissions != -1)
+       {
+           d->m_chmodJob = chmod(d->m_dest, d->m_permissions);
+       }
+       d->m_mustChmod = false;
+   }
+
    if (job == d->m_moveJob)
    {
       d->m_moveJob = 0; // Finished
@@ -2152,6 +2165,12 @@
    {
       d->m_delJob = 0; // Finished
    }
+
+   if (job == d->m_chmodJob)
+   {
+       d->m_chmodJob = 0; // Finished
+   }
+
    removeSubjob(job);
    if ( !hasSubjobs() )
        emitResult();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic