]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/FileDialog.h
Update sk.po
[lyx.git] / src / frontends / qt / FileDialog.h
1 // -*- C++ -*-
2 /**
3  * \file FileDialog.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author unknown
8  * \author John Levon
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef FILEDIALOG_H
14 #define FILEDIALOG_H
15
16 #include <QString>
17
18 #include <utility>
19
20 namespace lyx {
21
22 /**
23  * \class FileDialog
24  * \brief GUI-I definition of file dialog interface
25  */
26 class FileDialog
27 {
28         /// noncopyable
29         FileDialog(FileDialog const &);
30         void operator=(FileDialog const &);
31 public:
32         /// label, directory path button
33         typedef std::pair<QString, QString> Button;
34
35         /// result type
36         enum ResultType {
37                 Later, /**< modeless chooser, no result */
38                 Chosen /**< string contains filename */
39         };
40
41         /// result return
42         typedef std::pair<FileDialog::ResultType, QString> Result;
43
44         /// result return
45         typedef std::pair<FileDialog::ResultType, QStringList> Results;
46
47         /**
48          * Constructs a file dialog with title \param title.
49          *
50          * Up to two optional extra buttons are allowed for specifying
51          * additional directories in the navigation (an empty
52          * directory is interpreted as FileName::getcwd())
53          */
54         FileDialog(QString const & title);
55
56         ~FileDialog();
57
58         void setButton1(QString const & label, QString const & dir);
59         void setButton2(QString const & label, QString const & dir);
60
61         /// Choose a file for opening, starting in directory \c path.
62         Result open(QString const & path, QStringList const & filters,
63                           QString const & suggested = QString());
64         /// Choose several files for opening, starting in directory \c path.
65         Results openMulti(QString const & path, QStringList const & filters,
66                           QString const & suggested = QString(), bool multi = true);
67
68         /// Choose a directory, starting in directory \c path.
69         Result opendir(QString const & path = QString(),
70                              QString const & suggested = QString());
71
72         /// Choose a file for saving, starting in directory \c  path.
73         Result save(QString const & path, QStringList const & filters,
74                           QString const & suggested = QString());
75
76         /// Also retrieve the selected filter (selectedFilter can be 0 if
77         /// that output is not needed).
78         Result save(QString const & path, QStringList const & filters,
79                     QString const & suggested, QString *selectedFilter);
80
81 private:
82         class Private;
83         friend class Private;
84         Private * private_;
85
86         /// the dialog title
87         QString title_;
88
89 };
90
91 } // namespace lyx
92
93 #endif // FILEDIALOG_H