00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <karambaapp.h>
00024 #include <qobject.h>
00025
00026 #include <kaboutdata.h>
00027 #include <kcmdlineargs.h>
00028 #include <klocale.h>
00029 #include <kconfig.h>
00030 #include <kmainwindow.h>
00031 #include <qfileinfo.h>
00032 #include <qstringlist.h>
00033 #include <kconfig.h>
00034 #include <kstandarddirs.h>
00035 #include <kdeversion.h>
00036
00037 #include "karamba.h"
00038 #include "karambasessionmanaged.h"
00039 #include "karambainterface.h"
00040 #include "karamba_python.h"
00041
00042 static const char *description =
00043 I18N_NOOP("A KDE Eye-candy Application");
00044
00045 static const char *version = "0.41";
00046
00047 static KCmdLineOptions options[] =
00048 {
00049
00050
00051 { "+file", I18N_NOOP("A required argument 'file'"), 0 },
00052 { 0, 0, 0 }
00053 };
00054
00055
00056
00057
00058
00059 #ifdef KARAMBA_LOG
00060
00061 void karambaMessageOutput(QtMsgType type, const char *msg)
00062 {
00063 FILE* fp = fopen("/tmp/karamba.log", "a");
00064 if(fp)
00065 {
00066 pid_t pid = getpid();
00067
00068 switch ( type )
00069 {
00070 case QtDebugMsg:
00071 fprintf( fp, "Debug (%d): %s\n", pid, msg );
00072 break;
00073 case QtWarningMsg:
00074 if (strncmp(msg, "X Error", 7) != 0)
00075 fprintf( fp, "Warning (%d): %s\n", pid, msg );
00076 break;
00077 case QtFatalMsg:
00078 fprintf( fp, "Fatal (%d): %s\n", pid, msg );
00079 abort();
00080 }
00081 fclose(fp);
00082 }
00083 }
00084
00085 #endif
00086
00087 int main(int argc, char **argv)
00088 {
00089 #ifdef KARAMBA_LOG
00090 qInstallMsgHandler(karambaMessageOutput);
00091 #endif
00092 KAboutData about("superkaramba", I18N_NOOP("SuperKaramba"),
00093 version, description,
00094 KAboutData::License_GPL,
00095 "(c) 2003-2006 The SuperKaramba developers");
00096 about.addAuthor("Adam Geitgey", 0, "adam@rootnode.org");
00097 about.addAuthor("Hans Karlsson", 0, "karlsson.h@home.se");
00098 about.addAuthor("Ryan Nickell", 0, "p0z3r@earthlink.net");
00099 about.addAuthor("Petri Damstén", 0, "petri.damsten@iki.fi");
00100 about.addAuthor("Alexander Wiedenbruch", 0, "mail@wiedenbruch.de");
00101 about.addAuthor("Luke Kenneth Casson Leighton", 0, "lkcl@lkcl.net");
00102 KCmdLineArgs::init(argc, argv, &about);
00103 KCmdLineArgs::addCmdLineOptions(options);
00104 KSessionManaged ksm;
00105
00106 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
00107 QStringList lst;
00108 int ret = 0;
00109
00110
00111 KarambaApplication::checkSuperKarambaDir();
00112
00113 KarambaApplication::lockKaramba();
00114
00115 KarambaApplication app;
00116
00117 QString mainAppId = app.getMainKaramba();
00118 if(!mainAppId.isEmpty())
00119 {
00120 app.initDcopStub(mainAppId.ascii());
00121 }
00122 else
00123 {
00124
00125 app.setUpSysTray(&about);
00126 app.initDcopStub();
00127 }
00128
00129 KarambaApplication::unlockKaramba();
00130
00131 app.connect(qApp,SIGNAL(lastWindowClosed()),qApp,SLOT(quit()));
00132
00133
00134 app.checkPreviousSession(app, lst);
00135 if( (lst.size() == 0) && !app.isRestored() )
00136 {
00137
00138 app.checkCommandLine(args, lst);
00139
00140 if(lst.size() == 0)
00141 {
00142
00143
00144 app.globalShowThemeDialog();
00145 }
00146 }
00147
00148 args->clear();
00149
00150 KarambaPython::initPython();
00151
00152 if(app.startThemes(lst) || mainAppId.isEmpty())
00153 ret = app.exec();
00154 KarambaPython::shutdownPython();
00155 return ret;
00156 }