[Digikam-devel] advanced search calendar widget

Mikolaj Machowski mikmach at wp.pl
Tue Jun 27 14:38:26 BST 2006

Dnia sobota, 17 czerwca 2006 21:51, Caulier Gilles napisał:
> Le Vendredi 16 Juin 2006 20:56, Mikolaj Machowski a écrit :
> > Dnia piątek, 16 czerwca 2006 11:49, Gilles Caulier napisał:
> > > Please remember me what your patch must done exactly...
> >
> > Current implementation selects dates in future which are useless for
> > Digikam. My patch selects: Yesterday, Last Week, Last Friday, Last
> > Monday, Last Month.
> Totally agree with this patch. A picture is always taken in the past,
> never in the future... Commited ! Thanks Mikolaj...

Continuing (without patch, yet - I hope)...

Current implementation only allows for selecting time "Before" or
"After" selected date. With that in mind I used "Last Friday", "Last
Monday" to quick finding of photos taken during last weekend - as
Digikam is primarily for amateur photographers. But it is possible to
use with semi-prof or higher profile users. For them it could be useful
to select photos from last working week. It would mean adding
combination eg. "After"+"Last Sunday" but multiplication of kdatepicker
entries IMO isn't best solution - better would be expansion of date
conditions for "Day and after" (or "After (inclusive)") and "Day and
before (or "Before (inclusive)").

I started messing with this, added two entries into description table
(and increased RuleOptTableCound) in digikam/searchwidgets.cpp:

    { I18N_NOOP("Day and after"),      "GE",           
SearchAdvancedRule::DATE },
    { I18N_NOOP("Day and before"),     "LE",           
SearchAdvancedRule::DATE },

(1st field: label, 2nd: SQL keyword, 3rd: internal Digikam setting).

It comes out with sqlite error:

sqlite_compile error: near ")": syntax error on query: SELECT
Albums.url||'/'||Images.name FROM Images, Albums LEFT JOIN
ImageProperties on Images.id = ImageProperties.imageid WHERE ( ) AND
(Albums.id=Images.dirid) LIMIT 500;

SQLite doesn't like GE/LE (greater or equal, lesser or equal) on DATE
objects or something was missed?

BTW - small bug/inconsistency surfaced when testing some options:
I've made search for images "After" 23.05.2006 "As Well As" "Before"
25.05.2006. According to logic it should return images only from
24.05.2006, but it lists images from 23rd and 24th of May! After is
inclusive (GT) and Before is exclusive (LT). Don't know where is fault
Digikam code, Qt glitch when transferring dates or SQL(ite) specific
thing. At least it should be "fixed" by renaming option from "After" to
"After (inclusive)".


More information about the Digikam-devel mailing list