/***************************************************************************
                            KSSLCertificateHome.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_KSSLCertificateHome.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KSSLCertificateHome.h>
#include <kdeobjc/KSSLPKCS12.h>


@implementation  KSSLCertificateHome

- (void *) qt
{
	return _qt;
}

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

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

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


//+ (KSSLPKCS12*) getCertificateByHost: (NSString *)host password: (NSString *)password aa: (int*)aa
//{
//static qt_QString * _qstring_password = 0L;
//static qt_QString * _qstring_host = 0L;
//	return (KSSLPKCS12*) [QtSupport objectForQtKey: kde_KSSLCertificateHome_getCertificateByHost((qt_QString *) [host toQString: &_qstring_host], (qt_QString *) [password toQString: &_qstring_password], (int*)aa) withClass: [KSSLPKCS12 class] allocatedInObjcWorld: YES];
//}

+ (KSSLPKCS12*) getCertificateByName: (NSString *)name password: (NSString *)password
{
static qt_QString * _qstring_password = 0L;
static qt_QString * _qstring_name = 0L;
	return (KSSLPKCS12*) [QtSupport objectForQtKey: kde_KSSLCertificateHome_getCertificateByName((qt_QString *) [name toQString: &_qstring_name], (qt_QString *) [password toQString: &_qstring_password]) withClass: [KSSLPKCS12 class] allocatedInObjcWorld: YES];
}

+ (KSSLPKCS12*) getCertificateByName: (NSString *)name
{
static qt_QString * _qstring_name = 0L;
	return (KSSLPKCS12*) [QtSupport objectForQtKey: kde_KSSLCertificateHome_getCertificateByName1((qt_QString *) [name toQString: &_qstring_name]) withClass: [KSSLPKCS12 class] allocatedInObjcWorld: YES];
}

//+ (NSString *) getDefaultCertificateName: (NSString *)host aa: (int*)aa
//{
//static qt_QString * _qstring = 0L;
//static qt_QString * _qstring_host = 0L;
//	_qstring = kde_KSSLCertificateHome_getDefaultCertificateName((qt_QString *) [host toQString: &_qstring_host], (int*)aa);
//	return [NSString fromQString: _qstring];
//}

//+ (NSString *) getDefaultCertificateName: (int*)aa
//{
//static qt_QString * _qstring = 0L;
//	_qstring = kde_KSSLCertificateHome_getDefaultCertificateName1((int*)aa);
//	return [NSString fromQString: _qstring];
//}

//+ (KSSLPKCS12*) getDefaultCertificate: (NSString *)password aa: (int*)aa
//{
//static qt_QString * _qstring_password = 0L;
//	return (KSSLPKCS12*) [QtSupport objectForQtKey: kde_KSSLCertificateHome_getDefaultCertificate((qt_QString *) [password toQString: &_qstring_password], (int*)aa) withClass: [KSSLPKCS12 class] allocatedInObjcWorld: YES];
//}

//+ (KSSLPKCS12*) getDefaultCertificate: (NSString *)password
//{
//static qt_QString * _qstring_password = 0L;
//	return (KSSLPKCS12*) [QtSupport objectForQtKey: kde_KSSLCertificateHome_getDefaultCertificate((qt_QString *) [password toQString: &_qstring_password], 0) withClass: [KSSLPKCS12 class] allocatedInObjcWorld: YES];
//}

//+ (KSSLPKCS12*) getDefaultCertificate: (int*)aa
//{
//	return (KSSLPKCS12*) [QtSupport objectForQtKey: kde_KSSLCertificateHome_getDefaultCertificate1((int*)aa) withClass: [KSSLPKCS12 class] allocatedInObjcWorld: YES];
//}

//+ (KSSLPKCS12*) getDefaultCertificate
//{
//	return (KSSLPKCS12*) [QtSupport objectForQtKey: kde_KSSLCertificateHome_getDefaultCertificate1(0) withClass: [KSSLPKCS12 class] allocatedInObjcWorld: YES];
//}

+ (BOOL) hasCertificateByName: (NSString *)name
{
static qt_QString * _qstring_name = 0L;
	return (BOOL) kde_KSSLCertificateHome_hasCertificateByName((qt_QString *) [name toQString: &_qstring_name]);
}

+ setDefaultCertificate: (NSString *)name send: (BOOL)send prompt: (BOOL)prompt
{
static qt_QString * _qstring_name = 0L;
	kde_KSSLCertificateHome_setDefaultCertificate((qt_QString *) [name toQString: &_qstring_name], (int)send, (int)prompt);
	return self;
}

+ setDefaultCertificate: (NSString *)name 
{
static qt_QString * _qstring_name = 0L;
	kde_KSSLCertificateHome_setDefaultCertificate((qt_QString *) [name toQString: &_qstring_name], 1, 0);
	return self;
}

//+ setDefaultCertificate: (KSSLPKCS12*)cert send: (BOOL)send prompt: (BOOL)prompt
//{
//	kde_KSSLCertificateHome_setDefaultCertificate1((kde_KSSLPKCS12*) [cert qt], (int)send, (int)prompt);
//	return self;
//}

//+ setDefaultCertificate: (KSSLPKCS12*)cert
//{
//	kde_KSSLCertificateHome_setDefaultCertificate1((kde_KSSLPKCS12*) [cert qt], 1, 0);
//	return self;
//}

+ setDefaultCertificate: (NSString *)name host: (NSString *)host send: (BOOL)send prompt: (BOOL)prompt
{
static qt_QString * _qstring_host = 0L;
static qt_QString * _qstring_name = 0L;
	kde_KSSLCertificateHome_setDefaultCertificate2((qt_QString *) [name toQString: &_qstring_name], (qt_QString *) [host toQString: &_qstring_host], (int)send, (int)prompt);
	return self;
}

+ setDefaultCertificate: (NSString *)name host: (NSString *)host 
{
static qt_QString * _qstring_host = 0L;
static qt_QString * _qstring_name = 0L;
	kde_KSSLCertificateHome_setDefaultCertificate2((qt_QString *) [name toQString: &_qstring_name], (qt_QString *) [host toQString: &_qstring_host], 1, 0);
	return self;
}

//+ setDefaultCertificate: (KSSLPKCS12*)cert host: (NSString *)host send: (BOOL)send prompt: (BOOL)prompt
//{
//static qt_QString * _qstring_host = 0L;
//	kde_KSSLCertificateHome_setDefaultCertificate3((kde_KSSLPKCS12*) [cert qt], (qt_QString *) [host toQString: &_qstring_host], (int)send, (int)prompt);
//	return self;
//}

//+ setDefaultCertificate: (KSSLPKCS12*)cert host: (NSString *)host
//{
//static qt_QString * _qstring_host = 0L;
//	kde_KSSLCertificateHome_setDefaultCertificate3((kde_KSSLPKCS12*) [cert qt], (qt_QString *) [host toQString: &_qstring_host], 1, 0);
//	return self;
//}

+ (BOOL) addCertificate: (NSString *)filename password: (NSString *)password storePass: (BOOL)storePass
{
static qt_QString * _qstring_password = 0L;
static qt_QString * _qstring_filename = 0L;
	return (BOOL) kde_KSSLCertificateHome_addCertificate((qt_QString *) [filename toQString: &_qstring_filename], (qt_QString *) [password toQString: &_qstring_password], (int)storePass);
}

+ (BOOL) addCertificate: (NSString *)filename password: (NSString *)password 
{
static qt_QString * _qstring_password = 0L;
static qt_QString * _qstring_filename = 0L;
	return (BOOL) kde_KSSLCertificateHome_addCertificate((qt_QString *) [filename toQString: &_qstring_filename], (qt_QString *) [password toQString: &_qstring_password], 0);
}

+ addCertificate: (KSSLPKCS12*)cert passToStore: (NSString *)passToStore
{
static qt_QString * _qstring_passToStore = 0L;
	kde_KSSLCertificateHome_addCertificate1((kde_KSSLPKCS12*) [cert qt], (qt_QString *) [passToStore toQString: &_qstring_passToStore]);
	return self;
}

+ addCertificate: (KSSLPKCS12*)cert 
{
	kde_KSSLCertificateHome_addCertificate1((kde_KSSLPKCS12*) [cert qt], "");
	return self;
}

+ (NSArray *) getCertificateList
{
static qt_QStringList * _qlist = 0L;
	_qlist = kde_KSSLCertificateHome_getCertificateList();
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

+ (int) AuthNone
{
	return (int) KSSLCERTIFICATEHOME_AuthNone;
}

+ (int) AuthSend
{
	return (int) KSSLCERTIFICATEHOME_AuthSend;
}

+ (int) AuthPrompt
{
	return (int) KSSLCERTIFICATEHOME_AuthPrompt;
}

+ (int) AuthDont
{
	return (int) KSSLCERTIFICATEHOME_AuthDont;
}

@end
