Git commit f80ea56a5546d8419f25e55ce1bfec843e0c4488 by Stephane Mankowski.
Committed on 01/04/2015 at 14:26.
Pushed by smankowski into branch 'master'.

BUG:345719
Enhance fast search/filter on lists

M  +17   -4    doc/index.docbook
M  +1    -1    skgbasegui/skgfilteredtableview.ui
M  +4    -2    tests/skgbasemodelertest/skgtestbase.cpp

http://commits.kde.org/skrooge/f80ea56a5546d8419f25e55ce1bfec843e0c4488

diff --git a/doc/index.docbook b/doc/index.docbook
index 75b5cc0..0c57c98 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -578,11 +578,24 @@
          </para>
          <tip>
          <para>
-           The filtering string could be complex, some examples are better to 
explain:
+           The filtering string follows these rules:, 
+           <itemizedlist>          
+               <listitem><para>Searching is case-insensitive. So table, Table, 
and TABLE are all the same.</para></listitem>
+               <listitem><para>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).</para></listitem>
+               <listitem><para>If you want to add (logical operator OR) some 
line, you must prefix your word by "+".</para></listitem>
+               <listitem><para>If you want to remove (logical operator NOT) 
some line, you must prefix your word by "-".</para></listitem>
+               <listitem><para>If you want to search only on one column, you 
must prefix your word by the column name like: col1:word.</para></listitem>
+               <listitem><para>If you want to use the character ":" in value, 
you must specify the column name like this: col1:value:rest.</para></listitem>
+               <listitem><para>If you want to search for a phrase or something 
that contains spaces, you must put it in quotes, like: "yes, this is a 
phrase".</para></listitem>
+           </itemizedlist>
+           
+           Some examples are better to explain:
            <itemizedlist>
-             <listitem><para>"deposit auto" will keep all lines containing the 
words deposit AND auto</para></listitem>
-             <listitem><para>"deposit +auto" will keep all lines containing 
deposit AND lines containing auto</para></listitem>
-             <listitem><para>"deposit -auto" will keep all lines containing 
deposit but NOT auto</para></listitem>
+             <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 sentense 
"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>
            </itemizedlist>
          </para>
        </tip>
diff --git a/skgbasegui/skgfilteredtableview.ui 
b/skgbasegui/skgfilteredtableview.ui
index 516046e..c225272 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;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;/p&gt;&lt;p&gt;If you want to add (logical operator OR) some line, you must 
prefix your word by &amp;quot;+&amp;quot;.&lt;/p&gt;&lt;p&gt;If you want to 
remove (logical operator NOT) some line, you must prefix your word by 
&amp;quot;-&amp;quot;.&lt;/p&gt;&lt;p&gt;If you want to search only on one 
column, you must prefix your word by the column name like: 
col1:word.&lt;/p&gt;&lt;p&gt;Searching is case-insensitive. So table, Table, 
and TABLE are all the same. &lt;/p&gt;&lt;p&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;Examples:&lt;/p&gt;&lt;p&gt;+val1 +val2 
=&amp;gt; Keep lines containing val1 OR val2&lt;/p&gt;&lt;p&gt;+val1 -val2 
=&amp;gt; Keep lines containing val1 but NOT 
val2&lt;/p&gt;&lt;p&gt;&amp;quot;abc def&amp;quot; =&amp;gt; Keep lines 
containing the sentense &amp;quot;abc def&amp;quot; &lt;/p&gt;&lt;p&gt;abc:def 
=&amp;gt; Keep lines having a column name starting by abc and containing 
def&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;/p&gt;&lt;p&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;&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 sentense &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;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
        </property>
       </widget>
      </item>
diff --git a/tests/skgbasemodelertest/skgtestbase.cpp 
b/tests/skgbasemodelertest/skgtestbase.cpp
index 9e58c9d..2dfb904 100644
--- a/tests/skgbasemodelertest/skgtestbase.cpp
+++ b/tests/skgbasemodelertest/skgtestbase.cpp
@@ -394,10 +394,12 @@ 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\"", ' ', true);
-        SKGTEST("STR:splitCSVLine count", parameters.count(), 2);
+        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");
+        SKGTEST("STR:splitCSVLine", parameters[2], "e:f");
+        SKGTEST("STR:splitCSVLine", parameters[3], "e:f");
 
         SKGTEST("STR:splitCSVLine words", SKGServices::splitCSVLine("w1 w2", ' 
', true).count(), 2);
         SKGTEST("STR:splitCSVLine words", SKGServices::splitCSVLine("\"w1 
w1\"", ' ', true).count(), 1);

Reply via email to