+void GuiTabularCreate::getFiles()
+{
+ // We look for lyx files in the subdirectory dir of
+ // 1) user_lyxdir
+ // 2) build_lyxdir (if not empty)
+ // 3) system_lyxdir
+ // in this order. Files with a given sub-hierarchy will
+ // only be listed once.
+ // We also consider i18n subdirectories and store them separately.
+ QStringList dirs;
+
+ // The three locations to look at.
+ string const user = addPath(package().user_support().absFileName(), "tabletemplates");
+ string const build = addPath(package().build_support().absFileName(), "tabletemplates");
+ string const system = addPath(package().system_support().absFileName(), "tabletemplates");
+
+ dirs << toqstr(user)
+ << toqstr(build)
+ << toqstr(system);
+
+ for (int i = 0; i < dirs.size(); ++i) {
+ QString const dir = dirs.at(i);
+ QDirIterator it(dir, QDir::Files, QDirIterator::Subdirectories);
+ while (it.hasNext()) {
+ QString fn = QFileInfo(it.next()).fileName();
+ if (!fn.endsWith(".lyx") || fn.contains("_1x"))
+ continue;
+ QString data = fn.left(fn.lastIndexOf(".lyx"));
+ QString guiname = data;
+ guiname = toqstr(translateIfPossible(qstring_to_ucs4(guiname.replace('_', ' '))));
+ QString relpath = toqstr(makeRelPath(qstring_to_ucs4(fn),
+ qstring_to_ucs4(dir)));
+ if (styleCO->findData(data) == -1)
+ styleCO->addItem(guiname, data);
+ }
+ }
+}
+