File indexing completed on 2024-05-05 16:39:04

0001 /* This file is part of the KDE project
0002    Copyright (C) 1998-2002 Carsten Pfeiffer <pfeiffer@kde.org>
0003 
0004    This program is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU General Public
0006    License as published by the Free Software Foundation, version 2.
0007 
0008    This program is distributed in the hope that it will be useful,
0009    but WITHOUT ANY WARRANTY; without even the implied warranty of
0010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0011     General Public License for more details.
0012 
0013    You should have received a copy of the GNU General Public License
0014    along with this program; see the file COPYING.  If not, write to
0015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0016    Boston, MA 02110-1301, USA.
0017 */
0018 
0019 #include <KAboutData>
0020 #include <KLocalizedString>
0021 
0022 #include <QApplication>
0023 #include <QCommandLineParser>
0024 
0025 #include "kuickshow.h"
0026 #include "version.h"
0027 
0028 
0029 extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
0030 {
0031     QApplication app(argc, argv);
0032     KLocalizedString::setApplicationDomain("kuickshow");
0033 
0034     KAboutData about(
0035         QStringLiteral("kuickshow"),
0036         i18n("KuickShow"),
0037         KUICKSHOWVERSION,
0038         i18n("A fast and versatile image viewer"),
0039         KAboutLicense::GPL,
0040         i18n("(c) 1998-2009, Carsten Pfeiffer"),
0041         QString(),
0042         QStringLiteral(HOMEPAGE_URL)
0043     );
0044 
0045     about.addAuthor(i18n("Carsten Pfeiffer"), QString(), QStringLiteral("pfeiffer@kde.org"),
0046         QStringLiteral("http://devel-home.kde.org/~pfeiffer/"));
0047     about.addCredit(i18n("Rober Hamberger"), QString(), QStringLiteral("rh474@bingo-ev.de"));
0048     about.addCredit(i18n("Thorsten Scheuermann"), QString(), QStringLiteral("uddn@rz.uni-karlsruhe.de"));
0049 
0050     KAboutData::setApplicationData(about);
0051     QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("kuickshow")));
0052 
0053 
0054     QCommandLineParser parser;
0055     about.setupCommandLine(&parser);
0056 
0057     parser.addOption({ {"d", "lastfolder"}, i18n("Start in the last visited folder, not the current working folder.") });
0058     parser.addPositionalArgument("files", i18n("Optional image filenames/urls to show"), QStringLiteral("[files...]"));
0059 
0060     parser.process(app);
0061     about.processCommandLine(&parser);
0062 
0063     // the parser is needed in KuickShow::KuickShow()
0064     app.setProperty("cmdlineParser", QVariant::fromValue<void *>(&parser));
0065 
0066 
0067     if ( app.isSessionRestored() )
0068     RESTORE( KuickShow )
0069     else {
0070     (void) new KuickShow( "kuickshow" );
0071     }
0072 
0073     return app.exec();
0074 }