summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-21 04:30:08 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-21 04:30:08 +0000
commita3570c360e8884f2bbf60b89e4d9531321ae01ad (patch)
treea6bc829daca69956b99be4dfa3939ff14193ec54 /src/main.cpp
downloadkbookreader-a3570c360e8884f2bbf60b89e4d9531321ae01ad.tar.gz
kbookreader-a3570c360e8884f2bbf60b89e4d9531321ae01ad.zip
Initial import of kbookreader
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kbookreader@1242482 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..73504d2
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Nemish *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include <kapplication.h>
+#include <dcopclient.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <klocale.h>
+#include <ksplashscreen.h>
+#include "bookreader.h"
+
+static const char description[] = I18N_NOOP("A KDE Application");
+static const char version[] = "0.2";
+static KCmdLineOptions options[] =
+{
+ { "[URL]", I18N_NOOP("Document to open"), 0 },
+ KCmdLineLastOption
+};
+
+int main(int argc, char **argv)
+{
+ KAboutData about("bookreader", I18N_NOOP("BooKreader"), version, description,
+ KAboutData::License_GPL,
+ "(C) 2005-2007 Alexander Nemish", 0, 0, "[email protected]");
+ about.addAuthor("Alexander Nemish", 0, "[email protected]");
+ KCmdLineArgs::init(argc, argv, &about);
+ KCmdLineArgs::addCmdLineOptions(options);
+ KApplication app;
+
+ // register ourselves as a dcop client
+ app.dcopClient()->registerAs(app.name(), false);
+
+ // see if we are starting with session management
+ if (app.isRestored())
+ {
+ RESTORE(BookReader);
+ }
+ else
+ {
+ // no session.. just start up normally
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+ BookReader *widget = new BookReader;
+ app.setMainWidget(widget->centralWidget());
+ if (args->count() == 1)
+ widget->load(args->url(0));
+ widget->show();
+ args->clear();
+ }
+ return app.exec();
+}