File indexing completed on 2024-12-22 05:05:31
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "../dialog/showarchivestructuredialog.h" 0008 0009 #include <QApplication> 0010 #include <QCommandLineOption> 0011 #include <QCommandLineParser> 0012 #include <QFileDialog> 0013 #include <QStandardPaths> 0014 0015 int main(int argc, char **argv) 0016 { 0017 QApplication app(argc, argv); 0018 QStandardPaths::setTestModeEnabled(true); 0019 QCommandLineParser parser; 0020 parser.addVersionOption(); 0021 parser.addHelpOption(); 0022 parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("+[url]"), QStringLiteral("URL of a archive to open"))); 0023 parser.process(app); 0024 0025 QString fileName; 0026 if (parser.positionalArguments().isEmpty()) { 0027 fileName = QFileDialog::getOpenFileName(nullptr, QString(), QString(), QStringLiteral("Zip file (*.zip)")); 0028 } else { 0029 fileName = parser.positionalArguments().at(0); 0030 } 0031 if (fileName.isEmpty()) { 0032 return 0; 0033 } 0034 auto dialog = new ShowArchiveStructureDialog(fileName); 0035 dialog->resize(800, 600); 0036 dialog->show(); 0037 app.exec(); 0038 delete dialog; 0039 return 0; 0040 }