Commit 30e58de2 authored by Martin Straka's avatar Martin Straka

Added load zfo files from selected folder.

parent 3f127a2c
......@@ -23,6 +23,7 @@
#include <QDebug>
#include <QDir>
#include <QDirIterator>
#include <QRegExp>
#include <QStandardPaths>
#include <QTextStream>
......@@ -190,3 +191,27 @@ void deleteFilesFromDir(const QString &dirName)
QDir dir(filePath);
dir.removeRecursively();
}
QStringList getZfoFilesFromDir(const QString &importDir, bool includeSubDir)
{
QStringList filters("*.zfo");
QStringList fileList, filePathList;
QDir directory(QDir::home());
if (includeSubDir) {
QDirIterator it(importDir, filters, QDir::Files,
QDirIterator::Subdirectories);
while (it.hasNext()) {
filePathList.append(it.next());
}
} else {
directory.setPath(importDir);
fileList = directory.entryList(filters);
foreach (const QString &file, fileList) {
filePathList.append(importDir +
QDir::separator() + file);
}
}
return filePathList;
}
......@@ -103,4 +103,13 @@ QString writeFileToDir(const QString &dirName, qint64 msgId,
*/
void deleteFilesFromDir(const QString &dirName);
/*!
* @brief Get paths of ZFO files from selected folder.
*
* @param[in] importDir Import source directory path.
* @param[in] includeSubDir Include subdirectories.
* @return List of full path to ZFO files.
*/
QStringList getZfoFilesFromDir(const QString &importDir, bool includeSubDir);
#endif /* _FILESYSTEM_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment