Hi
>
> I'm trying to implement a simple kioslave, but I don't understand well the
> lifecycle and therefore how the slave should behave.
>
> If I get it right, the get() method is called each time a specific URL must
> be retrieved (e.g., a local file), while listDir and stat each time a folder
> content must be shown. Now, what I'd like to make into my slave is that
> when the root URL is called, a list of virtual folder is shown. Therefore I
> placed my simple implementation of listDir and stat as follows:
>
> code snip
>
> However I don't undestand how to force konqueror to list dirs when the root
> URL is placed into the address bar (e.g., rolefs:///), since the get method
> is the only one called. I've had a look at the audiocd slave implementation,
> that is similar to mine, but I don't understand how to instrument the get()
> method to force a directory listing instead of a single data retrieval. Can
> anybody point me to the solution?
Do you have the listing entry in your .protocol file?
Albert
>
>
> Thanks,
>
> Luca
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
The following is my protocol file:
[Protocol]
DocPath=kioslave/kio_rolefs.html
exec=kio_rolefs
input=none
output=filesystem
protocol=rolefs
reading=true
Icon=folder
listing=Name,Type
so I guess the listing entry is right. I've tried to change the list method
to force emitting the folders (that I have saved into a QList):
void RoleFS::listDir( const KUrl& url ){
kDebug(7000) << "[Entering RoleFS::listDir] URL = " <<
url.toMimeDataString();
for( int i = 0; i < rootFolders.size(); i++ ){
KIO::UDSEntry& dirEntry = *(rootFolders.at( i ));
// emit a signal to list this entry
listEntry( dirEntry, true );
}
//totalSize( rootFolders.size() );
data( QByteArray() );
finished();
kDebug(7000) << "[Exiting RoleFS::listDir]";
}
However this still does not work. My get method is almost empty:
void RoleFS::get( const KUrl &url ){
kDebug(7000) << "[Entering RoleFS::get] URL = " <<
url.toMimeDataString();
finished(); // success
kDebug(7000) << "[Exiting RoleFS::get]";
}
Am I doing something wrong?
Without looking at the code, don't know. But no, don't send me the code, you
said yourself that you wanted to do something similar to what audiocd:/ does,
so get the code of audiocd and start stripping it down and modifying it until
it does what you want. And then you'll find the difference with yours.
Cheers,
Albert