KubuntuFileSearch

Revision 20 as of 2005-07-11 16:47:58

Clear message

Download and Install

Current version:  kio-locate--tvo--0.1--patch-10 

kio-locate is now on the supermirror. To check it out use:

$ cd workingdirectory
$ ARCHIVE=http://mirrors.sourcecontrol.net/tobivollebregt@gmail.com--2005-kio-locate/kio-locate--tvo--0.1
$ baz get $ARCHIVE kio-locate

This creates a directory kio-locate inside workingdirectory. This directory contains the entire source. The archive is automagically registered. To install, do (presuming you're still in workingdirectory):

$ cd kio-locate
$ scons configure
$ scons
$ sudo scons install

Instead of  scons configure  you might want to use  scons configure debug=1  to enable debugging.

Use  scons -c install  to uninstall.

Type  locater:config  in konqueror for configuration. It might appear as if the first configuration dialog tab doesn't fit into the window. I've been told this is a bug in KDE 3.4.0 and has been fixed in later versions.

NOTE TO SELF:  baz archive-mirror  to update

Issues

Results

I can think of three ways to list results on typing, for example, "locate:openlayer" in konqueror. Compare the following images:

  1. http://home.casema.nl/vollebregt/soc/1.png

  2. http://home.casema.nl/vollebregt/soc/2.png

  3. http://home.casema.nl/vollebregt/soc/3.png

Of course, since 3 is just 2 with some extra links, 2 and 3 could be combined (with 3 optionally configurable).

Status: Resolved: currently 2 and 3 are implemented, with 3 being optional (via a checkbox in the configuration dialogs).

Hidden files

Konqueror only hides files starting with a dot, and not files like "/home/ubuntu/.local/trash/foo". Question is, should we hide hits containing "/." in kio_locate, or modify konqueror to do this (or file a bug). The first option is easiest to implement, but the second is more intuitive (only one location to change display of hidden files).

Status: Almost Resolved: sent the following patch to kde-core-devel list. Issue is resolved if accepted, otherwise I'll try to retrieve the setting from konqueror and hide /. files accordingly. Currently it is possible to change the setting in the configuration dialog.

--- kfileitem.cpp       2005-03-04 13:34:42.000000000 +0100
+++ kfileitem--tvo.cpp  2005-07-10 14:12:32.177853440 +0200
@@ -587,7 +587,7 @@
 bool KFileItem::isHidden() const
 {
   if ( !m_url.isEmpty() )
-      return m_url.fileName()[0] == '.';
+      return m_url.fileName()[0] == '.' || m_url.fileName().find("/.") >= 0;
   else // should never happen
       return m_strName[0] == '.';
 }

RegExp

Are we sure we don't want regexp searches? Just shell wildcards?

Most important arguments to leave out regexp:

  1. Passing regular expressions through the konqueror address bar can be tricky with all these escape characters.
  2. The casual user doesn't know regexps. They'll probably just confuse him/her. A more advanded user who knows regexps isn't afraid of CLI too, so he/she just opens an xterm and manually invokes  locate -r .

Done

I created a local 2005-kio-locate archive and imported a kio-locate--tvo--0.1 project. The log is:

base-0

Summary: initial import
Keywords:

ChangeLog kio-locate_0.4.2 [1] to kio-locate--tvo--0.1:

 * Directory collapsing works now by looking at the part of the path which
   actually matched: if the filename part matched, the file is added to the
   results. If the directory part matched, a directory is added to the results.

 * Additionally, if the directory part matches, an extra item is added to the
   results. It is a locater: URI which searches for the pattern inside the
   directory, hence the string "Search for <pattern> in <directory>".
   It is easy to remove this functionality or make it optional.

 * Simplified the code A LOT by removing the LocateDirectory and LocateItem
   intermediate data structures. The core locate output parsing and pattern
   matching is now in the two functions LocateProtocol::processPath() and
   LocateProtocol::processLocateOutput().

 * As a side effect of the previous item, searches below directories now work.
   They were broken in some (if not all) cases.

 * Changed kdDebug() to DEBUGSTR everywhere in the source and added
   #define DEBUGSTR kdDebug(7199) to src/locater.h. This simplifies a change in
   debugstream number. Also, it writes to a single stream now, instead of two
   (one in kdemain() and one in the rest of the code).

 * Added shell wildcard matching (* and ? only as of this version) and
   explicitly removed regexp support (which was an undocumented and unfinished
   feature) by escaping all patterns. Correctly handles special cases like
   "foo*\*bar", ie. containing both wildcards and escaped wildcards.

 * Added static modifiers to the helper functions in src/kio_locate.cpp

 * Added const modifiers to some methods of class LocateRegExp.

 * Turned off the scons cache in SConstruct. Seems like overkill to me, and
   also it accumulated to ~127M in only a few days :-(

 * Added myself to AUTHORS :-)

Imported all files which were in kio_locate_0.4.2.tar.gz [1], with the exception
of mini-scons. This is to be added to a release tarball, not to be imported into
the archive.

[1] kio_locate_0.4.2 by Armin Straub
    mailto:linux at arminstraub dot de
    http://arminstraub.de/browse.php?page=programs_kiolocate&lang=en

patch-1

Summary: added characterset wildcard
Keywords:

Added the characterset shell wildcard.
(Searches like "locate:fo[a-z]ba[^z]" are now possible.)

Cleaned up the partToPattern() function by adding two helpers:
hasWildcards() and convertWildcardsToRegExp().

The code is built to handle all kinds of special cases properly.

patch-2

Summary: reduced flickering
Keywords:

Modified the slave to only call SlaveBase::listEntries() as much as
Locater::gotOutput(), that is, once per 20 files or so. This reduces flickering
when Konqueror is continously updating and sorting it's list of entries
(while locating).

Commented out some of the DEBUGSTR statements.

patch-3

Summary: hit counting in matching directories
Keywords:

kio_locate now only lists a "Search for <pattern> in <directory>" entry if
the pattern actually matches at least one file or directory in <directory>.
So, no more "Search for..." entries that won't find anything if clicked.

Additionally, modified the code to count the number of hits inside the
directory. This allows entries like "(NN Hits) Display hits in <directory>"
for example. Or "Display the NN hits in <directory>" or
"NN items inside <directory>", or whatever. (instead of "Search for...")

Removed a duplicate path.startsWith(m_locateDirectory) check.

Changed the statusbar to show the expression the user entered instead of the
escaped and regexpified (read: obfuscated) expression, while locating.

patch-4

Summary: Made kio_locate configurable
Keywords:

Made the following things configurable:
 * case sensitivity: auto|sensitive|insensitive,
 * showing of hidden files (that is, their path contains "/."),
 * showing of "Search within directory" entries (a.k.a. collapsed directories),
 * format string for "Search within directory" entries.

patch-5

Summary: Modified the configuration dialogs.
Keywords:

Modified the configuration dialogs to support the four things which were made
configurable in the previous patch.

patch-6

Summary: Updated or unchanged message after config dialog.
Keywords:

It is now possible to show a different message depending on the state of the
configuration dialog: if anything changes, a "Config succesfully updated"
message is shown. If nothing changes (Cancel, Close, or Ok without changing
a thing), a "Config unchanged" message is shown.

patch-7

Summary: Different icons for normal directories and collapsed directories.
Keywords:

Added the possibility to choose a different icon (a different color that is)
in code and in configuration dialog. It's possible to choose from:
 * Blue   (folder)
 * Green  (folder_green)
 * Orange (folder_orange)
 * Red    (folder_red)
 * Violet (folder_violet)
 * Yellow (folder_yellow)
All icons are in kdelibs/pics/crystalsvg. I used size 32 for the combobox.

patch-8

Summary: locater:help now redirects to help:/kio_locate/
Keywords:

See summary.

patch-9

Summary: Bugfix.
Keywords:

Fixed a little bug which caused too few directories to be collapsed when
locating "foobar/" (note the trailing slash!).

patch-10

Summary: Updated the documentation.
Keywords:

See summary.

The preferred way of browsing the documentation is by typing "locater:help" in
the konqueror address bar.

Also created a new screenshot, the old one was corrupt here (and probably
outdated too).

Todo

Short term

(no particular order)

  • Patch KDE to different behaviour regarding hidden files -> let IOSlave specify if a file has hidden attrib. This might fix hidden files in fat filesystems of someone changes the IOSlave, and it will at least fix the hidden files in kio-locate.

  • Create .debs (uniq did this before)
  • ita: you should take the latest bksys snapshot and copy admin/kde.py and admin/generic.py to your own admin/ directory
  • Add search bar to about:konqueror (  JavaScript  allowed?) (Note to self: /usr/share/apps/konqueror/about/launch.html)

  • FINISH a kio_locate beta and announce on forum(s) before Friday July 16th 23:59:59 UTC+2

  • Integrate locate:/ with Konqueror's search bar (is already included in kio-locate_0.4.2 by Armin Straub isn't it?). Also includes figuring out how to set default search plugin per profile.
  • Look at Kat and Kat source
  • Look at Tenor and Tenor source
  • Look at Katapult and Katapult source
  • Look at Kfind and Kfind source
  • Look at kio-clucene and kio-clucene source (talk to trollichon)
  • Look at beagle and beagle source

The todo list from http://www.arminstraub.de, with status:

To do:

Status:

Implement locater:help.

Done

If a directory matches then don't add its childs. At least make this configurable.

Done

Use different icons for collapsed directories and make this configurable.

Done

After updating the settings show a success html message instead of a blank page.

Done

Check if locate's databases are outdated and warn about that.

Disappears in case of inotify locate, otherwise to do

Provide a means of updating the locate database (configurable of course).

idem

Additionally, these two extra items are found when grepping through the kio-locate_0.4.2 source tree. Both are to do status, but pretty low priority in my opinion.

kio_locate.cpp:        /// \todo Is UDS_NAME used for anything in stat? If so we should
kio_locate.cpp-        /// at least strip of the protocol part.
kio_locate.cpp-        UDSEntry entry;
kio_locate.cpp-        addAtom(entry, KIO::UDS_NAME, url.decode_string(url.url()));

kio_locate.cpp:        /// \todo Somehow locate: and locate:/ is thought to be a directory
kio_locate.cpp-        /// by konqueror anyway. How to change this?
kio_locate.cpp-    } else {
kio_locate.cpp-        // What's this?

Long term

(no particular order)

  • (August) Finally decide which of above projects (Kat, Tenor, Katapult, Kfind, kio-clucene, inotify locate) to help, take over or start.
  • (August) Add project to KDE extragear, http://extragear.kde.org, suggested by Armin Straub.

Other ideas:

  • (August, first week?) update locate database with inotify, or FAM API (through gamin)
  • Integrate locate:/ with katapult
  • Make kfind or Kat better

Links

http://lists.kde.org/?l=kde-devel&m=111328905108759&w=2 BR http://extragear.kde.org BR http://arminstraub.de/browse.php?page=programs_kiolocate&lang=en BR http://udu.wiki.ubuntu.com/KubuntuFileSearch BR

Developer

TobiVollebregt