From 0be08dde6d2e6ce55260df8e9c9d7515010b67af Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sun, 21 Dec 2014 19:08:41 +0100 Subject: [PATCH] Do not warn about changed modules when changing modules. Part of #9356 Also fixes #9365 --- src/frontends/qt4/GuiDocument.cpp | 35 ++++++++++++++++++------------- src/frontends/qt4/GuiDocument.h | 2 ++ status.21x | 8 ++++++- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 36a1a0e50b..76c85852df 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -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; } diff --git a/src/frontends/qt4/GuiDocument.h b/src/frontends/qt4/GuiDocument.h index cfd58823fe..1018c8f66b 100644 --- a/src/frontends/qt4/GuiDocument.h +++ b/src/frontends/qt4/GuiDocument.h @@ -273,6 +273,8 @@ private: std::list includeonlys_; /// bool biblioChanged_; + /// Track if a non-module document param changed + bool nonModuleChanged_; }; diff --git a/status.21x b/status.21x index 94c756e169..cfe41f8ff8 100644 --- a/status.21x +++ b/status.21x @@ -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 -- 2.39.5