File indexing completed on 2024-12-08 05:14:47

0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 // SPDX-FileCopyrightText: 2001 Dominik Seichter <domseichter@web.de>
0003 
0004 // Qt includes
0005 #include <QRect>
0006 #include <QtGlobal>
0007 #include <QWidget>
0008 
0009 // KDE includes
0010 
0011 #include <kaboutdata.h>
0012 
0013 #include <kconfig.h>
0014 #include <kmessagebox.h>
0015 
0016 #include <klocalizedstring.h>
0017 
0018 // Own includes
0019 #include "krenameimpl.h"
0020 
0021 // OS includes
0022 #ifndef Q_OS_WIN
0023 #include <unistd.h>
0024 #endif
0025 #include <sys/types.h>
0026 #include <QApplication>
0027 #include <KAboutData>
0028 #include <KCrash>
0029 #include <KLocalizedString>
0030 #include <QCommandLineParser>
0031 #include <QCommandLineOption>
0032 
0033 #include "../config-krename.h"
0034 
0035 int main(int argc, char *argv[])
0036 {
0037     QApplication app(argc, argv);
0038     app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
0039     KLocalizedString::setApplicationDomain("krename");
0040 
0041     KCrash::initialize();
0042 
0043     KAboutData aboutData("krename", i18n("KRename"), VERSION);
0044     aboutData.setShortDescription(i18n(
0045                                       "KRename is a batch file renamer which can rename a "
0046                                       "list of files based on a set of expressions."));
0047     aboutData.setOtherText(i18n(
0048                                "If you like KRename you may want to support it. "
0049                                "Testing, bug fixes and feature requests are as welcome "
0050                                "as financial support (everybody needs money ;). See help files for details."));
0051     aboutData.setLicense(KAboutLicense::GPL_V3);
0052     aboutData.setCopyrightStatement(i18n("(c) 2001-2012, Dominik Seichter\n"));
0053     aboutData.setHomepage("https://userbase.kde.org/KRename");
0054 
0055     aboutData.addAuthor(i18n("Heiko Becker"), i18n("Current maintainer"),
0056                         "heirecka@exherbo.org");
0057     aboutData.addAuthor(i18n("Dominik Seichter"), i18n("Developer and former maintainer"), "domseichter@web.de",
0058                         "https://www.krename.net/");
0059     aboutData.addAuthor(i18n("Stefan \"Stonki\" Onken"),
0060                         i18n("Website, testing, very good ideas and keeping me coding!"),
0061                         "support@stonki.de", "https://www.stonki.com/");
0062 
0063     aboutData.addCredit(i18n("Arpad Biro"), i18n("Helped to fix style guide issues and made improvements to user messages."), "biro.arpad@gmail.com");
0064     aboutData.addCredit(i18n("Trevor Semeniuk"),  i18n("Thanks to him for creating RedHat 7.x packages and some other help."),
0065                         "semeniuk@ee.ualberta.ca", "http://www.semeniuk.net");
0066     aboutData.addCredit(i18n("Groult Richard"),   i18n("Fixed a bug with startIndex and added the BatchRenamer class\n"
0067                         "to his excellent image viewer showimg."),
0068                         "rgroult@jalix.org");
0069     aboutData.addCredit(i18n("Michael Elvers"),  i18n("Fixed a bug that caused krename not closing open files."),
0070                         "m_elvers@yahoo.com");
0071     aboutData.addCredit(i18n("Andreas Pour"),  i18n("Thanks for his great job at apps.kde.com and help with contributing krename to apps.kde.com."),
0072                         "pour@mieterra.com");
0073     aboutData.addCredit(i18n("Charles Samuels"), i18n("Thanks for noatun and the ID3/Ogg Tag code is based on his noatun modules."),
0074                         "charles@kde.org");
0075     aboutData.addCredit(i18n("Franz Schmid"), i18n("Gave me a good start into writing plugins with his application scribus."),
0076                         "Franz.Schmid@altmuehlnet.de", "http://web2.altmuehlnet.de/fschmid/index.html");
0077     aboutData.addCredit(i18n("Rolf Magnus"), i18n("Parts of the PNG support are copied from his KFile plugin for png support."),
0078                         "ramagnus@kde.org");
0079     aboutData.addCredit(i18n("Michael v.Ostheim"), i18n("Created the Gentoo Ebuild scripts for KRename."),
0080                         "MvOstheim@web.de", "http://www.vonostheim.de");
0081     aboutData.addCredit(i18n("Brandon Low"), i18n("Some GCC 3.1 fixes for Gentoo."),
0082                         "lostlogic@gentoo.org");
0083     aboutData.addCredit(i18n("Per Oyvind Karlsen"), i18n("Thanks for creating the Mandrake RPM"),
0084                         "peroyvind@delonic.no");
0085     aboutData.addCredit(i18n("Vincenzo Reale"), i18n("Italian translation"), "smart2128@baslug.org");
0086     aboutData.addCredit(i18n("Daniele Medri"), i18n("Italian translation work"), "madrid@linuxmeeting.net");
0087     aboutData.addCredit(i18n("Stephan Johach"), i18n("Provided a gcc3.x namespace patch"), "lucardus@onlinehome.de");
0088     aboutData.addCredit(i18n("Michael Zugaro"), i18n("Provided the new preview and move features") , "michael.zugaro@college-de-france.fr");
0089     aboutData.addCredit(i18n("Rene Gass"), i18n("Fixed problems with the spec file and contributed rpms for every SuSE version you can imagine and is also the new Gentoo maintainer for KRename"), "kde-package@gmx.de");
0090     aboutData.addCredit(i18n("Mark Ziegler"), i18n("Provided SuSE RPMs and very good suggestions"), "mark.ziegler@rakekniven.de");
0091     aboutData.addCredit(i18n("Jose Rodriguez"), i18n("Contributed a Spanish translation"), "chmpmi@eresmas.net");
0092     aboutData.addCredit(i18n("Steven P. Ulrick"), i18n("Provided a RedHat RPM and was big help in improving KRename"), "steve@afolkey2.net");
0093     aboutData.addCredit(i18n("UTUMI Hirosi"), i18n("Translated KRename to Japanese"), "utuhiro@mx12.freecom.ne.jp");
0094     aboutData.addCredit(i18n("Nicolas Benoit"), i18n("Translated KRename into French"), "nbenoit@tuxfamily.org");
0095     aboutData.addCredit(i18n("Krzysztof Pawlak"), i18n("Translated KRename into Polish"), "jmnemonic@gazeta.pl");
0096     aboutData.addCredit(i18n("Ilya Ivkov"), i18n("Translated KRename into Russian"), "ilya-ivkov@yandex.ru");
0097     aboutData.addCredit(i18n("Asim Husanovic"), i18n("Translated KRename into Bosnian"), "asim.h@megatel.ba");
0098     aboutData.addCredit(i18n("Michal Smoczyk"), i18n("Polish Translation"), "msmoczyk@wp.pl");
0099     aboutData.addCredit(i18n("Pavel Fric"), i18n("Czech Translation"), "pavelfric@seznam.cz");
0100     aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"),
0101                             i18nc("EMAIL OF TRANSLATORS", "Your emails"));
0102 
0103     aboutData.setDesktopFileName(QStringLiteral("org.kde.krename"));
0104 
0105     KAboutData::setApplicationData(aboutData);
0106     QApplication::setWindowIcon(QIcon::fromTheme("krename", QApplication::windowIcon()));
0107 
0108     QCommandLineParser parser;
0109     parser.addPositionalArgument(QLatin1String("files"), i18n("Files to be added to the list to be renamed"), i18n("[files...]"));
0110     parser.addOption(QCommandLineOption(QStringList() << QLatin1String("r"), i18n("add folder recursively"), i18n("folder")));
0111     parser.addOption(QCommandLineOption(QStringList() << QLatin1String("template"), i18n("set a template")));
0112     parser.addOption(QCommandLineOption(QStringList() << QLatin1String("extension"), i18n("set a template for the file extension")));
0113     parser.addOption(QCommandLineOption(QStringList() << QLatin1String("use-plugin"), i18n("enable a plugin for use")));
0114     parser.addOption(QCommandLineOption(QStringList() << QLatin1String("copy"), i18n("copy files to folder or url"), i18n("path or url")));
0115     parser.addOption(QCommandLineOption(QStringList() << QLatin1String("move"), i18n("move files to folder or url"), i18n("path or url")));
0116     parser.addOption(QCommandLineOption(QStringList() << QLatin1String("link"), i18n("link files to folder or url"), i18n("path or url")));
0117     parser.addOption(QCommandLineOption(QStringList() << QLatin1String("start"), i18n("start renaming immediately")));
0118     parser.addOption(QCommandLineOption(QStringList() << QLatin1String("test"), i18n("start KRename's selftest (developers only)")));
0119     // This option was never implemented in the KDE4 version:
0120     //parser.addOption(QCommandLineOption(QStringList() << QLatin1String("previewitems"), i18n("only show <num> preview items"), QLatin1String("num")));
0121 
0122     aboutData.setupCommandLine(&parser);
0123     parser.process(app);
0124     aboutData.processCommandLine(&parser);
0125 
0126     app.setQuitOnLastWindowClosed(true);
0127 
0128     QWidget *krename = KRenameImpl::launch(QRect(0, 0, 0, 0), KRenameFile::List(), &parser);
0129 
0130 #ifndef Q_OS_WIN
0131     /* Check if KRename
0132      * was started from root!
0133      */
0134     unsigned int uid = geteuid();
0135     if (uid == 0)
0136         KMessageBox::information(krename, i18n(
0137                                      "<b>KRename was started from root!</b><br>"
0138                                      "When started from root, KRename may damage your "
0139                                      "system if you do not know exactly what you are "
0140                                      "doing!"
0141                                  ), i18n("Error"), "KrenameRootWarning");
0142 #endif // Q_OS_WIN
0143 
0144     /*
0145      * Activate this warning message for unstable development releases.
0146      */
0147     /*    KMessageBox::sorry( krename, i18n(
0148         "<b>Warning !</b> This is a development release which may cause damage to your files!"
0149         "<br>Make backups before using KRename." ));
0150     */
0151     return app.exec();
0152 }
0153