summaryrefslogtreecommitdiffstats
path: root/karm/main.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch)
tree67208f7c145782a7e90b123b982ca78d88cc2c87 /karm/main.cpp
downloadtdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz
tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'karm/main.cpp')
-rw-r--r--karm/main.cpp93
1 files changed, 93 insertions, 0 deletions
diff --git a/karm/main.cpp b/karm/main.cpp
new file mode 100644
index 000000000..cc1fc1cde
--- /dev/null
+++ b/karm/main.cpp
@@ -0,0 +1,93 @@
+#include <signal.h>
+#include <kapplication.h>
+#include <klocale.h>
+#include <kcmdlineargs.h>
+#include <kaboutdata.h>
+#include <kdebug.h>
+#include "version.h"
+#include "mainwindow.h"
+
+
+namespace
+{
+ const char* description = I18N_NOOP("KDE Time tracker tool");
+
+ void cleanup( int )
+ {
+ kdDebug(5970) << i18n("Just caught a software interrupt.") << endl;
+ kapp->exit();
+ }
+}
+
+static const KCmdLineOptions options[] =
+{
+ { "+file", I18N_NOOP( "The iCalendar file to open" ), 0 },
+ KCmdLineLastOption
+};
+
+int main( int argc, char *argv[] )
+{
+ KAboutData aboutData( "karm", I18N_NOOP("KArm"),
+ KARM_VERSION, description, KAboutData::License_GPL,
+ "(c) 1997-2004, KDE PIM Developers" );
+
+ aboutData.addAuthor( "Mark Bucciarelli", I18N_NOOP( "Current Maintainer" ),
+ "mark@hubcapconsulting.com" );
+ aboutData.addAuthor( "Sirtaj Singh Kang", I18N_NOOP( "Original Author" ),
+ "taj@kde.org" );
+ aboutData.addAuthor( "Allen Winter", 0, "winterz@verizon.net" );
+ aboutData.addAuthor( "David Faure", 0, "faure@kde.org" );
+ aboutData.addAuthor( "Espen Sand", 0, "espen@kde.org" );
+ aboutData.addAuthor( "Gioele Barabucci", 0, "gioele@gioelebarabucci.com" );
+ aboutData.addAuthor( "Jan Schaumann", 0, "jschauma@netmeister.org" );
+ aboutData.addAuthor( "Jesper Pedersen", 0, "blackie@kde.org" );
+ aboutData.addAuthor( "Kalle Dalheimer", 0, "kalle@kde.org" );
+ aboutData.addAuthor( "Scott Monachello", 0, "smonach@cox.net" );
+ aboutData.addAuthor( "Thorsten Staerk", 0, "kde@staerk.de" );
+ aboutData.addAuthor( "Tomas Pospisek", 0, "tpo_deb@sourcepole.ch" );
+ aboutData.addAuthor( "Willi Richert", 0, "w.richert@gmx.net" );
+
+ KCmdLineArgs::init( argc, argv, &aboutData );
+ KCmdLineArgs::addCmdLineOptions( options );
+ KApplication myApp;
+
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+ MainWindow *mainWindow;
+ if ( args->count() > 0 )
+ {
+ QString icsfile = QString::fromLocal8Bit( args->arg( 0 ) );
+ // FIXME: there is probably a Qt or KDE fcn for this test
+ if ( icsfile.startsWith( "/" )
+ || icsfile.lower().startsWith( "http://" )
+ || icsfile.lower().startsWith( "ftp://" )
+ )
+ {
+ // leave as is
+ ;
+ }
+ else
+ {
+ icsfile = KCmdLineArgs::cwd() + "/" + icsfile;
+ }
+ mainWindow = new MainWindow( icsfile );
+ }
+ else
+ {
+ mainWindow = new MainWindow();
+ }
+
+ myApp.setMainWidget( mainWindow );
+
+ if (kapp->isRestored() && KMainWindow::canBeRestored( 1 ))
+ mainWindow->restore( 1, false );
+ else
+ mainWindow->show();
+
+ signal( SIGQUIT, cleanup );
+ signal( SIGINT, cleanup );
+ int ret = myApp.exec();
+
+ delete mainWindow;
+ return ret;
+}