/***************************************************************************
                            Slave.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_Slave.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/Slave.h>
#include <kdeobjc/Connection.h>

@implementation  Slave


//- initWithConnection: (Connection*)connection
//{
//	if ([self qt] == 0L) {
//		[self setQt: kde_new_Slave((kde_Connection*) [connection qt])];
//		[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_Slave((kde_Slave *)[self qt]);
//		}
//		[QtSupport removeQtKey: [self qt]];
//		[self setQt: 0L];
//	}
//	[super dealloc];
//}

- setConnection: (Connection*)connection
{
	kde_Slave_setConnection((kde_Slave *)[self qt], (kde_Connection*) [connection qt]);
	return self;
}

- (Connection*) connection
{
	return (Connection*) [QtSupport objectForQtKey: kde_Slave_connection((kde_Slave *)[self qt]) withClass: [Connection class] allocatedInObjcWorld: YES];
}

- setProgressId: (int)identifier
{
	kde_Slave_setProgressId((kde_Slave *)[self qt], (int)identifier);
	return self;
}

- (int) progressId
{
	return (int) kde_Slave_progressId((kde_Slave *)[self qt]);
}

- sendResumeAnswer: (BOOL)resume
{
	kde_Slave_sendResumeAnswer((kde_Slave *)[self qt], (int)resume);
	return self;
}

- (BOOL) dispatch
{
	return (BOOL) kde_Slave_dispatch((kde_Slave *)[self qt]);
}

//- (BOOL) dispatch: (int)_cmd data: (QByteArray*)data
//{
//	return (BOOL) kde_Slave_dispatch1((kde_Slave *)[self qt], (int)_cmd, (qt_QByteArray*) [data qt]);
//}

//- openPassDlg: (AuthInfo*)info
//{
//	kde_Slave_openPassDlg((kde_Slave *)[self qt], (kde_AuthInfo*) [info qt]);
//	return self;
//}

- openPassDlg: (NSString *)prompt user: (NSString *)user caption: (NSString *)caption comment: (NSString *)comment label: (NSString *)label readOnly: (BOOL)readOnly
{
static qt_QString * _qstring_label = 0L;
static qt_QString * _qstring_comment = 0L;
static qt_QString * _qstring_caption = 0L;
static qt_QString * _qstring_user = 0L;
static qt_QString * _qstring_prompt = 0L;
	kde_Slave_openPassDlg1((kde_Slave *)[self qt], (qt_QString *) [prompt toQString: &_qstring_prompt], (qt_QString *) [user toQString: &_qstring_user], (qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [comment toQString: &_qstring_comment], (qt_QString *) [label toQString: &_qstring_label], (int)readOnly);
	return self;
}

- openPassDlg: (NSString *)prompt user: (NSString *)user readOnly: (BOOL)readOnly
{
static qt_QString * _qstring_user = 0L;
static qt_QString * _qstring_prompt = 0L;
	kde_Slave_openPassDlg2((kde_Slave *)[self qt], (qt_QString *) [prompt toQString: &_qstring_prompt], (qt_QString *) [user toQString: &_qstring_user], (int)readOnly);
	return self;
}

- messageBox: (int)type text: (NSString *)text caption: (NSString *)caption buttonYes: (NSString *)buttonYes buttonNo: (NSString *)buttonNo
{
static qt_QString * _qstring_buttonNo = 0L;
static qt_QString * _qstring_buttonYes = 0L;
static qt_QString * _qstring_caption = 0L;
static qt_QString * _qstring_text = 0L;
	kde_Slave_messageBox((kde_Slave *)[self qt], (int)type, (qt_QString *) [text toQString: &_qstring_text], (qt_QString *) [caption toQString: &_qstring_caption], (qt_QString *) [buttonYes toQString: &_qstring_buttonYes], (qt_QString *) [buttonNo toQString: &_qstring_buttonNo]);
	return self;
}

- requestNetwork: (NSString *)arg1 string: (NSString *)arg2
{
static qt_QString * _qstring_arg2 = 0L;
static qt_QString * _qstring_arg1 = 0L;
	kde_Slave_requestNetwork((kde_Slave *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], (qt_QString *) [arg2 toQString: &_qstring_arg2]);
	return self;
}

- dropNetwork: (NSString *)arg1 string: (NSString *)arg2
{
static qt_QString * _qstring_arg2 = 0L;
static qt_QString * _qstring_arg1 = 0L;
	kde_Slave_dropNetwork((kde_Slave *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], (qt_QString *) [arg2 toQString: &_qstring_arg2]);
	return self;
}

//+ sigpipe_handler: (int)arg1
//{
//	kde_Slave_sigpipe_handler((int)arg1);
//	return self;
//}

@end
