SVN_SILENT made messages (.desktop file)
[kdeadmin.git] / kdat / main.cpp
blob8194692e40d7497154ed682320fda7557d6f3c8a
1 // KDat - a tar-based DAT archiver
2 // Copyright (C) 1998-2000 Sean Vyain, svyain@mail.tds.net
3 // Copyright (C) 2001-2002 Lawrence Widman, kdat@cardiothink.com
4 //
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 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #include <sys/stat.h>
20 #include <sys/types.h>
21 #include <fcntl.h>
22 #include <unistd.h>
23 #include <stdlib.h>
25 #include <QFile>
26 #include <QDir>
28 #include <klocale.h>
29 #include <kcmdlineargs.h>
30 #include <kaboutdata.h>
31 #include <kcrash.h>
32 #include <kmessagebox.h>
34 #include <signal.h>
36 #include "kdat.h"
37 #include "KDatMainWindow.h"
39 static const char description[] =
40 I18N_NOOP("tar-based DAT archiver for KDE");
42 /* in ErrorHandler.cpp */
43 void error_handler(int err_sig);
45 int main( int argc, char** argv )
47 KAboutData aboutData( "kdat", 0, ki18n("KDat"),
48 KDAT_VERSION, ki18n(description), KAboutData::License_GPL,
49 ki18n("(c) 1999-2000, Sean Vyain; 2001-2002 Lawrence Widman"));
51 /* 2002-01-28 LEW: so we can dump core if we want to */
52 // KCrash::setCrashHandler(0); // this is supposed to work, but it doesn't
53 #ifdef DEBUG
55 char *newarg;
56 if( ( newarg = (char *)malloc( strlen("--nocrashhandler") + 1 ) ) == NULL )
58 KMessageBox::sorry(NULL, i18n("Cannot allocate memory in kdat"));
59 exit(1);
61 strcpy( newarg, "--nocrashhandler" );
62 argv[ argc ] = newarg;
63 argc++;
66 int i;
67 for(i=0; i<argc; i++){
68 printf("Arg %d: %s\n", i, argv[i]);
71 #endif /* DEBUG */
72 /* 2002-01-28 LEW */
74 KCmdLineArgs::init( argc, argv, &aboutData );
75 aboutData.addAuthor( ki18n("Lawrence Widman"), KLocalizedString(), "kdat@cardiothink.com");
76 // KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
77 KApplication app;
79 app.setMainWidget( KDatMainWindow::getInstance() );
81 /* set up error handler so we don't crash without notice */
82 signal(SIGHUP, error_handler);
83 signal(SIGINT, error_handler);
84 signal(SIGFPE, error_handler);
85 signal(SIGSEGV, error_handler);
86 signal(SIGTERM, error_handler);
88 if ( app.isSessionRestored() && KDatMainWindow::canBeRestored( 1 ) ) {
89 KDatMainWindow::getInstance()->restore( 1 );
90 } else {
91 KDatMainWindow::getInstance()->show();
94 return app.exec();