Jean-Marc Lasgouttes a écrit :
"Georg" == Georg Baum <[EMAIL PROTECTED]> writes:

Georg> Am Mittwoch, 22. März 2006 15:39 schrieb Jean-Marc Lasgouttes:
Comments? I'd like to apply it for 1.4.1. Then of course we'll have
to fix the actual problem.

Georg> I think you should put that in. Even if we are going to fix the
Georg> xurrent problems it will LyX make more robust wrt incomoplete
Georg> layout files, which is a Good Thing (TM).

I did that.

Here is the equivalent patch to Qt4. It contains also a port of preampleUi from Q3MultilineEdit to QTextEdit.

Will apply shortly.

Abdel.

Index: QDocumentDialog.C
===================================================================
--- QDocumentDialog.C   (revision 13453)
+++ QDocumentDialog.C   (working copy)
@@ -43,24 +43,10 @@
 #include "controllers/frnt_lang.h"
 
 
-#include <QLabel>
-#include <QLineEdit>
-#include <QPushButton>
-#include <QRadioButton>
-#include <QCheckBox>
-#include <QSlider>
-#include <QPixmap>
-#include <QColor>
-#include <QColorDialog>
-#include <QValidator>
-
 using lyx::support::token;
 using lyx::support::bformat;
 using lyx::support::getVectorFromString;
 
-using std::string;
-
-
 using std::distance;
 using std::vector;
 using std::string;
@@ -80,13 +66,6 @@
 
 }
 
-/*
-QDocumentDialog::getTextClass()
-{
-       return latexModule->classCO->currentItem();
-}
-*/
-
 QDocumentDialog::QDocumentDialog(QDocument * form)
        : form_(form), 
        lang_(getSecond(getLanguageData(false)))
@@ -359,7 +338,7 @@
 
        preambleModule = new UiWidget<Ui::PreambleUi>;
        // preamble
-       connect(preambleModule->preambleMLE, SIGNAL(textChanged()), this, 
SLOT(change_adaptor()));
+       connect(preambleModule->preambleTE, SIGNAL(textChanged()), this, 
SLOT(change_adaptor()));
 
 
        bulletsModule = new BulletsModule;
@@ -592,7 +571,7 @@
 {
        // preamble
        params.preamble =
-               fromqstr(preambleModule->preambleMLE->text());
+               fromqstr(preambleModule->preambleTE->document()->toPlainText());
 
        // biblio
        params.cite_engine = biblio::ENGINE_BASIC;
@@ -650,8 +629,10 @@
        params.language = languages.getLanguage(lang_[pos]);
 
        // numbering
-       params.tocdepth = numberingModule->tocSL->value();
-       params.secnumdepth = numberingModule->depthSL->value();
+       if (params.getLyXTextClass().hasTocLevels()) {
+               params.tocdepth = numberingModule->tocSL->value();
+               params.secnumdepth = numberingModule->depthSL->value();
+       }
 
        // bullets
        params.user_defined_bullet(0) = bulletsModule->getBullet(0);
@@ -837,7 +818,7 @@
 
        // preamble
        QString preamble = toqstr(params.preamble);
-       preambleModule->preambleMLE->setText(preamble);
+       preambleModule->preambleTE->document()->setPlainText(preamble);
 
        // biblio
        biblioModule->citeDefaultRB->setChecked(
@@ -883,19 +864,19 @@
        // numbering
        int const min_toclevel = form_->controller().textClass().min_toclevel();
        int const max_toclevel = form_->controller().textClass().max_toclevel();
-       if (min_toclevel != LyXLayout::NOT_IN_TOC)
+       if (form_->controller().textClass().hasTocLevels())
                numberingModule->setEnabled(true);
-       else {
+               numberingModule->depthSL->setMinValue(min_toclevel - 1);
+               numberingModule->depthSL->setMaxValue(max_toclevel);
+               numberingModule->depthSL->setValue(params.secnumdepth);
+               numberingModule->tocSL->setMinValue(min_toclevel - 1);
+               numberingModule->tocSL->setMaxValue(max_toclevel);
+               numberingModule->tocSL->setValue(params.tocdepth);
+               updateNumbering();
+       } else {
                numberingModule->setEnabled(false);
                numberingModule->tocLV->clear();
        }
-       numberingModule->depthSL->setMinValue(min_toclevel - 1);
-       numberingModule->depthSL->setMaxValue(max_toclevel);
-       numberingModule->depthSL->setValue(params.secnumdepth);
-       numberingModule->tocSL->setMinValue(min_toclevel - 1);
-       numberingModule->tocSL->setMaxValue(max_toclevel);
-       numberingModule->tocSL->setValue(params.tocdepth);
-       updateNumbering();
 
        // bullets
        bulletsModule->setBullet(0,params.user_defined_bullet(0));

Reply via email to