--- kdepim/kmail/attachmentlistview.cpp 2005/07/26 18:54:59 438982 +++ kdepim/kmail/attachmentlistview.cpp 2006/04/15 06:51:13 530022 @@ -92,7 +92,7 @@ QBuffer serNumBuffer( serNums ); serNumBuffer.open( IO_ReadOnly ); QDataStream serNumStream( &serNumBuffer ); - unsigned long serNum; + Q_UINT32 serNum; KMFolder *folder = 0; int idx; QPtrList messageList; --- kdepim/kmail/kmedit.cpp 2006/02/20 11:40:20 511574 +++ kdepim/kmail/kmedit.cpp 2006/04/15 06:51:13 530022 @@ -144,7 +144,7 @@ QBuffer serNumBuffer(serNums); serNumBuffer.open(IO_ReadOnly); QDataStream serNumStream(&serNumBuffer); - unsigned long serNum; + Q_UINT32 serNum; KMFolder *folder = 0; int idx; QPtrList messageList; --- kdepim/kmail/kmkernel.cpp 2006/04/09 09:53:18 527760 +++ kdepim/kmail/kmkernel.cpp 2006/04/09 09:53:52 527761 @@ -1463,6 +1463,9 @@ void KMKernel::readConfig() { + //Needed here, since this function is also called when the configuration + //changes, and the static variables should be updated then - IOF + KMMessage::readConfig(); } void KMKernel::cleanupImapFolders() --- kdepim/kmail/kmmsgbase.cpp 2006/01/11 14:34:42 496941 +++ kdepim/kmail/kmmsgbase.cpp 2006/04/15 13:05:11 530119 @@ -870,7 +870,7 @@ char *l; for ( l = latin.data(); *l; ++l ) { - if ( ( *l & 0xE0 == 0 ) || ( *l & 0x80 ) ) + if ( ( ( *l & 0xE0 ) == 0 ) || ( *l & 0x80 ) ) // *l is control character or 8-bit char break; } --- kdepim/kmail/kmmsgdict.cpp 2005/07/26 18:54:59 438982 +++ kdepim/kmail/kmmsgdict.cpp 2006/04/15 13:05:11 530119 @@ -205,7 +205,16 @@ } KMFolderIndex* folder = static_cast( msg->storage() ); - if (folder && index == -1) + if ( !folder ) { + kdDebug(5006) << "KMMsgDict::insert: Cannot insert the message, " + << "null pointer to storage. Requested serial: " << msgSerNum + << endl; + kdDebug(5006) << " Message info: Subject: " << msg->subject() << ", To: " + << msg->toStrip() << ", Date: " << msg->dateStr() << endl; + return 0; + } + + if (index == -1) index = folder->find(msg); // Should not happen, indicates id file corruption @@ -241,7 +250,16 @@ const KMMsgBase *msg, int index) { KMFolderIndex* folder = static_cast( msg->storage() ); - if ( folder && index == -1 ) + if ( !folder ) { + kdDebug(5006) << "KMMsgDict::replace: Cannot replace the message serial " + << "number, null pointer to storage. Requested serial: " << msgSerNum + << endl; + kdDebug(5006) << " Message info: Subject: " << msg->subject() << ", To: " + << msg->toStrip() << ", Date: " << msg->dateStr() << endl; + return; + } + + if ( index == -1 ) index = folder->find( msg ); remove( msgSerNum ); --- kdepim/kmail/renamejob.cpp 2005/12/10 04:41:02 487311 +++ kdepim/kmail/renamejob.cpp 2006/04/15 13:05:11 530119 @@ -59,11 +59,13 @@ mNewName( newName ), mNewFolder( 0 ) { mStorageTempOpened = 0; - mOldName = storage->name(); - if ( storage->folderType() == KMFolderTypeImap ) { - mOldImapPath = static_cast(storage)->imapPath(); - } else if ( storage->folderType() == KMFolderTypeCachedImap ) { - mOldImapPath = static_cast(storage)->imapPath(); + if ( storage ) { + mOldName = storage->name(); + if ( storage->folderType() == KMFolderTypeImap ) { + mOldImapPath = static_cast(storage)->imapPath(); + } else if ( storage->folderType() == KMFolderTypeCachedImap ) { + mOldImapPath = static_cast(storage)->imapPath(); + } } } --- kdepim/kmail/configuredialog_p.h 2005/08/19 15:04:44 450950 +++ kdepim/kmail/configuredialog_p.h 2006/04/01 23:19:36 525407 @@ -715,8 +715,7 @@ void slotOutlookCompatibleClicked(); private: - //virtual void doLoadFromGlobalSettings(); - virtual void doLoadOther(); + virtual void doLoadFromGlobalSettings(); //FIXME virtual void doResetToDefaultsOther(); private: --- kdepim/kmail/replyphrases.kcfg 2006/04/09 09:53:18 527760 +++ kdepim/kmail/replyphrases.kcfg 2006/04/09 09:53:52 527761 @@ -20,17 +20,14 @@ - Forwarded Message - On %D, you wrote: - On %D, %F wrote: --- kdepim/kmail/kmfolder.cpp 2005/12/06 21:29:44 486141 +++ kdepim/kmail/kmfolder.cpp 2006/04/18 20:41:15 531267 @@ -84,12 +84,6 @@ } } - // trigger from here, since it needs a fully constructed FolderStorage - if ( mExportsSernums ) - mStorage->registerWithMessageDict(); - if ( !mHasIndex ) - mStorage->setAutoCreateIndex( false ); - if ( aParent ) { connect( mStorage, SIGNAL( msgAdded( KMFolder*, Q_UINT32 ) ), aParent->manager(), SIGNAL( msgAdded( KMFolder*, Q_UINT32 ) ) ); @@ -133,8 +127,16 @@ this, SLOT( slotContentsTypeChanged( KMail::FolderContentsType ) ) ); //FIXME: Centralize all the readConfig calls somehow - Zack + // Meanwhile, readConfig must be done before registerWithMessageDict, since + // that one can call writeConfig in some circumstances - David mStorage->readConfig(); + // trigger from here, since it needs a fully constructed FolderStorage + if ( mExportsSernums ) + mStorage->registerWithMessageDict(); + if ( !mHasIndex ) + mStorage->setAutoCreateIndex( false ); + if ( mId == 0 && aParent ) mId = aParent->manager()->createId(); } --- kdepim/kmail/configuredialog.cpp 2006/01/21 12:34:03 500799 +++ kdepim/kmail/configuredialog.cpp 2006/05/03 08:46:45 536841 @@ -2276,7 +2276,7 @@ const QString encoding = KGlobal::charsets()->encodingForName(*it); if ( encoding == "iso-8859-15" ) indexOfLatin9 = i; - if( false && encoding == currentEncoding ) + if( encoding == currentEncoding ) { mCharsetCombo->setCurrentItem( i ); found = true; @@ -3348,15 +3348,12 @@ mAttachWordsListEditor, SLOT(setEnabled(bool)) ); } -void ComposerPage::AttachmentsTab::doLoadOther() { - KConfigGroup composer( KMKernel::config(), "Composer" ); - +void ComposerPage::AttachmentsTab::doLoadFromGlobalSettings() { mOutlookCompatibleCheck->setChecked( - composer.readBoolEntry( "outlook-compatible-attachments", false ) ); + GlobalSettings::self()->outlookCompatibleAttachments() ); mMissingAttachmentDetectionCheck->setChecked( - composer.readBoolEntry( "showForgottenAttachmentWarning", true ) ); - QStringList attachWordsList = - composer.readListEntry( "attachment-keywords" ); + GlobalSettings::self()->showForgottenAttachmentWarning() ); + QStringList attachWordsList = GlobalSettings::self()->attachmentKeywords(); if ( attachWordsList.isEmpty() ) { // default value attachWordsList << QString::fromLatin1("attachment") @@ -3371,13 +3368,12 @@ } void ComposerPage::AttachmentsTab::save() { - KConfigGroup composer( KMKernel::config(), "Composer" ); - composer.writeEntry( "outlook-compatible-attachments", - mOutlookCompatibleCheck->isChecked() ); - composer.writeEntry( "showForgottenAttachmentWarning", - mMissingAttachmentDetectionCheck->isChecked() ); - composer.writeEntry( "attachment-keywords", - mAttachWordsListEditor->stringList() ); + GlobalSettings::self()->setOutlookCompatibleAttachments( + mOutlookCompatibleCheck->isChecked() ); + GlobalSettings::self()->setShowForgottenAttachmentWarning( + mMissingAttachmentDetectionCheck->isChecked() ); + GlobalSettings::self()->setAttachmentKeywords( + mAttachWordsListEditor->stringList() ); } void ComposerPageAttachmentsTab::slotOutlookCompatibleClicked() --- kdepim/kmail/antispamwizard.cpp 2005/12/30 00:15:02 492457 +++ kdepim/kmail/antispamwizard.cpp 2006/05/06 09:14:35 537923 @@ -502,7 +502,7 @@ while ( account ) { if ( account->type() == "pop" || account->type().contains( "imap" ) ) { const NetworkAccount * n = dynamic_cast( account ); - if ( n->host().lower().contains( pattern.lower() ) ) { + if ( n && n->host().lower().contains( pattern.lower() ) ) { mInfoPage->addAvailableTool( (*it).getVisibleName() ); found = true; } --- kdepim/kmail/kmmessage.cpp 2006/03/16 12:47:35 519171 +++ kdepim/kmail/kmmessage.cpp 2006/05/06 09:14:35 537923 @@ -2667,7 +2667,7 @@ parts.removeLast(); } - if (part->Body().Message() && + if (part && part->Body().Message() && part->Body().Message()->Body().FirstBodyPart()) { part = part->Body().Message()->Body().FirstBodyPart(); --- kdepim/kmail/kmreaderwin.cpp 2006/02/20 20:15:05 511744 +++ kdepim/kmail/kmreaderwin.cpp 2006/05/06 09:14:35 537923 @@ -371,7 +371,7 @@ if( dataNode->parentNode() && !weAreReplacingTheRootNode ) { kdDebug(5006) << "dataNode is NOT replacing the root node: Store the headers." << endl; resultingData += headers->AsString().c_str(); - } else if( weAreReplacingTheRootNode && part->hasHeaders() ){ + } else if( weAreReplacingTheRootNode && part && part->hasHeaders() ){ kdDebug(5006) << "dataNode replace the root node: Do NOT store the headers but change" << endl; kdDebug(5006) << " the Message's headers accordingly." << endl; kdDebug(5006) << " old Content-Type = " << rootHeaders.ContentType().AsString().c_str() << endl; --- kdepim/kmail/kmsender.cpp 2006/03/20 17:51:08 520754 +++ kdepim/kmail/kmsender.cpp 2006/05/06 09:14:35 537923 @@ -373,12 +373,14 @@ KMessageBox::information(0, i18n("Critical error: " "Unable to process sent mail (out of space?)" "Moving failing message to \"sent-mail\" folder.")); - sentFolder->moveMsg(mCurrentMsg); - sentFolder->close(); + if ( sentFolder ) { + sentFolder->moveMsg(mCurrentMsg); + sentFolder->close(); + } cleanup(); return; case 1: - if (sentFolder->moveMsg(mCurrentMsg) != 0) + if ( sentFolder && sentFolder->moveMsg(mCurrentMsg) != 0 ) { KMessageBox::error(0, i18n("Moving the sent message \"%1\" from the " "\"outbox\" to the \"sent-mail\" folder failed.\n" --- kdepim/kmail/objecttreeparser.cpp 2005/12/16 16:18:58 488973 +++ kdepim/kmail/objecttreeparser.cpp 2006/05/06 09:14:35 537923 @@ -92,6 +92,7 @@ #include #include #include +#include // other headers #include @@ -277,7 +278,7 @@ << node->typeString() << '/' << node->subTypeString() << ')' << endl; - if ( !bpf->process( this, node, processResult ) ) + if ( bpf && !bpf->process( this, node, processResult ) ) defaultHandling( node, processResult ); } node->setProcessed( true, false ); @@ -765,30 +766,21 @@ //static bool ObjectTreeParser::containsExternalReferences( const QCString & str ) { - int httpPos = str.find( "\"http:", 0, true ); - int httpsPos = str.find( "\"https:", 0, true ); + QRegExp httpRegExp("(\\\"|\\\'|url\\s*\\(\\s*)http[s]?:"); + int httpPos = str.find( httpRegExp, 0 ); - while ( httpPos >= 0 || httpsPos >= 0 ) { - // pos = index of next occurrence of "http: or "https: whichever comes first - int pos = ( httpPos < httpsPos ) - ? ( ( httpPos >= 0 ) ? httpPos : httpsPos ) - : ( ( httpsPos >= 0 ) ? httpsPos : httpPos ); + while ( httpPos >= 0 ) { // look backwards for "href" - if ( pos > 5 ) { - int hrefPos = str.findRev( "href", pos - 5, true ); + if ( httpPos > 5 ) { + int hrefPos = str.findRev( "href", httpPos - 5, true ); // if no 'href' is found or the distance between 'href' and '"http[s]:' // is larger than 7 (7 is the distance in 'href = "http[s]:') then // we assume that we have found an external reference - if ( ( hrefPos == -1 ) || ( pos - hrefPos > 7 ) ) + if ( ( hrefPos == -1 ) || ( httpPos - hrefPos > 7 ) ) return true; } // find next occurrence of "http: or "https: - if ( pos == httpPos ) { - httpPos = str.find( "\"http:", httpPos + 6, true ); - } - else { - httpsPos = str.find( "\"https:", httpsPos + 7, true ); - } + httpPos = str.find( httpRegExp, httpPos + 6 ); } return false; }