[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE_3_2_BRANCH: kdepim/kmail
From:       Ladislav Strojil <Ladislav () Strojil ! cz>
Date:       2004-02-04 17:25:57
Message-ID: 20040204172557.D60C4990D () office ! kde ! org
[Download RAW message or body]

CVS commit by strojil: 

Commiting a patch by Ingo Klöcker:
The attached patch fixes the critical bug #71866.

>From http://bugs.kde.org/show_bug.cgi?id=71866#c2:
"That's a prime example for why it's bad to store the value of an enum
as a number in a config file. The reason for this bug is a reordering
of the enum values in the code. This changed the meaning of the value
which is stored in the config file.

With the patch KMail stores the enum as a string representing the enum
value. As a consequence all POP filters will be reset to NoAction. But
there is no other fix possible because it's impossible to find out
whether the pop filter configuration was saved with KMail 1.6 or with a
previous version of KMail."


  M +24 -3     kmfilter.cpp   1.58.4.1


--- kdepim/kmail/kmfilter.cpp  #1.58:1.58.4.1
@@ -148,7 +148,16 @@ void KMFilter::readConfig(KConfig* confi
   mPattern.readConfig(config);
 
-  if (bPopFilter)
+  if (bPopFilter) {
     // get the action description...
-    mAction = (KMPopFilterAction) config->readNumEntry( "action" );
+    QString action = config->readEntry( "action" );
+    if ( action == "down" )
+      mAction = Down;
+    else if ( action == "later" )
+      mAction = Later;
+    else if ( action == "delete" )
+      mAction = Delete;
+    else
+      mAction = NoAction;
+  }
   else {
     QStringList sets = config->readListEntry("apply-on");
@@ -211,5 +220,17 @@ void KMFilter::writeConfig(KConfig* conf
 
   if (bPopFilter) {
-    config->writeEntry( "action", mAction );
+    switch ( mAction ) {
+    case Down:
+      config->writeEntry( "action", "down" );
+      break;
+    case Later:
+      config->writeEntry( "action", "later" );
+      break;
+    case Delete:
+      config->writeEntry( "action", "delete" );
+      break;
+    default:
+      config->writeEntry( "action", "" );
+    }
   } else {
     QStringList sets;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic