2001-03-12 12:47:07 +00:00
|
|
|
/**
|
|
|
|
* \file FileDialog_private.C
|
|
|
|
* Copyright 2001 the LyX Team
|
|
|
|
* Read the file COPYING
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "LString.h"
|
2001-03-26 19:34:45 +00:00
|
|
|
|
|
|
|
#include <qapplication.h>
|
2001-03-12 12:47:07 +00:00
|
|
|
#include <qfiledialog.h>
|
2001-03-26 19:34:45 +00:00
|
|
|
|
2001-03-12 12:47:07 +00:00
|
|
|
#include "QtLyXView.h"
|
|
|
|
#include "debug.h"
|
2002-08-07 08:11:41 +00:00
|
|
|
#include "funcrequest.h"
|
2001-03-26 19:34:45 +00:00
|
|
|
|
2001-03-12 12:47:07 +00:00
|
|
|
#include "FileDialog_private.h"
|
|
|
|
|
2002-08-07 08:11:41 +00:00
|
|
|
LyXFileDialog::LyXFileDialog(LyXView * lv, kb_action a,
|
|
|
|
string const & p, string const & m, string const & t)
|
|
|
|
: QFileDialog(p.c_str(), m.c_str(), qApp->mainWidget(), t.c_str(),
|
|
|
|
a == LFUN_SELECT_FILE_SYNC),
|
|
|
|
lv_(lv), action_(a)
|
2001-03-12 12:47:07 +00:00
|
|
|
{
|
|
|
|
setCaption(t.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LyXFileDialog::done(int what)
|
|
|
|
{
|
2001-03-26 19:34:45 +00:00
|
|
|
lyxerr[Debug::GUI] << "Done FileDialog, value " << what << std::endl;
|
|
|
|
|
2001-03-12 12:47:07 +00:00
|
|
|
if (action_ == LFUN_SELECT_FILE_SYNC) {
|
|
|
|
QDialog::done(what);
|
|
|
|
return;
|
2002-01-16 23:56:25 +00:00
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-08-07 08:11:41 +00:00
|
|
|
if (what == QDialog::Accepted)
|
2002-08-13 14:40:38 +00:00
|
|
|
lv_->getLyXFunc().dispatch(FuncRequest(action_, selectedFile().data()));
|
2002-08-07 08:11:41 +00:00
|
|
|
|
2001-03-12 12:47:07 +00:00
|
|
|
delete this;
|
|
|
|
}
|