#include <config.h>
#include "FileDialog_private.h"
+
#include "qt_helpers.h"
#include "support/filefilterlist.h"
#include <QHBoxLayout>
using lyx::support::split;
-
using std::string;
-
-namespace {
+namespace lyx {
/// return the Qt form of the label
-string const getLabel(string const & str) {
+static docstring const getLabel(docstring const & ucs4str) {
+ // FIXME UNICODE
+ string str = to_utf8(ucs4str);
string label;
string sc(split(str, label, '|'));
if (sc.length() < 2)
- return label;
+ return from_utf8(label);
string::size_type pos = label.find(sc[1]);
if (pos == string::npos)
- return label;
+ return from_utf8(label);
label.insert(pos, 1, '&');
- return label;
+ return from_utf8(label);
}
-} // namespace anon
-
-LyXFileDialog::LyXFileDialog(string const & t,
- string const & p,
- lyx::support::FileFilterList const & filters,
+LyXFileDialog::LyXFileDialog(docstring const & t,
+ docstring const & p,
+ support::FileFilterList const & filters,
FileDialog::Button const & b1,
FileDialog::Button const & b2)
- : QFileDialog(qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget(),
+ // FIXME replace that with theApp->gui()->currentView()
+ : QFileDialog(qApp->focusWidget(),
toqstr(t), toqstr(p), toqstr(filters.as_string())),
b1_(0), b2_(0)
{
- setCaption(toqstr(t));
+ setWindowTitle(toqstr(t));
QList<QHBoxLayout *> layout = findChildren<QHBoxLayout *>();
void LyXFileDialog::buttonClicked()
{
if (sender() == b1_)
- setDir(toqstr(b1_dir_));
+ setDirectory(toqstr(b1_dir_));
else if (sender() == b2_)
- setDir(toqstr(b2_dir_));
+ setDirectory(toqstr(b2_dir_));
}
+} // namespace lyx
+
#include "FileDialog_private_moc.cpp"
+