diff --git a/src/main.cpp b/src/main.cpp index 54b8fd0..a7917d5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,6 +22,11 @@ #include #include #include +#include +#include +#include +#include +#include static const char description[] = I18N_NOOP("A KDE 4 Application"); @@ -33,12 +38,17 @@ int main(int argc, char **argv) KAboutData about("danbooru_client", 0, ki18n("danbooru_client"), version, ki18n(description), KAboutData::License_GPL, ki18n("(C) %{CURRENT_YEAR} %{AUTHOR}"), KLocalizedString(), 0, "%{EMAIL}"); about.addAuthor( ki18n("%{AUTHOR}"), KLocalizedString(), "%{EMAIL}" ); - KCmdLineArgs::init(argc, argv, &about); + QApplication app(argc, argv); + QCommandLineParser parser; + KAboutData::setApplicationData(aboutData); + parser.addVersionOption(); + parser.addHelpOption(); + //PORTING SCRIPT: adapt aboutdata variable if necessary + aboutData.setupCommandLine(&parser); + parser.process(app); + aboutData.processCommandLine(&parser); - KCmdLineOptions options; - options.add("+[URL]", ki18n( "Document to open" )); - KCmdLineArgs::addCmdLineOptions(options); - KApplication app; + parser.addOption(QCommandLineOption(QStringList() << QLatin1String("+[URL]"), i18n( "Document to open" ))); danbooru_client *widget = new danbooru_client; @@ -50,8 +60,7 @@ int main(int argc, char **argv) else { // no session.. just start up normally - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - if (args->count() == 0) + if (parser.positionalArguments().count() == 0) { //danbooru_client *widget = new danbooru_client; widget->show(); @@ -59,13 +68,13 @@ int main(int argc, char **argv) else { int i = 0; - for (; i < args->count(); i++) + for (; i < parser.positionalArguments().count(); i++) { //danbooru_client *widget = new danbooru_client; widget->show(); } } - args->clear(); + } return app.exec();