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

@implementation  KPasswordDialog


- initWithInt: (int)type enableKeep: (BOOL)enableKeep extraBttn: (int)extraBttn parent: (QWidget *)parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KPasswordDialog((int)type, (int)enableKeep, (int)extraBttn, (qt_QWidget *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithInt: (int)type enableKeep: (BOOL)enableKeep extraBttn: (int)extraBttn 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KPasswordDialog((int)type, (int)enableKeep, (int)extraBttn, 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithInt: (int)type prompt: (NSString *)prompt enableKeep: (BOOL)enableKeep extraBttn: (int)extraBttn
{
static qt_QString * _qstring_prompt = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KPasswordDialog1((int)type, (qt_QString *) [prompt toQString: &_qstring_prompt], (int)enableKeep, (int)extraBttn)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithInt: (int)type prompt: (NSString *)prompt 
{
static qt_QString * _qstring_prompt = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KPasswordDialog1((int)type, (qt_QString *) [prompt toQString: &_qstring_prompt], 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld] && [self parentWidget: YES] == nil) {
			kde_del_KPasswordDialog((kde_KPasswordDialog *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- setPrompt: (NSString *)prompt
{
static qt_QString * _qstring_prompt = 0L;
	kde_KPasswordDialog_setPrompt((kde_KPasswordDialog *)[self qt], (qt_QString *) [prompt toQString: &_qstring_prompt]);
	return self;
}

- (NSString *) prompt
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KPasswordDialog_prompt((kde_KPasswordDialog *)[self qt]);
	return [NSString fromQString: _qstring];
}

- addLine: (NSString *)key value: (NSString *)value
{
static qt_QString * _qstring_value = 0L;
static qt_QString * _qstring_key = 0L;
	kde_KPasswordDialog_addLine((kde_KPasswordDialog *)[self qt], (qt_QString *) [key toQString: &_qstring_key], (qt_QString *) [value toQString: &_qstring_value]);
	return self;
}

- (NSString *) password
{
	return (NSString *) [NSString stringWithCString: kde_KPasswordDialog_password((kde_KPasswordDialog *)[self qt])];
}

- (BOOL) keep
{
	return (BOOL) kde_KPasswordDialog_keep((kde_KPasswordDialog *)[self qt]);
}

+ (int) getPassword: (NSString *)password prompt: (NSString *)prompt keep: (int*)keep
{
static qt_QString * _qstring_prompt = 0L;
static qt_QCString * _qcstring_password = 0L;
	return (int) kde_KPasswordDialog_getPassword((qt_QCString*) [password toQCString: &_qcstring_password], (qt_QString *) [prompt toQString: &_qstring_prompt], (int*)keep);
}

+ (int) getPassword: (NSString *)password prompt: (NSString *)prompt 
{
static qt_QString * _qstring_prompt = 0L;
static qt_QCString * _qcstring_password = 0L;
	return (int) kde_KPasswordDialog_getPassword((qt_QCString*) [password toQCString: &_qcstring_password], (qt_QString *) [prompt toQString: &_qstring_prompt], 0L);
}

+ (int) getNewPassword: (NSString *)password prompt: (NSString *)prompt
{
static qt_QString * _qstring_prompt = 0L;
static qt_QCString * _qcstring_password = 0L;
	return (int) kde_KPasswordDialog_getNewPassword((qt_QCString*) [password toQCString: &_qcstring_password], (qt_QString *) [prompt toQString: &_qstring_prompt]);
}

+ disableCoreDumps
{
	kde_KPasswordDialog_disableCoreDumps();
	return self;
}

- (BOOL) checkPassword: (NSString *)arg1
{
	return (BOOL) kde_KPasswordDialog_checkPassword((kde_KPasswordDialog *)[self qt], (char*) [arg1 cString]);
}

- slotOk
{
	kde_KPasswordDialog_slotOk((kde_KPasswordDialog *)[self qt]);
	return self;
}

- slotCancel
{
	kde_KPasswordDialog_slotCancel((kde_KPasswordDialog *)[self qt]);
	return self;
}

- slotKeep: (BOOL)arg1
{
	kde_KPasswordDialog_slotKeep((kde_KPasswordDialog *)[self qt], (int)arg1);
	return self;
}

+ (int) Password
{
	return (int) KPASSWORDDIALOG_Password;
}

+ (int) NewPassword
{
	return (int) KPASSWORDDIALOG_NewPassword;
}

@end
