/***************************************************************************
                            KCommand.m -  description
                             -------------------
    begin                : Thu Mar 21 01:01:29 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Thu Mar 21 01:01:29 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_KCommand.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KCommand.h>

@implementation  KCommand

- (void *) qt
{
	return _qt;
}

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

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

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


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

- execute
{
	kde_KCommand_execute((kde_KCommand *)[self qt]);
	return self;
}

- unexecute
{
	kde_KCommand_unexecute((kde_KCommand *)[self qt]);
	return self;
}

- (NSString *) name
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KCommand_name((kde_KCommand *)[self qt]);
	return [NSString fromQString: _qstring];
}

@end
