~ubuntu-branches/ubuntu/quantal/kdepimlibs/quantal-proposed

« back to all changes in this revision

Viewing changes to kmime/kmime_content.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2011-12-14 14:37:07 UTC
  • mto: This revision was merged to the branch mainline in revision 112.
  • Revision ID: package-import@ubuntu.com-20111214143707-m0qplh3hsd957ukv
Tags: upstream-4.7.90
ImportĀ upstreamĀ versionĀ 4.7.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
412
412
    QByteArray chset = KGlobal::locale()->encoding();
413
413
    contentType()->setCharset( chset );
414
414
  }
415
 
  
 
415
 
416
416
  QString s = codec->toUnicode( d_ptr->body.data(), d_ptr->body.length() );
417
417
 
418
418
  if ( trimText || removeTrailingNewlines ) {
563
563
void Content::removeContent( Content *c, bool del )
564
564
{
565
565
  Q_D( Content );
566
 
  if( !d->multipartContents.contains( c ) )
 
566
  if ( d->multipartContents.isEmpty() || !d->multipartContents.contains( c ) ) {
567
567
    return;
568
 
  // This method makes no sense for encapsulated messages. Should be covered by the above
569
 
  // assert already, though.
 
568
  }
 
569
 
 
570
  // This method makes no sense for encapsulated messages.
 
571
  // Should be covered by the above assert already, though.
570
572
  Q_ASSERT( !bodyIsMessage() );
571
573
 
572
574
  d->multipartContents.removeAll( c );
902
904
  return d_ptr->parent == 0;
903
905
}
904
906
 
905
 
void Content::setParent( Content* parent )
 
907
void Content::setParent( Content *parent )
906
908
{
907
 
  //make sure the Content is only in the contents list of one parent object
 
909
  // Make sure the Content is only in the contents list of one parent object
908
910
  Content *oldParent = d_ptr->parent;
909
 
  if ( oldParent && oldParent->contents().contains( this ) ) {
910
 
    oldParent->removeContent( this );
 
911
  if ( oldParent ) {
 
912
    if ( !oldParent->contents().isEmpty() && oldParent->contents().contains( this ) ) {
 
913
      oldParent->removeContent( this );
 
914
    }
911
915
  }
912
916
 
913
917
  d_ptr->parent = parent;
914
 
  if ( parent && !parent->contents().contains( this ) ) {
915
 
    parent->addContent( this );
 
918
  if ( parent ) {
 
919
    if ( !parent->contents().isEmpty() && !parent->contents().contains( this ) ) {
 
920
      parent->addContent( this );
 
921
    }
916
922
  }
917
923
}
918
924
 
919
 
Content* Content::parent() const
 
925
Content *Content::parent() const
920
926
{
921
927
  return d_ptr->parent;
922
928
}
923
929
 
924
 
Content* Content::topLevel() const
 
930
Content *Content::topLevel() const
925
931
{
926
932
  Content *top = const_cast<Content*>(this);
927
933
  Content *c = parent();