]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/FileDialog_private.C
code cosmetics whitespace, unneeded lyx:: qualification, indentation, unneeded destru...
[lyx.git] / src / frontends / qt4 / FileDialog_private.C
index 32eb8f3581981d852ba09ad866d961c44a0c969c..fefa83ad4c6f37665ece1f460403bc026b07b2b0 100644 (file)
@@ -11,6 +11,7 @@
 #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 *>();
 
@@ -77,9 +77,12 @@ LyXFileDialog::LyXFileDialog(string const & t,
 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"
+