Am 06.06.2007 um 00:03 schrieb Mael Hilléreau:

Le 5 juin 07 à 19:20, Richard Heck a écrit :

Can someone on Mac sort this out: http://bugzilla.lyx.org/ show_bug.cgi?id=3818? I think I know what needs to be done, but I'm not on Mac. See my comments. Should be simple.

Tested on Intel Mac OS 10.4.9, with 1.5.0rc1: your #ifdef USE_NATIVE_FILEDIALOG fixes the problem.

No, it doesn't. USE_NATIVE_FILEDIALOG is not defined in callback.cpp on any platform. Putting an #ifdef around the part is like "#ifdef 0". The right patch is attached.

Stefan

Index: src/callback.cpp
===================================================================
--- src/callback.cpp    (Revision 18677)
+++ src/callback.cpp    (Arbeitskopie)
@@ -127,6 +127,7 @@
{
        string fname = buffer->fileName();
        string const oldname = fname;
+       bool askForOverwriteConfirmation = true;
        if (newname.empty()) {
@@ -158,11 +159,16 @@
                fname = makeAbsPath(fname).absFilename();
                if (!isLyXFilename(fname))
                        fname += ".lyx";
+               
+               // either the dialog asks for overwriting or we do it below
+               if (fileDlg.asksForOverwriteConfirmation())
+                       askForOverwriteConfirmation = false;
        } else
                fname = newname;
        FileName const filename(fname);
-       if (fs::exists(filename.toFilesystemEncoding())) {
+       if (askForOverwriteConfirmation &&
+                       fs::exists(filename.toFilesystemEncoding())) {
                docstring const file = makeDisplayPath(fname, 30);
                docstring text = bformat(_("The document %1$s already 
exists.\n\n"
                                                     "Do you want to over-write that 
document?"), file);
Index: src/frontends/qt4/FileDialog.cpp
===================================================================
--- src/frontends/qt4/FileDialog.cpp    (Revision 18677)
+++ src/frontends/qt4/FileDialog.cpp    (Arbeitskopie)
@@ -180,4 +180,13 @@
}
+bool FileDialog::asksForOverwriteConfirmation()
+{
+#ifdef USE_NATIVE_FILEDIALOG
+       return true;
+#else
+       return false;
+#endif
+}
+
} // namespace lyx
Index: src/frontends/FileDialog.h
===================================================================
--- src/frontends/FileDialog.h  (Revision 18677)
+++ src/frontends/FileDialog.h  (Arbeitskopie)
@@ -77,6 +77,9 @@
                          support::FileFilterList const & filters,
                          docstring const & suggested);
+       /// Does the dialog ask for an overwrite confirmation itself?
+       bool asksForOverwriteConfirmation();
+
private:
        class Private;
        friend class Private;


Attachment: nodoubleconfirmationonmac.patch
Description: Binary data

Attachment: PGP.sig
Description: Signierter Teil der Nachricht

Reply via email to