[PATCH] KFileItem performance improvement
Peter Penz
peter.penz at gmx.at
Fri Jun 27 11:05:30 BST 2008
Hi David,
> On Thursday 26 June 2008, Peter Penz wrote:
> > Attached is a patch which remembers the icon name after
> KFileItem::iconName()
> > is invoked at least once.
>
> I think it's a good idea, but as with all caches, the main problem is when
> to invalidate the cache. 1) if you rename foo.txt to foo.jpg the icon used to change,
> but doesn't change anymore, right? Or 2) if you use the properties dialog to change the icon
> of a .desktop file, or 3) if you use the filetypes editor to change the icon for a given
> mimetype. These are the three cases I can think of, and they are not as easy to fix.
>
> 1) might be solved by clearing the icon name in KFileItem::refresh() -- to
> be checked
> 2) might work out of the box via KDirWatch telling KDirLister that this
> file has changed -- to be checked
I'll take a look on those 2 issues (I won't have time until mid of next week for KDE -> I'll reply until the end of next week).
> 3) is the really hard one I think. There is no direct relation between
> "ksycoca has new definition
> for this mimetype" and "we need to clear the cache in all kfileitems".
> Unless kdirlister does something
> like KMimeTypeChooser (connect to KSycoca::self(),
> SIGNAL(databaseChanged(),
> test for KSycoca::self()->isChanged("mime"), and refresh the mimetype and
> icon of all fileitems it knows.
> This would also fix the case of changing a mimetype pattern, in fact. I
> guess this doesn't work right now,
> hmm, well, until reloading the directory. Yeah maybe we can forget about
> 3, it's probably
> good enough if we say that the user has to reload the directory after
> changing mimetype
> definitions.
I've currently no access to my KDE system, but I thought the KFileItem::iconName() won't be invoked at all in this case, so that this issue (?) already exists without the cache. Anyway I'll try this out :-)
Peter
> --
> David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
> Konqueror (http://www.konqueror.org), and KOffice
> (http://www.koffice.org).
More information about the kde-core-devel
mailing list