From 3133bbc63a2d32dac638db58fa13e966488e88b5 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 15 Feb 2010 18:23:18 +0000 Subject: Added abandoned KDE3 version of kchmviewer git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kchmviewer@1090662 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/main.cpp | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 src/main.cpp (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..f79bbca --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,96 @@ +/*************************************************************************** + * Copyright (C) 2004-2007 by Georgy Yunaev, gyunaev@ulduzsoft.com * + * Please do not use email address above for bug reports; see * + * the README file * + * * + * 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., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include "kde-qt.h" + +#include "kchmmainwindow.h" +#include "kchmconfig.h" +#include "kchmkeyeventfilter.h" + +#if defined (USE_KDE) + #include + #include + + #include "kde/kchmdcopiface.h" +#endif + +KCHMMainWindow * mainWindow; + + +int main( int argc, char ** argv ) +{ +#if defined (USE_KDE) + static KCmdLineOptions options[] = + { + { "autotestmode", "Perform auto testing", 0 }, + { "shortautotestmode", "Perform short auto testing", 0 }, + { "+[chmfile]", "A CHM file to show", 0 }, + { "search ", I18N_NOOP("'--search ' specifies the search query to search, and activate the first entry if found"), 0 }, + { "sindex ", I18N_NOOP("'--sindex ' specifies the word to find in index, and activate if found"), 0 }, + KCmdLineLastOption + }; + + KAboutData aboutdata ( "kchmviewer", + APP_NAME, + APP_VERSION, + I18N_NOOP("CHM file viewer"), + KAboutData::License_GPL, + "(c) 2004-2007 George Yunaev, gyunaev@ulduzsoft.com", + 0, + "http://www.kchmviewer.net", + "gyunaev@ulduzsoft.com"); + + KLocale::setMainCatalogue( "kchmviewer" ); + KCmdLineArgs::init (argc, argv, &aboutdata); + KCmdLineArgs::addCmdLineOptions( options ); + + KApplication app; +#else + QApplication app( argc, argv ); +#endif + + appConfig.load(); + app.installEventFilter( &gKeyEventFilter ); + +#if defined(USE_KDE) + // DCOP stuff + KCHMDCOPIface iface; + + DCOPClient *client = kapp->dcopClient(); + + if ( !client->attach() ) + qWarning("DCOP attach failed"); + + //QCString realAppId = client->registerAs( kapp->name() ); + QCString realAppId = client->registerAs( "kchmviewer" ); +#endif + + mainWindow = new KCHMMainWindow(); + mainWindow->show(); + +#if !defined(USE_KDE) + app.connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) ); +#else + app.setMainWidget( mainWindow ); +#endif + + return app.exec(); +} -- cgit v1.2.3