2007-09-27 11:27:52 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file DialogView.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Abdelrazak Younes
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-12-09 22:35:04 +00:00
|
|
|
#ifndef DIALOGVIEW_H
|
|
|
|
#define DIALOGVIEW_H
|
2007-09-27 11:27:52 +00:00
|
|
|
|
2007-10-07 08:55:20 +00:00
|
|
|
#include "Dialog.h"
|
2008-03-05 20:11:47 +00:00
|
|
|
#include "GuiView.h"
|
2007-09-27 11:27:52 +00:00
|
|
|
|
2008-06-06 10:00:33 +00:00
|
|
|
#include <QCloseEvent>
|
2007-09-27 11:27:52 +00:00
|
|
|
#include <QDialog>
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-10-09 22:13:51 +00:00
|
|
|
class DialogView : public QDialog, public Dialog
|
2007-09-27 11:27:52 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-12-09 22:35:04 +00:00
|
|
|
/// \param lv is the access point for the dialog to the LyX kernel.
|
|
|
|
/// \param name is the identifier given to the dialog by its parent
|
|
|
|
/// container.
|
2008-02-05 12:43:19 +00:00
|
|
|
/// \param title is the window title used for decoration.
|
2008-03-05 20:11:47 +00:00
|
|
|
DialogView(GuiView & lv, QString const & name, QString const & title)
|
2010-10-21 13:40:49 +00:00
|
|
|
: QDialog(&lv), Dialog(lv, name, "LyX: " + title)
|
2008-03-05 20:11:47 +00:00
|
|
|
{}
|
2007-09-27 11:27:52 +00:00
|
|
|
|
2007-12-09 22:35:04 +00:00
|
|
|
virtual QWidget * asQWidget() { return this; }
|
|
|
|
virtual QWidget const * asQWidget() const { return this; }
|
2007-09-27 14:05:05 +00:00
|
|
|
|
2007-12-10 13:05:00 +00:00
|
|
|
protected:
|
2010-01-27 18:10:33 +00:00
|
|
|
/// \name Dialog inherited methods
|
2008-02-04 17:06:34 +00:00
|
|
|
//@{
|
|
|
|
void applyView() {}
|
|
|
|
bool initialiseParams(std::string const & /*data*/) { return true; }
|
|
|
|
void clearParams() {}
|
Fix bug #6451 (last part): Crash when interacting with buffer-dependent dialog with no buffer open.
- First, the comment for isBufferDependent is corrected. It seems that the actual use of this function differs from the comment. As the comment said, I decided to close all dialogs that were buffer dependent, but this didn't seem to be correct for the view source pan, the outliner, and find-and-replace.
- Second, the dialogs that are buffer dependent are now closed, but dockviews are not, except for the spellchecker pane, which really depends on an open buffer, but I can't test that.
So, please test whether the spellchecker dockviewed window behaves as one expects.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34291 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-26 02:12:10 +00:00
|
|
|
bool needBufferOpen() const { return isBufferDependent(); }
|
2008-02-04 17:06:34 +00:00
|
|
|
//@}
|
2008-06-06 15:53:02 +00:00
|
|
|
/// Any dialog that overrides this method should make sure to call it.
|
2008-06-06 10:00:33 +00:00
|
|
|
void closeEvent(QCloseEvent * ev)
|
|
|
|
{
|
|
|
|
clearParams();
|
|
|
|
Dialog::disconnect();
|
|
|
|
ev->accept();
|
|
|
|
}
|
2008-08-13 14:32:30 +00:00
|
|
|
/// Any dialog that overrides this method should make sure to call it.
|
|
|
|
void hideEvent(QHideEvent * ev)
|
|
|
|
{
|
|
|
|
if (!ev->spontaneous()) {
|
|
|
|
clearParams();
|
|
|
|
Dialog::disconnect();
|
|
|
|
ev->accept();
|
|
|
|
}
|
|
|
|
}
|
2007-09-27 11:27:52 +00:00
|
|
|
};
|
|
|
|
|
2007-12-09 22:35:04 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-09-27 11:27:52 +00:00
|
|
|
|
2007-12-09 22:35:04 +00:00
|
|
|
#endif // DIALOGVIEW_H
|