kdirlister and friends

Jens Herden jens at kdewebdev.org
Tue May 16 22:41:22 BST 2006


> > > My current idea is to move KDirLister to K3DirLister because I think
> > > the model would do more or less the same. And implementing the model on
> > > top of the KDirLister seems to be not very efficient.
> I strongly disagree, for the same reasons David posted already. You can
> write a new model, yes, but leave KDirLister working. Eventually, I will
> finish porting it to Qt 4, but right now I lack the time :(

After reading Davids and your mail and looking again in the code I aggree to 
you both. So I will try to create a model on top of KDirLister. 

May I suggest some changes for KDirLister/KDirListerCache for KDE4?

1. I would move KDirListerCache::validURL into the KDirLister class because it 
is not working with any data from KDirListerCache.

2. I see many places where lister->d-> is used in KDirListerCache to access 
the private data in the KDirLister. I guess it would speed up things a little 
if the pointer to the private data would be cached, right? IMHO this would be 
also more readable.

3. I wonder if the code for filtering could get removed from KDirLister. There 
is a class KSimpleFileFilter that does almost the same (I think only the 
dirOnly mode is missing) which could be used in KDirLister. 
The problematic part would be that KDirLister only emits signals for the 
changed items when the filter criteria got changed. Currently the old filter 
settings are saved and the KFileItem is filtered once with the old filter and 
again with the new filter.
But maybe the information if a KFileItem passed the filter or not could get 
saved in the KFileItem's extra data? This way KDirLister would retrieve the 
filter status from the extra data instead of evaluating it again in 
emitChanges for the old filter settings. And we could use a KSimpleFileFilter 
for the new filter status.
I would remove all the filter code from KDirLister and provide a method to set 
a pointer to a KFileFilter. This way KDirLister is only responsible for 
listing and would only filter if a KFileFilter was set. 

4.   void setAutoErrorHandlingEnabled( bool enable, QWidget *parent );
should change to 
  void setAutoErrorHandlingEnabled( bool enable, QWidget *parent = 0);

5. A minor wish would be to rename the property autoErrorHandlingEnabled to 
just autoErrorHandling. This would shorten the name a bit without loosing the 
meaning and it is also consistent to the other bool properties which do not 
feature the 'Enabled' in the name. 

If you want I can create a patch for my suggested changes.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060517/a3af6203/attachment.sig>

More information about the kde-core-devel mailing list