]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/Dialog.cpp
If we are in a closeEvent, we don't want to close all buffers, because these may...
[lyx.git] / src / frontends / qt4 / Dialog.cpp
index 801abd2ef8c684c00f9e826da3c53ed1f4463300..8d831b91cf6d42c492de1bfe7c541159e5886d0d 100644 (file)
@@ -106,25 +106,12 @@ KernelDocType Dialog::docType() const
 }
 
 
-BufferView * Dialog::bufferview()
-{
-       return lyxview_->view();
-}
-
-
 BufferView const * Dialog::bufferview() const
 {
        return lyxview_->view();
 }
 
 
-Buffer & Dialog::buffer()
-{
-       LASSERT(lyxview_->buffer(), /**/);
-       return *lyxview_->buffer();
-}
-
-
 Buffer const & Dialog::buffer() const
 {
        LASSERT(lyxview_->buffer(), /**/);
@@ -166,13 +153,11 @@ void Dialog::apply()
 }
 
 
-void Dialog::showView()
+void Dialog::prepareView()
 {
        // Make sure the dialog controls are correctly enabled/disabled with
        // readonly status.
        checkStatus();
-       if (exitEarly())
-               return;
 
        QWidget * w = asQWidget();
        w->setWindowTitle(title_);
@@ -180,7 +165,14 @@ void Dialog::showView()
        QSize const hint = w->sizeHint();
        if (hint.height() >= 0 && hint.width() >= 0)
                w->setMinimumSize(hint);
+}
+
 
+void Dialog::showView()
+{
+       prepareView();
+
+       QWidget * w = asQWidget();
        if (w->isVisible()) {
                w->raise();
                w->activateWindow();
@@ -189,8 +181,11 @@ void Dialog::showView()
 
        if (wantInitialFocus())
                w->setFocus();
-       else
+       else {
+               lyxview_->raise();
+               lyxview_->activateWindow();
                lyxview_->setFocus();
+       }
 }
 
 
@@ -240,7 +235,7 @@ void Dialog::checkStatus()
        // check whether this dialog may be active
        if (canApply()) {
                bool const readonly = isBufferReadonly();
-               enableView(!readonly);
+               enableView(!readonly || canApplyToReadOnly());
                // refreshReadOnly() is too generous in _enabling_ widgets
                // update dialog to disable disabled widgets again
 
@@ -254,7 +249,7 @@ void Dialog::checkStatus()
 
 QString Dialog::sessionKey() const
 {
-       return "view-" + QString::number(lyxview_->id())
+       return "views/" + QString::number(lyxview_->id())
                + "/" + name();
 }