]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/FileDialog.h
Remove the .aux and .bbl files and update the citation labels
[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 "FuncCode.h"
17
18 #include <QString>
19
20 #include <utility>
21
22 namespace lyx {
23
24 /**
25  * \class FileDialog
26  * \brief GUI-I definition of file dialog interface
27  */
28 class FileDialog
29 {
30 public:
31         /// label, directory path button
32         typedef std::pair<QString, QString> Button;
33
34         /// result type
35         enum ResultType {
36                 Later, /**< modeless chooser, no result */
37                 Chosen /**< string contains filename */
38         };
39
40         /// result return
41         typedef std::pair<FileDialog::ResultType, QString> Result;
42
43         /**
44          * Constructs a file dialog with title \param title.
45          * If \param a is \const LFUN_SELECT_FILE_SYNC then a value
46          * will be returned immediately upon performing a open(),
47          * otherwise a callback Dispatch() will be invoked with the filename as
48          * argument, of action \param a.
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, FuncCode a = LFUN_SELECT_FILE_SYNC);
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
65         /// Choose a directory, starting in directory \c path.
66         Result opendir(QString const & path = QString(),
67                              QString const & suggested = QString());
68
69         /// Choose a file for saving, starting in directory \c  path.
70         Result save(QString const & path, QStringList const & filters,
71                           QString const & suggested = QString());
72
73         /// Also retrieve the selected filter (selectedFilter can be 0 if
74         /// that output is not needed).
75         Result save(QString const & path, QStringList const & filters,
76                     QString const & suggested, QString *selectedFilter);
77
78 private:
79         class Private;
80         friend class Private;
81         Private * private_;
82
83         /// the dialog title
84         QString title_;
85
86         /// success action to perform if not synchronous
87         FuncCode success_;
88 };
89
90 } // namespace lyx
91
92 #endif // FILEDIALOG_H