From c8e7c932faf890cf4ab529d6994b28f81593c5f5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 9 Feb 2004 20:15:35 +0000 Subject: [PATCH] From aegypten_branch: Better text for signed maessage (don't confuse the user about key vs. signature creation data), and remove my long-standing fixme. svn path=/trunk/kdepim/; revision=286591 --- objecttreeparser.cpp | 48 ++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/objecttreeparser.cpp b/objecttreeparser.cpp index 25da9a000..feaf3c61b 100644 --- a/objecttreeparser.cpp +++ b/objecttreeparser.cpp @@ -231,24 +231,18 @@ namespace KMail { } for ( ; node ; node = node->nextSibling() ) { - ProcessResult processResult; - - if ( node->processed() ) { - // ### (mmutz) I think this is a bug if node->processed() is - // true from the beginning (_can_ it?), then any crypto state is - // reset. I therefore believe that this code should be inside the - // corresponding conditional above: - processResult.adjustCryptoStatesOfNode( node ); - continue; - } + if ( node->processed() ) + continue; const BodyPartFormatter * bpf - = BodyPartFormatter::createFor( node->type(), node->subType() ); + = BodyPartFormatter::createFor( node->type(), node->subType() ); kdFatal( !bpf, 5006 ) << "THIS SHOULD NO LONGER HAPPEN (" - << node->typeString() << '/' << node->subTypeString() - << ')' << endl; + << node->typeString() << '/' << node->subTypeString() + << ')' << endl; + + ProcessResult processResult; if ( !bpf->process( this, node, processResult ) ) - defaultHandling( node, processResult ); + defaultHandling( node, processResult ); node->setProcessed( true, false ); @@ -2078,28 +2072,27 @@ QString ObjectTreeParser::writeSigstatHeader( PartMetaData & block, } else { bool dateOK = ( 0 < block.creationTime.tm_year && block.creationTime.tm_year < 3000 ); - QDate created; + QDateTime created; if ( dateOK ) - created = QDate( 1900 + block.creationTime.tm_year, - block.creationTime.tm_mon, - block.creationTime.tm_mday ); + created.setTime_t( mktime(&block.creationTime) ); if( dateOK && created.isValid() ) { if( signer.isEmpty() ) { if( onlyShowKeyURL ) htmlStr += i18n( "Message was signed with key %1." ) .arg( keyWithWithoutURL ); else - htmlStr += i18n( "Message was signed with key %1, created %2." ) - .arg( keyWithWithoutURL ).arg( created.toString( Qt::LocalDate ) ); + htmlStr += i18n( "Message was signed on %1 with key %2." ) + .arg( KGlobal::locale()->formatDateTime( created ) ) + .arg( keyWithWithoutURL ); } else { if( onlyShowKeyURL ) htmlStr += i18n( "Message was signed with key %1." ) .arg( keyWithWithoutURL ); else - htmlStr += i18n( "Message was signed by %3 with key %1, created %2." ) + htmlStr += i18n( "Message was signed by %3 on %1 with key %2" ) + .arg( KGlobal::locale()->formatDateTime( created ) ) .arg( keyWithWithoutURL ) - .arg( created.toString( Qt::LocalDate ) ) .arg( signer ); } } @@ -2141,14 +2134,13 @@ QString ObjectTreeParser::writeSigstatHeader( PartMetaData & block, if( !block.keyId.isEmpty() ) { bool dateOK = ( 0 < block.creationTime.tm_year && block.creationTime.tm_year < 3000 ); - QDate created; + QDateTime created; if ( dateOK ) - created = QDate( 1900 + block.creationTime.tm_year, - block.creationTime.tm_mon, - block.creationTime.tm_mday ); + created.setTime_t( mktime(&block.creationTime) ); if( dateOK && created.isValid() ) - htmlStr += i18n( "Message was signed with unknown key %1, created %2." ) - .arg( keyWithWithoutURL ).arg( created.toString( Qt::LocalDate ) ); + htmlStr += i18n( "Message was signed on %1 with unknown key %2." ) + .arg( KGlobal::locale()->formatDateTime( created ) ) + .arg( keyWithWithoutURL ); else htmlStr += i18n( "Message was signed with unknown key %1." ) .arg( keyWithWithoutURL );