| Summary: | WISH lossless jpeg rotations change file date/time. Could this be made optional since I want to keep the original file date/time | ||
|---|---|---|---|
| Product: | [Applications] digikam | Reporter: | Stefan Zink <Zink.Stefan> |
| Component: | Plugin-Bqm-Rotate | Assignee: | Digikam Developers <digikam-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | wishlist | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | openSUSE | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | 0.1.0 | |
| Sentry Crash Report: | |||
|
Description
Stefan Zink
2005-07-04 14:51:35 UTC
Where nothing is done to the image other than rotation it would definitely be preferable to keep the original date. I'll vote for it. SVN commit 433539 by pahlibar:
preserve timestamp of image when rotating/flipping
BUG: 108537
M +25 -3 utils.cpp
--- trunk/extragear/libs/kipi-plugins/jpeglossless/utils.cpp #433538:433539
@@ -28,6 +28,9 @@
extern "C" {
#include <tiffio.h>
#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <utime.h>
}
#include "utils.h"
@@ -125,11 +128,30 @@
bool MoveFile(const QString& src, const QString& dst)
{
- if (!CopyFile(src,dst)) return false;
+ struct stat stbuf;
+ if (::stat(QFile::encodeName(dst), &stbuf) != 0)
+ {
+ kdWarning( 51000 ) << "KIPIJPEGLossLessPlugin:MoveFile: failed to stat src"
+ << endl;
+ return false;
+ }
+
+ if (!CopyFile(src,dst))
+ return false;
- if (::unlink(QFile::encodeName(src).data()) != 0) {
+ struct utimbuf timbuf;
+ timbuf.actime = stbuf.st_atime;
+ timbuf.modtime = stbuf.st_mtime;
+ if (::utime(QFile::encodeName(dst), &timbuf) != 0)
+ {
+ kdWarning( 51000 ) << "KIPIJPEGLossLessPlugin:MoveFile: failed to update dst time"
+ << endl;
+ }
+
+ if (::unlink(QFile::encodeName(src).data()) != 0)
+ {
kdWarning( 51000 ) << "KIPIJPEGLossLessPlugin:MoveFile: failed to unlink src"
- << endl;
+ << endl;
}
return true;
}
|