22 #include <tdeuniqueapplication.h>
23 #include <tdeglobal.h>
24 #include <knotifyclient.h>
25 #include <dcopclient.h>
27 #include "kmail_options.h"
33 #include "aboutdata.h"
35 #include "kmstartup.h"
39 class KMailApplication :
public TDEUniqueApplication
42 KMailApplication() : TDEUniqueApplication() { };
43 virtual int newInstance();
44 void commitData(TQSessionManager& sm);
48 void KMailApplication::commitData(TQSessionManager& sm) {
49 kmkernel->dumpDeadLetters();
50 kmkernel->setShuttingDown(
true );
51 TDEApplication::commitData( sm );
55 int KMailApplication::newInstance()
57 kdDebug(5006) <<
"KMailApplication::newInstance()" << endl;
61 if (!kmkernel->firstInstance() || !kapp->isRestored())
62 kmkernel->handleCommandLine(
true );
63 kmkernel->setFirstInstance(FALSE);
67 int main(
int argc,
char *argv[])
74 KMail::AboutData about;
76 TDECmdLineArgs::init(argc, argv, &about);
77 TDECmdLineArgs::addCmdLineOptions( kmail_options );
78 if (!KMailApplication::start())
84 KMail::insertLibraryCataloguesAndIcons();
88 KNotifyClient::startDaemon();
90 kapp->dcopClient()->suspend();
97 kapp->dcopClient()->setDefaultObject( kmailKernel.objId() );
100 kmailKernel.doSessionManagement();
103 kmailKernel.recoverDeadLetters();
105 kmsetSignalHandler(kmsignalHandler);
107 kapp->dcopClient()->resume();
108 kmailKernel.setStartingUp(
false );
110 int ret = kapp->exec();
112 kmailKernel.cleanup();
Central point of coordination in KMail.