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

List:       kde-devel
Subject:    Re: easy question about ioslaves
From:       Laurence Anderson <l.d.anderson () warwick ! ac ! uk>
Date:       2004-06-01 12:45:14
Message-ID: 20040601124443.QZSN20971.mta09-svc.ntlworld.com () adelle
[Download RAW message or body]

> So the answer is "it is not possible unless patching konqueror", it would
> be very nice if in the near future someone implements
> "X-Konq-Redirect-URL" or something similar.
> 
> Bye, Stefano

I looked at this problem and came up with the following patch, which worked
for me. However I don't think its going to be very efficient calling
KTrader every time any file/folder is clicked on. Would it be possible to
have a stub kpart associated with archives that just redirects to the
correct URL?

Laurence
["kdebase-konq_mainwindow.patch" (text/x-diff)]

--- konq_mainwindow.cc	2003-10-17 19:13:18.000000000 +0100
+++ konq_mainwindow.cc.cool	2003-08-12 20:21:03.000000000 +0100
@@ -634,37 +625,15 @@

   KURL url( _url );

-  //////////// 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
+  //////////// Archive file support

-  if ( url.isLocalFile())  // kio_tar/kio_zip only support local files
+  if ( url.isLocalFile() && serviceType != "inode/directory" )  // kio_archive only \
supports local files, and always ignore directorys (would never match)  {
-    if ( serviceType == QString::fromLatin1("application/x-tar")  ||
-         serviceType == QString::fromLatin1("application/x-tgz")  ||
-         serviceType == QString::fromLatin1("application/x-tbz") )
-    {
-      url.setProtocol( QString::fromLatin1("tar") );
-      url.setPath( url.path() + '/' );
-      serviceType = "inode/directory";
-      // kdDebug(1202) << "TAR FILE. Now trying with " << url.url() << endl;
-
-    }
-    else if (serviceType == QString::fromLatin1("application/x-webarchive") )
-    {
-      url.setProtocol( QString::fromLatin1("tar") );
-      url.setPath( url.path() + "/index.html");
-
-      serviceType = "text/html";
-    }
-    else if (serviceType == QString::fromLatin1("application/x-zip"))
-    {
-      url.setProtocol( QString::fromLatin1("zip") );
-      url.setPath( url.path() + '/' );
-
-      serviceType = "inode/directory";
+    KTrader::OfferList offers = KTrader::self()->query( serviceType, "'Protocol' in \
ServiceTypes" ); +    if ( offers.count() > 0 ) {
+      KTrader::OfferList::ConstIterator it = offers.begin();
+      url = KURL( (*it)->property( "X-Konq-Redirect-URL" ).toString().arg( \
url.path() ) ); +      serviceType = (*it)->property( "X-Konq-Redirect-Mimetype" \
).toString();  }
   }



>> 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