KIO errors (CVS HEAD)

Andras Mantia amantia at
Mon Jun 14 16:19:40 BST 2004


 Today I encountered two KIO::NetAccess errors. The first one is with 
download (but affects file_copy as well), the second is with file_copy.
 The problem with the first one is that if you do the following:
       QString tmp;
       KIO::NetAccess::download(absUrl, tmp, this);
       QFile f(tmp);
       if (!
         kdDebug(24000) << "Cannot open: " << << ". The error 
was: " << f.errorString() << endl;
       else {

From time to time you will see that the file cannot be opened, and the 
error is "No such file or directory".
I've tried to workaround the above by using:
 KTempFile *tempFile = new KTempFile(tmpDir);
 tempFile->close(); (tried also without this line)
 KURL tmpURL = KURL::fromPathOrURL(tempFile->name());

//loop begin
 KIO::NetAccess::file_copy(absUrl, tmpURL, -1, true, true, this);
 QFile f(tempFile->name());
 if (!
     kdDebug(24000) << "Cannot open: " << << ". The error was: 
" << f.errorString() << endl;
 else {
//loop end


The result is the same. Sometimes the file cannot be opened. An ugly 
      int k = 0;
      while (!f.exists() && k < 1000000) k++;
before usually helps.

The second problem appears with the second example. If the above code is 
called for many files (but using the same temporary file, so the part 
between //loop begin and //loop end is put inside a loop), from time to 
time I get a "file exist, do you want to overwrite" dialog. Note that 
"overwrite = true" above... I've even tried an f.remove() after 
I think the problem is somewhere deeper in the code. Oh, I forgot, I've 
used the FTP protocol here. With fish it just hangs sometime. sftp 
seems to be OK regarding both bugs. So what can be the problem here?

I need the following to work as there are some classes that does not 
work with remote files (QDomDocument, KMD5) and to be network 
transparent first I need to download the files to a temporary location.

Quanta Plus developer -
K Desktop Environment -
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <>

More information about the kde-core-devel mailing list