[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/kdepim/enterprise/kdepim/kmail
From: Thomas McGuire <mcguire () kde ! org>
Date: 2010-09-30 19:37:45
Message-ID: 20100930193746.02BB3AC88E () svn ! kde ! org
[Download RAW message or body]
SVN commit 1181355 by tmcguire:
Transform the mail loss debug #define into a config option, and
also use that for some more debugging output I added earlier.
MERGE: none
M +3 -1 kmail.kcfg
M +2 -0 kmailicalifaceimpl.cpp
M +31 -35 kmfoldercachedimap.cpp
M +2 -2 kmfolderindex.cpp
--- branches/kdepim/enterprise/kdepim/kmail/kmail.kcfg #1181354:1181355
@@ -93,10 +93,12 @@
<whatsthis>The most recently selected folder in the folder selection \
dialog.</whatsthis> <default>inbox</default>
</entry>
-
</group>
<group name="General">
+ <entry name="mailLossDebug" type="Bool">
+ <default>false</default>
+ </entry>
<entry name="disregardUmask" type="Bool">
<label>Disregard the users umask setting and use "read-write for the user \
only" instead</label> <default>false</default>
--- branches/kdepim/enterprise/kdepim/kmail/kmailicalifaceimpl.cpp #1181354:1181355
@@ -551,9 +551,11 @@
f->open( "incidences" );
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug(5006) << k_funcinfo << "Getting incidences (" << mimetype << ") for folder \
" << f->label()
<< ", starting with index " << startIndex << ", " << nbMessages << " \
messages." << endl; kdDebug(5006) << "The folder has " << f->count() << " messages." \
<< endl; + }
int stopIndex = nbMessages == -1 ? f->count() :
QMIN( f->count(), startIndex + nbMessages );
--- branches/kdepim/enterprise/kdepim/kmail/kmfoldercachedimap.cpp #1181354:1181355
@@ -84,7 +84,6 @@
#include <globalsettings.h>
#define UIDCACHE_VERSION 1
-#define MAIL_LOSS_DEBUGGING 0
static QString incidencesForToString( KMFolderCachedImap::IncidencesFor r ) {
switch (r) {
@@ -314,9 +313,9 @@
}
QStringList delUids = config->readListEntry( "UIDSDeletedSinceLastSync" );
-#if MAIL_LOSS_DEBUGGING
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug( 5006 ) << "READING IN UIDSDeletedSinceLastSync: " << \
folder()->prettyURL() << endl << delUids << endl;
-#endif
+ }
for ( QStringList::iterator it = delUids.begin(); it != delUids.end(); it++ ) {
mDeletedUIDsSinceLastSync.insert( (*it).toULong(), 0);
}
@@ -357,9 +356,9 @@
uidstrings.append( QString::number( (*it) ) );
}
configGroup.writeEntry( "UIDSDeletedSinceLastSync", uidstrings );
-#if MAIL_LOSS_DEBUGGING
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug( 5006 ) << "WRITING OUT UIDSDeletedSinceLastSync in: " << folder( \
)->prettyURL( ) << endl << uidstrings << endl;
-#endif
+ }
} else {
configGroup.deleteEntry( "UIDSDeletedSinceLastSync" );
}
@@ -445,9 +444,9 @@
setUidValidity( QString::fromLocal8Bit(buf).stripWhiteSpace() );
len = uidcache.readLine( buf, sizeof(buf) );
if( len > 0 ) {
-#if MAIL_LOSS_DEBUGGING
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug(5006) << "Reading in last uid from cache: " << \
QString::fromLocal8Bit(buf).stripWhiteSpace() << " in " << folder()->prettyURL() << \
endl;
-#endif
+ }
// load the last known highest uid from the on disk cache
setLastUid( QString::fromLocal8Bit(buf).stripWhiteSpace().toULong() );
return 0;
@@ -467,9 +466,9 @@
return unlink( QFile::encodeName( uidCacheLocation() ) );
return 0;
}
-#if MAIL_LOSS_DEBUGGING
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug(5006) << "Writing out UID cache lastuid: " << lastUid() << " in: " << \
folder()->prettyURL() << endl;
-#endif
+ }
QFile uidcache( uidCacheLocation() );
if( uidcache.open( IO_WriteOnly ) ) {
QTextStream str( &uidcache );
@@ -581,7 +580,7 @@
/* Reimplemented from KMFolderMaildir */
void KMFolderCachedImap::removeMsg(int idx, bool imapQuiet)
{
- if ( contentsType() != ContentsTypeMail ) {
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug(5006) << k_funcinfo << "Deleting message with idx " << idx << " in \
folder " << label() << endl; }
uidMapDirty = true;
@@ -644,9 +643,9 @@
void KMFolderCachedImap::setLastUid( ulong uid )
{
-#if MAIL_LOSS_DEBUGGING
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug(5006) << "Setting mLastUid to: " << uid << " in " << \
folder()->prettyURL() << endl;
-#endif
+ }
mLastUid = uid;
if( uidWriteTimer == -1 )
// Write in one minute
@@ -677,7 +676,7 @@
QMap<ulong,int>::Iterator it = uidMap.find( uid );
if( it != uidMap.end() ) {
KMMsgBase *msg = getMsgBase( *it );
-#if MAIL_LOSS_DEBUGGING
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug(5006) << "Folder: " << folder()->prettyURL() << endl;
kdDebug(5006) << "UID " << uid << " is supposed to be in the map" << endl;
kdDebug(5006) << "UID's index is to be " << *it << endl;
@@ -685,16 +684,16 @@
if ( msg ) {
kdDebug(5006) << "Its UID is: " << msg->UID() << endl;
}
-#endif
+ }
if( msg && msg->UID() == uid )
return msg;
kdDebug(5006) << "########## Didn't find uid: " << uid << "in cache athough it's \
supposed to be there!" << endl; } else {
-#if MAIL_LOSS_DEBUGGING
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug(5006) << "Didn't find uid: " << uid << "in cache!" << endl;
-#endif
}
+ }
// Not found by now
// if( mapReloaded )
// Not here then
@@ -705,10 +704,9 @@
if( it != uidMap.end() )
// Since the uid map is just rebuilt, no need for the sanity check
return getMsgBase( *it );
-#if MAIL_LOSS_DEBUGGING
- else
+ else if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug(5006) << "Reloaded, but stil didn't find uid: " << uid << endl;
-#endif
+ }
// Then it's not here
return 0;
}
@@ -1700,16 +1698,14 @@
}
if( !msgsForDeletion.isEmpty() ) {
- if ( contentsType() != ContentsTypeMail ) {
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug(5006) << k_funcinfo << label() << " Going to locally delete " << \
msgsForDeletion.count()
<< " messages, with the uids " << uids.join( "," ) << endl;
}
-#if MAIL_LOSS_DEBUGGING
- if ( KMessageBox::warningYesNo(
+ if ( !GlobalSettings::self()->mailLossDebug() || KMessageBox::warningYesNo(
0, i18n( "<qt><p>Mails on the server in folder <b>%1</b> were deleted. \
"
"Do you want to delete them locally?<br>UIDs: %2</p></qt>" )
.arg( folder()->prettyURL() ).arg( uids.join(",") ) ) == \
KMessageBox::Yes )
-#endif
removeMsg( msgsForDeletion );
}
@@ -1905,15 +1901,15 @@
// kdDebug(5006) << "KMFolderCachedImap::slotGetMessagesData() : folder \
"<<label()<<" already has msg="<<msg->headerField("Subject") << ", UID="<<uid << ", \
lastUid = " << mLastUid << endl; KMMsgBase *existingMessage = findByUID(uid);
if( !existingMessage ) {
-#if MAIL_LOSS_DEBUGGING
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug(5006) << "Looking at uid " << uid << " high water is: " << \
lastUid() << " we should delete it" << endl;
-#endif
+ }
// double check we deleted it since the last sync
if ( mDeletedUIDsSinceLastSync.contains(uid) ) {
if ( mUserRightsState != KMail::ACLJobs::Ok || ( mUserRights & \
KMail::ACLJobs::Delete ) ) {
-#if MAIL_LOSS_DEBUGGING
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug(5006) << "message with uid " << uid << " is gone from \
local cache. Must be deleted on server!!!" << endl;
-#endif
+ }
uidsForDeletionOnServer << uid;
} else {
redownload = true;
@@ -1939,9 +1935,9 @@
// kdDebug(5006) << "message with uid " << uid << " found in the local \
cache. " << endl; }
if ( uid > lastUid() || redownload ) {
-#if MAIL_LOSS_DEBUGGING
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug(5006) << "Looking at uid " << uid << " high water is: " << lastUid() \
<< " we should download it" << endl;
-#endif
+ }
// The message is new since the last sync, but we might have just uploaded \
it, in which case // the uid map already contains it.
if ( !uidMap.contains( uid ) ) {
@@ -1951,9 +1947,9 @@
}
// Remember the highest uid and once the download is completed, update \
mLastUid if ( uid > mTentativeHighestUid ) {
-#if MAIL_LOSS_DEBUGGING
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug(5006) << "Setting the tentative highest UID to: " << uid << endl;
-#endif
+ }
mTentativeHighestUid = uid;
}
}
@@ -1970,10 +1966,10 @@
if ( !job->error() && !mFoundAnIMAPDigest ) {
kdWarning(5006) << "######## Folderlisting did not complete, but there was no \
error! " "Aborting sync of folder: " << folder()->prettyURL() << endl;
-#if MAIL_LOSS_DEBUGGING
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kmkernel->emergencyExit( i18n("Folder listing failed in interesting ways." ) \
);
-#endif
}
+ }
if( job->error() ) { // error listing messages but the user chose to continue
mContentState = imapNoInformation;
mSyncState = SYNC_STATE_HANDLE_INBOX; // be sure not to continue in this folder
@@ -2988,9 +2984,9 @@
}
}
if (sane) {
-#if MAIL_LOSS_DEBUGGING
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug(5006) << "Tentative highest UID test was sane, writing out: " << \
mTentativeHighestUid << endl;
-#endif
+ }
setLastUid( mTentativeHighestUid );
}
}
--- branches/kdepim/enterprise/kdepim/kmail/kmfolderindex.cpp #1181354:1181355
@@ -217,7 +217,7 @@
bool KMFolderIndex::readIndex()
{
- if ( contentsType() != KMail::ContentsTypeMail ) {
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug(5006) << k_funcinfo << "Reading index for " << label() << endl;
}
Q_INT32 len;
@@ -314,7 +314,7 @@
}
mTotalMsgs = mMsgList.count();
- if ( contentsType() != KMail::ContentsTypeMail ) {
+ if ( GlobalSettings::self()->mailLossDebug() ) {
kdDebug(5006) << k_funcinfo << "Done reading the index for " << label() << ", we \
have " << mTotalMsgs << " messages." << endl; }
return true;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic