Master/Child: do not clean includeonly list while editing (part of #12470)

This commit is contained in:
Juergen Spitzmueller 2022-12-27 15:36:36 +01:00
parent 4c8a698a28
commit 69d54ff9d8
2 changed files with 7 additions and 6 deletions

View File

@ -1989,16 +1989,16 @@ void GuiDocument::includeonlyClicked(QTreeWidgetItem * item, int)
return; return;
string child = fromqstr(item->text(0)); string child = fromqstr(item->text(0));
if (child.empty()) if (child.empty())
return; return;
if (std::find(includeonlys_.begin(), if (isChildIncluded(child))
includeonlys_.end(), child) != includeonlys_.end())
includeonlys_.remove(child); includeonlys_.remove(child);
else else
includeonlys_.push_back(child); includeonlys_.push_back(child);
updateIncludeonlys(); updateIncludeonlys(false);
change_adaptor(); change_adaptor();
} }
@ -3768,6 +3768,7 @@ void GuiDocument::applyView()
// Master/Child // Master/Child
bp_.clearIncludedChildren(); bp_.clearIncludedChildren();
updateIncludeonlys();
if (masterChildModule->includeonlyRB->isChecked()) { if (masterChildModule->includeonlyRB->isChecked()) {
list<string>::const_iterator it = includeonlys_.begin(); list<string>::const_iterator it = includeonlys_.begin();
for (; it != includeonlys_.end() ; ++it) { for (; it != includeonlys_.end() ; ++it) {
@ -4690,7 +4691,7 @@ void GuiDocument::updateIncludeonlyDisplay()
} }
void GuiDocument::updateIncludeonlys() void GuiDocument::updateIncludeonlys(bool const cleanup)
{ {
masterChildModule->childrenTW->clear(); masterChildModule->childrenTW->clear();
QString const no = qt_("No"); QString const no = qt_("No");
@ -4716,7 +4717,7 @@ void GuiDocument::updateIncludeonlys()
} }
// Both if all children are included and if none is included // Both if all children are included and if none is included
// is equal to "include all" (i.e., omit \includeonly). // is equal to "include all" (i.e., omit \includeonly).
if (!has_unincluded || all_unincluded) if (cleanup && (!has_unincluded || all_unincluded))
includeonlys_.clear(); includeonlys_.clear();
} }

View File

@ -215,7 +215,7 @@ private:
/// ///
void updateIncludeonlyDisplay(); void updateIncludeonlyDisplay();
/// ///
void updateIncludeonlys(); void updateIncludeonlys(bool const cleanup = true);
/// ///
void updateDefaultBiblio(std::string const & style, void updateDefaultBiblio(std::string const & style,
std::string const & which = std::string()); std::string const & which = std::string());