From 4f9618d2fcc17d3e44fe2f94d86e001d968e57bd Mon Sep 17 00:00:00 2001 From: Nikhil Tanwar <2002nikhiltanwar@gmail.com> Date: Fri, 26 Nov 2021 18:06:24 +0530 Subject: [PATCH] Open multiple ZIM files from command line (#720) Loop through all the ZIM files in arguments and open them one by one. --- src/main.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 163ff25..930c57d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,22 +17,20 @@ int main(int argc, char *argv[]) KiwixApp a(argc, argv); a.setApplicationVersion(version); QCommandLineParser parser; - QString zimfile; parser.setApplicationDescription(QStringLiteral("The Kiwix Desktop is a viewer/manager of ZIM files for GNU/Linux and Microsoft Windows OSes.")); parser.addHelpOption(); parser.addVersionOption(); parser.addPositionalArgument("zimfile", "The zim file"); parser.process(a); auto positionalArguments = parser.positionalArguments(); - if (positionalArguments.size() >= 1) { - zimfile = parser.positionalArguments().at(0); - } if (a.isRunning()) { - a.sendMessage(zimfile); + for (QString zimfile : positionalArguments) { + a.sendMessage(zimfile); + } return 0; } a.init(); - if (!zimfile.isEmpty()) { + for (QString zimfile : positionalArguments) { a.openZimFile(zimfile); } return a.exec();