]> git.lyx.org Git - features.git/commitdiff
Do not warn about changed modules when changing modules.
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 21 Dec 2014 18:08:41 +0000 (19:08 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Thu, 25 Dec 2014 09:50:21 +0000 (10:50 +0100)
Part of #9356
Also fixes #9365

src/frontends/qt4/GuiDocument.cpp
src/frontends/qt4/GuiDocument.h
status.21x

index 36a1a0e50b8636f6ddb92dd15dfaa721526b3275..76c85852dfb49f1eb3597b73b738fec736e3f172 100644 (file)
@@ -629,7 +629,8 @@ void LocalLayout::validatePressed() {
 
 
 GuiDocument::GuiDocument(GuiView & lv)
-       : GuiDialog(lv, "document", qt_("Document Settings"))
+       : GuiDialog(lv, "document", qt_("Document Settings")),
+         nonModuleChanged_(false)
 {
        setupUi(this);
 
@@ -1322,8 +1323,6 @@ GuiDocument::GuiDocument(GuiView & lv)
                        availableModel(), selectedModel(), this);
        connect(selectionManager, SIGNAL(updateHook()),
                this, SLOT(updateModuleInfo()));
-       connect(selectionManager, SIGNAL(updateHook()),
-               this, SLOT(change_adaptor()));
        connect(selectionManager, SIGNAL(selectionChanged()),
                this, SLOT(modulesChanged()));
 
@@ -1443,6 +1442,7 @@ void GuiDocument::useDefaultsClicked()
 
 void GuiDocument::change_adaptor()
 {
+       nonModuleChanged_ = true;
        changed();
 }
 
@@ -1463,7 +1463,7 @@ void GuiDocument::includeonlyClicked(QTreeWidgetItem * item, int)
                includeonlys_.push_back(child);
 
        updateIncludeonlys();
-       changed();
+       change_adaptor();
 }
 
 
@@ -1640,7 +1640,7 @@ void GuiDocument::changeBackgroundColor()
        // save color
        set_backgroundcolor = rgbFromHexName(fromqstr(newColor.name()));
        is_backgroundcolor = true;
-       changed();
+       change_adaptor();
 }
 
 
@@ -1653,7 +1653,7 @@ void GuiDocument::deleteBackgroundColor()
        // save default color (white)
        set_backgroundcolor = rgbFromHexName("#ffffff");
        is_backgroundcolor = false;
-       changed();
+       change_adaptor();
 }
 
 
@@ -1670,7 +1670,7 @@ void GuiDocument::changeFontColor()
        // save color
        set_fontcolor = rgbFromHexName(fromqstr(newColor.name()));
        is_fontcolor = true;
-       changed();
+       change_adaptor();
 }
 
 
@@ -1683,7 +1683,7 @@ void GuiDocument::deleteFontColor()
        // save default color (black)
        set_fontcolor = rgbFromHexName("#000000");
        is_fontcolor = false;
-       changed();
+       change_adaptor();
 }
 
 
@@ -1698,7 +1698,7 @@ void GuiDocument::changeNoteFontColor()
                colorButtonStyleSheet(newColor));
        // save color
        set_notefontcolor = rgbFromHexName(fromqstr(newColor.name()));
-       changed();
+       change_adaptor();
 }
 
 
@@ -1708,7 +1708,7 @@ void GuiDocument::deleteNoteFontColor()
        theApp()->getRgbColor(Color_greyedouttext, set_notefontcolor);
        colorModule->noteFontColorPB->setStyleSheet(
                colorButtonStyleSheet(rgb2qcolor(set_notefontcolor)));
-       changed();
+       change_adaptor();
 }
 
 
@@ -1723,7 +1723,7 @@ void GuiDocument::changeBoxBackgroundColor()
                colorButtonStyleSheet(newColor));
        // save color
        set_boxbgcolor = rgbFromHexName(fromqstr(newColor.name()));
-       changed();
+       change_adaptor();
 }
 
 
@@ -1733,7 +1733,7 @@ void GuiDocument::deleteBoxBackgroundColor()
        theApp()->getRgbColor(Color_shadedbg, set_boxbgcolor);
        colorModule->boxBackgroundPB->setStyleSheet(
                colorButtonStyleSheet(rgb2qcolor(set_boxbgcolor)));
-       changed();
+       change_adaptor();
 }
 
 
@@ -2208,7 +2208,7 @@ void GuiDocument::languagePackageChanged(int i)
 void GuiDocument::biblioChanged()
 {
        biblioChanged_ = true;
-       changed();
+       change_adaptor();
 }
 
 
@@ -2359,7 +2359,7 @@ void GuiDocument::modulesChanged()
 {
        modulesToParams(bp_);
 
-       if (applyPB->isEnabled()) {
+       if (applyPB->isEnabled() && nonModuleChanged_) {
                int const ret = Alert::prompt(_("Unapplied changes"),
                                _("Some changes in the dialog were not yet applied.\n"
                                "If you do not apply now, they will be lost after this action."),
@@ -2370,6 +2370,7 @@ void GuiDocument::modulesChanged()
 
        bp_.makeDocumentClass();
        paramsToDialog();
+       changed();
 }
 
 
@@ -2909,6 +2910,9 @@ void GuiDocument::applyView()
                pdf.pagemode.clear();
        pdf.quoted_options = pdf.quoted_options_check(
                                fromqstr(pdfSupportModule->optionsLE->text()));
+
+       // reset tracker
+       nonModuleChanged_ = false;
 }
 
 
@@ -3428,6 +3432,9 @@ void GuiDocument::paramsToDialog()
 
        // clear changed branches cache
        changedBranches_.clear();
+
+       // reset tracker
+       nonModuleChanged_ = false;
 }
 
 
index cfd58823fed127594514139932534004849e7eca..1018c8f66bc268cd60e312b2e8e723c3a8cf555c 100644 (file)
@@ -273,6 +273,8 @@ private:
        std::list<std::string> includeonlys_;
        ///
        bool biblioChanged_;
+       /// Track if a non-module document param changed
+       bool nonModuleChanged_;
 };
 
 
index 94c756e169da8ca314d02075ba337a2dd9bc2b81..cfe41f8ff8f05264300f96ad44a588d2bcf761a2 100644 (file)
@@ -147,7 +147,13 @@ What's new
   layout (bug 2666).
 
 - When switching classes, warn user about all unapplied document changes
-  (part of bug 9356).
+  (1. part of bug 9356).
+
+- When adding a module, warn user about all unapplied document changes
+  (2. part of bug 9356).
+
+- Do not enable the Apply button in the document dialog just because a
+  module was selected in the widget (without actual change) (bug 9365).
 
 
 * INTERNALS