]> git.lyx.org Git - features.git/commitdiff
* src/frontends/GuiDocument.{cpp,h}:
authorJürgen Spitzmüller <spitz@lyx.org>
Tue, 15 Jan 2008 10:38:19 +0000 (10:38 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Tue, 15 Jan 2008 10:38:19 +0000 (10:38 +0000)
- 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/trunk@22583 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiDocument.cpp
src/frontends/qt4/GuiDocument.h

index 4d4c6530cdf337fe8f285df4a801123e9a5dcdec..4e0ac136b2ed27e7ebcf0dcf85242619250cf325 100644 (file)
@@ -47,6 +47,8 @@
 #include "support/filetools.h"
 #include "support/lstrings.h"
 
+#include "frontends/alert.h"
+
 #include <boost/bind.hpp>
 
 #include <QCloseEvent>
@@ -490,7 +492,7 @@ void PreambleModule::closeEvent(QCloseEvent * e)
 
 
 GuiDocument::GuiDocument(GuiView & lv)
-       : GuiDialog(lv, "document")
+       : GuiDialog(lv, "document"), current_id_(0)
 {
        setupUi(this);
        setViewTitle(_("Document Settings"));
@@ -841,14 +843,14 @@ GuiDocument::GuiDocument(GuiView & lv)
 
        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()));
        
        selectionManager = 
                new ModuleSelMan(latexModule->availableLV, latexModule->selectedLV, 
@@ -1200,8 +1202,16 @@ void GuiDocument::classChanged()
        textclass_type const tc = latexModule->classCO->currentIndex();
        bp_.setBaseClass(tc);
        if (lyxrc.auto_reset_options) {
+               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)
+                               applyView();
+               }
                bp_.useClassDefaults();
-               updateContents();
+               forceUpdate();
        }
 }
 
@@ -1982,6 +1992,9 @@ void GuiDocument::updateSelectedModules()
 
 void GuiDocument::updateContents()
 {
+       if (id() == current_id_)
+               return;
+
        updateAvailableModules();
        updateSelectedModules();
        
@@ -1990,13 +2003,32 @@ void GuiDocument::updateContents()
        //selected, and that we don't have conflicts. If so, we could
        //at least pop up a warning.
        updateParams(bp_);
+       current_id_ = id();
 }
 
+
+void GuiDocument::forceUpdate()
+{
+       // reset to force dialog update
+       current_id_ = 0;
+       updateContents();
+}
+
+
 void GuiDocument::useClassDefaults()
 {
+       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)
+                       applyView();
+       }
+
        bp_.setBaseClass(latexModule->classCO->currentIndex());
        bp_.useClassDefaults();
-       updateContents();
+       forceUpdate();
 }
 
 
index 830a8856c6614cfc60078d52e05fe8b9ea484517..b379687ec07b2b77bca623800064e169ea51c244 100644 (file)
@@ -100,6 +100,9 @@ private:
 };
 
 
+typedef void const * BufferId;
+
+
 class GuiDocument : public GuiDialog, public Ui::DocumentUi
 {
        Q_OBJECT
@@ -175,6 +178,8 @@ private:
        void applyView();
        /// update
        void updateContents();
+       /// force content update
+       void forceUpdate();
        ///
        void updateAvailableModules();
        ///
@@ -187,6 +192,8 @@ private:
        GuiIdListModel available_model_;
        /// selected modules
        GuiIdListModel selected_model_;
+       /// current buffer
+       BufferId current_id_;
 
 protected:
        /// return false if validate_listings_params returns error
@@ -245,9 +252,6 @@ private:
 };
 
 
-typedef void const * BufferId;
-
-
 class PreambleModule : public UiWidget<Ui::PreambleUi>
 {
        Q_OBJECT