class KIO.ForwardingSlaveBase


abstract class

Table of contents
Modules
kio Classes
All Classes
Module kio
Namespace kio
Class KIO.ForwardingSlaveBase
Inherits QObject, KIO.SlaveBase

This class should be used as a base for ioslaves acting as a forwarder to other ioslaves. It has been designed to support only local filesystem like ioslaves.

If the resulting ioslave should be a simple proxy, you only need to implement the ForwardingSlaveBase.rewriteUrl() method.

For more advanced behavior, the classic ioslave methods should be reimplemented, because their default behavior in this class is to forward using the ForwardingSlaveBase.rewriteUrl() method.

A possible code snippet for an advanced stat() behavior would look like this in the child class:

void ChildProtocol.stat(const KUrl &url)
{
bool is_special = false;

// Process the URL to see if it should have // a special treatment

if ( is_special ) { // Handle the URL ourselves KIO.UDSEntry entry; // Fill entry with UDSAtom instances statEntry(entry); finished(); } else { // Setup the ioslave internal state if // required by ChildProtocol.rewriteUrl() ForwardingSlaveBase.stat(url); } }

Of course in this case, you surely need to reimplement listDir() and get() accordingly.

If you want view on directories to be correctly refreshed when something changes on a forwarded URL, you'll need a companion kded module to emit the KDirNotify Files*() D-Bus signals.

This class was initially used for media:/ ioslave. This ioslave code and the MediaDirNotify class of its companion kded module can be a good source of inspiration.

See also ForwardingSlaveBase.rewriteUrl() Author Kevin Ottens



methods