problem with KIO::NetAccess and KDirLister/KFileTreeView

Klaas Freitag freitag at suse.de
Mon Oct 7 15:10:11 BST 2002


Hi,

I have a problem with KIO::NetAccess methods and KFileTreeView that uses
KDirLister to monitor a directory.

In the renaming slot of the KFileTreeView, I like to rename a file in the
directory by using the KIO::NetAccess functions copy and del in this way:
   [...]
   bool success = false;
   if( KIO::NetAccess::exists( targetUrl ) )
   {
      kdDebug(28000)<< "Target already exists - can not copy" << endl;
   }
   else
   {
      if( KIO::NetAccess::copy( fromUrl, targetUrl ))
      {
	 kdDebug(28000) << "Copy success, removing " << fromUrl.prettyURL()
                        << endl;
	 KIO::NetAccess::del( fromUrl );
	 toUrl = targetUrl;
	 success  = true;
      }
      else
      {
	 kdDebug(28000) << "Could not copy:" <<
                           KIO::NetAccess::lastErrorString() << endl;
      }
   }
   [...]

In KDE 3.0.x that works in that way that the new file is reported by
KDirLister and the file appears in the KFileTreeView and the deleted file
is removed from the tree also by a signal of KDirLister.
In KDE 3.1 (head from today) it is not working. The new file does not appear
as long as the del-function is called. It removes the old line and no new file
is reported. If the del-line is removed from the code above, the new file is
reported correctly, but of course the old one remains.

Well, I fear that you all say 'Do not use NetAccess', and I am willing to change
it in the future. But since the files are locally I used NetAccess to enable
in-treeview-renaming again for Kooka.

Is it possible that changes on KDirLister cause this problem?

Thanks for any help,

Klaas


Console debug output:

Kooka: Renaming to
file:/home/kf/.kde/share/apps/ScanImages/OCR/specverylonghere.pbm
kio (KIOJob): Starting kio_uiserver
kio (KLauncher): KLauncher: Got
start_service_by_desktop_path('kio_uiserver.desktop', ...)
kdeinit: Got EXEC_NEW 'kio_uiserver' from launcher.
kio (KLauncher): kio_uiserver (pid 2551) up and running.
DCOP: register 'kio_uiserver' -> number of clients is now 2
kio (KIOJob): startServiceByDesktopPath returned 0
kio (KIOJob): kio_uiserver registered
DCOP: register 'anonymous-2551' -> number of clients is now 3
DCOP: new daemon kio_uiserver
kio (UIServer): UIServer::newJob observerAppId=kooka-2533. Giving id=1
Kooka: Copy success, removing
file:/home/kf/.kde/share/apps/ScanImages/OCR/spec.pbm
DCOP: unregister 'anonymous-2551'
kdeinit: PID 2551 terminated.
kio (UIServer): UIServer::jobFinished id=1
kio (UIServer): UIServer::newJob observerAppId=kooka-2533. Giving id=2
kio (KIOJob): stat file:/home/kf/.kde/share/apps/ScanImages/OCR/spec.pbm
kio_file: FileProtocol::stat details=1
kio (KDirWatch): KDirWatch-1 stopped scanning
/home/kf/.kde/share/apps/ScanImages/OCR (now
 0 watchers)
kio (KDirWatch): KDirWatch-1 restarted scanning
/home/kf/.kde/share/apps/ScanImages/OCR (n
ow 1 watchers)
Kooka: renaming OK
kio (KDirListerCache): [virtual void KDirListerCache::FilesRemoved(const
KURL::List&)]
kfile (kdelibs): Slot Delete Item hitted for
file:/home/kf/.kde/share/apps/ScanImages/OCR/
spec.pbm
kfile (kdelibs): Child count: 0
kfile (kdelibs): Found corresponding KFileTreeViewItem
Kooka: Deleting image from thumbview, result is true
kio (UIServer): UIServer::totalFiles 2 1
kio (UIServer): UIServer::totalDirs 2 0
kio (UIServer): UIServer::jobFinished id=2
kio_file: Done



-- 
 Was auch immer geschieht :                                Klaas Freitag
 Nie dürft ihr so tief sinken,                      mail freitag at suse.de
 von dem Kakao, durch den man euch zieht,           SuSE Labs, Nuernberg
 auch noch zu trinken! - E. Kaestner





More information about the kde-core-devel mailing list