File indexing completed on 2024-04-14 05:35:35
0001 /*************************************************************************** 0002 * Copyright (C) 2005-2009 by Rajko Albrecht * 0003 * ral@alwins-world.de * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 0019 ***************************************************************************/ 0020 0021 #include "commandline.h" 0022 #include "kdesvn-config.h" 0023 #include "kdesvn.h" 0024 #include <KAboutData> 0025 #include <QApplication> 0026 0027 #include <QCommandLineParser> 0028 #include <QDir> 0029 #include <klocalizedstring.h> 0030 0031 int main(int argc, char **argv) 0032 { 0033 QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); 0034 QApplication app(argc, argv); 0035 KLocalizedString::setApplicationDomain("kdesvn"); 0036 app.setWindowIcon(QIcon::fromTheme(QStringLiteral("kdesvn"), app.windowIcon())); 0037 0038 KAboutData aboutData(QStringLiteral("kdesvn"), 0039 i18n("kdesvn"), 0040 QStringLiteral(KDESVN_VERSION), 0041 i18n("A Subversion Client by KDE (standalone application)"), 0042 KAboutLicense::GPL, 0043 i18n("(C) 2005-2009 Rajko Albrecht,\n(C) 2015-2019 Christian Ehrlicher")); 0044 aboutData.addAuthor(i18n("Rajko Albrecht"), i18n("Developer"), QStringLiteral("ral@alwins-world.de")); 0045 aboutData.addAuthor(i18n("Christian Ehrlicher"), i18n("Developer"), QStringLiteral("ch.ehrlicher@gmx.de")); 0046 aboutData.setHomepage(QStringLiteral("https://commits.kde.org/kdesvn")); 0047 KAboutData::setApplicationData(aboutData); 0048 0049 QCommandLineParser parser; 0050 parser.addOption({QStringLiteral("r"), i18n("Execute single Subversion command on specific revision(-range)"), i18n("startrev[:endrev]")}); 0051 parser.addOption({QStringLiteral("R"), i18n("Ask for revision when executing single command")}); 0052 parser.addOption({QStringLiteral("f"), i18n("Force operation")}); 0053 parser.addOption({QStringLiteral("o"), i18n("Save output of Subversion command (eg \"cat\") into file <file>"), i18n("<file>")}); 0054 parser.addOption({QStringLiteral("l"), i18n("Limit log output to <number>"), i18n("<number>")}); 0055 parser.addPositionalArgument(QStringLiteral("+exec <command>"), i18n("Execute Subversion command (\"exec help\" for more information)")); 0056 parser.addPositionalArgument(QStringLiteral("+[URL]"), i18n("Document to open")); 0057 aboutData.setupCommandLine(&parser); 0058 parser.process(app); 0059 aboutData.processCommandLine(&parser); 0060 0061 // see if we are starting with session management 0062 if (app.isSessionRestored()) { 0063 RESTORE(kdesvn); 0064 } else { 0065 // no session.. just start up normally 0066 if (parser.positionalArguments().isEmpty()) { 0067 kdesvn *widget = new kdesvn; 0068 widget->show(); 0069 widget->checkReload(); 0070 } else { 0071 if (parser.positionalArguments().at(0) == QLatin1String("exec")) { 0072 CommandLine cl(&parser); 0073 return cl.exec(); 0074 } else { 0075 int i = 0; 0076 for (; i < parser.positionalArguments().count(); i++) { 0077 kdesvn *widget = new kdesvn; 0078 widget->show(); 0079 widget->load(QUrl::fromUserInput(parser.positionalArguments().at(i), QDir::currentPath()), true); 0080 } 0081 } 0082 } 0083 } 0084 return app.exec(); 0085 }