file name wildcard match

Dawit A. adawit at kde.org
Wed Apr 10 06:09:20 BST 2002


On Tuesday 09 April 2002 18:01, Erik Sjölund wrote:
> I installed konqueror from the KDE_3_0_BRANCH cvstag.
>
> If I write /home/erik/*wav in the urlbar
> no directories are hidden by the filter,
> just file names not having the substring wav
> are hidden.
>
> For example foobar.wav.ews is shown.

Hmm... how is this supposed to match *wav ?  *wav means something that ends 
with wav but containing 0 or more characters infront of it .

> This was a bit of a surprise to me as I expected a shell like behaviour that
> you have on the command line.
>
> Looking at the kdelibs/kio/kio/kdirlister.cpp
> I recognized that a QRegExp::search was done.
> Changing that to QRegExp::exactMatch seems
> to hide just the file names ending with
> wav.
> And then I looked at the directory exception
> to file name globbering. I think it's more
> straightforward to treat directory names the
> same way as ordinary file names. So I also
> tried to find that place in the source
> code and make a little change (see attachment).
> But I am really new to this code so I don't
> have an overview of how such changes affect
> other things.

This is exactly why there is a mime-type based filter plugin 
(kdeaddons/konqplugins/dirfilter) :)  There is a much better chance of 
filtering something by using its mime-type rather than a simple wildcard 
macthing scheme.  This is specially true in light of the fact that a file of 
any type (eg: text/plain) can be named anything making it impossibe for you 
to filter all such files in/out.

Regards,
Dawit A.





More information about the kfm-devel mailing list