main.cpp
00001 #include <signal.h> 00002 #include <tdeapplication.h> 00003 #include <tdelocale.h> 00004 #include <tdecmdlineargs.h> 00005 #include <tdeaboutdata.h> 00006 #include <kdebug.h> 00007 #include "version.h" 00008 #include "mainwindow.h" 00009 00010 00011 namespace 00012 { 00013 const char* description = I18N_NOOP("TDE Time tracker tool"); 00014 00015 void cleanup( int ) 00016 { 00017 kdDebug(5970) << i18n("Just caught a software interrupt.") << endl; 00018 kapp->exit(); 00019 } 00020 } 00021 00022 static const TDECmdLineOptions options[] = 00023 { 00024 { "+file", I18N_NOOP( "The iCalendar file to open" ), 0 }, 00025 TDECmdLineLastOption 00026 }; 00027 00028 int main( int argc, char *argv[] ) 00029 { 00030 TDEAboutData aboutData( "karm", I18N_NOOP("KArm"), 00031 KARM_VERSION, description, TDEAboutData::License_GPL, 00032 "(c) 1997-2004, KDE PIM Developers" ); 00033 00034 aboutData.addAuthor( "Mark Bucciarelli", I18N_NOOP( "Current Maintainer" ), 00035 "mark@hubcapconsulting.com" ); 00036 aboutData.addAuthor( "Sirtaj Singh Kang", I18N_NOOP( "Original Author" ), 00037 "taj@kde.org" ); 00038 aboutData.addAuthor( "Allen Winter", 0, "winterz@verizon.net" ); 00039 aboutData.addAuthor( "David Faure", 0, "faure@kde.org" ); 00040 aboutData.addAuthor( "Espen Sand", 0, "espen@kde.org" ); 00041 aboutData.addAuthor( "Gioele Barabucci", 0, "gioele@gioelebarabucci.com" ); 00042 aboutData.addAuthor( "Jan Schaumann", 0, "jschauma@netmeister.org" ); 00043 aboutData.addAuthor( "Jesper Pedersen", 0, "blackie@kde.org" ); 00044 aboutData.addAuthor( "Kalle Dalheimer", 0, "kalle@kde.org" ); 00045 aboutData.addAuthor( "Scott Monachello", 0, "smonach@cox.net" ); 00046 aboutData.addAuthor( "Thorsten Staerk", 0, "kde@staerk.de" ); 00047 aboutData.addAuthor( "Tomas Pospisek", 0, "tpo_deb@sourcepole.ch" ); 00048 aboutData.addAuthor( "Willi Richert", 0, "w.richert@gmx.net" ); 00049 00050 TDECmdLineArgs::init( argc, argv, &aboutData ); 00051 TDECmdLineArgs::addCmdLineOptions( options ); 00052 TDEApplication myApp; 00053 00054 TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); 00055 00056 MainWindow *mainWindow; 00057 if ( args->count() > 0 ) 00058 { 00059 TQString icsfile = TQString::fromLocal8Bit( args->arg( 0 ) ); 00060 // FIXME: there is probably a TQt or KDE fcn for this test 00061 if ( icsfile.startsWith( "/" ) 00062 || icsfile.lower().startsWith( "http://" ) 00063 || icsfile.lower().startsWith( "ftp://" ) 00064 ) 00065 { 00066 // leave as is 00067 ; 00068 } 00069 else 00070 { 00071 icsfile = TDECmdLineArgs::cwd() + "/" + icsfile; 00072 } 00073 mainWindow = new MainWindow( icsfile ); 00074 } 00075 else 00076 { 00077 mainWindow = new MainWindow(); 00078 } 00079 00080 myApp.setMainWidget( mainWindow ); 00081 00082 if (kapp->isRestored() && TDEMainWindow::canBeRestored( 1 )) 00083 mainWindow->restore( 1, false ); 00084 else 00085 mainWindow->show(); 00086 00087 signal( SIGQUIT, cleanup ); 00088 signal( SIGINT, cleanup ); 00089 int ret = myApp.exec(); 00090 00091 delete mainWindow; 00092 return ret; 00093 }