#include <config.h>
-#include "frontends/FileDialog.h"
+#include "FileDialog.h"
#include "LyXFileDialog.h"
#include "qt_helpers.h"
-#include "debug.h"
-#include "gettext.h"
-
+#include "support/debug.h"
#include "support/FileFilterList.h"
+#include "support/FileName.h"
+#include "support/gettext.h"
#include "support/os.h"
/** when this is defined, the code will use
using support::FileFilterList;
using support::os::internal_path;
-using std::endl;
class FileDialog::Private {
};
-FileDialog::FileDialog(docstring const & t,
- kb_action s, Button b1, Button b2)
+FileDialog::FileDialog(docstring const & t, kb_action s)
: private_(new FileDialog::Private), title_(t), success_(s)
-{
- private_->b1 = b1;
- private_->b2 = b2;
-}
+{}
FileDialog::~FileDialog()
}
+void FileDialog::setButton1(docstring const & label, docstring const & dir)
+{
+ private_->b1.first = label;
+ private_->b1.second = dir;
+}
+
+
+void FileDialog::setButton2(docstring const & label, docstring const & dir)
+{
+ private_->b2.first = label;
+ private_->b2.second = dir;
+}
+
+
FileDialog::Result const FileDialog::save(docstring const & path,
FileFilterList const & filters,
docstring const & suggested)
{
- LYXERR(Debug::GUI) << "Select with path \"" << to_utf8(path)
+ LYXERR(Debug::GUI, "Select with path \"" << to_utf8(path)
<< "\", mask \"" << to_utf8(filters.as_string())
- << "\", suggested \"" << to_utf8(suggested) << '"' << endl;
+ << "\", suggested \"" << to_utf8(suggested) << '"');
FileDialog::Result result;
result.first = FileDialog::Chosen;
if (!suggested.empty())
dlg.selectFile(toqstr(suggested));
- LYXERR(Debug::GUI) << "Synchronous FileDialog: " << endl;
+ LYXERR(Debug::GUI, "Synchronous FileDialog: ");
int res = dlg.exec();
- LYXERR(Debug::GUI) << "result " << res << endl;
+ LYXERR(Debug::GUI, "result " << res);
if (res == QDialog::Accepted)
result.second = from_utf8(internal_path(
fromqstr(dlg.selectedFiles()[0])));
FileFilterList const & filters,
docstring const & suggested)
{
- LYXERR(Debug::GUI) << "Select with path \"" << to_utf8(path)
+ LYXERR(Debug::GUI, "Select with path \"" << to_utf8(path)
<< "\", mask \"" << to_utf8(filters.as_string())
- << "\", suggested \"" << to_utf8(suggested) << '"' << endl;
+ << "\", suggested \"" << to_utf8(suggested) << '"');
FileDialog::Result result;
result.first = FileDialog::Chosen;
if (!suggested.empty())
dlg.selectFile(toqstr(suggested));
- LYXERR(Debug::GUI) << "Synchronous FileDialog: " << endl;
+ LYXERR(Debug::GUI, "Synchronous FileDialog: ");
int res = dlg.exec();
- LYXERR(Debug::GUI) << "result " << res << endl;
+ LYXERR(Debug::GUI, "result " << res);
if (res == QDialog::Accepted)
result.second = from_utf8(internal_path(
fromqstr(dlg.selectedFiles()[0])));
FileDialog::Result const FileDialog::opendir(docstring const & path,
docstring const & suggested)
{
- LYXERR(Debug::GUI) << "Select with path \"" << to_utf8(path)
- << "\", suggested \"" << to_utf8(suggested) << '"' << endl;
+ LYXERR(Debug::GUI, "Select with path \"" << to_utf8(path)
+ << "\", suggested \"" << to_utf8(suggested) << '"');
FileDialog::Result result;
result.first = FileDialog::Chosen;
if (!suggested.empty())
dlg.selectFile(toqstr(suggested));
- LYXERR(Debug::GUI) << "Synchronous FileDialog: " << endl;
+ LYXERR(Debug::GUI, "Synchronous FileDialog: ");
int res = dlg.exec();
- LYXERR(Debug::GUI) << "result " << res << endl;
+ LYXERR(Debug::GUI, "result " << res);
if (res == QDialog::Accepted)
result.second = from_utf8(internal_path(
fromqstr(dlg.selectedFiles()[0])));