21 #include <kontactinterface/pimuniqueapplication.h>
28 #include <kmessagebox.h>
29 #undef Status // stupid X headers
44 class KMailApplication :
public KontactInterface::PimUniqueApplication
47 KMailApplication() : KontactInterface::PimUniqueApplication(),
48 mDelayedInstanceCreation( false ),
49 mEventLoopReached( false ) { }
50 virtual int newInstance();
52 void setEventLoopReached();
53 void delayedInstanceCreation();
55 bool mDelayedInstanceCreation;
56 bool mEventLoopReached;
63 KApplication::commitData( sm );
66 void KMailApplication::setEventLoopReached() {
67 mEventLoopReached =
true;
70 int KMailApplication::newInstance()
77 if ( !mEventLoopReached ) {
78 kDebug() <<
"Delaying instance creation.";
79 mDelayedInstanceCreation =
true;
86 if (!
kmkernel->firstInstance() || !kapp->isSessionRestored())
92 void KMailApplication::delayedInstanceCreation() {
93 if ( mDelayedInstanceCreation )
97 int main(
int argc,
char *argv[])
103 #if 0 // for testing KUniqueAppliaction on Windows
105 QString(
"main() %1 pid=%2").arg(argv[0]).arg(getpid()).toLatin1(),
106 QString(
"main() \"%1\"").arg(argv[0]).toLatin1(), MB_OK|MB_ICONINFORMATION|MB_TASKMODAL);
111 KCmdLineArgs::init(argc, argv, &about);
113 if (!KMailApplication::start())
116 KMailApplication app;
126 KMail::insertLibraryCataloguesAndIcons();
141 app.setEventLoopReached();
142 app.delayedInstanceCreation();
145 int ret = qApp->exec();
void setQuitOnLastWindowClosed(bool quit)
Central point of coordination in KMail.
static KCmdLineOptions kmail_options()
void recoverDeadLetters()
bool doSessionManagement()
int main(int argc, char *argv[])