| Summary: | Image permissions are restricted after saving. | ||
|---|---|---|---|
| Product: | [Applications] digikam | Reporter: | Tung NGUYEN <ntung> |
| Component: | ImageEditor-Save | Assignee: | Digikam Developers <digikam-bugs-null> |
| Status: | CLOSED FIXED | ||
| Severity: | normal | CC: | caulier.gilles |
| Priority: | NOR | ||
| Version First Reported In: | 0.8.0 | ||
| Target Milestone: | --- | ||
| Platform: | Compiled Sources | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | 7.5.0 | |
| Sentry Crash Report: | |||
|
Description
Tung NGUYEN
2005-10-05 21:38:42 UTC
SVN commit 467716 by pahlibar:
preserve permissions when doing save/saveAs
BUGS: 113914
M +19 -1 imlibinterface.cpp
--- trunk/extragear/graphics/digikam/utilities/imageeditor/imlibinterface.cpp #467715:467716
@@ -26,6 +26,9 @@
extern "C"
{
#include <tiffio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
}
// C++ includes.
@@ -99,6 +102,7 @@
Imlib_Color_Modifier cmod;
Imlib_Load_Error errorRet;
QString filename;
+ mode_t filePermissions;
UndoManager* undoMan;
};
@@ -189,6 +193,7 @@
d->gamma = 1.0;
d->contrast = 1.0;
d->brightness = 0.0;
+ d->filePermissions = 0;
imlib_context_set_color_modifier(d->cmod);
imlib_reset_color_modifier();
@@ -219,7 +224,14 @@
}
}
- if (d->image) {
+ if (d->image)
+ {
+ struct stat stbuf;
+ if (::stat(QFile::encodeName(filename), &stbuf) == 0)
+ {
+ d->filePermissions = stbuf.st_mode;
+ }
+
imlib_context_set_image(d->image);
imlib_image_set_changes_on_disk();
@@ -1007,6 +1019,12 @@
return false; // Do not reload the file if saving failed !
}
+ // file saved. now preserve the permissions
+ if (d->filePermissions != 0)
+ {
+ ::chmod(QFile::encodeName(saveFile), d->filePermissions);
+ }
+
return true;
}
I have tested this bug fix with the lastest SVN, permissions are now preserved after saving. Thank you. Fixed by Renchi. Closed. Gilles |