Intergrating mht file to konqueror

Spiros Georgaras sngeorgaras at otenet.gr
Sun Nov 7 09:56:30 GMT 2004


David Faure wrote:
> On Thursday 04 November 2004 20:08, Spiros Georgaras wrote:
> > David Faure wrote:
> > > Ah yeah I'm still behind with that.
> > > How about adding support for X-KDE-LocalProtocol instead? Query the
> > > mimetype for it, and if it's set, redirect to <protocol>://path.
> >
> > Sorry David I don't understand what you mean.... :(
> > Where does X-KDE-LocalProtocol refer to?
> > Do you mean to change the mht.protocol file?
> >
> > I see in konq_mainwindow.cc file:
> >   //////////// Tar/zip files support
> >   // The hack-ish and hardcoded way.
> >   // Possible cleaner solution: 2 properties in the mimetype definition,
> >   // e.g. X-Konq-Redirect-URL set to tar:%f/
> >   //  and X-Konq-Redirect-Mimetype set to inode/directory
> >
> > This is something different right?
>
> It was the initial idea long ago, but after discussion with Jowenn he added
> X-KDE-LocalProtocol to the mimetypes instead.
>
> For instance the mimetype application/x-tar has a property
> X-KDE-LocalProtocol set to "tar" (see
> kdelibs/mimetypes/application/x-tar.desktop)
>
> So the konq_mainwindow code would be like
>
> if ( url.isLocalFile() )
> {
>   KServiceType::Ptr ptr = KServiceType::serviceType( serviceType );
>   if ( ptr )
>   {
>      const QString protocol =
> ptr->property("X-KDE-LocalProtocol").toString(); if ( !protocol.isEmpty() )
>      {
>          url.setProtocol( protocol );
>          url.setPath( url.path() + '/' );        // TODO: for *.war files
> we want "/index.html". New property? serviceType = "inode/directory"; //
> would be text/html for *.war files... }
>    }
> }
>
> Please test, it should work :)
> Don't forget to add this to your mimetype .desktop file:
>
> [Property::X-KDE-LocalProtocol]
> Type=QString
> Value=mht
>
> Hmm, it looks like x-zip.desktop is missing it...

I haven't had the time to test it but Raul Fernandes has 
http://lists.kde.org/?l=kfm-devel&m=109969996114138&w=2
and reports that it works.

The problem I see with it is that X-KDE-LocalProtocol is not enough to access 
a protocol like war or mht, cause we need to pass to konqueror the protocol 
name, the default document to display ( index.html or / ) and its mimetype 
( text/html or inode/directory ).

One solution would be to have in the desktop file something like

[Property::X-KDE-LocalProtocol]
Type=QString
Value=mht

[Property::X-KDE-LocalFile]
Type=QString
Value=index.html

[Property::X-KDE-LocalServiceType]
Type=QString
Value=text/html

What do you think?




More information about the kfm-devel mailing list