Generic ioslave support

Spiros Georgaras sngeorgaras at otenet.gr
Mon Nov 22 15:29:15 GMT 2004


Hi all

We have recently applied a patch (by Raul Fernandes) to konq_mainwin.cc to 
provide a more generic support for ioslaves.

I have patched my KDE 3.3.1 installation to support kio_mhtml using this patch 
and I discovered that the default action for mhtml files is 'show directory 
listing' instead of 'display index.html'. That means that a mhtml file should 
be displayed the way a war file does.

In order to do that I had to repatch the path to add support.

The relevant code is

    KServiceType::Ptr ptr = KServiceType::serviceType( serviceType );
    if ( ptr ) 
      const QString protocol = 
ptr->property("X-KDE-LocalProtocol").toString();
      if ( !protocol.isEmpty() )
      {
        url.setProtocol( protocol );
        if (serviceType == QString::fromLatin1("application/x-webarchive"))
        {
          url.setPath( url.path() + "/index.html" );
          serviceType = "text/html";
        }else
        {
          url.setPath( url.path() + '/' );
          serviceType = "inode/directory";
        }
      }

and I had to add/chage

        if (serviceType == QString::fromLatin1("application/x-webarchive") || 
serviceType == QString::fromLatin1("application/x-mimearchive"))

to it, to get ot right.

I know this is the easy way to do it, but this is not 'generic support for 
ioslaves'. I mean what if a new ioslave is introduced in the future and it 
has to display its index.html file as the default action? We would have to 
patch konq_mainwindow.cc again to support it. And what if the default action 
would be to display another type of file (e.g. text/xml)? That would make 
things more difficult.

Shouldn't there be a more generic way to support ioslaves? Somrthing like: 
each ioslave reports the kind of action or type of file it wants to display 
as its default action

What do you think?




More information about the kfm-devel mailing list