[KPhotoAlbum] bug: searching for descriptions is broken

Christoph Moseler forums at moseler.net
Sun Oct 29 17:05:19 GMT 2006


Hi,

searching for descriptions seems to be broken, can somebody confirm that?

bool ImageSearchInfo::match( ImageInfoPtr info ) const
[...]
     QString txt = info->description();
     if ( !txt.isEmpty() ) {
         QStringList list = QStringList::split( QChar(' '), _description );
         for( QStringList::Iterator it = list.begin(); it != list.end(); 
++it ) {
             ok &= ( txt.find( *it, 0, false ) != -1 );
         }
     }

     return ok;

The code finds all images with the descriptions being searched for plus 
all images with *no* description.

Maybe this could help and is quite fast.

     QString txt = info->description();
+    if ( !_description.isEmpty() && txt.isEmpty() ) {
+        ok = false;
+    }
     if ( !txt.isEmpty() ) {
         QStringList list = QStringList::split( QChar(' '), _description );
         for( QStringList::Iterator it = list.begin(); it != list.end(); 
++it ) {
             ok &= ( txt.find( *it, 0, false ) != -1 );
         }
     }

     return ok;

Cheers,
Christoph



More information about the Kphotoalbum mailing list