diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-11-24 20:55:16 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-11-24 23:06:51 +0200 |
commit | fc48cde77c98385c69bc4d951de6867cf2f652a0 (patch) | |
tree | 512ca848cacf2f37720ea5518ca541ccf3ce6a82 /desktop-widgets | |
parent | 712697e0c24e53d32ef6087c7f2b4e24fdf8a57c (diff) | |
download | subsurface-fc48cde77c98385c69bc4d951de6867cf2f652a0.tar.gz |
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>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/templatelayout.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/desktop-widgets/templatelayout.cpp b/desktop-widgets/templatelayout.cpp index b53f55741..ab9b3f09a 100644 --- a/desktop-widgets/templatelayout.cpp +++ b/desktop-widgets/templatelayout.cpp @@ -20,23 +20,22 @@ int getTotalWork(print_options *printOptions) void find_all_templates() { + const QString ext(".html"); grantlee_templates.clear(); grantlee_statistics_templates.clear(); QDir dir(getPrintingTemplatePathUser()); QStringList list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot); foreach (const QString& filename, list) { - if (filename.at(filename.size() - 1) != '~') { + if (filename.at(filename.size() - 1) != '~' && filename.endsWith(ext)) grantlee_templates.append(filename); - } } // find statistics templates dir.setPath(getPrintingTemplatePathUser() + QDir::separator() + "statistics"); list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot); 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); - } } } |