[Kde-imaging] kdeextragear-libs-1/kipi-plugins/batchprocessimages

Gilles Caulier caulier.gilles at free.fr
Thu Sep 23 08:14:01 CEST 2004


CVS commit by cgilles: 

KIPI BatchRenameImages : fixed files date correction using Qt API instead C ANSI (from Showimg).
CCMAIL: kde-imaging at kde.org


  M +7 -53     renameimagesdialog.cpp   1.25
  M +1 -1      renameimagesdialog.h   1.5


--- kdeextragear-libs-1/kipi-plugins/batchprocessimages/renameimagesdialog.cpp  #1.24:1.25
@@ -722,59 +722,13 @@ QString RenameImagesDialog::oldFileName2
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////
-// From ShowImg batch renamer
 
-bool RenameImagesDialog::changeDate(QString file)
+bool RenameImagesDialog::changeDate(KURL file)
 {
-    FILE * f;
-    struct utimbuf * t = new utimbuf();
-    struct tm tmp;
-    struct stat st;
-
-    time_t ti;
-
-    f = fopen(file.ascii (), "r");
-
-    if( f == NULL )
-       {
-       return false;
-       }
-
-    fclose( f );
-
-    tmp.tm_mday = m_newDate.day();
-    tmp.tm_mon = m_newDate.month() - 1;
-    tmp.tm_year = m_newDate.year() - 1900;
-
-    tmp.tm_hour = m_hour;
-    tmp.tm_min = m_minute;
-    tmp.tm_sec = m_second;
-    tmp.tm_isdst = -1;
-
-    ti = mktime( &tmp );
-
-    if( ti == -1 )
-       {
-       return false;
-       }
-
-    if( stat(file.ascii(), &st ) == -1 )
-       {
-       return false;
-       }
-
-    if(m_changeAccess)
-        t->actime = ti;
-    else
-        t->actime = st.st_atime;
-
-    if(m_changeModification)
-        t->modtime = ti;
-    else
-        t->modtime = st.st_mtime;
-
-    if(utime(file.ascii(), t ) != 0)
-       {
-       return false;
-       }
+    KIPI::ImageInfo info = m_interface->info( file );
+    QDateTime dateTime = info.time();
+    dateTime.setDate(m_newDate);
+    QTime newTime(m_hour, m_minute, m_second);
+    dateTime.setTime(newTime);
+    info.setTime( dateTime );
 
     return true;

--- kdeextragear-libs-1/kipi-plugins/batchprocessimages/renameimagesdialog.h  #1.4:1.5
@@ -92,5 +92,5 @@ Q_OBJECT
    void    copyItemOperations(void);
    void    updateOptions(void);
-   bool    changeDate(QString file);
+   bool    changeDate(KURL file);
    
 };




More information about the Kde-imaging mailing list