* src/frontends/QDocument.{cpp,h}:

- do not update dialog when clicking in the main window without buffer change
	  (bug 4302).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@22584 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2008-01-15 10:44:55 +00:00
parent ba2ab848b4
commit 6be0995fd7
3 changed files with 46 additions and 8 deletions

View File

@ -39,6 +39,8 @@
#include "insets/InsetListingsParams.h"
#include "controllers/ControlDocument.h"
#include "frontends/alert.h"
#include "support/lstrings.h"
#include <QCloseEvent>
@ -531,14 +533,14 @@ QDocumentDialog::QDocumentDialog(QDocument * form)
latexModule = new UiWidget<Ui::LaTeXUi>;
// latex class
connect(latexModule->classCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
connect(latexModule->optionsLE, SIGNAL(textChanged(const QString &)),
this, SLOT(change_adaptor()));
connect(latexModule->psdriverCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
connect(latexModule->classCO, SIGNAL(activated(int)),
this, SLOT(classChanged()));
connect(latexModule->classCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
// packages
for (int n = 0; tex_graphics[n][0]; ++n) {
QString enc = qt_(tex_graphics_gui[n]);
@ -834,10 +836,18 @@ void QDocumentDialog::classChanged()
textclass_type const tc = latexModule->classCO->currentIndex();
if (form_->controller().loadTextclass(tc)) {
if (applyPB->isEnabled()) {
int const ret = Alert::prompt(_("Unapplied changes"),
_("Some changes in the dialog were not yet applied."
"If you do not apply now, they will be lost after this action."),
1, 1, _("&Apply"), _("&Dismiss"));
if (ret == 0)
form_->apply();
}
params.textclass = tc;
if (lyxrc.auto_reset_options)
params.useClassDefaults();
form_->update_contents();
form_->forceUpdate();
} else {
latexModule->classCO->setCurrentIndex(params.textclass);
}
@ -1409,7 +1419,7 @@ typedef QController<ControlDocument, QView<QDocumentDialog> >
QDocument::QDocument(Dialog & parent)
: DocumentBase(parent, _("Document Settings"))
: DocumentBase(parent, _("Document Settings")), current_id_(0)
{}
@ -1439,9 +1449,22 @@ void QDocument::update_contents()
if (!dialog_.get())
return;
if (controller().id() == current_id_)
return;
dialog_->updateParams(controller().params());
current_id_ = controller().id();
}
void QDocument::forceUpdate()
{
// reset to force dialog update
current_id_ = 0;
update_contents();
}
void QDocument::saveDocDefault()
{
// we have to apply the params first
@ -1457,8 +1480,16 @@ void QDocument::useClassDefaults()
///\todo verify the use of below with lyx-devel:
params.textclass = dialog_->latexModule->classCO->currentIndex();
if (dialog_->applyPB->isEnabled()) {
int const ret = Alert::prompt(_("Unapplied changes"),
_("Some changes in the dialog were not yet applied."
"If you do not apply now, they will be lost after this action."),
1, 1, _("&Apply"), _("&Dismiss"));
if (ret == 0)
apply();
}
params.useClassDefaults();
update_contents();
forceUpdate();
}

View File

@ -121,6 +121,8 @@ private:
class ControlDocument;
typedef void const * BufferId;
class QDocument
: public QController<ControlDocument, QView<QDocumentDialog> >
{
@ -137,21 +139,22 @@ private:
void apply();
/// update
void update_contents();
/// force content update
void forceUpdate();
/// build the dialog
void build_dialog();
/// save as default template
void saveDocDefault();
/// reset to default params
void useClassDefaults();
/// current buffer
BufferId current_id_;
protected:
/// return false if validate_listings_params returns error
virtual bool isValid();
};
typedef void const * BufferId;
class PreambleModule : public UiWidget<Ui::PreambleUi>
{
Q_OBJECT

View File

@ -93,6 +93,7 @@ What's new
- Fix LaTeX code for line spacing when using the memoir class.
* USER INTERFACE:
- Fix a crash when changing the document encoding while View->Source
@ -105,6 +106,9 @@ What's new
- Fix update/drawing of char style insets.
- Keep unapplied content of the document settings dialog after
clicking in the main window (bug 4302).
- Fix access to network drives on Windows.
- "Accept compound words" in Preferences->Spellchecker now also works