Commit 0790a27e authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Ensure no double entries in generators menu

parent ffd00a77
Pipeline #21057 passed with stage
in 10 minutes and 33 seconds
......@@ -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()));
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