]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/FileDialog.h
Revert "Mark some intentional fall-throughs (in a way understandable to gcc)"
[lyx.git] / src / frontends / qt4 / 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         /**
45          * Constructs a file dialog with title \param title.
46          *
47          * Up to two optional extra buttons are allowed for specifying
48          * additional directories in the navigation (an empty
49          * directory is interpreted as FileName::getcwd())
50          */
51         FileDialog(QString const & title);
52
53         ~FileDialog();
54
55         void setButton1(QString const & label, QString const & dir);
56         void setButton2(QString const & label, QString const & dir);
57
58         /// Choose a file for opening, starting in directory \c path.
59         Result open(QString const & path, QStringList const & filters,
60                           QString const & suggested = QString());
61
62         /// Choose a directory, starting in directory \c path.
63         Result opendir(QString const & path = QString(),
64                              QString const & suggested = QString());
65
66         /// Choose a file for saving, starting in directory \c  path.
67         Result save(QString const & path, QStringList const & filters,
68                           QString const & suggested = QString());
69
70         /// Also retrieve the selected filter (selectedFilter can be 0 if
71         /// that output is not needed).
72         Result save(QString const & path, QStringList const & filters,
73                     QString const & suggested, QString *selectedFilter);
74
75 private:
76         class Private;
77         friend class Private;
78         Private * private_;
79
80         /// the dialog title
81         QString title_;
82
83 };
84
85 } // namespace lyx
86
87 #endif // FILEDIALOG_H