/***************************************************************************
                            KApplication.m -  description
                             -------------------
    begin                : Fri Mar  8 13:55:08 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Mar  8 13:55:08 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This library is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 ***************************************************************************/

#include <qtc/qt_QString.h>
#include <qtc/qt_QCString.h>
#include <kdec/kde_KApplication.h>
#include <kdec/kde_KInstance.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KApplication.h>
#include <kdeobjc/KURL.h>
#include <qtobjc/QSessionManager.h>
#include <qtobjc/QWidget.h>


@implementation  KApplication


- initWithBOOL: (BOOL)allowStyles GUIenabled: (BOOL)GUIenabled
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KApplication((int)allowStyles, (int)GUIenabled)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- init
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KApplication(1, 1)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

//- initWithDisplay: (Display*)display argc: (int)argc argv: (NSString *)argv rAppName: (NSString *)rAppName allowStyles: (BOOL)allowStyles GUIenabled: (BOOL)GUIenabled
//{
//static qt_QCString * _qcstring_rAppName = 0L;
//	if ([self qt] == 0L) {
//		[self setQt: kde_new_KApplication1((Display*)display, (int)argc, (char**) [argv cString], (qt_QCString*) [rAppName toQCString: &_qcstring_rAppName], (int)allowStyles, (int)GUIenabled)];
//		[self setAllocatedInObjcWorld: YES];
//		[QtSupport setObject: self forQtKey: [self qt]];
//	}
//	[super init];
//	return self;
//}

//- initWithDisplay: (Display*)display argc: (int)argc argv: (NSString *)argv rAppName: (NSString *)rAppName
//{
//static qt_QCString * _qcstring_rAppName = 0L;
//	if ([self qt] == 0L) {
//		[self setQt: kde_new_KApplication1((Display*)display, (int)argc, (char**) [argv cString], (qt_QCString*) [rAppName toQCString: &_qcstring_rAppName], 1, 1)];
//		[self setAllocatedInObjcWorld: YES];
//		[QtSupport setObject: self forQtKey: [self qt]];
//	}
//	[super init];
//	return self;
//}

- initWithInt: (int)argc argv: (NSString *)argv rAppName: (NSString *)rAppName allowStyles: (BOOL)allowStyles GUIenabled: (BOOL)GUIenabled
{
static qt_QCString * _qcstring_rAppName = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KApplication2((int)argc, (char**) [argv cString], (qt_QCString*) [rAppName toQCString: &_qcstring_rAppName], (int)allowStyles, (int)GUIenabled)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithInt: (int)argc argv: (NSString *)argv rAppName: (NSString *)rAppName 
{
static qt_QCString * _qcstring_rAppName = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KApplication2((int)argc, (char**) [argv cString], (qt_QCString*) [rAppName toQCString: &_qcstring_rAppName], 1, 1)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld] && [self parent] == nil) {
			kde_del_KApplication((kde_KApplication *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (KConfig*) sessionConfig
{
	return (KConfig*) [QtSupport objectForQtKey: kde_KApplication_sessionConfig((kde_KApplication *)[self qt]) withClass: [KConfig class] allocatedInObjcWorld: YES];
}

- (BOOL) isRestored
{
	return (BOOL) kde_KApplication_isRestored((kde_KApplication *)[self qt]);
}

- disableSessionManagement
{
	kde_KApplication_disableSessionManagement((kde_KApplication *)[self qt]);
	return self;
}

- (BOOL) requestShutDown: (int)confirm sdtype: (int)sdtype sdmode: (int)sdmode
{
	return (BOOL) kde_KApplication_requestShutDown((kde_KApplication *)[self qt], (int)confirm, (int)sdtype, (int)sdmode);
}

- (BOOL) requestShutDown
{
	return (BOOL) kde_KApplication_requestShutDown((kde_KApplication *)[self qt], [KApplication ShutdownConfirmDefault], [KApplication ShutdownTypeDefault], [KApplication ShutdownModeDefault]);
}

- propagateSessionManager
{
	kde_KApplication_propagateSessionManager((kde_KApplication *)[self qt]);
	return self;
}

- commitData: (QSessionManager*)sm
{
	kde_KApplication_commitData((kde_KApplication *)[self qt], (qt_QSessionManager*) [sm qt]);
	return self;
}

- saveState: (QSessionManager*)sm
{
	kde_KApplication_saveState((kde_KApplication *)[self qt], (qt_QSessionManager*) [sm qt]);
	return self;
}

- (QPixmap*) icon
{
	return (QPixmap*) [QtSupport objectForQtKey: kde_KApplication_icon((kde_KApplication *)[self qt]) withClass: [QPixmap class] allocatedInObjcWorld: YES];
}

- (NSString *) iconName
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KApplication_iconName((kde_KApplication *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (QPixmap*) miniIcon
{
	return (QPixmap*) [QtSupport objectForQtKey: kde_KApplication_miniIcon((kde_KApplication *)[self qt]) withClass: [QPixmap class] allocatedInObjcWorld: YES];
}

- (NSString *) miniIconName
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KApplication_miniIconName((kde_KApplication *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setTopWidget: (QWidget *)topWidget
{
	kde_KApplication_setTopWidget((kde_KApplication *)[self qt], (qt_QWidget *) [topWidget qt]);
	return self;
}

- invokeHelp: (NSString *)anchor appname: (NSString *)appname
{
static qt_QString * _qstring_appname = 0L;
static qt_QString * _qstring_anchor = 0L;
	kde_KApplication_invokeHelp((kde_KApplication *)[self qt], (qt_QString *) [anchor toQString: &_qstring_anchor], (qt_QString *) [appname toQString: &_qstring_appname]);
	return self;
}

- invokeHelp
{
	kde_KApplication_invokeHelp((kde_KApplication *)[self qt], qt_QString_null(), qt_QString_null());
	return self;
}

- invokeHTMLHelp: (NSString *)aFilename aTopic: (NSString *)aTopic
{
static qt_QString * _qstring_aTopic = 0L;
static qt_QString * _qstring_aFilename = 0L;
	kde_KApplication_invokeHTMLHelp((kde_KApplication *)[self qt], (qt_QString *) [aFilename toQString: &_qstring_aFilename], (qt_QString *) [aTopic toQString: &_qstring_aTopic]);
	return self;
}

- invokeHTMLHelp: (NSString *)aFilename 
{
static qt_QString * _qstring_aFilename = 0L;
	kde_KApplication_invokeHTMLHelp((kde_KApplication *)[self qt], (qt_QString *) [aFilename toQString: &_qstring_aFilename], qt_QString_null());
	return self;
}

- invokeMailer: (NSString *)address subject: (NSString *)subject
{
static qt_QString * _qstring_subject = 0L;
static qt_QString * _qstring_address = 0L;
	kde_KApplication_invokeMailer((kde_KApplication *)[self qt], (qt_QString *) [address toQString: &_qstring_address], (qt_QString *) [subject toQString: &_qstring_subject]);
	return self;
}

- invokeMailer: (KURL*)mailtoURL
{
	kde_KApplication_invokeMailer1((kde_KApplication *)[self qt], (kde_KURL*) [mailtoURL qt]);
	return self;
}

- invokeMailer: (NSString *)to cc: (NSString *)cc bcc: (NSString *)bcc subject: (NSString *)subject body: (NSString *)body messageFile: (NSString *)messageFile attachURLs: (NSArray *)attachURLs
{
static qt_QStringList * _qlist_attachURLs = 0L;
static qt_QString * _qstring_messageFile = 0L;
static qt_QString * _qstring_body = 0L;
static qt_QString * _qstring_subject = 0L;
static qt_QString * _qstring_bcc = 0L;
static qt_QString * _qstring_cc = 0L;
static qt_QString * _qstring_to = 0L;
	kde_KApplication_invokeMailer2((kde_KApplication *)[self qt], (qt_QString *) [to toQString: &_qstring_to], (qt_QString *) [cc toQString: &_qstring_cc], (qt_QString *) [bcc toQString: &_qstring_bcc], (qt_QString *) [subject toQString: &_qstring_subject], (qt_QString *) [body toQString: &_qstring_body], (qt_QString *) [messageFile toQString: &_qstring_messageFile], (qt_QStringList*) [attachURLs toQStringList: (void *)&_qlist_attachURLs]);
	return self;
}

- invokeMailer: (NSString *)to cc: (NSString *)cc bcc: (NSString *)bcc subject: (NSString *)subject body: (NSString *)body 
{
static qt_QString * _qstring_body = 0L;
static qt_QString * _qstring_subject = 0L;
static qt_QString * _qstring_bcc = 0L;
static qt_QString * _qstring_cc = 0L;
static qt_QString * _qstring_to = 0L;
	kde_KApplication_invokeMailer2((kde_KApplication *)[self qt], (qt_QString *) [to toQString: &_qstring_to], (qt_QString *) [cc toQString: &_qstring_cc], (qt_QString *) [bcc toQString: &_qstring_bcc], (qt_QString *) [subject toQString: &_qstring_subject], (qt_QString *) [body toQString: &_qstring_body], qt_QString_null(), 0);
	return self;
}

- invokeBrowser: (NSString *)url
{
static qt_QString * _qstring_url = 0L;
	kde_KApplication_invokeBrowser((kde_KApplication *)[self qt], (qt_QString *) [url toQString: &_qstring_url]);
	return self;
}

- (NSString *) caption
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KApplication_caption((kde_KApplication *)[self qt]);
	return [NSString fromQString: _qstring];
}

//- (KStyle*) kstyle
//{
//	return (KStyle*) [QtSupport objectForQtKey: kde_KApplication_kstyle((kde_KApplication *)[self qt]) withClass: [KStyle class] allocatedInObjcWorld: YES];
//}

- (NSString *) makeStdCaption: (NSString *)userCaption withAppName: (BOOL)withAppName modified: (BOOL)modified
{
static qt_QString * _qstring = 0L;
static qt_QString * _qstring_userCaption = 0L;
	_qstring = kde_KApplication_makeStdCaption((kde_KApplication *)[self qt], (qt_QString *) [userCaption toQString: &_qstring_userCaption], (int)withAppName, (int)modified);
	return [NSString fromQString: _qstring];
}

- (NSString *) tempSaveName: (NSString *)pFilename
{
static qt_QString * _qstring = 0L;
static qt_QString * _qstring_pFilename = 0L;
	_qstring = kde_KApplication_tempSaveName((kde_KApplication *)[self qt], (qt_QString *) [pFilename toQString: &_qstring_pFilename]);
	return [NSString fromQString: _qstring];
}

- (NSString *) checkRecoverFile: (NSString *)pFilename bRecover: (BOOL)bRecover
{
static qt_QString * _qstring = 0L;
static qt_QString * _qstring_pFilename = 0L;
	_qstring = kde_KApplication_checkRecoverFile((kde_KApplication *)[self qt], (qt_QString *) [pFilename toQString: &_qstring_pFilename], (int)bRecover);
	return [NSString fromQString: _qstring];
}

//- (Display*) getDisplay
//{
//	return (Display*) kde_KApplication_getDisplay((kde_KApplication *)[self qt]);
//}

- enableStyles
{
	kde_KApplication_enableStyles((kde_KApplication *)[self qt]);
	return self;
}

- disableStyles
{
	kde_KApplication_disableStyles((kde_KApplication *)[self qt]);
	return self;
}

- installX11EventFilter: (QWidget *)filter
{
	kde_KApplication_installX11EventFilter((kde_KApplication *)[self qt], (qt_QWidget *) [filter qt]);
	return self;
}

- addKipcEventMask: (int)identifier
{
	kde_KApplication_addKipcEventMask((kde_KApplication *)[self qt], (int)identifier);
	return self;
}

- removeKipcEventMask: (int)identifier
{
	kde_KApplication_removeKipcEventMask((kde_KApplication *)[self qt], (int)identifier);
	return self;
}

- (NSString *) startupId
{
static qt_QCString * _qcstring = 0L;
	_qcstring = kde_KApplication_startupId((kde_KApplication *)[self qt]);
	return [NSString fromQCString: _qcstring];
}

- setStartupId: (NSString *)startup_id
{
static qt_QCString * _qcstring_startup_id = 0L;
	kde_KApplication_setStartupId((kde_KApplication *)[self qt], (qt_QCString*) [startup_id toQCString: &_qcstring_startup_id]);
	return self;
}

- (NSString *) geometryArgument
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KApplication_geometryArgument((kde_KApplication *)[self qt]);
	return [NSString fromQString: _qstring];
}

- installKDEPropertyMap
{
	kde_KApplication_installKDEPropertyMap((kde_KApplication *)[self qt]);
	return self;
}

- (BOOL) notify: (QObject *)receiver event: (QEvent *)event
{
	return (BOOL) kde_KApplication_notify((kde_KApplication *)[self qt], (qt_QObject *) [receiver qt], (qt_QEvent *) [event qt]);
}

- (int) xioErrhandler
{
	return (int) kde_KApplication_xioErrhandler((kde_KApplication *)[self qt]);
}

//- iceIOErrorHandler: (_IceConn*)conn
//{
//	kde_KApplication_iceIOErrorHandler((kde_KApplication *)[self qt], (_IceConn*) conn);
//	return self;
//}

- ref
{
	kde_KApplication_ref((kde_KApplication *)[self qt]);
	return self;
}

- deref
{
	kde_KApplication_deref((kde_KApplication *)[self qt]);
	return self;
}

+ addCmdLineOptions
{
	kde_KApplication_addCmdLineOptions();
	return self;
}

+ (KApplication*) kApplication
{
	return (KApplication*) [QtSupport objectForQtKey: kde_KApplication_kApplication() withClass: [KApplication class] allocatedInObjcWorld: YES];
}

+ (DCOPClient*) dcopClient
{
	return (DCOPClient*) [QtSupport objectForQtKey: kde_KApplication_dcopClient() withClass: [DCOPClient class] allocatedInObjcWorld: YES];
}

+ disableAutoDcopRegistration
{
	kde_KApplication_disableAutoDcopRegistration();
	return self;
}

+ (NSString *) launcher
{
static qt_QCString * _qcstring = 0L;
	_qcstring = kde_KApplication_launcher();
	return [NSString fromQCString: _qcstring];
}

+ (int) startServiceByName: (NSString *)_name URL: (NSString *)URL error: (NSString *)error dcopService: (NSString *)dcopService pid: (int*)pid startup_id: (NSString *)startup_id noWait: (BOOL)noWait
{
static qt_QCString * _qcstring_startup_id = 0L;
static qt_QCString * _qcstring_dcopService = 0L;
static qt_QString * _qstring_error = 0L;
static qt_QString * _qstring_URL = 0L;
static qt_QString * _qstring__name = 0L;
	return (int) kde_KApplication_startServiceByName((qt_QString *) [_name toQString: &_qstring__name], (qt_QString *) [URL toQString: &_qstring_URL], (qt_QString*) [error toQString: &_qstring_error], (qt_QCString*) [dcopService toQCString: &_qcstring_dcopService], (int*)pid, (qt_QCString*) [startup_id toQCString: &_qcstring_startup_id], (int)noWait);
}

+ (int) startServiceByName: (NSString *)_name URL: (NSString *)URL 
{
static qt_QString * _qstring_URL = 0L;
static qt_QString * _qstring__name = 0L;
	return (int) kde_KApplication_startServiceByName((qt_QString *) [_name toQString: &_qstring__name], (qt_QString *) [URL toQString: &_qstring_URL], 0, 0, 0, "", 0);
}

+ (int) startServiceByName: (NSString *)_name URLs: (NSArray *)URLs error: (NSString *)error dcopService: (NSString *)dcopService pid: (int*)pid startup_id: (NSString *)startup_id noWait: (BOOL)noWait
{
static qt_QCString * _qcstring_startup_id = 0L;
static qt_QCString * _qcstring_dcopService = 0L;
static qt_QString * _qstring_error = 0L;
static qt_QStringList * _qlist_URLs = 0L;
static qt_QString * _qstring__name = 0L;
	return (int) kde_KApplication_startServiceByName1((qt_QString *) [_name toQString: &_qstring__name], (qt_QStringList*) [URLs toQStringList: (void *)&_qlist_URLs], (qt_QString*) [error toQString: &_qstring_error], (qt_QCString*) [dcopService toQCString: &_qcstring_dcopService], (int*)pid, (qt_QCString*) [startup_id toQCString: &_qcstring_startup_id], (int)noWait);
}

+ (int) startServiceByName: (NSString *)_name 
{
static qt_QString * _qstring__name = 0L;
	return (int) kde_KApplication_startServiceByName1((qt_QString *) [_name toQString: &_qstring__name], 0, 0, 0, 0, "", 0);
}

+ (int) startServiceByDesktopPath: (NSString *)_name URL: (NSString *)URL error: (NSString *)error dcopService: (NSString *)dcopService pid: (int*)pid startup_id: (NSString *)startup_id noWait: (BOOL)noWait
{
static qt_QCString * _qcstring_startup_id = 0L;
static qt_QCString * _qcstring_dcopService = 0L;
static qt_QString * _qstring_error = 0L;
static qt_QString * _qstring_URL = 0L;
static qt_QString * _qstring__name = 0L;
	return (int) kde_KApplication_startServiceByDesktopPath((qt_QString *) [_name toQString: &_qstring__name], (qt_QString *) [URL toQString: &_qstring_URL], (qt_QString*) [error toQString: &_qstring_error], (qt_QCString*) [dcopService toQCString: &_qcstring_dcopService], (int*)pid, (qt_QCString*) [startup_id toQCString: &_qcstring_startup_id], (int)noWait);
}

+ (int) startServiceByDesktopPath: (NSString *)_name URL: (NSString *)URL
{
static qt_QString * _qstring_URL = 0L;
static qt_QString * _qstring__name = 0L;
	return (int) kde_KApplication_startServiceByDesktopPath((qt_QString *) [_name toQString: &_qstring__name], (qt_QString *) [URL toQString: &_qstring_URL], 0, 0, 0, "", 0);
}

+ (int) startServiceByDesktopPath: (NSString *)_name URLs: (NSArray *)URLs error: (NSString *)error dcopService: (NSString *)dcopService pid: (int*)pid startup_id: (NSString *)startup_id noWait: (BOOL)noWait
{
static qt_QCString * _qcstring_startup_id = 0L;
static qt_QCString * _qcstring_dcopService = 0L;
static qt_QString * _qstring_error = 0L;
static qt_QStringList * _qlist_URLs = 0L;
static qt_QString * _qstring__name = 0L;
	return (int) kde_KApplication_startServiceByDesktopPath1((qt_QString *) [_name toQString: &_qstring__name], (qt_QStringList*) [URLs toQStringList: (void *)&_qlist_URLs], (qt_QString*) [error toQString: &_qstring_error], (qt_QCString*) [dcopService toQCString: &_qcstring_dcopService], (int*)pid, (qt_QCString*) [startup_id toQCString: &_qcstring_startup_id], (int)noWait);
}

+ (int) startServiceByDesktopPath: (NSString *)_name 
{
static qt_QString * _qstring__name = 0L;
	return (int) kde_KApplication_startServiceByDesktopPath1((qt_QString *) [_name toQString: &_qstring__name], 0, 0, 0, 0, "", 0);
}

+ (int) startServiceByDesktopName: (NSString *)_name URL: (NSString *)URL error: (NSString *)error dcopService: (NSString *)dcopService pid: (int*)pid startup_id: (NSString *)startup_id noWait: (BOOL)noWait
{
static qt_QCString * _qcstring_startup_id = 0L;
static qt_QCString * _qcstring_dcopService = 0L;
static qt_QString * _qstring_error = 0L;
static qt_QString * _qstring_URL = 0L;
static qt_QString * _qstring__name = 0L;
	return (int) kde_KApplication_startServiceByDesktopName((qt_QString *) [_name toQString: &_qstring__name], (qt_QString *) [URL toQString: &_qstring_URL], (qt_QString*) [error toQString: &_qstring_error], (qt_QCString*) [dcopService toQCString: &_qcstring_dcopService], (int*)pid, (qt_QCString*) [startup_id toQCString: &_qcstring_startup_id], (int)noWait);
}

+ (int) startServiceByDesktopName: (NSString *)_name URL: (NSString *)URL
{
static qt_QString * _qstring_URL = 0L;
static qt_QString * _qstring__name = 0L;
	return (int) kde_KApplication_startServiceByDesktopName((qt_QString *) [_name toQString: &_qstring__name], (qt_QString *) [URL toQString: &_qstring_URL], 0, 0, 0, "", 0);
}

+ (int) startServiceByDesktopName: (NSString *)_name URLs: (NSArray *)URLs error: (NSString *)error dcopService: (NSString *)dcopService pid: (int*)pid startup_id: (NSString *)startup_id noWait: (BOOL)noWait
{
static qt_QCString * _qcstring_startup_id = 0L;
static qt_QCString * _qcstring_dcopService = 0L;
static qt_QString * _qstring_error = 0L;
static qt_QStringList * _qlist_URLs = 0L;
static qt_QString * _qstring__name = 0L;
	return (int) kde_KApplication_startServiceByDesktopName1((qt_QString *) [_name toQString: &_qstring__name], (qt_QStringList*) [URLs toQStringList: (void *)&_qlist_URLs], (qt_QString*) [error toQString: &_qstring_error], (qt_QCString*) [dcopService toQCString: &_qcstring_dcopService], (int*)pid, (qt_QCString*) [startup_id toQCString: &_qcstring_startup_id], (int)noWait);
}

+ (int) startServiceByDesktopName: (NSString *)_name 
{
static qt_QString * _qstring__name = 0L;
	return (int) kde_KApplication_startServiceByDesktopName1((qt_QString *) [_name toQString: &_qstring__name], 0, 0, 0, 0, "", 0);
}

+ (int) kdeinitExec: (NSString *)name args: (NSArray *)args error: (NSString *)error pid: (int*)pid
{
static qt_QString * _qstring_error = 0L;
static qt_QStringList * _qlist_args = 0L;
static qt_QString * _qstring_name = 0L;
	return (int) kde_KApplication_kdeinitExec((qt_QString *) [name toQString: &_qstring_name], (qt_QStringList*) [args toQStringList: (void *)&_qlist_args], (qt_QString*) [error toQString: &_qstring_error], (int*)pid);
}

//+ (int) kdeinitExec: (NSString *)name
//{
//static qt_QString * _qstring_name = 0L;
//	return (int) kde_KApplication_kdeinitExec((qt_QString *) [name toQString: &_qstring_name], 0, 0, 0);
//}

+ (int) kdeinitExecWait: (NSString *)name args: (NSArray *)args error: (NSString *)error pid: (int*)pid
{
static qt_QString * _qstring_error = 0L;
static qt_QStringList * _qlist_args = 0L;
static qt_QString * _qstring_name = 0L;
	return (int) kde_KApplication_kdeinitExecWait((qt_QString *) [name toQString: &_qstring_name], (qt_QStringList*) [args toQStringList: (void *)&_qlist_args], (qt_QString*) [error toQString: &_qstring_error], (int*)pid);
}

+ (int) kdeinitExecWait: (NSString *)name
{
static qt_QString * _qstring_name = 0L;
	return (int) kde_KApplication_kdeinitExecWait((qt_QString *) [name toQString: &_qstring_name], 0, 0, 0);
}

+ (int) random
{
	return (int) kde_KApplication_random();
}

+ (NSString *) randomString: (int)length
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KApplication_randomString((int)length);
	return [NSString fromQString: _qstring];
}

+ startKdeinit
{
	kde_KApplication_startKdeinit();
	return self;
}

- initWithBOOL: (BOOL)allowStyles GUIenabled: (BOOL)GUIenabled _instance: (KInstance*)_instance
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KApplication3((int)allowStyles, (int)GUIenabled, (kde_KInstance*) [_instance qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

//- (BOOL) x11EventFilter: (XEvent*)arg1
//{
//	return (BOOL) kde_KApplication_x11EventFilter((kde_KApplication *)[self qt], (XEvent*)arg1);
//}

+ (int) CaptionAppLast
{
	return (int) KAPPLICATION_CaptionAppLast;
}

+ (int) CaptionAppFirst
{
	return (int) KAPPLICATION_CaptionAppFirst;
}

+ (int) CaptionNoApp
{
	return (int) KAPPLICATION_CaptionNoApp;
}

+ (int) ShutdownConfirmDefault
{
	return (int) KAPPLICATION_ShutdownConfirmDefault;
}

//+ (int) /***Don'tconfirm
//{
//	return (int) KAPPLICATION_/***Don'tconfirm;
//}

+ (int) ShutdownConfirmNo
{
	return (int) KAPPLICATION_ShutdownConfirmNo;
}

//+ (int) /***Alwaysconfirm
//{
//	return (int) KAPPLICATION_/***Alwaysconfirm;
//}

+ (int) ShutdownConfirmYes
{
	return (int) KAPPLICATION_ShutdownConfirmYes;
}

+ (int) ShutdownTypeDefault
{
	return (int) KAPPLICATION_ShutdownTypeDefault;
}

+ (int) ShutdownTypeNone
{
	return (int) KAPPLICATION_ShutdownTypeNone;
}

+ (int) ShutdownTypeReboot
{
	return (int) KAPPLICATION_ShutdownTypeReboot;
}

+ (int) ShutdownTypeHalt
{
	return (int) KAPPLICATION_ShutdownTypeHalt;
}

+ (int) ShutdownModeDefault
{
	return (int) KAPPLICATION_ShutdownModeDefault;
}

+ (int)ShutdownModeSchedule
{
	return (int) KAPPLICATION_ShutdownModeSchedule;
}

//+ (int) /***Shutdown
//{
//	return (int) KAPPLICATION_/***Shutdown;
//}

+ (int) ShutdownModeTryNow
{
	return (int) KAPPLICATION_ShutdownModeTryNow;
}

+ (int) ShutdownModeForceNow
{
	return (int) KAPPLICATION_ShutdownModeForceNow;
}

+ (int) SETTINGS_MOUSE
{
	return (int) KAPPLICATION_SETTINGS_MOUSE;
}

+ (int) SETTINGS_COMPLETION
{
	return (int) KAPPLICATION_SETTINGS_COMPLETION;
}

+ (int) SETTINGS_PATHS
{
	return (int) KAPPLICATION_SETTINGS_PATHS;
}

+ (int) SETTINGS_POPUPMENU
{
	return (int) KAPPLICATION_SETTINGS_POPUPMENU;
}

+ (int) SETTINGS_QT
{
	return (int) KAPPLICATION_SETTINGS_QT;
}

+ (int) SETTINGS_SHORTCUTS
{
	return (int) KAPPLICATION_SETTINGS_SHORTCUTS;
}

@end

@implementation KApplication (KInstanceImplementation)
- (KStandardDirs*) dirs
{
	return (KStandardDirs*) [QtSupport objectForQtKey: kde_KInstance_dirs(kde_KApplication_KInstance([self qt])) withClass: [KStandardDirs class] allocatedInObjcWorld: YES];
}

- (KConfig*) config
{
	return (KConfig*) [QtSupport objectForQtKey: kde_KInstance_config(kde_KApplication_KInstance([self qt])) withClass: [KConfig class] allocatedInObjcWorld: YES];
}

- (KIconLoader*) iconLoader
{
	return (KIconLoader*) [QtSupport objectForQtKey: kde_KInstance_iconLoader(kde_KApplication_KInstance([self qt])) withClass: [KIconLoader class] allocatedInObjcWorld: YES];
}

- newIconLoader
{
	kde_KInstance_newIconLoader(kde_KApplication_KInstance([self qt]));
	return self;
}

//- (KCharsets*) charsets
//{
//	return (KCharsets*) [QtSupport objectForQtKey: kde_KInstance_charsets(kde_KApplication_KInstance([self qt])) withClass: [KCharsets class] allocatedInObjcWorld: YES];
//}

- (KAboutData*) aboutData
{
	return (KAboutData*) [QtSupport objectForQtKey: kde_KInstance_aboutData(kde_KApplication_KInstance([self qt])) withClass: [KAboutData class] allocatedInObjcWorld: YES];
}

- (NSString *) instanceName
{
static qt_QCString * _qcstring = 0L;
	_qcstring = kde_KInstance_instanceName(kde_KApplication_KInstance([self qt]));
	return [NSString fromQCString: _qcstring];
}

//- (KMimeSourceFactory*) mimeSourceFactory
//{
//	return (KMimeSourceFactory*) [QtSupport objectForQtKey: kde_KInstance_mimeSourceFactory(kde_KApplication_KInstance([self qt])) withClass: [KMimeSourceFactory class] allocatedInObjcWorld: YES];
//}

@end
