29#include <tdeabc/stdaddressbook.h> 
   30#include <tdeaboutdata.h> 
   31#include <tdecmdlineargs.h> 
   35#include <tdestartupinfo.h> 
   36#include <tdeuniqueapplication.h> 
   39#include "kaddressbookmain.h" 
   40#include "kaddressbook_options.h" 
   43class KAddressBookApp : 
public TDEUniqueApplication {
 
   45    KAddressBookApp() : mMainWin( 0 ), mDefaultIsOpen( false ) {}
 
   55int KAddressBookApp::newInstance()
 
   59    if ( TDEMainWindow::canBeRestored( 1 ) ) {
 
   61      setMainWidget( mMainWin );
 
   63      mMainWin->restore( 1 );
 
   66    TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
 
   68    if ( args->isSet( 
"editor-only" ) ) {
 
   71          setMainWidget( mMainWin );
 
   75        TDEStartupInfo::appStarted();
 
   78      if ( args->isSet( 
"document" ) ) {
 
   79         file = args->getOption( 
"document" );
 
   81      if ( !( file.isEmpty() && mDefaultIsOpen ) ) {
 
   84          setMainWidget( mMainWin );
 
   90        if ( file.isEmpty() ) mDefaultIsOpen = 
true;
 
   94    mMainWin->handleCommandLine();
 
  100#if defined TQ_WS_X11 && ! defined K_WS_TQTONLY 
  101  static bool firstInstance = 
true;
 
  103  if ( !firstInstance )
 
  104    TDEStartupInfo::setNewStartupId( mMainWin, tdeApp->startupId() );
 
  106  firstInstance = 
false;
 
  112int main( 
int argc, 
char *argv[] )
 
  114  TDELocale::setMainCatalogue( 
"kaddressbook" );
 
  116  TDECmdLineArgs::init( argc, argv, KABCore::createAboutData() );
 
  117  TDECmdLineArgs::addCmdLineOptions( kaddressbook_options );
 
  118  TDEUniqueApplication::addCmdLineOptions();
 
  120  if ( !KAddressBookApp::start() )
 
  124  TDEGlobal::locale()->insertCatalogue( 
"libtdepim" );
 
  126  bool ret = app.exec();
 
  127  while (TDEMainWindow::memberList->first())
 
  128      delete TDEMainWindow::memberList->first();
 
This class serves as the main window for KAddressBook.