diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2016-01-08 15:42:27 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-08 10:03:06 -0800 |
commit | f07a9fa09f06ca2b5f4ea5f501c3825c031a74fc (patch) | |
tree | 2e5461ef7582e40f4c1a2a1564cf0718698a6873 /desktop-widgets/templatelayout.cpp | |
parent | a809eec8533d2504d93798f02f6f014195c09f8c (diff) | |
download | subsurface-f07a9fa09f06ca2b5f4ea5f501c3825c031a74fc.tar.gz |
Simplify Finding the Templates
We don't need a list of QFileInfo if we are not using it
much better to have a list of the files directly
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/templatelayout.cpp')
-rw-r--r-- | desktop-widgets/templatelayout.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/desktop-widgets/templatelayout.cpp b/desktop-widgets/templatelayout.cpp index 1c6ca4fba..5130c2a54 100644 --- a/desktop-widgets/templatelayout.cpp +++ b/desktop-widgets/templatelayout.cpp @@ -21,20 +21,19 @@ void find_all_templates() grantlee_templates.clear(); grantlee_statistics_templates.clear(); QDir dir(getPrintingTemplatePathUser()); - QFileInfoList list = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot); - foreach (QFileInfo finfo, list) { - QString filename = finfo.fileName(); + QStringList list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot); + foreach (const QString& filename, list) { if (filename.at(filename.size() - 1) != '~') { - grantlee_templates.append(finfo.fileName()); + grantlee_templates.append(filename); } } + // find statistics templates dir.setPath(getPrintingTemplatePathUser() + QDir::separator() + "statistics"); - list = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot); - foreach (QFileInfo finfo, list) { - QString filename = finfo.fileName(); + list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot); + foreach (const QString& filename, list) { if (filename.at(filename.size() - 1) != '~') { - grantlee_statistics_templates.append(finfo.fileName()); + grantlee_statistics_templates.append(filename); } } } |