mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-30 13:20:58 +00:00
f65f5be6d7
- 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
68 lines
1.6 KiB
C++
68 lines
1.6 KiB
C++
// -*- 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.
|
|
*/
|
|
|
|
#ifndef DIALOGVIEW_H
|
|
#define DIALOGVIEW_H
|
|
|
|
#include "Dialog.h"
|
|
#include "GuiView.h"
|
|
|
|
#include <QCloseEvent>
|
|
#include <QDialog>
|
|
|
|
namespace lyx {
|
|
namespace frontend {
|
|
|
|
class DialogView : public QDialog, public Dialog
|
|
{
|
|
public:
|
|
/// \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.
|
|
/// \param title is the window title used for decoration.
|
|
DialogView(GuiView & lv, QString const & name, QString const & title)
|
|
: Dialog(lv, name, "LyX: " + title)
|
|
{}
|
|
|
|
virtual QWidget * asQWidget() { return this; }
|
|
virtual QWidget const * asQWidget() const { return this; }
|
|
|
|
protected:
|
|
/// \name Dialog inherited methods
|
|
//@{
|
|
void applyView() {}
|
|
bool initialiseParams(std::string const & /*data*/) { return true; }
|
|
void clearParams() {}
|
|
bool needBufferOpen() const { return isBufferDependent(); }
|
|
//@}
|
|
/// Any dialog that overrides this method should make sure to call it.
|
|
void closeEvent(QCloseEvent * ev)
|
|
{
|
|
clearParams();
|
|
Dialog::disconnect();
|
|
ev->accept();
|
|
}
|
|
/// Any dialog that overrides this method should make sure to call it.
|
|
void hideEvent(QHideEvent * ev)
|
|
{
|
|
if (!ev->spontaneous()) {
|
|
clearParams();
|
|
Dialog::disconnect();
|
|
ev->accept();
|
|
}
|
|
}
|
|
};
|
|
|
|
} // namespace frontend
|
|
} // namespace lyx
|
|
|
|
#endif // DIALOGVIEW_H
|