Beispiel #1
0
void BlockGraph::addBlockNeighbour(PinNode *source, PinNode *target,
                                   QPtrList<PinNode> &seen)
{
    if (INSTANCEOF(target->parent()->model(), MuxModel)) {
        // iterate through output pins
        QPtrList<PinNode> neighbours = target->neighbours();
        for (QPtrListIterator<PinNode> it(neighbours); it != 0;
             ++it) {

            Q_ASSERT(target->parent() == (*it)->parent());

            if (!seen.contains(*it)) {
                seen.append(*it);
                QPtrList<PinNode> neighbours2 = (*it)->neighbours();
                for (QPtrListIterator<PinNode> it2(neighbours2); it2 != 0;
                     ++it2) {

                    addBlockNeighbour(source, *it2, seen);
                }
            }
        }
    }
    else {
//         qDebug(QString("added connection %1 -> %2")
//                .arg(source->parent()->model()->name())
//                .arg(target->parent()->model()->name()));
        source->parent()->addNeighbour(target->parent());
    }
}
Beispiel #2
0
  //-----------------------------------------------------------------------------
  QPtrList<KMMessagePart> BodyVisitor::partsToLoad()
  {
    QPtrListIterator<KMMessagePart> it( mParts );
    QPtrList<KMMessagePart> selected;
    KMMessagePart *part = 0;
    bool headerCheck = false;
    while ( (part = it.current()) != 0 )
    {
      ++it;
      // skip this part if the parent part is already loading
      if ( part->parent() &&
           selected.contains( part->parent() ) &&
           part->loadPart() )
        continue;

      if ( part->originalContentTypeStr().contains("SIGNED") )
      {
        // signed messages have to be loaded completely
        // so construct a new dummy part that loads the body
        KMMessagePart *fake = new KMMessagePart();
        fake->setPartSpecifier( "TEXT" );
        fake->setOriginalContentTypeStr("");
        fake->setLoadPart( true );
        selected.append( fake );
        break;
      }

      if ( headerCheck && !part->partSpecifier().endsWith(".HEADER") )
      {
        // this is an embedded simple message (not multipart) so we get no header part
        // from imap. As we probably need to load the header (e.g. in smart or inline mode)
        // we add a fake part that is not included in the message itself
        KMMessagePart *fake = new KMMessagePart();
        QString partId = part->partSpecifier().section( '.', 0, -2 )+".HEADER";
        fake->setPartSpecifier( partId );
        fake->setOriginalContentTypeStr("");
        fake->setLoadPart( true );
        if ( addPartToList( fake ) )
          selected.append( fake );
      }

      if ( part->originalContentTypeStr() == "MESSAGE/RFC822" )
        headerCheck = true;
      else
        headerCheck = false;

      // check whether to load this part or not:
      // look at the basic list, ask the subclass and check the parent
      if ( mBasicList.contains( part->originalContentTypeStr() ) ||
           parentNeedsLoading( part ) ||
           addPartToList( part ) )
      {
        if ( part->typeStr() != "MULTIPART" ||
             part->partSpecifier().endsWith(".HEADER") )
        {
          // load the part itself
          part->setLoadPart( true );
        }
      }
      if ( !part->partSpecifier().endsWith(".HEADER") &&
           part->typeStr() != "MULTIPART" )
        part->setLoadHeaders( true ); // load MIME header

      if ( part->loadHeaders() || part->loadPart() )
        selected.append( part );
    }
    return selected;
  }