mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-24 04:32:15 -04:00
Open multiple ZIM files from command line (#720)
Loop through all the ZIM files in arguments and open them one by one.
This commit is contained in:
parent
35b28bbbd6
commit
4f9618d2fc
@ -17,22 +17,20 @@ int main(int argc, char *argv[])
|
|||||||
KiwixApp a(argc, argv);
|
KiwixApp a(argc, argv);
|
||||||
a.setApplicationVersion(version);
|
a.setApplicationVersion(version);
|
||||||
QCommandLineParser parser;
|
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.setApplicationDescription(QStringLiteral("The Kiwix Desktop is a viewer/manager of ZIM files for GNU/Linux and Microsoft Windows OSes."));
|
||||||
parser.addHelpOption();
|
parser.addHelpOption();
|
||||||
parser.addVersionOption();
|
parser.addVersionOption();
|
||||||
parser.addPositionalArgument("zimfile", "The zim file");
|
parser.addPositionalArgument("zimfile", "The zim file");
|
||||||
parser.process(a);
|
parser.process(a);
|
||||||
auto positionalArguments = parser.positionalArguments();
|
auto positionalArguments = parser.positionalArguments();
|
||||||
if (positionalArguments.size() >= 1) {
|
|
||||||
zimfile = parser.positionalArguments().at(0);
|
|
||||||
}
|
|
||||||
if (a.isRunning()) {
|
if (a.isRunning()) {
|
||||||
|
for (QString zimfile : positionalArguments) {
|
||||||
a.sendMessage(zimfile);
|
a.sendMessage(zimfile);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
a.init();
|
a.init();
|
||||||
if (!zimfile.isEmpty()) {
|
for (QString zimfile : positionalArguments) {
|
||||||
a.openZimFile(zimfile);
|
a.openZimFile(zimfile);
|
||||||
}
|
}
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user