/***************************************************************************
                            KSSLSettings.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_KSSLSettings.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KSSLSettings.h>

@implementation  KSSLSettings

- (void *) qt
{
	return _qt;
}

- setQt: (void *) qt
{
	_qt = qt;
	return self;
}

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

- setAllocatedInObjcWorld: (BOOL) yn
{
	_allocatedInObjcWorld = yn;
	return self;
}


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

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

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld]) {
			kde_del_KSSLSettings((kde_KSSLSettings *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (BOOL) sslv2
{
	return (BOOL) kde_KSSLSettings_sslv2((kde_KSSLSettings *)[self qt]);
}

- (BOOL) sslv3
{
	return (BOOL) kde_KSSLSettings_sslv3((kde_KSSLSettings *)[self qt]);
}

- (BOOL) tlsv1
{
	return (BOOL) kde_KSSLSettings_tlsv1((kde_KSSLSettings *)[self qt]);
}

- (BOOL) warnOnEnter
{
	return (BOOL) kde_KSSLSettings_warnOnEnter((kde_KSSLSettings *)[self qt]);
}

- (BOOL) warnOnUnencrypted
{
	return (BOOL) kde_KSSLSettings_warnOnUnencrypted((kde_KSSLSettings *)[self qt]);
}

- setWarnOnUnencrypted: (BOOL)x
{
	kde_KSSLSettings_setWarnOnUnencrypted((kde_KSSLSettings *)[self qt], (int)x);
	return self;
}

- (BOOL) warnOnLeave
{
	return (BOOL) kde_KSSLSettings_warnOnLeave((kde_KSSLSettings *)[self qt]);
}

- (BOOL) warnOnMixed
{
	return (BOOL) kde_KSSLSettings_warnOnMixed((kde_KSSLSettings *)[self qt]);
}

- (BOOL) warnOnSelfSigned
{
	return (BOOL) kde_KSSLSettings_warnOnSelfSigned((kde_KSSLSettings *)[self qt]);
}

- (BOOL) warnOnRevoked
{
	return (BOOL) kde_KSSLSettings_warnOnRevoked((kde_KSSLSettings *)[self qt]);
}

- (BOOL) warnOnExpired
{
	return (BOOL) kde_KSSLSettings_warnOnExpired((kde_KSSLSettings *)[self qt]);
}

- (BOOL) useEGD
{
	return (BOOL) kde_KSSLSettings_useEGD((kde_KSSLSettings *)[self qt]);
}

- (BOOL) useEFile
{
	return (BOOL) kde_KSSLSettings_useEFile((kde_KSSLSettings *)[self qt]);
}

- setTLSv1: (BOOL)enabled
{
	kde_KSSLSettings_setTLSv1((kde_KSSLSettings *)[self qt], (int)enabled);
	return self;
}

- setSSLv2: (BOOL)enabled
{
	kde_KSSLSettings_setSSLv2((kde_KSSLSettings *)[self qt], (int)enabled);
	return self;
}

- setSSLv3: (BOOL)enabled
{
	kde_KSSLSettings_setSSLv3((kde_KSSLSettings *)[self qt], (int)enabled);
	return self;
}

- (BOOL) autoSendX509
{
	return (BOOL) kde_KSSLSettings_autoSendX509((kde_KSSLSettings *)[self qt]);
}

- (BOOL) promptSendX509
{
	return (BOOL) kde_KSSLSettings_promptSendX509((kde_KSSLSettings *)[self qt]);
}

- (NSString *) getCipherList
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KSSLSettings_getCipherList((kde_KSSLSettings *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) getEGDPath
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KSSLSettings_getEGDPath((kde_KSSLSettings *)[self qt]);
	return [NSString fromQString: _qstring];
}

- load
{
	kde_KSSLSettings_load((kde_KSSLSettings *)[self qt]);
	return self;
}

- defaults
{
	kde_KSSLSettings_defaults((kde_KSSLSettings *)[self qt]);
	return self;
}

- save
{
	kde_KSSLSettings_save((kde_KSSLSettings *)[self qt]);
	return self;
}

@end
