Add configuration update script for fixing changed keys for filtering by status.

BUGS:101001

svn path=/trunk/kdepim/; revision=406208
wilder-work
Ingo Klcker 21 years ago
parent 58fad94852
commit 44aca43b57
  1. 3
      Makefile.am
  2. 42
      kmail-3.4.1-update-status-filters.pl
  3. 4
      kmail.upd
  4. 3
      kmstartup.cpp

@ -167,7 +167,8 @@ update_SCRIPTS = upgrade-transport.pl kmail-pgpidentity.pl \
kmail-3.3-split-sign-encr-keys.sh \
kmail-3.3-misc.pl \
kmail-3.3b1-misc.pl \
kmail-3.4-misc.pl
kmail-3.4-misc.pl \
kmail-3.4.1-update-status-filters.pl
confdir = $(kde_confdir)
conf_DATA = kmail.antispamrc kmail.antivirusrc

@ -0,0 +1,42 @@
#!/usr/bin/perl -w
use strict;
# This script converts lower case status filter rules to upper case.
# read the whole config file
my $currentGroup = "";
my %configFile;
while ( <> ) {
chomp;
next if ( /^$/ ); # skip empty lines
next if ( /^\#/ ); # skip comments
if ( /^\[/ ) { # group begin
$currentGroup = $_;
next;
} elsif ( $currentGroup ne "" ) { # normal entry
my ($key,$value) = split /=/;
$configFile{$currentGroup}{$key}=$value;
}
}
# go through all filters and check for rules which are no longer valid
my @filterGroups = grep { /^\[Filter \#\d+\]/ } keys %configFile;
foreach my $filterGroup (@filterGroups) {
my $numRules = $configFile{$filterGroup}{'rules'};
# go through all rules:
for ( my $i = 0; $i < $numRules; ++$i ) {
my $c = chr( ord("A") + $i );
my $fieldKey = "field$c";
my $field = $configFile{$filterGroup}{$fieldKey};
if ( $field eq "<status>" ) {
my $contentsKey = "contents$c";
my $contents = $configFile{$filterGroup}{$contentsKey};
if ( $contents =~ /^[a-z]/ ) {
$contents = ucfirst( $contents );
print "# DELETE $filterGroup$contentsKey\n";
print "$filterGroup\n$contentsKey=$contents\n";
}
}
}
}

@ -154,6 +154,10 @@ Options=copy
Key=list-font,list-new-font
Options=copy
Key=list-font,list-unread-font
# Convert status filter rules to upper case (cf. bug #101001)
Id=3.4.1
File=kmailrc
Script=kmail-3.4.1-update-status-filters.pl,perl
#
# Important notice:
# If you add updates here, keep this text below them.

@ -112,7 +112,8 @@ void checkConfigUpdates() {
"3.3b1-misc",
"3.4-misc",
"3.4a",
"3.4b"
"3.4b",
"3.4.1"
};
static const int numUpdates = sizeof updates / sizeof *updates;
// Warning: do not remove entries in the above array, or the update-level check below will break

Loading…
Cancel
Save