Solving issue 1704: "No error message saving profile to write protected directory"

This commit is contained in:
natureh 510
2013-02-27 23:16:36 +01:00
parent cde922284e
commit 7959dfd0f4
6 changed files with 32 additions and 6 deletions

View File

@@ -115,6 +115,12 @@ bool confirmOverwrite (Gtk::Window& parent, const std::string& filename) {
return safe;
}
void writeFailed (Gtk::Window& parent, const std::string& filename) {
Glib::ustring msg_ = Glib::ustring::compose(M("MAIN_MSG_WRITEFAILED"), filename);
Gtk::MessageDialog msgd (parent, msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd.run ();
}
void drawCrop (Cairo::RefPtr<Cairo::Context> cr, int imx, int imy, int imw, int imh, int startx, int starty, double scale, const rtengine::procparams::CropParams& cparams) {
cr->set_line_width (0.);

View File

@@ -28,6 +28,7 @@ void thumbInterp (const unsigned char* src, int sw, int sh, unsigned char* dst,
Glib::ustring removeExtension (const Glib::ustring& filename);
Glib::ustring getExtension (const Glib::ustring& filename);
bool confirmOverwrite (Gtk::Window& parent, const std::string& filename);
void writeFailed (Gtk::Window& parent, const std::string& filename);
void drawCrop (Cairo::RefPtr<Cairo::Context> cr, int imx, int imy, int imw, int imh, int startx, int starty, double scale, const rtengine::procparams::CropParams& cparams);
/**

View File

@@ -186,17 +186,29 @@ void ProfilePanel::save_clicked (GdkEventButton* event) {
// saving the partial profile
PartialProfile ppTemp(true);
partialProfileDlg->applyPaste (ppTemp.pparams, ppTemp.pedited, toSave->pparams, toSave->pedited);
ppTemp.pparams->save (fname, "", ppTemp.pedited);
int retCode = ppTemp.pparams->save (fname, "", ppTemp.pedited);
ppTemp.deleteInstance();
if (retCode)
writeFailed(dialog, fname);
else {
done=true;
refreshProfileList ();
}
}
else {
// saving a full profile
toSave->pparams->save (fname);
int retCode = toSave->pparams->save (fname);
if (retCode)
writeFailed(dialog, fname);
else {
done=true;
refreshProfileList ();
}
}
refreshProfileList ();
}
else done = true;
}
done = true;
else done = true;
} while (!done);
return;
}