Bug 31862

Summary: Lowercase for RegExp Scoring
Product: [Unmaintained] knode Reporter: philipp
Component: generalAssignee: kdepim bugs <pim-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 0.6   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Solaris   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description philipp 2001-08-30 17:49:55 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           knode
Version:           0.6 (using KDE 2.2.0 )
Severity:          normal
Installed from:    compiled sources
Compiler:          gcc version 2.95.2 19991024 (release)
OS:                SunOS (sun4u) release 5.7
OS/Compiler notes: 

It seems all string comparisons are performed lowercase. This is probably okay for substring comparison but it extremely reduces the power of RegExp comparison (like ignoring all stupid upper-only subjects).

Since this behaviour is not mentioned in the knode help I suppose it is a bug.

Thank you for this great piece of work Philipp.

(Submitted via bugs.kde.org)
(Called from KBugReport dialog)
Comment 1 Cp Hennessy 2002-09-25 02:27:08 UTC
The last update to this bug report was over 1 year ago.   
Can you please give us an updated on whether this is still a problem for you   
with a more recent version of knode?   
Sorry I do not use "Scoring" so I do not know how to test this feature. 
 
If it is not a problem - the status of this bug report will be changed to closed.   
  
Comment 2 Rainer Endres 2004-04-05 12:33:21 UTC
Can somebody with more knowledge in RegExp have a look if this is still valid?
Comment 3 Volker Krause 2005-01-16 19:03:58 UTC
CVS commit by vkrause: 

Add case sensitive regexp matching.

FEATURE: 31862


  M +10 -0     kscoring.cpp   1.52
  M +2 -2      kscoring.h   1.28
  M +1 -0      kscoringeditor.cpp   1.46


--- kdepim/libkdepim/kscoring.cpp  #1.51:1.52
@@ -371,4 +371,9 @@ KScoringExpression::KScoringExpression(c
     expr.setCaseSensitive(false);
   }
+  else if ( t == "MATCHCS" ) {
+    cond = MATCHCS;
+    expr.setPattern( expr_str );
+    expr.setCaseSensitive( true );
+  }
   else if (t == "CONTAINS" ) cond = CONTAINS;
   else if (t == "EQUALS" ) cond = EQUALS;
@@ -397,4 +402,5 @@ int KScoringExpression::getConditionForN
   if (s == getNameForCondition(CONTAINS)) return CONTAINS;
   else if (s == getNameForCondition(MATCH)) return MATCH;
+  else if (s == getNameForCondition(MATCHCS)) return MATCHCS;
   else if (s == getNameForCondition(EQUALS)) return EQUALS;
   else if (s == getNameForCondition(SMALLER)) return SMALLER;
@@ -413,4 +419,5 @@ QString KScoringExpression::getNameForCo
   case CONTAINS: return i18n("Contains Substring");
   case MATCH: return i18n("Matches Regular Expression");
+  case MATCHCS: return i18n("Matches Regular Expression (Case Sensitive)");
   case EQUALS: return i18n("Is Exactly the Same As");
   case SMALLER: return i18n("Less Than");
@@ -429,4 +436,5 @@ QStringList KScoringExpression::conditio
   l << getNameForCondition(CONTAINS);
   l << getNameForCondition(MATCH);
+  l << getNameForCondition(MATCHCS);
   l << getNameForCondition(EQUALS);
   l << getNameForCondition(SMALLER);
@@ -477,4 +485,5 @@ bool KScoringExpression::match(ScorableA
       break;
     case MATCH:
+    case MATCHCS:
       res = (expr.search(head)!=-1);
       break;
@@ -527,4 +536,5 @@ QString KScoringExpression::getTypeStrin
   case CONTAINS: return "CONTAINS";
   case MATCH: return "MATCH";
+  case MATCHCS: return "MATCHCS";
   case EQUALS: return "EQUALS";
   case SMALLER: return "SMALLER";

--- kdepim/libkdepim/kscoring.h  #1.27:1.28
@@ -174,5 +174,5 @@ class KDE_EXPORT KScoringExpression
   friend class KScoringRule;
  public:
-  enum Condition { CONTAINS, MATCH, EQUALS, SMALLER, GREATER };
+  enum Condition { CONTAINS, MATCH, EQUALS, SMALLER, GREATER, MATCHCS };
 
   KScoringExpression(const QString&,const QString&,const QString&, const QString&);

--- kdepim/libkdepim/kscoringeditor.cpp  #1.45:1.46
@@ -128,4 +128,5 @@ void SingleConditionWidget::toggleRegExp
 {
   bool isRegExp = KScoringExpression::MATCH == selected &&
+      KScoringExpression::MATCHCS == selected &&
       !KTrader::self()->query("KRegExpEditor/KRegExpEditor").isEmpty();
   regExpButton->setEnabled( isRegExp );