Merged revisions 703856-703887 via svnmerge from

https://vkrause@svn.kde.org/home/kde/branches/work/~vkrause/enterprise

........
  r703856 | vkrause | 2007-08-23 14:57:25 +0200 (Thu, 23 Aug 2007) | 2 lines
  
  Add migration infrastructure to transfer local flags to the server.
........
  r703887 | vkrause | 2007-08-23 16:34:57 +0200 (Thu, 23 Aug 2007) | 5 lines
  
  Configuration update script to trigger migration of local IMAP flags to
  the server. This should solve a regression due to the recent changes to
  store the seen flag on the server also for read-only folders where all
  local flags were overwritten.
........

svn path=/branches/kdepim/enterprise/kdepim/; revision=703903
wilder-work
Volker Krause 19 years ago
parent 515cd85187
commit b4d12ce82b
  1. 3
      Makefile.am
  2. 39
      kmail-3.5-trigger-flag-migration.pl
  3. 7
      kmail.upd
  4. 19
      kmfolderimap.cpp
  5. 8
      kmfolderimap.h
  6. 3
      kmstartup.cpp

@ -191,7 +191,8 @@ update_SCRIPTS = upgrade-transport.pl kmail-pgpidentity.pl \
kmail-3.3-misc.pl \
kmail-3.3b1-misc.pl \
kmail-3.4-misc.pl \
kmail-3.4.1-update-status-filters.pl
kmail-3.4.1-update-status-filters.pl \
kmail-3.5-trigger-flag-migration.pl
confdir = $(kde_confdir)
conf_DATA = kmail.antispamrc kmail.antivirusrc

@ -0,0 +1,39 @@
#!/usr/bin/perl
#
# Copyright (c) 2007 Volker Krause <vkrause@kde.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
#
$currentGroup = "";
$source = $ARGV[0];
while (<STDIN>) {
chomp;
next if /^$/;
next if /^\#/;
# recognize groups:
if ( /^\[(.+)\]$/ ) {
$currentGroup = $_;
next;
};
($key,$value) = split /=/;
next if $key eq "";
if ( $currentGroup =~ /^\[Folder/ ) {
if( ($key eq "UploadAllFlags" or $key eq "StatusChangedLocally") and not $value eq "true" ) {
$value = "true";
print "#DELETE $currentGroup $key\n";
print "$currentGroup\n$key=$value\n"
}
}
}

@ -139,7 +139,7 @@ Script=kmail-3.3b1-misc.pl,perl
Id=3.4
File=kmailrc
Script=kmail-3.4-misc.pl,perl
# Remove the MenuBar key so that menu bar will be visible in the separate reader window
# Remove the MenuBar key so that menu bar will be visible in the separate reader window
Id=3.4a
File=kmailrc
Group=Separate Reader Window
@ -163,6 +163,11 @@ Id=3.5.4
File=kmailrc
Group=FolderSelectionDialog
RemoveKey=Size
# Trigger migration of all local imap flags to the server
Id=3.5.7-imap-flag-migration
Options=overwrite
File=kmailrc
Script=kmail-3.5-trigger-flag-migration.pl,perl
#
# Important notice:
# If you add updates here, keep this text below them.

@ -62,7 +62,8 @@ using KMail::RenameJob;
#include <assert.h>
KMFolderImap::KMFolderImap(KMFolder* folder, const char* aName)
: KMFolderMbox(folder, aName)
: KMFolderMbox(folder, aName),
mUploadAllFlags( false )
{
mContentState = imapNoInformation;
mSubfolderState = imapNoInformation;
@ -205,6 +206,7 @@ void KMFolderImap::readConfig()
}
mNoContent = config->readBoolEntry("NoContent", false);
mReadOnly = config->readBoolEntry("ReadOnly", false);
mUploadAllFlags = config->readBoolEntry( "UploadAllFlags", true );
KMFolderMbox::readConfig();
}
@ -219,6 +221,7 @@ void KMFolderImap::writeConfig()
config->writeEntry("ImapPath", mImapPath);
config->writeEntry("NoContent", mNoContent);
config->writeEntry("ReadOnly", mReadOnly);
config->writeEntry( "UploadAllFlags", mUploadAllFlags );
KMFolderMbox::writeConfig();
}
@ -1851,9 +1854,19 @@ void KMFolderImap::setStatus(int idx, KMMsgStatus status, bool toggle)
setStatus(ids, status, toggle);
}
void KMFolderImap::setStatus(QValueList<int>& ids, KMMsgStatus status, bool toggle)
void KMFolderImap::setStatus(QValueList<int>& _ids, KMMsgStatus status, bool toggle)
{
FolderStorage::setStatus(ids, status, toggle);
FolderStorage::setStatus(_ids, status, toggle);
QValueList<int> ids;
if ( mUploadAllFlags ) {
kdDebug(5006) << k_funcinfo << "Migrating all flags to the server" << endl;
ids.clear();
for ( int i = 0; i < count(); ++i )
ids << i;
mUploadAllFlags = false;
} else {
ids = _ids;
}
/* The status has been already set in the local index. Update the flags on
* the server. To avoid doing that for each message individually, group them

@ -187,7 +187,7 @@ public:
/**
* Change the status of several messages indicated by @p ids
*/
virtual void setStatus(QValueList<int>& ids, KMMsgStatus status, bool toggle);
virtual void setStatus(QValueList<int>& _ids, KMMsgStatus status, bool toggle);
/** generates sets of uids */
static QStringList makeSets( QValueList<ulong>&, bool sort = true);
@ -530,6 +530,12 @@ private:
ProgressItem *mAddMessageProgressItem;
// to-be-added folders
QStringList mFoldersPendingCreation;
// push all flags to the server instead of just the changed once
// when doing a flag change the next time
// this is needed for migrating local flags from the time where we didn't
// have the ability to store them on the server
bool mUploadAllFlags;
};
#endif // kmfolderimap_h

@ -116,7 +116,8 @@ void checkConfigUpdates() {
"3.4a",
"3.4b",
"3.4.1",
"3.5.4"
"3.5.4",
"3.5.7-imap-flag-migration"
};
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