kontact Library API Documentation

main.cpp

00001 /* 00002 This file is part of KDE Kontact. 00003 00004 Copyright (c) 2001 Matthias Hoelzer-Kluepfel <mhk@kde.org> 00005 Copyright (c) 2002-2003 Daniel Molkentin <molkentin@kde.org> 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 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 ) // only the first time 00061 { 00062 // show splash 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 // There can only be one main window 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 // Handle startup notification and window activation 00093 // (The first time it will do nothing except note that it was called) 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 }
KDE Logo
This file is part of the documentation for kontact Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:58:15 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003