]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FileDialog.C
fix crash with "save as"
[lyx.git] / src / frontends / xforms / FileDialog.C
index d92e80e10387f3d71248ea359edeca61f8fefc64..7427dd0620f32e1a82246adbdb47382010a25f3d 100644 (file)
@@ -1,35 +1,32 @@
-// -*- C++ -*-
 /**
- * \file FileDialog.C
- * Copyright 2001 the LyX Team
- * Read the file COPYING
+ * \file xforms/FileDialog.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
  * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS
  */
 
+#include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-#include <config.h>
-#include <gettext.h>
-#include <utility>
-
-#include "commandtags.h"
-
-#include "support/lstrings.h" 
-
-// temp. hack until Allow/ProhibitInput is not
+#include "FormFiledialog.h"
+#include "frontends/FileDialog.h"
+// temp. hack until Allow/prohibitInput is not
 // needed any more in src/ - for now it's simplest
-// to leave it there 
-#include "LyXView.h" 
+// to leave it there
+#include "frontends/LyXView.h"
 #include "bufferview_funcs.h"
-#include "frontends/FileDialog.h"
-
-#include "FormFiledialog.h"
-
+#include "gettext.h"
+#include "commandtags.h"
 #include "debug.h"
+#include "support/lstrings.h"
+#include <utility>
+
 
 using std::make_pair;
 using std::pair;
@@ -38,9 +35,9 @@ using std::endl;
 FileDialog::FileDialog(LyXView *lv, string const &t, kb_action s, Button b1, Button b2)
        : private_(0), lv_(lv), title_(t), success_(s)
 {
-       private_ = new FileDialog::Private();
+       private_ = new FileDialog::Private(lv->getDialogs());
 
-       private_->SetButton(0, b1.first, b1.second); 
+       private_->SetButton(0, b1.first, b1.second);
        private_->SetButton(1, b2.first, b2.second);
 }
 
@@ -48,11 +45,16 @@ FileDialog::FileDialog(LyXView *lv, string const &t, kb_action s, Button b1, But
 FileDialog::~FileDialog()
 {
        delete private_;
-       private_ = 0;
 }
 
 
-FileDialog::Result const FileDialog::Select(string const & path, string const & mask, string const & suggested)
+FileDialog::Result const FileDialog::save(string const & path, string const & mask, string const & suggested)
+{
+       return open(path, mask, suggested);
+}
+
+FileDialog::Result const FileDialog::open(string const & path, string const & mask, string const & suggested)
 {
        string filter = mask;
 
@@ -64,18 +66,19 @@ FileDialog::Result const FileDialog::Select(string const & path, string const &
                        filter = mask;
        }
 
-       lyxerr[Debug::GUI] << "Select with path \"" << path << "\", mask \"" << filter << "\", suggested \"" << suggested << "\"" << endl;
+       lyxerr[Debug::GUI] << "filedialog open  with path \"" << path << "\", mask \""
+               << filter << "\", suggested \"" << suggested << "\"" << endl;
 
        // no support for asynchronous selection yet
 
-       ProhibitInput(lv_->view());
+       lv_->prohibitInput();
 
        FileDialog::Result result;
 
        result.first = FileDialog::Chosen;
        result.second = private_->Select(title_, path, filter, suggested);
-       AllowInput(lv_->view());
+
+       lv_->allowInput();
+
        return result;
 }