/***************************************************************************
                            KDirLister.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_KDirLister.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KDirLister.h>
#include <kdeobjc/KFileItem.h>
#include <kdeobjc/KURL.h>
#include <qtobjc/QWidget.h>


@implementation  KDirLister


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

- init
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KDirLister(0)];
		[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_KDirLister((kde_KDirLister *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (BOOL) openURL: (KURL*)_url _keep: (BOOL)_keep _reload: (BOOL)_reload
{
	return (BOOL) kde_KDirLister_openURL((kde_KDirLister *)[self qt], (kde_KURL*) [_url qt], (int)_keep, (int)_reload);
}

- (BOOL) openURL: (KURL*)_url 
{
	return (BOOL) kde_KDirLister_openURL((kde_KDirLister *)[self qt], (kde_KURL*) [_url qt], 0, 0);
}

- stop
{
	kde_KDirLister_stop((kde_KDirLister *)[self qt]);
	return self;
}

- stop: (KURL*)_url
{
	kde_KDirLister_stop1((kde_KDirLister *)[self qt], (kde_KURL*) [_url qt]);
	return self;
}

- (BOOL) autoUpdate
{
	return (BOOL) kde_KDirLister_autoUpdate((kde_KDirLister *)[self qt]);
}

- setAutoUpdate: (BOOL)enable
{
	kde_KDirLister_setAutoUpdate((kde_KDirLister *)[self qt], (int)enable);
	return self;
}

- (BOOL) autoErrorHandlingEnabled
{
	return (BOOL) kde_KDirLister_autoErrorHandlingEnabled((kde_KDirLister *)[self qt]);
}

- setAutoErrorHandlingEnabled: (BOOL)enable parent: (QWidget *)parent
{
	kde_KDirLister_setAutoErrorHandlingEnabled((kde_KDirLister *)[self qt], (int)enable, (qt_QWidget *) [parent qt]);
	return self;
}

- (BOOL) showingDotFiles
{
	return (BOOL) kde_KDirLister_showingDotFiles((kde_KDirLister *)[self qt]);
}

- setShowingDotFiles: (BOOL)_showDotFiles
{
	kde_KDirLister_setShowingDotFiles((kde_KDirLister *)[self qt], (int)_showDotFiles);
	return self;
}

- (BOOL) dirOnlyMode
{
	return (BOOL) kde_KDirLister_dirOnlyMode((kde_KDirLister *)[self qt]);
}

- setDirOnlyMode: (BOOL)dirsOnly
{
	kde_KDirLister_setDirOnlyMode((kde_KDirLister *)[self qt], (int)dirsOnly);
	return self;
}

- (KURL*) url
{
	return (KURL*) [QtSupport objectForQtKey: kde_KDirLister_url((kde_KDirLister *)[self qt]) withClass: [KURL class] allocatedInObjcWorld: YES];
}

- emitChanges
{
	kde_KDirLister_emitChanges((kde_KDirLister *)[self qt]);
	return self;
}

- updateDirectory: (KURL*)_dir
{
	kde_KDirLister_updateDirectory((kde_KDirLister *)[self qt], (kde_KURL*) [_dir qt]);
	return self;
}

- (BOOL) isFinished
{
	return (BOOL) kde_KDirLister_isFinished((kde_KDirLister *)[self qt]);
}

- (KFileItem*) rootItem
{
	return (KFileItem*) [QtSupport objectForQtKey: kde_KDirLister_rootItem((kde_KDirLister *)[self qt]) withClass: [KFileItem class] allocatedInObjcWorld: YES];
}

- (KFileItem*) findByURL: (KURL*)_url
{
	return (KFileItem*) [QtSupport objectForQtKey: kde_KDirLister_findByURL((kde_KDirLister *)[self qt], (kde_KURL*) [_url qt]) withClass: [KFileItem class] allocatedInObjcWorld: YES];
}

- (KFileItem*) find: (KURL*)_url
{
	return (KFileItem*) [QtSupport objectForQtKey: kde_KDirLister_find((kde_KDirLister *)[self qt], (kde_KURL*) [_url qt]) withClass: [KFileItem class] allocatedInObjcWorld: YES];
}

- (KFileItem*) findByName: (NSString *)name
{
static qt_QString * _qstring_name = 0L;
	return (KFileItem*) [QtSupport objectForQtKey: kde_KDirLister_findByName((kde_KDirLister *)[self qt], (qt_QString *) [name toQString: &_qstring_name]) withClass: [KFileItem class] allocatedInObjcWorld: YES];
}

- setNameFilter: (NSString *)arg1
{
static qt_QString * _qstring_arg1 = 0L;
	kde_KDirLister_setNameFilter((kde_KDirLister *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1]);
	return self;
}

- (NSString *) nameFilter
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KDirLister_nameFilter((kde_KDirLister *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setMimeFilter: (NSArray *)arg1
{
static qt_QStringList * _qlist_arg1 = 0L;
	kde_KDirLister_setMimeFilter((kde_KDirLister *)[self qt], (qt_QStringList*) [arg1 toQStringList: (void *)&_qlist_arg1]);
	return self;
}

- clearMimeFilter
{
	kde_KDirLister_clearMimeFilter((kde_KDirLister *)[self qt]);
	return self;
}

- (NSArray *) mimeFilters
{
static qt_QStringList * _qlist = 0L;
	_qlist = kde_KDirLister_mimeFilters((kde_KDirLister *)[self qt]);
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

- (BOOL) matchesFilterWithName: (NSString *)name
{
static qt_QString * _qstring_name = 0L;
	return (BOOL) kde_KDirLister_matchesFilter((kde_KDirLister *)[self qt], (qt_QString *) [name toQString: &_qstring_name]);
}

- (BOOL) matchesMimeFilterWithName: (NSString *)mime
{
static qt_QString * _qstring_mime = 0L;
	return (BOOL) kde_KDirLister_matchesMimeFilter((kde_KDirLister *)[self qt], (qt_QString *) [mime toQString: &_qstring_mime]);
}

- (BOOL) matchesFilter: (KFileItem*)arg1
{
	return (BOOL) kde_KDirLister_matchesFilter1((kde_KDirLister *)[self qt], (kde_KFileItem*) [arg1 qt]);
}

- (BOOL) matchesMimeFilter: (KFileItem*)arg1
{
	return (BOOL) kde_KDirLister_matchesMimeFilter1((kde_KDirLister *)[self qt], (kde_KFileItem*) [arg1 qt]);
}

- (BOOL) validURL: (KURL*)arg1
{
	return (BOOL) kde_KDirLister_validURL((kde_KDirLister *)[self qt], (kde_KURL*) [arg1 qt]);
}

- virtual_hook: (int)identifier data: (void*)data
{
	kde_KDirLister_virtual_hook((kde_KDirLister *)[self qt], (int)identifier, (void*)data);
	return self;
}

@end
