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

List:       kde-commits
Subject:    KDE/kdebase/runtime/kioslave/smb
From:       Carlo Segato <brandon.ml () gmail ! com>
Date:       2008-06-01 1:32:13
Message-ID: 1212283933.528218.25505.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 815042 by segato:

preserve the modification time when copying a file over the smb kioslave
it works only on systems with utime
CCBUG: 79937


 M  +4 -0      CMakeLists.txt  
 A             config-smb.h.cmake  
 M  +2 -0      kio_smb.h  
 M  +16 -0     kio_smb_file.cpp  


--- trunk/KDE/kdebase/runtime/kioslave/smb/CMakeLists.txt #815041:815042
@@ -1,3 +1,7 @@
+check_include_files(utime.h HAVE_UTIME_H)
+
+configure_file(config-smb.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-smb.h)
+
 set(kio_smb_PART_SRCS 
    kio_smb.cpp 
    kio_smb_auth.cpp 
--- trunk/KDE/kdebase/runtime/kioslave/smb/kio_smb.h #815041:815042
@@ -36,6 +36,8 @@
 #ifndef KIO_SMB_H_INCLUDED
 #define KIO_SMB_H_INCLUDED
 
+#include "config-smb.h"
+
 //-------------
 // QT includes
 //-------------
--- trunk/KDE/kdebase/runtime/kioslave/smb/kio_smb_file.cpp #815041:815042
@@ -34,6 +34,7 @@
 #include "kio_smb_internal.h"
 
 #include <QVarLengthArray>
+#include <QDateTime>
 
 #include <kmimetype.h>
 
@@ -440,6 +441,21 @@
         // TODO: put in call to chmod when it is working!
         // smbc_chmod(url.toSmbcUrl(),permissions);
     }
+#ifdef HAVE_UTIME_H
+    // set modification time
+    const QString mtimeStr = metaData( "modified" );
+    if ( !mtimeStr.isEmpty() ) {
+        QDateTime dt = QDateTime::fromString( mtimeStr, Qt::ISODate );
+        if ( dt.isValid() ) {
+            if (cache_stat( m_current_url, &st ) == 0) {
+                struct utimbuf utbuf;
+                utbuf.actime = st.st_atime; // access time, unchanged
+                utbuf.modtime = dt.toTime_t(); // modification time
+                smbc_utime( m_current_url.toSmbcUrl(), &utbuf );
+            }
+        }
+    }
+#endif
 
     // We have done our job => finish
     finished();
[prev in list] [next in list] [prev in thread] [next in thread] 

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