Fwd: How to use KDE for file copying jobs (not kdev topic)
Victor Röder
victor_roeder at gmx.de
Sun Jul 14 13:58:05 UTC 2002
Hi, Bretzel! :-)
> So, I am searching a way into the kde's IO jobs to copy file <src> to
> <dest> in the same file system.
> Is there a simple way to do it ? I read KIO/jobclasses.h and job.cpp
> and no clue....When I compile: "KIO::CopyJob (or FileCopyJob) undeclared in
> KIO name space" -> Maybe I am in the wrong way.
The easiest way:
#include <kprocess.h>
...
KShellProcess proc("/bin/sh");
proc << "cp";
proc << yourSrcPath;
proc << yourDestPath;
proc.start(KProcess::DontCare);
The more easiest way:
#include <kio/job.h>
...
KIO::Job* job = KIO::copy ( yourSrcPath, yourDestPath );
// now you can control your copy-job via job (i.e. kill, connect with a slot,
// etc)
connect ( job, SIGNAL ( result ( KIO::Job* ) ), this, SLOT (
slotResultOfYourCopyJob ( KIO::Job* ) ) );
You can have a look at Bernd's KDE Architecture Overview ( part of Gideon )
where this stuff is explained really cool.
Bye,
Victor
More information about the KDevelop-devel
mailing list