Hi,

I need your help in writing a simple kio slave to display contents of
a xml file (xml file follows a structure like a filesystem though
there will only be folders).

API documentation has not proved much useful. The easiest
example/source of kio slave implementation I could find was
'applications' slave.

>From there I am getting the impression that get() is the first method
called when the url is opened in e.g. konqueror. Here is how I do it:
-

void SKioSlave::get(const KUrl& url){
    error( KIO::ERR_IS_DIRECTORY, url.prettyUrl() ); // We only have
folders in the tree
}

I'm not sure in which cases and when stat() and listDir() are called.
Here is my implementation of them (created just to get hold of
things).

void SKioSlave::stat(const KUrl& url){
    KIO::UDSEntry entry;

    if(url.path().size() == 0){ //base folder
        createFolderEntry(entry, "Sparkle", "");
        statEntry(entry);
        finished();
        return;
    }

    statEntry(entry);//Must be either Catalogue or invalid folder,
ignore for now
    finished();
}

void SKioSlave::listDir(const KUrl& url){
    KIO::UDSEntry entry;
    if(url.path().size() != 0){// Category or invalid folder, mark them empty
        listEntry(entry, true);
        totalSize(0);
        finished();
        return;
    }

    //Base folder, we have only one sub folder i.e. Catalogue

    createFolderEntry(entry, "Catalogue", "");
    listEntry(entry, false);

    listEntry(entry, true);
    totalSize(1);

    finished();
}

The problem is that when I open sparkle: in konqueror, it is forever
in loading state and it shows nothing. If I right click -> Properties
-> Calculate then correct number of subfolders (1) is shown, also name
of base folder (Sparkle) is shown.

What could be the problem here? What happens after I signal error in
the get() function?

Please help.

Regards,

Yogesh Marwaha

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

Reply via email to