]> git.lyx.org Git - features.git/commitdiff
Table dialog: Fix enabling/disabling of first header and last footer
authorAbdelrazak Younes <younes@lyx.org>
Tue, 2 Nov 2010 13:35:16 +0000 (13:35 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Tue, 2 Nov 2010 13:35:16 +0000 (13:35 +0000)
check boxes.
This should fix bug #7008

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35993 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiTabular.cpp
src/frontends/qt4/GuiTabular.h

index 6fd86eadb9a4328d0730b591ad65c95105379646..1a1dd29f50e78628c695f87837ed5e0d3e794bfb 100644 (file)
@@ -79,7 +79,7 @@ GuiTabular::GuiTabular(QWidget * parent)
                this, SLOT(checkEnabled()));
        connect(borderSetPB, SIGNAL(clicked()),
                this, SLOT(borderSet_clicked()));
-       connect(borderUnsetPB, SIGNAL(clicked()), 
+       connect(borderUnsetPB, SIGNAL(clicked()),
                this, SLOT(borderUnset_clicked()));
        connect(hAlignCB, SIGNAL(activated(int)),
                this, SLOT(checkEnabled()));
@@ -149,8 +149,8 @@ GuiTabular::GuiTabular(QWidget * parent)
                this, SLOT(checkEnabled()));
        connect(rightRB, SIGNAL(clicked()),
                this, SLOT(checkEnabled()));
-               
-       
+
+
        // initialize the length validator
        addCheckedWidget(widthED, fixedWidthColLA);
        addCheckedWidget(topspaceED, topspaceLA);
@@ -168,7 +168,7 @@ void GuiTabular::checkEnabled()
        decimalPointLE->setEnabled(dalign);
        decimalL->setEnabled(dalign);
 
-       vAlignCB->setEnabled(!multirowCB->isChecked() 
+       vAlignCB->setEnabled(!multirowCB->isChecked()
                && !widgetsToLength(widthED, widthUnitCB).empty());
 
        topspaceED->setEnabled(topspaceCO->currentIndex() == 2);
@@ -197,10 +197,7 @@ void GuiTabular::checkEnabled()
        headerBorderBelowCB->setEnabled(longtabular
                && headerStatusCB->isChecked());
 
-       // first header can only be suppressed when there is a header
-       // FIXME: old code also checked for
-       //  tabular.haveLTHead() && !tabular.haveLTFirstHead());
-       firstheaderNoContentsCB->setEnabled(longtabular);
+       firstheaderNoContentsCB->setEnabled(longtabular && firstheader_suppressable_);
        // check if setting a first header is allowed
        // additionally check firstheaderNoContentsCB because when this is
        // the case a first header makes no sense
@@ -217,10 +214,7 @@ void GuiTabular::checkEnabled()
        footerBorderBelowCB->setEnabled(longtabular
                && footerBorderAboveCB->isChecked());
 
-       // last footer can only be suppressed when there is a footer
-       // FIXME: old code also checked for
-       //   tabular.haveLTFoot() && !tabular.haveLTLastFoot());
-       lastfooterNoContentsCB->setEnabled(longtabular);
+       lastfooterNoContentsCB->setEnabled(longtabular && lastfooter_suppressable_);
        // check if setting a last footer is allowed
        // additionally check lastfooterNoContentsCB because when this is
        // the case a last footer makes no sense
@@ -233,7 +227,7 @@ void GuiTabular::checkEnabled()
 
        captionStatusCB->setEnabled(funcEnabled(Tabular::TOGGLE_LTCAPTION)
                && longtabular);
-       
+
        multicolumnCB->setEnabled(funcEnabled(Tabular::MULTICOLUMN));
        multirowCB->setEnabled(funcEnabled(Tabular::MULTIROW));
 
@@ -276,7 +270,7 @@ void GuiTabular::setHAlign(string & param_str) const
 {
        Tabular::Feature num = Tabular::ALIGN_LEFT;
        Tabular::Feature multi_num = Tabular::M_ALIGN_LEFT;
-       string const align = 
+       string const align =
                fromqstr(hAlignCB->itemData(hAlignCB->currentIndex()).toString());
        if (align == "left") {
                num = Tabular::ALIGN_LEFT;
@@ -855,6 +849,13 @@ void GuiTabular::paramsToDialog(Inset const * inset)
        }
        newpageCB->setChecked(tabular.getLTNewPage(row));
 
+       // first header can only be suppressed when there is a header
+       firstheader_suppressable_ = tabular.haveLTHead()
+                       && !tabular.haveLTFirstHead();
+       // last footer can only be suppressed when there is a footer
+       lastfooter_suppressable_ = tabular.haveLTFoot()
+                       && !tabular.haveLTLastFoot();
+
        // after setting the features, check if they are enabled
        checkEnabled();
 }
index 9b31a94c79d4266e02a579cd67c8833b6b48cf65..c36076f1d541f5baa21d7d3ef86b941fdaa6de5d 100644 (file)
@@ -53,6 +53,10 @@ private:
        void setWidthAndAlignment();
        ///
        bool funcEnabled(Tabular::Feature f) const;
+       ///
+       bool firstheader_suppressable_;
+       ///
+       bool lastfooter_suppressable_;
 };
 
 } // namespace frontend