Index: libkleo/backends/qgpgme/qgpgmekeylistjob.cpp
===================================================================
--- libkleo/backends/qgpgme/qgpgmekeylistjob.cpp	(revision 746135)
+++ libkleo/backends/qgpgme/qgpgmekeylistjob.cpp	(working copy)
@@ -95,7 +95,7 @@
       }
     }
     deleteLater();
-    mResult = GpgME::KeyListResult( 0, err );
+    mResult = GpgME::KeyListResult( 0, err.toErrorCode() );
     return err;
   }
   mResult = GpgME::KeyListResult( 0, 0 );
@@ -135,7 +135,7 @@
   for ( const char* * chunk = patterns() ; chunk ; chunk = nextChunk() ) {
 
     if ( const GpgME::Error err = mCtx->startKeyListing( chunk, mSecretOnly ) )
-      return GpgME::KeyListResult( 0, err );
+      return GpgME::KeyListResult( 0, err.toErrorCode() );
 
     GpgME::Error err;
     do
@@ -161,7 +161,7 @@
   if ( !mResult.error() )
     if ( const char* * chunk = nextChunk() ) {
       if ( const GpgME::Error err = mCtx->startKeyListing( chunk, mSecretOnly ) )
-	mResult.mergeWith( GpgME::KeyListResult( 0, err ) );
+	mResult.mergeWith( GpgME::KeyListResult( 0, err.toErrorCode() ) );
       else
 	return;
     }
Index: libkleo/backends/chiasmus/chiasmusjob.cpp
===================================================================
--- libkleo/backends/chiasmus/chiasmusjob.cpp	(revision 746135)
+++ libkleo/backends/chiasmus/chiasmusjob.cpp	(working copy)
@@ -103,7 +103,8 @@
 
   LaterDeleter d( this );
 
-  if ( const GpgME::Error err = setup() )
+  const GpgME::Error err = setup();
+  if ( err )
     return mError = err;
 
   connect( mSymCryptRun, SIGNAL(finished(int, QProcess::ExitStatus)),
@@ -165,8 +166,11 @@
 }
 
 GpgME::Error Kleo::ChiasmusJob::exec() {
-  if ( const GpgME::Error err = setup() )
-    return mError = err;
+  {
+    const GpgME::Error err = setup();
+    if ( err )
+        return mError = err;
+  }
 
   if ( !mSymCryptRun->launch( mInput, true ) ) {
     delete mSymCryptRun; mSymCryptRun = 0;
Index: libkleo/kleo/cryptobackendfactory.cpp
===================================================================
--- libkleo/kleo/cryptobackendfactory.cpp	(revision 746135)
+++ libkleo/kleo/cryptobackendfactory.cpp	(working copy)
@@ -162,7 +162,8 @@
 void Kleo::CryptoBackendFactory::scanForBackends( QStringList * reasons ) {
   for ( std::vector<CryptoBackend*>::const_iterator it = mBackendList.begin() ; it != mBackendList.end() ; ++it ) {
     assert( *it );
-    for ( int i = 0 ; const char * protocol = (*it)->enumerateProtocols( i ) ; ++i ) {
+    const char * protocol;
+    for ( int i = 0 ; (protocol = (*it)->enumerateProtocols( i )) ; ++i ) {
       QString reason;
       if ( (*it)->supportsProtocol( protocol ) && !(*it)->checkForProtocol( protocol, &reason ) ) {
         if ( reasons ) {
Index: libkleo/ui/backendconfigwidget.cpp
===================================================================
--- libkleo/ui/backendconfigwidget.cpp	(revision 746135)
+++ libkleo/ui/backendconfigwidget.cpp	(working copy)
@@ -250,12 +250,14 @@
 
   // populate the plugin list:
   BackendListViewItem * top = 0;
-  for ( unsigned int i = 0 ; const CryptoBackend * b = d->backendFactory->backend( i ) ; ++i ) {
+  const CryptoBackend * b;
+  for ( unsigned int i = 0 ; (b = d->backendFactory->backend( i )) ; ++i ) {
 
     top = new Kleo::BackendListViewItem( d->listView, top, b );
 
     ProtocolCheckListItem * last = 0;
-    for ( int i = 0 ; const char * name = b->enumerateProtocols( i ) ; ++i ) {
+    const char * name;
+    for ( int i = 0 ; (name = b->enumerateProtocols( i )) ; ++i ) {
       const CryptoBackend::Protocol * protocol = b->protocol( name );
 
       if ( protocol ) {
@@ -319,7 +321,8 @@
 }
 
 void Kleo::BackendConfigWidget::save() const {
-  for ( int i = 0 ; const char * name = d->backendFactory->enumerateProtocols( i ) ; ++i )
+  const char * name;
+  for ( int i = 0 ; (name = d->backendFactory->enumerateProtocols( i )) ; ++i )
     d->backendFactory->setProtocolBackend( name,  d->listView->chosenBackend( name ) );
 }
 
Index: kmail/kmailicalifaceimpl.cpp
===================================================================
--- kmail/kmailicalifaceimpl.cpp	(revision 746016)
+++ kmail/kmailicalifaceimpl.cpp	(working copy)
@@ -471,7 +471,7 @@
                   << sernum;
 
     //debugBodyParts( "after addMsg", *msg );
-    addFolderChange( &folder,Contents );
+    addFolderChange( &folder,ContentsChanged );
     syncFolder( &folder );
   } else
     kError(5006) <<"addIncidenceKolab(): Message *NOT* saved!";
@@ -875,7 +875,7 @@
       rc = newMsg->getMsgSerNum();
       kDebug(5006) <<"forget about" << sernum <<", it's" << rc <<" now";
     }
-    addFolderChange( f, Contents );
+    addFolderChange( f, ContentsChanged );
     syncFolder( f );
   } else {
     // Message not found - store it newly
@@ -1345,7 +1345,7 @@
   assert(idx != -1);
   srcFolder->removeMsg(idx);
   delete msg;
-  addFolderChange( srcFolder, Contents );
+  addFolderChange( srcFolder, ContentsChanged );
 }
 
 void KMailICalIfaceImpl::folderContentsTypeChanged( KMFolder* folder,
@@ -1501,8 +1501,8 @@
   // there could be 0, 1, or N kolab resources at this point.
   // We can hack the N case, but not the 0 case.
   // So the idea of a DCOP signal for this wouldn't work.
-  if ( ( _changes & Contents ) ||
-       ( _changes & KMail::ACL ) ) {
+  if ( ( _changes & KMail::ContentsChanged ) ||
+       ( _changes & KMail::ACLChanged ) ) {
     if ( storageFormat( folder ) == StorageXML && folder->storage()->contentsType() == KMail::ContentsTypeCalendar )
       triggerKolabFreeBusy( folderURL );
   }
Index: kmail/bodypartformatterfactory.cpp
===================================================================
--- kmail/bodypartformatterfactory.cpp	(revision 746016)
+++ kmail/bodypartformatterfactory.cpp	(working copy)
@@ -116,24 +116,26 @@
       kWarning( 5006 ) <<"BodyPartFormatterFactory: plugin \"" << *it <<"\" is not valid!";
       continue;
     }
-    for ( int i = 0 ; const KMail::Interface::BodyPartFormatter * bfp = plugin->bodyPartFormatter( i ) ; ++i ) {
+    const KMail::Interface::BodyPartFormatter * bfp;
+    for ( int i = 0 ; (bfp = plugin->bodyPartFormatter( i )) ; ++i ) {
       const char * type = plugin->type( i );
       if ( !type || !*type ) {
-	kWarning( 5006 ) <<"BodyPartFormatterFactory: plugin \"" << *it
-			  << "\" returned empty type specification for index"
-			  << i;
-	break;
+        kWarning( 5006 ) <<"BodyPartFormatterFactory: plugin \"" << *it
+                  << "\" returned empty type specification for index"
+                  << i;
+        break;
       }
       const char * subtype = plugin->subtype( i );
       if ( !subtype || !*subtype ) {
-	kWarning( 5006 ) <<"BodyPartFormatterFactory: plugin \"" << *it
-			  << "\" returned empty subtype specification for index"
-			  << i;
-	break;
+        kWarning( 5006 ) <<"BodyPartFormatterFactory: plugin \"" << *it
+                  << "\" returned empty subtype specification for index"
+                  << i;
+        break;
       }
       insertBodyPartFormatter( type, subtype, bfp );
     }
-    for ( int i = 0 ; const KMail::Interface::BodyPartURLHandler * handler = plugin->urlHandler( i ) ; ++i )
+    const KMail::Interface::BodyPartURLHandler * handler;
+    for ( int i = 0 ; (handler = plugin->urlHandler( i )) ; ++i )
       KMail::URLHandlerManager::instance()->registerHandler( handler );
   }
 }
Index: kmail/kmfoldercachedimap.cpp
===================================================================
--- kmail/kmfoldercachedimap.cpp	(revision 746016)
+++ kmail/kmfoldercachedimap.cpp	(working copy)
@@ -83,8 +83,10 @@
 #include <QRadioButton>
 
 #include <errno.h>
+#include <unistd.h>
 
 #define UIDCACHE_VERSION 1
+#undef max
 
 static QString incidencesForToString( KMFolderCachedImap::IncidencesFor r )
 {
@@ -2362,7 +2364,7 @@
     static_cast<KIO::Job*>(job)->ui()->setWindow( 0 );
     static_cast<KIO::Job*>(job)->ui()->showErrorMessage();
   } else {
-    kmkernel->iCalIface().addFolderChange( folder(), ACL );
+    kmkernel->iCalIface().addFolderChange( folder(), ACLChanged );
   }
 
   if ( mAccount->slave() ) {
@@ -2737,7 +2739,7 @@
      * The incidences-for changed, we must trigger the freebusy creation.
      * HACK: in theory we would need a new enum value for this.
      */
-    kmkernel->iCalIface().addFolderChange( folder(), ACL );
+    kmkernel->iCalIface().addFolderChange( folder(), ACLChanged );
   }
 }
 
Index: kmail/kmail_util.h
===================================================================
--- kmail/kmail_util.h	(revision 746016)
+++ kmail/kmail_util.h	(working copy)
@@ -54,6 +54,6 @@
   enum StorageFormat { StorageIcalVcard, StorageXML };
 
   /// This bitfield indicates which changes have been made in a folder, at syncing time.
-  enum FolderChanges { NoChange = 0, Contents = 1, ACL = 2 };
+  enum FolderChanges { NoChange = 0, ContentsChanged = 1, ACLChanged = 2 };
 }
 #endif
Index: kmail/kmmessagetag.cpp
===================================================================
--- kmail/kmmessagetag.cpp	(revision 746016)
+++ kmail/kmmessagetag.cpp	(working copy)
@@ -286,20 +286,20 @@
   //first, delete all groups:
   QStringList tagGroups 
       = config->groupList().filter( QRegExp( "MessageTag #\\d+" ) );
-  for ( QStringList::Iterator it = tagGroups.begin(); 
-        it != tagGroups.end(); ++it )
-    config->deleteGroup( *it );
+  for ( QStringList::ConstIterator itGroup = tagGroups.constBegin(); 
+        itGroup != tagGroups.constEnd(); ++itGroup )
+    config->deleteGroup( *itGroup );
 
   // Now, write out the new stuff:
   int i = 0;
   QString grpName;
 
-  QListIterator<KMMessageTagDescription *> it ( *mTagList );
-  while (it.hasNext()) {
-    if ( ! it.peekNext()->isEmpty() ) {
+  QListIterator<KMMessageTagDescription *> itDesc ( *mTagList );
+  while (itDesc.hasNext()) {
+    if ( ! itDesc.peekNext()->isEmpty() ) {
       grpName.sprintf( "MessageTag #%d", i );
       KConfigGroup group( config, grpName );
-      it.next()->writeConfig( group );
+      itDesc.next()->writeConfig( group );
       ++i;
     }
   }
Index: knode/knfiltermanager.cpp
===================================================================
--- knode/knfiltermanager.cpp	(revision 746016)
+++ knode/knfiltermanager.cpp	(working copy)
@@ -151,16 +151,16 @@
   fset=fs;
   commitNeeded = false;
 
-  for ( QList<KNArticleFilter*>::Iterator it = mFilterList.begin(); it != mFilterList.end(); ++it )
-    fset->addItem( (*it) );
+  for ( QList<KNArticleFilter*>::ConstIterator itArticle = mFilterList.constBegin(); 
+        itArticle != mFilterList.constEnd(); ++itArticle )
+    fset->addItem( (*itArticle) );
 
-  QList<int>::Iterator it = menuOrder.begin();
-  while (it != menuOrder.end()) {
-    if ((*it)!=-1)
-      fset->addMenuItem(byID((*it)));
+  for ( QList<int>::ConstIterator itOrder = menuOrder.constBegin();
+        itOrder != menuOrder.constEnd(); ++itOrder ) {
+    if ((*itOrder)!=-1)
+      fset->addMenuItem(byID((*itOrder)));
     else
       fset->addMenuItem(0);
-    ++it;
   }
 }
 
Index: libkdepim/kpimprefs.h
===================================================================
--- libkdepim/kpimprefs.h	(revision 746016)
+++ libkdepim/kpimprefs.h	(working copy)
@@ -38,6 +38,8 @@
   public:
     KPimPrefs( const QString &name = QString() );
 
+    KPimPrefs(KPimPrefs const & other);
+
     virtual ~KPimPrefs();
 
     /** Set preferences to default values */
Index: libkdepim/kpimprefs.cpp
===================================================================
--- libkdepim/kpimprefs.cpp	(revision 746016)
+++ libkdepim/kpimprefs.cpp	(working copy)
@@ -43,6 +43,12 @@
 {
 }
 
+KPimPrefs::KPimPrefs(KPimPrefs const & other)
+  : KConfigSkeleton( other.objectName() )
+  , mCustomCategories( other.mCustomCategories )
+{
+}
+
 KPimPrefs::~KPimPrefs()
 {
 }
