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

List:       kfm-devel
Subject:    [PATCH] kioslaves in konqueror
From:       Raul Fernandes <rgfernandes () correioweb ! com ! br>
Date:       2004-11-05 22:12:17
Message-ID: 200411052212.17262.rgfernandes () correioweb ! com ! br
[Download RAW message or body]

I've been developing a kioslave for RAR archives and couldn't find a way to 
konqueror opens a RAR archive using the kioslave when I double-click the 
archive.
I've discovered and followed this thread from kfm-devel list 
(http://lists.kde.org/?l=kfm-devel&m=109959649007762&w=2) about the same 
problem that Spiros Georgaras has with their kioslave (kio_mht). So, I've 
found a piece of code that David Faure puts in a email and says to test it. 
Well, I changed a little the code, test it and works perfectly here.
This is not in CVS currently, so I made this patch to be commited to CVS.
Is this patch ok???

Raul Fernandes
rgfernandes@correioweb.com.br 

["kdebase-konqueror-kioslaves.patch" (text/x-diff)]

Index: kdebase/konqueror/konq_mainwindow.cc
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_mainwindow.cc,v
retrieving revision 1.1366
diff -u -3 -p -u -r1.1366 konq_mainwindow.cc
--- kdebase/konqueror/konq_mainwindow.cc	28 Oct 2004 20:52:38 -0000	1.1366
+++ kdebase/konqueror/konq_mainwindow.cc	6 Nov 2004 00:08:30 -0000
@@ -679,37 +679,25 @@ bool KonqMainWindow::openView( QString s
 
   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
-
   if ( url.isLocalFile())  // kio_tar/kio_zip only support local files
   {
-    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"))
+    KServiceType::Ptr ptr = KServiceType::serviceType( serviceType );
+    if ( ptr ) 
     {
-      url.setProtocol( QString::fromLatin1("zip") );
-      url.setPath( url.path() + '/' );
-
-      serviceType = "inode/directory";
+      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";
+        }
+      }
     }
   }
 


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

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