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

List:       koffice
Subject:    Re: icons
From:       David Faure <David.Faure () insa-lyon ! fr>
Date:       1999-02-19 0:03:13
[Download RAW message or body]

On Fri, Feb 19, 1999 at 12:03:39AM +0100, Reginald Stadlbauer wrote:
> Am Thu, 18 Feb 1999 schrieb David Faure:
> >On Wed, Feb 17, 1999 at 02:44:28AM +0000, Kevin Forge wrote:
> >> Reginald Stadlbauer wrote:
> >> > 
> >> > Actually this is no problem. You just have also to change the
> >> > sources of the apps. Because if a KOffice app doesn't find all
> >> > icons, it crashes 
> >> 
> >> You are going to fix this right ? :)
> >
> >Can I suggest an easy fix ?
> >
> >Now that almost all koffice apps use ICON() (i.e. KIconLoader, from
> >kdelibs), the fix would be to patch KIconLoader to return the
> >"unknown.xpm" pixmap if the one asked can't be found.
> >
> >Is there any application out there that relies on KIconLoader::loadIcon
> >returning 0L when the icon can't be found ?
> >
> >(In this case we could add another parameter, with a default value).
> >
> >What do you think ?
> 
> Sounds good to me...

I came up with the following patch, and tested it.
Of course, unknown.xpm is WAYS to big for a toolbar - that's the point :
you easily see that the icon is missing....   :)))

RCS file: /home/kde/kdelibs/kdecore/kiconloader.cpp,v
retrieving revision 1.26
diff -u -p -r1.26 kiconloader.cpp
--- kiconloader.cpp     1999/01/18 10:56:20     1.26
+++ kiconloader.cpp     1999/02/18 23:50:49
@@ -155,11 +155,13 @@ QPixmap KIconLoader::loadIcon ( const QS
 /* Stephan: It's OK to know, how many icons are still missing, but
        we don't need to tell everybody ;) Perhaps this can be con-
        verted to a KDEBUG solution, that is more silent? Don't know.
-
-  if (result.isNull())
-    warning(klocale->translate("ERROR: couldn't find icon: %s"), (const char *) name);
-
+   David: Re-enabled the warning. Most applications (esp. koffice) crash
+        if the icon doesn't exist, anyway. And base apps should be ok now.
 */
+  if (result.isNull()) {
+    warning(klocale->translate("ERROR: couldn't find icon: %s"), (const char *) name);
+    result = loadInternal("unknown.xpm", w, h);
+  }
 
   return result;
 }


I also grepped the whole CVS tree to make sure no application was relying
on loadIcon returning 0L in some cases. Luckily, everybody is lazy enough
*not* to test the return value :)

Shall I commit it ?

-- 
 ____________________________________________________________________
|                                                                    |
|  David FAURE                                                       |
|  E-mail : David.Faure@insa-lyon.fr, faure@kde.org                  |
|  http://www.insa-lyon.fr/People/AEDI/dfaure/index.html             |
|____________________________________________________________________|

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

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