]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiViewSource.cpp
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / GuiViewSource.cpp
index 5941186b9894526d8232351348befcbc3bbfcacf..a5beae5da691e673c05fa55d77e9ae9274527128 100644 (file)
@@ -50,6 +50,8 @@ ViewSourceWidget::ViewSourceWidget()
                this, SLOT(updateView()));
        connect(autoUpdateCB, SIGNAL(toggled(bool)),
                updatePB, SLOT(setDisabled(bool)));
+       connect(autoUpdateCB, SIGNAL(toggled(bool)),
+               this, SLOT(updateView()));
        connect(updatePB, SIGNAL(clicked()),
                this, SLOT(updateView()));
 
@@ -115,6 +117,7 @@ static bool getContent(BufferView const * view, bool fullSource, QString & qstr)
 void ViewSourceWidget::setBufferView(BufferView const * bv)
 {
        bv_ = bv;
+       setEnabled(bv ?  true : false);
 }
 
 
@@ -125,6 +128,8 @@ void ViewSourceWidget::updateView()
                setEnabled(false);
                return;
        }
+       
+       setEnabled(true);
 
        QString content;
        if (getContent(bv_, viewFullSourceCB->isChecked(), content))
@@ -176,12 +181,10 @@ void GuiViewSource::updateView()
 
 void GuiViewSource::enableView(bool enable)
 {
-       if (!enable) {
+       widget_->setBufferView(bufferview());
+       if (!enable)
                // In the opposite case, updateView() will be called anyway.
-               widget_->setBufferView(bufferview());
                widget_->updateView();
-       }
-       widget_->setEnabled(enable);
 }
 
 
@@ -228,6 +231,7 @@ void GuiViewSource::restoreSession()
        QSettings settings;
        widget_->autoUpdateCB->setChecked(
                settings.value(sessionKey() + "/autoupdate", true).toBool());
+       widget_->updateView();
 }