]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/FileDialog_private.C
the FuncRequest changes
[lyx.git] / src / frontends / qt2 / FileDialog_private.C
1 /**
2  * \file FileDialog_private.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon
7  */
8
9 #include <config.h>
10
11 #include "LString.h"
12
13 #include <qapplication.h>
14 #include <qfiledialog.h>
15
16 #include "QtLyXView.h"
17 #include "debug.h"
18 #include "funcrequest.h"
19
20 #include "FileDialog_private.h"
21
22 LyXFileDialog::LyXFileDialog(LyXView * lv, kb_action a,
23                 string const & p, string const & m, string const & t)
24         : QFileDialog(p.c_str(), m.c_str(), qApp->mainWidget(), t.c_str(),
25                             a == LFUN_SELECT_FILE_SYNC),
26           lv_(lv), action_(a)
27 {
28         setCaption(t.c_str());
29 }
30
31
32 void LyXFileDialog::done(int what)
33 {
34         lyxerr[Debug::GUI] << "Done FileDialog, value " << what << std::endl;
35
36         if (action_ == LFUN_SELECT_FILE_SYNC) {
37                 QDialog::done(what);
38                 return;
39         }
40
41         if (what == QDialog::Accepted)
42                 lv_->getLyXFunc()->dispatch(FuncRequest(action_, selectedFile().data()));
43
44         delete this;
45 }