main.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <dcopclient.h>
00023 #include <kaboutdata.h>
00024 #include <kcmdlineargs.h>
00025 #include <kdebug.h>
00026 #include <kiconloader.h>
00027 #include <klocale.h>
00028 #include <kstartupinfo.h>
00029 #include <kuniqueapplication.h>
00030 #include <kwin.h>
00031
00032 #include <qlabel.h>
00033 #if (QT_VERSION-0 >= 0x030200)
00034 #include <qsplashscreen.h>
00035 #else
00036 #include "splash.h"
00037 #endif
00038
00039 #include "mainwindow.h"
00040
00041 static const char description[] =
00042 I18N_NOOP( "A KDE Personal Information Manager" );
00043
00044 static const char version[] = "0.8.1";
00045
00046 class KontactApp : public KUniqueApplication {
00047 public:
00048 KontactApp() : mMainWindow( 0 ) {}
00049 ~KontactApp() {}
00050
00051 int newInstance();
00052
00053 private:
00054 Kontact::MainWindow *mMainWindow;
00055 };
00056
00057 int KontactApp::newInstance()
00058 {
00059 QWidget* splash = 0;
00060 if ( !mMainWindow )
00061 {
00062
00063 #if (QT_VERSION-0 >= 0x030200)
00064 QPixmap splashPixmap( UserIcon( "splash" ) );
00065
00066 splash = new QSplashScreen( splashPixmap );
00067 splash->show();
00068 #else
00069 splash = new Kontact::Splash( 0, "splash" );
00070 splash->show();
00071 #endif
00072 }
00073
00074 if ( isRestored() ) {
00075
00076 if ( KMainWindow::canBeRestored( 1 ) ) {
00077 mMainWindow = new Kontact::MainWindow;
00078 setMainWidget( mMainWindow );
00079 mMainWindow->show();
00080 mMainWindow->restore( 1 );
00081 }
00082 } else {
00083 if ( !mMainWindow ) {
00084 mMainWindow = new Kontact::MainWindow;
00085 mMainWindow->show();
00086 setMainWidget( mMainWindow );
00087 }
00088 }
00089
00090 delete splash;
00091
00092
00093
00094 return KUniqueApplication::newInstance();
00095 }
00096
00097 int main(int argc, char **argv)
00098 {
00099 KAboutData about( "kontact", I18N_NOOP( "Kontact" ), version, description,
00100 KAboutData::License_GPL, I18N_NOOP("(C) 2001-2003 The Kontact developers"), 0, "http://kontact.kde.org", "kde-pim@kde.org" );
00101 about.addAuthor( "Daniel Molkentin", 0, "molkentin@kde.org" );
00102 about.addAuthor( "Don Sanders", 0, "sanders@kde.org" );
00103 about.addAuthor( "Cornelius Schumacher", 0, "schumacher@kde.org" );
00104 about.addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" );
00105 about.addAuthor( "Sven Lüppken", 0, "sven@kde.org" );
00106 about.addAuthor( "Zack Rusin", 0, "zack@kde.org" );
00107 about.addAuthor( "Matthias Hoelzer-Kluepfel", I18N_NOOP("Original Author"), "mhk@kde.org" );
00108
00109 KCmdLineArgs::init( argc, argv, &about );
00110
00111 if ( !KontactApp::start() ) {
00112 kdError() << "Kontact is already running!" << endl;
00113 return 0;
00114 }
00115
00116 KontactApp app;
00117
00118 bool ret = app.exec();
00119 while ( KMainWindow::memberList->first() )
00120 delete KMainWindow::memberList->first();
00121
00122 return ret;
00123 }
This file is part of the documentation for kontact Library Version 3.2.2.