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 =&gt; Keep lines containing val1 OR 
val2</para></listitem>
              <listitem><para>+val1 -val2 =&gt; Keep lines containing val1 but 
NOT val2</para></listitem>
              <listitem><para>"abc def" =&gt; Keep lines containing the 
sentence "abc def"</para></listitem>
+             <listitem><para>"-att:abc def" =&gt; Remove lines having a column 
name starting by abc and containing "abc def"</para></listitem>
              <listitem><para>abc:def =&gt; Keep lines having a column name 
starting by abc and containing def</para></listitem>
              <listitem><para>:abc:def =&gt; Keep lines containing 
"abc:def"</para></listitem>
              <listitem><para>Date&gt;2015-03-01 =&gt; 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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Searching is 
case-insensitive. So table, Table, and TABLE are all the same.&lt;br/&gt;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). 
&lt;br/&gt;If you want to add (logical operator OR) some line, you must prefix 
your word by &amp;quot;+&amp;quot;.&lt;br/&gt;If you want to remove (logical 
operator NOT) some line, you must prefix your word by 
&amp;quot;-&amp;quot;.&lt;br/&gt;If you want to search only on one column, you 
must prefix your word by the column name like: col1:word.&lt;br/&gt;If you want 
to use the character &amp;quot;:&amp;quot; in value, you must specify the 
column name like this: col1:value:rest.&lt;br/&gt;If you want to search for a 
phrase or something that contains spaces, you must put it in quotes, like: 
&amp;quot;yes, this is a phrase&amp;quot;.&lt;/p&gt;&lt;p&gt;You can also use 
operator &amp;quot;&amp;lt;&amp;quot; and 
&amp;quot;&amp;gt;&amp;quot;.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; 
font-weight:600; text-decoration: 
underline;&quot;&gt;Examples:&lt;/span&gt;&lt;br/&gt;+val1 +val2 =&amp;gt; Keep 
lines containing val1 OR val2&lt;br/&gt;+val1 -val2 =&amp;gt; Keep lines 
containing val1 but NOT val2&lt;br/&gt;&amp;quot;abc def&amp;quot; =&amp;gt; 
Keep lines containing the sentence &amp;quot;abc def&amp;quot; 
&lt;br/&gt;abc:def =&amp;gt; Keep lines having a column name starting by abc 
and containing def&lt;br/&gt;:abc:def =&amp;gt; Keep lines containing 
&amp;quot;abc:def&amp;quot;&lt;br/&gt;Date&amp;gt;2015-03-01 =&amp;gt; Keep 
lines where Date attribute is greater than 
2015-03-01&lt;br/&gt;Amount&amp;lt;10 =&amp;gt;Keep lines where Amount 
attribute is less than 10&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+        <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Searching is 
case-insensitive. So table, Table, and TABLE are all the same.&lt;br/&gt;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). 
&lt;br/&gt;If you want to add (logical operator OR) some line, you must prefix 
your word by &amp;quot;+&amp;quot;.&lt;br/&gt;If you want to remove (logical 
operator NOT) some line, you must prefix your word by 
&amp;quot;-&amp;quot;.&lt;br/&gt;If you want to search only on one column, you 
must prefix your word by the column name like: col1:word.&lt;br/&gt;If you want 
to use the character &amp;quot;:&amp;quot; in value, you must specify the 
column name like this: col1:value:rest.&lt;br/&gt;If you want to search for a 
phrase or something that contains spaces, you must put it in quotes, like: 
&amp;quot;yes, this is a phrase&amp;quot;.&lt;/p&gt;&lt;p&gt;You can also use 
operator &amp;quot;&amp;lt;&amp;quot; and 
&amp;quot;&amp;gt;&amp;quot;.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; 
font-weight:600; text-decoration: 
underline;&quot;&gt;Examples:&lt;/span&gt;&lt;br/&gt;+val1 +val2 =&amp;gt; Keep 
lines containing val1 OR val2&lt;br/&gt;+val1 -val2 =&amp;gt; Keep lines 
containing val1 but NOT val2&lt;br/&gt;&amp;quot;abc def&amp;quot; =&amp;gt; 
Keep lines containing the sentence &amp;quot;abc def&amp;quot; 
&lt;br/&gt;&amp;quot;-att:abc def&amp;quot; =&amp;gt; Remove lines having a 
column name starting by abc and containing &amp;quot;abc def&amp;quot; 
&lt;br/&gt;abc:def =&amp;gt; Keep lines having a column name starting by abc 
and containing def&lt;br/&gt;:abc:def =&amp;gt; Keep lines containing 
&amp;quot;abc:def&amp;quot;&lt;br/&gt;Date&amp;gt;2015-03-01 =&amp;gt; Keep 
lines where Date attribute is greater than 
2015-03-01&lt;br/&gt;Amount&amp;lt;10 =&amp;gt;Keep lines where Amount 
attribute is less than 10&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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);

Reply via email to