Merge the following commit from e4:

------------------------------------------------------------------------
r973523 | tmcguire | 2009-05-27 15:41:58 +0200 (Wed, 27 May 2009) | 16 lines

Merged revisions 970924 via svnmerge from 
svn+ssh://tmcguire@svn.kde.org/home/kde/branches/KDE/4.2/kdepim

........
  r970924 | tmcguire | 2009-05-21 14:19:57 +0200 (Thu, 21 May 2009) | 10 lines
  
  Backport r970921 by tmcguire from trunk to the 4.2 branch:
  
  Don't grow the list of the UIDs of messages with changed statuses uncontrollable,
  which would lead to huge memory consumption and a large kmailrc.
  
  Patch by Frank Thieme <frank at fthieme dot net>, thank you!
  
  CCBUG: 191753
........

------------------------------------------------------------------------

svn path=/branches/kdepim/enterprise/kdepim/; revision=973669
wilder-work
Thomas McGuire 17 years ago
parent a14e9018ca
commit 257ed5604c
  1. 18
      kmfoldercachedimap.cpp
  2. 4
      kmfoldercachedimap.h

@ -297,7 +297,7 @@ void KMFolderCachedImap::readConfig()
config->readBoolEntry( "StatusChangedLocally", false );
QStringList uidsChanged = config->readListEntry( "UIDStatusChangedLocally" );
for ( QStringList::iterator it = uidsChanged.begin(); it != uidsChanged.end(); it++ ) {
mUIDsOfLocallyChangedStatuses.append( ( *it ).toUInt() );
mUIDsOfLocallyChangedStatuses.insert( ( *it ).toUInt() );
}
mAnnotationFolderTypeChanged = config->readBoolEntry( "AnnotationFolderTypeChanged", false );
@ -333,7 +333,7 @@ void KMFolderCachedImap::writeConfig()
// StatusChangedLocally is always false, as we use UIDStatusChangedLocally now
configGroup.writeEntry( "StatusChangedLocally", false );
QStringList uidsToWrite;
for( QValueList<ulong>::iterator it = mUIDsOfLocallyChangedStatuses.begin();
for( std::set<ulong>::iterator it = mUIDsOfLocallyChangedStatuses.begin();
it != mUIDsOfLocallyChangedStatuses.end(); it++ ) {
uidsToWrite.append( QString::number( (*it) ) );
}
@ -960,14 +960,14 @@ void KMFolderCachedImap::serverSyncInternal()
// Upload flags, unless we know from the ACL that we're not allowed
// to do that or they did not change locally
if ( mUserRights <= 0 || ( mUserRights & (KMail::ACLJobs::WriteFlags ) ) ) {
if ( !mUIDsOfLocallyChangedStatuses.isEmpty() || mStatusChangedLocally ) {
if ( !mUIDsOfLocallyChangedStatuses.empty() || mStatusChangedLocally ) {
uploadFlags();
break;
} else {
//kdDebug(5006) << "Skipping flags upload, folder unchanged: " << label() << endl;
}
} else if ( mUserRights & KMail::ACLJobs::WriteSeenFlag ) {
if ( !mUIDsOfLocallyChangedStatuses.isEmpty() || mStatusChangedLocally ) {
if ( !mUIDsOfLocallyChangedStatuses.empty() || mStatusChangedLocally ) {
uploadSeenFlags();
break;
}
@ -1421,7 +1421,8 @@ void KMFolderCachedImap::uploadFlags()
if( !msg || msg->UID() == 0 )
// Either not a valid message or not one that is on the server yet
continue;
if ( mUIDsOfLocallyChangedStatuses.findIndex( msg->UID() ) < 0 && !mStatusChangedLocally ) {
if ( mUIDsOfLocallyChangedStatuses.find( msg->UID() ) != mUIDsOfLocallyChangedStatuses.end()
&& !mStatusChangedLocally ) {
// This message has not had its status changed locally
continue;
}
@ -1468,7 +1469,8 @@ void KMFolderCachedImap::uploadSeenFlags()
// Either not a valid message or not one that is on the server yet
continue;
if ( mUIDsOfLocallyChangedStatuses.findIndex( msg->UID() ) < 0 && !mStatusChangedLocally ) {
if ( mUIDsOfLocallyChangedStatuses.find( msg->UID() ) != mUIDsOfLocallyChangedStatuses.end()
&& !mStatusChangedLocally ) {
// This message has not had its status changed locally
continue;
}
@ -1532,7 +1534,7 @@ void KMFolderCachedImap::setStatus( int idx, KMMsgStatus status, bool toggle)
const KMMsgBase *msg = getMsgBase( idx );
Q_ASSERT( msg );
if ( msg )
mUIDsOfLocallyChangedStatuses.append( msg->UID() );
mUIDsOfLocallyChangedStatuses.insert( msg->UID() );
}
void KMFolderCachedImap::setStatus(QValueList<int>& ids, KMMsgStatus status, bool toggle)
@ -1542,7 +1544,7 @@ void KMFolderCachedImap::setStatus(QValueList<int>& ids, KMMsgStatus status, boo
const KMMsgBase *msg = getMsgBase( *it );
Q_ASSERT( msg );
if ( msg )
mUIDsOfLocallyChangedStatuses.append( msg->UID() );
mUIDsOfLocallyChangedStatuses.insert( msg->UID() );
}
}

@ -47,6 +47,8 @@
#include "cachedimapjob.h"
#include "quotajobs.h"
#include <set>
using KMail::FolderJob;
using KMail::QuotaInfo;
class KMCommand;
@ -549,7 +551,7 @@ private:
* uploaded to the server, overwriting the server's notion of the status
* of the mails in this folder.
*/
QValueList<ulong> mUIDsOfLocallyChangedStatuses;
std::set<ulong> mUIDsOfLocallyChangedStatuses;
/**
* Same as above, but uploads the flags of all mails, even if not all changed.

Loading…
Cancel
Save