Commit 263d474b authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Ensure no double entries in generators menu

parent 08900246
......@@ -121,10 +121,15 @@ void Generators::getGenerators(const QStringList &producers, QMenu *menu)
const QStringList generatorFolders =
QStandardPaths::locateAll(QStandardPaths::AppDataLocation, QStringLiteral("generators"), QStandardPaths::LocateDirectory);
const QStringList filters = QStringList() << QStringLiteral("*.xml");
QStringList parsedGenerators;
for (const QString &folder : generatorFolders) {
QDir directory(folder);
const QStringList filesnames = directory.entryList(filters, QDir::Files);
for (const QString &fname : filesnames) {
if (parsedGenerators.contains(fname)) {
parsedGenerators << fname;
QPair<QString, QString> result = parseGenerator(directory.absoluteFilePath(fname), producers);
if (!result.first.isEmpty()) {
QAction *action = menu->addAction(i18n(result.first.toUtf8().data()));
Supports Markdown
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