Git commit 62e5a687dd6b4555824f786add4e1a1d941f3c49 by Stephane Mankowski. Committed on 03/04/2015 at 18:19. Pushed by smankowski into branch 'master'.
BUG:345719 Enhance fast search/filter on lists M +1 -0 doc/index.docbook M +1 -1 skgbasegui/skgfilteredtableview.ui M +1 -1 skgbasemodeler/skgservices.cpp M +2 -2 tests/skgbasemodelertest/skgtestbase.cpp http://commits.kde.org/skrooge/62e5a687dd6b4555824f786add4e1a1d941f3c49 diff --git a/doc/index.docbook b/doc/index.docbook index c5e10ba..1de31c9 100644 --- a/doc/index.docbook +++ b/doc/index.docbook @@ -597,6 +597,7 @@ <listitem><para>+val1 +val2 => Keep lines containing val1 OR val2</para></listitem> <listitem><para>+val1 -val2 => Keep lines containing val1 but NOT val2</para></listitem> <listitem><para>"abc def" => Keep lines containing the sentence "abc def"</para></listitem> + <listitem><para>"-att:abc def" => Remove lines having a column name starting by abc and containing "abc def"</para></listitem> <listitem><para>abc:def => Keep lines having a column name starting by abc and containing def</para></listitem> <listitem><para>:abc:def => Keep lines containing "abc:def"</para></listitem> <listitem><para>Date>2015-03-01 => Keep lines where Date attribute is greater than 2015-03-01</para></listitem> diff --git a/skgbasegui/skgfilteredtableview.ui b/skgbasegui/skgfilteredtableview.ui index f332315..35371fa 100644 --- a/skgbasegui/skgfilteredtableview.ui +++ b/skgbasegui/skgfilteredtableview.ui @@ -101,7 +101,7 @@ <enum>Qt::WheelFocus</enum> </property> <property name="toolTip"> - <string><html><head/><body><p>Searching is case-insensitive. So table, Table, and TABLE are all the same.<br/>If you just put a word or series of words in the search box, the application will filter the table to keep all lines having these words (logical operator AND). <br/>If you want to add (logical operator OR) some line, you must prefix your word by &quot;+&quot;.<br/>If you want to remove (logical operator NOT) some line, you must prefix your word by &quot;-&quot;.<br/>If you want to search only on one column, you must prefix your word by the column name like: col1:word.<br/>If you want to use the character &quot;:&quot; in value, you must specify the column name like this: col1:value:rest.<br/>If you want to search for a phrase or something that contains spaces, you must put it in quotes, like: &quot;yes, this is a phrase&quot;.</p><p>You can also use operator &quot;&lt;&quot; and &quot;&gt;&quot;.</p><p><span style=" font-weight:600; text-decoration: underline;">Examples:</span><br/>+val1 +val2 =&gt; Keep lines containing val1 OR val2<br/>+val1 -val2 =&gt; Keep lines containing val1 but NOT val2<br/>&quot;abc def&quot; =&gt; Keep lines containing the sentence &quot;abc def&quot; <br/>abc:def =&gt; Keep lines having a column name starting by abc and containing def<br/>:abc:def =&gt; Keep lines containing &quot;abc:def&quot;<br/>Date&gt;2015-03-01 =&gt; Keep lines where Date attribute is greater than 2015-03-01<br/>Amount&lt;10 =&gt;Keep lines where Amount attribute is less than 10</p></body></html></string> + <string><html><head/><body><p>Searching is case-insensitive. So table, Table, and TABLE are all the same.<br/>If you just put a word or series of words in the search box, the application will filter the table to keep all lines having these words (logical operator AND). <br/>If you want to add (logical operator OR) some line, you must prefix your word by &quot;+&quot;.<br/>If you want to remove (logical operator NOT) some line, you must prefix your word by &quot;-&quot;.<br/>If you want to search only on one column, you must prefix your word by the column name like: col1:word.<br/>If you want to use the character &quot;:&quot; in value, you must specify the column name like this: col1:value:rest.<br/>If you want to search for a phrase or something that contains spaces, you must put it in quotes, like: &quot;yes, this is a phrase&quot;.</p><p>You can also use operator &quot;&lt;&quot; and &quot;&gt;&quot;.</p><p><span style=" font-weight:600; text-decoration: underline;">Examples:</span><br/>+val1 +val2 =&gt; Keep lines containing val1 OR val2<br/>+val1 -val2 =&gt; Keep lines containing val1 but NOT val2<br/>&quot;abc def&quot; =&gt; Keep lines containing the sentence &quot;abc def&quot; <br/>&quot;-att:abc def&quot; =&gt; Remove lines having a column name starting by abc and containing &quot;abc def&quot; <br/>abc:def =&gt; Keep lines having a column name starting by abc and containing def<br/>:abc:def =&gt; Keep lines containing &quot;abc:def&quot;<br/>Date&gt;2015-03-01 =&gt; Keep lines where Date attribute is greater than 2015-03-01<br/>Amount&lt;10 =&gt;Keep lines where Amount attribute is less than 10</p></body></html></string> </property> </widget> </item> diff --git a/skgbasemodeler/skgservices.cpp b/skgbasemodeler/skgservices.cpp index ade344f..f2dd9b9 100644 --- a/skgbasemodeler/skgservices.cpp +++ b/skgbasemodeler/skgservices.cpp @@ -347,7 +347,7 @@ QStringList SKGServices::splitCSVLine(const QString& iString, const QChar& iSepa if (isInBlock) { item += c; } - } else if ((c == '\"' || c == '\'') && iCoteDefineBlock) { + } else if ((c == '\"' || c == '\'') && item.count() == 0 && iCoteDefineBlock) { if (cote == ' ') { cote = c; // Set the real cote char } diff --git a/tests/skgbasemodelertest/skgtestbase.cpp b/tests/skgbasemodelertest/skgtestbase.cpp index 2dfb904..b6a5e75 100644 --- a/tests/skgbasemodelertest/skgtestbase.cpp +++ b/tests/skgbasemodelertest/skgtestbase.cpp @@ -394,7 +394,7 @@ int main(int argc, char** argv) SKGTEST("STR:splitCSVLine", parameters[0], "A"); SKGTEST("STR:splitCSVLine", parameters[1], "\"B\";\"C\""); - parameters = SKGServices::splitCSVLine("+123 -\"abc def\" \"e:f\" e:f", ' ', true); + parameters = SKGServices::splitCSVLine("+123 \"-abc def\" \"e:f\" e:f", ' ', true); SKGTEST("STR:splitCSVLine count", parameters.count(), 4); SKGTEST("STR:splitCSVLine", parameters[0], "+123"); SKGTEST("STR:splitCSVLine", parameters[1], "-abc def"); @@ -448,7 +448,7 @@ int main(int argc, char** argv) SKGTEST("STR:stringToSearchCriterias word", criterias[0].words[0], "abc def ghi"); SKGTEST("STR:stringToSearchCriterias word", criterias[0].words[1], "123 456"); - criterias = SKGServices::stringToSearchCriterias("-payee:\"abc def : ghi\" +amount:25"); + criterias = SKGServices::stringToSearchCriterias("\"-payee:abc def : ghi\" +amount:25"); SKGTEST("STR:stringToSearchCriterias count", criterias.count(), 2); SKGTEST("STR:stringToSearchCriterias mode", criterias[0].mode, '+'); SKGTEST("STR:stringToSearchCriterias words count", criterias[0].words.count(), 1);
