+void GuiDocument::updateIncludeonlys()
+{
+ masterChildModule->childrenTW->clear();
+ QString const no = qt_("No");
+ QString const yes = qt_("Yes");
+
+ if (includeonlys_.empty()) {
+ masterChildModule->includeallRB->setChecked(true);
+ masterChildModule->childrenTW->setEnabled(false);
+ masterChildModule->maintainAuxCB->setEnabled(false);
+ } else {
+ masterChildModule->includeonlyRB->setChecked(true);
+ masterChildModule->childrenTW->setEnabled(true);
+ masterChildModule->maintainAuxCB->setEnabled(true);
+ }
+ QTreeWidgetItem * item = 0;
+ std::vector<Buffer *> children = buffer().getChildren(false);
+ vector<Buffer *>::const_iterator it = children.begin();
+ vector<Buffer *>::const_iterator end = children.end();
+ bool has_unincluded = false;
+ bool all_unincluded = true;
+ for (; it != end; ++it) {
+ item = new QTreeWidgetItem(masterChildModule->childrenTW);
+ // FIXME Unicode
+ string const name =
+ to_utf8(makeRelPath(from_utf8((*it)->fileName().absFilename()),
+ from_utf8(buffer().filePath())));
+ item->setText(0, toqstr(name));
+ item->setText(1, isChildIncluded(name) ? yes : no);
+ if (!isChildIncluded(name))
+ has_unincluded = true;
+ else
+ all_unincluded = false;
+ }
+ // Both if all childs are included and if none is included
+ // is equal to "include all" (i.e., ommit \includeonly).
+ // Thus, reset the GUI.
+ if (!has_unincluded || all_unincluded) {
+ masterChildModule->includeallRB->setChecked(true);
+ masterChildModule->childrenTW->setEnabled(false);
+ includeonlys_.clear();
+ }
+ // If all are included, we need to update again.
+ if (!has_unincluded)
+ updateIncludeonlys();
+}
+
+