From 5fc09123aa954d43e1a787ee56b8a95a8d4139e4 Mon Sep 17 00:00:00 2001 From: dockes Date: Fri, 5 Oct 2007 14:00:04 +0000 Subject: [PATCH] add rclcat prefix to query languages + adapt find_applet to use it --- src/query/wasatorcl.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/query/wasatorcl.cpp b/src/query/wasatorcl.cpp index a514e953..0d7d1a15 100644 --- a/src/query/wasatorcl.cpp +++ b/src/query/wasatorcl.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: wasatorcl.cpp,v 1.9 2007-06-22 06:14:04 dockes Exp $ (C) 2006 J.F.Dockes"; +static char rcsid[] = "@(#$Id: wasatorcl.cpp,v 1.10 2007-10-05 14:00:04 dockes Exp $ (C) 2006 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -17,12 +17,18 @@ static char rcsid[] = "@(#$Id: wasatorcl.cpp,v 1.9 2007-06-22 06:14:04 dockes Ex * Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include +#include +using std::string; +using std::list; + #include "wasastringtoquery.h" #include "rcldb.h" #include "searchdata.h" #include "wasatorcl.h" #include "debuglog.h" #include "smallut.h" +#include "rclconfig.h" Rcl::SearchData *wasaStringToRcl(const string &qs, string &reason) { @@ -56,11 +62,23 @@ Rcl::SearchData *wasaQueryToRcl(WasaQuery *wasa) // ?? continue; case WasaQuery::OP_LEAF: - // Special case for mime. Not pretty. + + // Special cases for mime and category. Not pretty. if (!stringicmp("mime", (*it)->m_fieldspec)) { sdata->addFiletype((*it)->m_value); break; } + if (!stringicmp("rclcat", (*it)->m_fieldspec)) { + RclConfig *conf = RclConfig::getMainConfig(); + list mtypes; + if (conf && conf->getMimeCatTypes((*it)->m_value, mtypes)) { + for (list::iterator mit = mtypes.begin(); + mit != mtypes.end(); mit++) { + sdata->addFiletype(*mit); + } + } + break; + } if ((*it)->m_value.find_first_of(" \t\n\r") != string::npos) { nclause = new Rcl::SearchDataClauseDist(Rcl::SCLT_PHRASE,