/***************************************************************************
                            FileCopyJob.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_FileCopyJob.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/FileCopyJob.h>
#include <kdeobjc/KURL.h>
#include <qtobjc/QByteArray.h>
#include <kdeobjc/SimpleJob.h>


@implementation  FileCopyJob


- initWithURL: (KURL*)src dest: (KURL*)dest permissions: (int)permissions move: (BOOL)move overwrite: (BOOL)overwrite resume: (BOOL)resume showProgressInfo: (BOOL)showProgressInfo
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_FileCopyJob((kde_KURL*) [src qt], (kde_KURL*) [dest qt], (int)permissions, (int)move, (int)overwrite, (int)resume, (int)showProgressInfo)];
		[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_FileCopyJob((kde_FileCopyJob *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

//- setSourceSize: (off_t)size
//{
//	kde_FileCopyJob_setSourceSize((kde_FileCopyJob *)[self qt], (off_t) size);
//	return self;
//}

- (KURL*) srcURL
{
	return (KURL*) [QtSupport objectForQtKey: kde_FileCopyJob_srcURL((kde_FileCopyJob *)[self qt]) withClass: [KURL class] allocatedInObjcWorld: YES];
}

- (KURL*) destURL
{
	return (KURL*) [QtSupport objectForQtKey: kde_FileCopyJob_destURL((kde_FileCopyJob *)[self qt]) withClass: [KURL class] allocatedInObjcWorld: YES];
}

- slotStart
{
	kde_FileCopyJob_slotStart((kde_FileCopyJob *)[self qt]);
	return self;
}

- slotData: (Job*)arg1 data: (QByteArray*)data
{
	kde_FileCopyJob_slotData((kde_FileCopyJob *)[self qt], (kde_Job*) [arg1 qt], (qt_QByteArray*) [data qt]);
	return self;
}

- slotDataReq: (Job*)arg1 data: (QByteArray*)data
{
	kde_FileCopyJob_slotDataReq((kde_FileCopyJob *)[self qt], (kde_Job*) [arg1 qt], (qt_QByteArray*) [data qt]);
	return self;
}

- startCopyJob
{
	kde_FileCopyJob_startCopyJob((kde_FileCopyJob *)[self qt]);
	return self;
}

- startCopyJob: (KURL*)slave_url
{
	kde_FileCopyJob_startCopyJob1((kde_FileCopyJob *)[self qt], (kde_KURL*) [slave_url qt]);
	return self;
}

- startDataPump
{
	kde_FileCopyJob_startDataPump((kde_FileCopyJob *)[self qt]);
	return self;
}

- connectSubjob: (SimpleJob*)job
{
	kde_FileCopyJob_connectSubjob((kde_FileCopyJob *)[self qt], (kde_SimpleJob*) [job qt]);
	return self;
}

- slotResult: (Job*)job
{
	kde_FileCopyJob_slotResult((kde_FileCopyJob *)[self qt], (kde_Job*) [job qt]);
	return self;
}

//- slotProcessedSize: (Job*)arg1 size: (unsigned long)size
//{
//	kde_FileCopyJob_slotProcessedSize((kde_FileCopyJob *)[self qt], (kde_Job*) [arg1 qt], (unsigned long)size);
//	return self;
//}

//- slotTotalSize: (Job*)arg1 size: (unsigned long)size
//{
//	kde_FileCopyJob_slotTotalSize((kde_FileCopyJob *)[self qt], (kde_Job*) [arg1 qt], (unsigned long)size);
//	return self;
//}

- slotPercent: (Job*)arg1 pct: (unsigned long)pct
{
	kde_FileCopyJob_slotPercent((kde_FileCopyJob *)[self qt], (kde_Job*) [arg1 qt], (unsigned long)pct);
	return self;
}

//- slotCanResume: (Job*)arg1 offset: (unsigned long)offset
//{
//	kde_FileCopyJob_slotCanResume((kde_FileCopyJob *)[self qt], (kde_Job*) [arg1 qt], (unsigned long)offset);
//	return self;
//}

@end
