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

List:       kde-devel
Subject:    Re: Redirection problem + How to get files in Sidebar?
From:       Michael Goffioul <goffioul () imec ! be>
Date:       2001-11-12 17:15:34
[Download RAW message or body]

> See the whole problem is that from an ioslave point-of-view is that there's
> no difference between "listing the directory in the sidebar" and "listing
> the directory in the iconview (or listview)".

I could manage to do what I want. Basically it relies on the fact that I
can return different results when "listDir()" and "stat()". When my slave
receives a "listDir()", it only returns directories so that they can be
shown in the sidebar, but when "stat()" it returns a file on printer
object with the mime type set to "text/html". But now I have to persuade
konqueror to ask a "stat()" on a openURLRequest(). For that, the client
(sidebar or iconview) shouldn't pass the serviceType as argument, konqueror
will then stat the file to get its mimetype. This is possible in iconview
if the KFileItem contain a mimeType and a guessedMimeType. So I simply have
to add a fake UDS_GUESSED_MIME_TYPE in my entries on listDir().
To make it finally work in the sidebar, the code of dirtree_item.cpp has to
be changed a little bit such that externalMimeType() returns QString::null
if KFileItem::isMimeTypeKnown() is false.

I attached a patch for the changes. Should I commit? (don't thing it breaks
anything).

Michael.

-- 
------------------------------------------------------------------
Michael Goffioul		IMEC-DESICS-MIRA
e-mail: goffioul@imec.be	(Mixed-Signal and RF Applications)
Tel:    +32/16/28-8510		Kapeldreef, 75
Fax:    +32/16/28-1515		3001 HEVERLEE, BELGIUM
------------------------------------------------------------------
["sidebar.diff" (text/plain)]

Index: dirtree_item.cpp
===================================================================
RCS file: /home/kde/kdebase/konqueror/sidebar/trees/dirtree_module/dirtree_item.cpp,v
retrieving revision 1.5
diff -u -8 -r1.5 dirtree_item.cpp
--- dirtree_item.cpp	2001/10/12 13:06:07	1.5
+++ dirtree_item.cpp	2001/11/12 17:15:16
@@ -109,17 +109,20 @@
 
 KURL KonqSidebarDirTreeItem::externalURL() const
 {
     return m_fileItem->url();
 }
 
 QString KonqSidebarDirTreeItem::externalMimeType() const
 {
-    return m_fileItem->mimetype();
+    if (m_fileItem->isMimeTypeKnown())
+        return m_fileItem->mimetype();
+    else
+        return QString::null;
 }
 
 bool KonqSidebarDirTreeItem::acceptsDrops( const QStrList & formats )
 {
     if ( formats.contains("text/uri-list") )
         return m_fileItem->acceptsDrops();
     return false;
 }

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