mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
printing: only load *.html files in the UI
The function find_all_templates() thus far handled all files in the user template directory. This patch makes it so that only files with the .html extension are loaded. Also remove brackets for single lined `if` statement. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
712697e0c2
commit
fc48cde77c
1 changed files with 3 additions and 4 deletions
|
@ -20,24 +20,23 @@ int getTotalWork(print_options *printOptions)
|
||||||
|
|
||||||
void find_all_templates()
|
void find_all_templates()
|
||||||
{
|
{
|
||||||
|
const QString ext(".html");
|
||||||
grantlee_templates.clear();
|
grantlee_templates.clear();
|
||||||
grantlee_statistics_templates.clear();
|
grantlee_statistics_templates.clear();
|
||||||
QDir dir(getPrintingTemplatePathUser());
|
QDir dir(getPrintingTemplatePathUser());
|
||||||
QStringList list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
|
QStringList list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
|
||||||
foreach (const QString& filename, list) {
|
foreach (const QString& filename, list) {
|
||||||
if (filename.at(filename.size() - 1) != '~') {
|
if (filename.at(filename.size() - 1) != '~' && filename.endsWith(ext))
|
||||||
grantlee_templates.append(filename);
|
grantlee_templates.append(filename);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// find statistics templates
|
// find statistics templates
|
||||||
dir.setPath(getPrintingTemplatePathUser() + QDir::separator() + "statistics");
|
dir.setPath(getPrintingTemplatePathUser() + QDir::separator() + "statistics");
|
||||||
list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
|
list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
|
||||||
foreach (const QString& filename, list) {
|
foreach (const QString& filename, list) {
|
||||||
if (filename.at(filename.size() - 1) != '~') {
|
if (filename.at(filename.size() - 1) != '~' && filename.endsWith(ext))
|
||||||
grantlee_statistics_templates.append(filename);
|
grantlee_statistics_templates.append(filename);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find templates which are part of the bundle in the user path
|
/* find templates which are part of the bundle in the user path
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue