1 /***************************************************************************
2 * Copyright (C) 2003 by Hideki Ikemoto *
3 * ikemo@users.sourceforge.jp *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 ***************************************************************************/
11 #include "mainwindow.h"
13 #include <cstdlib> // setenv()
15 #include <kaboutdata.h>
16 #include <kcmdlineargs.h>
17 #include <kuniqueapplication.h>
19 #include "libkita/config.h"
20 #include "libkita/globalconfig.h"
22 static const char *description =
23 I18N_NOOP("Kita - 2ch client for KDE");
27 int main(int argc, char **argv)
29 // for code page 932 with NEC special characters
30 setenv("UNICODEMAP_JP", "cp932,nec-vdc", 1);
31 KAboutData about("kita", "kita", ki18n("Kita"), VERSION, ki18n(description),
32 KAboutData::License_GPL, ki18n("(C) 2003-2010 Kita Developers"),
33 KLocalizedString(), QByteArray(), "ikemo@users.sourceforge.jp");
34 about.addAuthor(ki18n("Hideki Ikemoto"), ki18n("maintainer, initial code"),
35 "ikemo@users.sourceforge.jp");
36 about.addAuthor(ki18n("konqueror plugin no hito"),
37 ki18n("konqueror plugin, KDE part"), "ogirin@users.sourceforge.jp");
38 about.addAuthor(ki18n("421"), ki18n("kitanavi, threadview's improvement"));
39 about.addAuthor(ki18n("Toshihiko Okada"), ki18n("improvements"),
40 "tossi@users.sourceforge.jp");
41 about.addAuthor(ki18n("75"), ki18n("stylesheet support"));
42 KCmdLineArgs::init(argc, argv, &about);
43 KCmdLineOptions options;
44 options.add("+[URL]", ki18n("Document to open."));
45 options.add("boardlist <boardlist>", ki18n("board list's URL."),
46 "http://menu.2ch.net/bbsmenu.html");
47 KCmdLineArgs::addCmdLineOptions(options);
48 KUniqueApplication app;
50 // register ourselves as a dcop client
51 // app.dcopClient() ->registerAs(app.name(), FALSE);
53 KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
54 GlobalConfig::setBoardListUrl(QString(args->getOption("boardlist")));
56 // see if we are starting with session management
57 if (app.isSessionRestored()) {
58 kRestoreMainWindows<MainWindow>();
60 // no session.. just start up normally
61 KCmdLineArgs * args = KCmdLineArgs::parsedArgs();
62 if (args->count() == 0) {
63 MainWindow * widget = new MainWindow;
67 for (; i < args->count(); i++) {
68 MainWindow *widget = new MainWindow;
70 widget->load(args->url(i));