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

List:       kfm-devel
Subject:    Re: [PATCH] favicons with rel="icon"
From:       Malte Starostik <malte () kde ! org>
Date:       2002-06-25 0:05:09
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Tuesday 25 June 2002 01:03 schrieb Alexander Kellett:
> On Sun, Jun 23, 2002 at 11:22:52PM +0200, Alexander Kellett wrote:
> > AFAICS, the problem is as follows, seticonforurl is called correctly, but
> > as its not a host icon, but is rather a "link" icon, the icon and its
> > related iconurl are not "related" correctly (i.e the config file doesn't
> > ever get a writeEntry for this url).
> >
> > If all such relations are called for a large host then the faviconrc
> > would get quite enormous. Therefore another less persistant but "good
> > enough" way to do fix this might be to add a cache of page urls and
> > related iconurls to the kded module itself. I'll try writing a patch now.
>
> Patch attached, together with my first patch it gets the
> mozilla.org site to work well at the very least :)
Yes, works fine except for one thing:
Go to www.mozilla.org with konq so kded knows about the icon. Now type 
"www.mozilla.org" (no quotes) into minicli: it doesn't show the icon unless 
you append a /
Attached patch in addition to yours should fix this by being tolerant wrt 
trailing slashes.
Hope it applies, your parts manually removed from `cvs diff`
- -- 
Malte Starostik
PGP: 1024D/D2F3C787 [C138 2121 FAF3 410A 1C2A  27CD 5431 7745 D2F3 C787]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9F7O4VDF3RdLzx4cRAiQlAKC6QAZ9jditOV6JCaaSRIdhx0M9mACfSFTN
jrD7Iyolj51KDZWlDTllmME=
=1mr3
-----END PGP SIGNATURE-----

["favicons.diff" (text/x-diff)]

Index: favicons.cpp
===================================================================
RCS file: /home/kde/kdebase/libkonq/favicons/favicons.cpp,v
retrieving revision 1.13
diff -u -3 -d -p -r1.13 favicons.cpp
--- favicons.cpp	2002/03/13 21:35:06	1.13
+++ favicons.cpp	2002/06/25 00:03:41
@@ -96,6 +108,12 @@ QString FaviconsModule::simplifyURL(cons
     for (unsigned int i = 0; i < result.length(); ++i)
         if (result[i] == '=')
             result[i] = '_';
+    for (unsigned int i = result.length() - 1; i > 0; --i)
+        if (result[i] != '/')
+        {
+            result.truncate(i + 1);
+            break;
+        }
 
     return result;
 }
@@ -105,10 +123,10 @@ QString FaviconsModule::iconNameFromURL(
     if (iconURL.path() == "/favicon.ico")
        return iconURL.host();
 
-    QString result = iconURL.host() + iconURL.path();
-    // splat = and / so it can be safely used as a file name
+    QString result = simplifyURL(iconURL);
+    // splat / so it can be safely used as a file name
     for (unsigned int i = 0; i < result.length(); ++i)
-        if (result[i] == '=' || result[i] == '/')
+        if (result[i] == '/')
             result[i] = '_';
 
     QString ext = result.right(4);


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

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