[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    kioslave implementation help
From:       fluca1978 () infinito ! it
Date:       2012-03-14 9:59:44
Message-ID: 49c0fd6edb54288aee88d602dfd75c53 () 195 ! 62 ! 182 ! 11
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi all,

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:


void RoleFS::listDir( const KUrl& url ){

  KIO::UDSEntry dirEntry;

  dirEntry.insert( KIO::UDSEntry::UDS_NAME, "TEST" );

  dirEntry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR );

  

  // emit a signal to list this entry

  listEntry( dirEntry, true );

  totalSize(1);

  finished();


}



void RoleFS::stat(const KUrl& url)

{

    KIO::UDSEntry dirEntry;

    dirEntry.insert( KIO::UDSEntry::UDS_NAME, "TEST" );

    dirEntry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR );

    statEntry( dirEntry );

    finished();

}



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?


Thanks,

Luca


[Attachment #5 (text/html)]

Hi all,<br />I'm trying to implement a simple kioslave, but I don't understand well \
the lifecycle and therefore how the slave should behave.<br />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:<br /><br />void RoleFS::listDir( const KUrl&amp; url ){<br />&nbsp; \
KIO::UDSEntry dirEntry;<br />&nbsp; dirEntry.insert( KIO::UDSEntry::UDS_NAME, "TEST" \
);<br />&nbsp; dirEntry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR );<br />&nbsp; \
<br />&nbsp; // emit a signal to list this entry<br />&nbsp; listEntry( dirEntry, \
true );<br />&nbsp; totalSize(1);<br />&nbsp; finished();<br /><br />}<br /><br /><br \
/>void RoleFS::stat(const KUrl&amp; url)<br />{<br />&nbsp;&nbsp;&nbsp; KIO::UDSEntry \
dirEntry;<br />&nbsp;&nbsp;&nbsp; dirEntry.insert( KIO::UDSEntry::UDS_NAME, "TEST" \
);<br />&nbsp;&nbsp;&nbsp; dirEntry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR \
);<br />&nbsp;&nbsp;&nbsp; statEntry( dirEntry );<br />&nbsp;&nbsp;&nbsp; \
finished();<br />}<br /><br /><br />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?<br /><br />Thanks,<br />Luca<br>



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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic