void KWDocStructRootItem::setupArrangement() { deleteAllChildren(); QIntDict<KWDocStructParagItem> parags; parags.setAutoDelete( false ); KWFrameSet* frameset = 0L; KWTextParag* parag = 0L; KoTextDocument* textdoc = 0L; KWDocument* dok = doc(); KWDocStructTextFrameSetItem *item = 0L; QString _name; for ( int i = dok->frameSetCount() - 1; i >= 0; i-- ) { frameset = dok->frameSet( i ); if ( frameset->type() == FT_TEXT && frameset->frameSetInfo() == KWFrameSet::FI_BODY && !frameset->groupmanager() && frameset->frameCount()>0) { KWTextFrameSet *tmpParag = dynamic_cast<KWTextFrameSet*> (frameset) ; item = new KWDocStructTextFrameSetItem( this, frameset->name(), tmpParag); textdoc= tmpParag->textDocument(); parag = static_cast<KWTextParag *>(textdoc->firstParag()); while ( parag ) { KoParagCounter *tmpCounter = parag->counter(); if (tmpCounter !=0 && (tmpCounter->style() != KoParagCounter::STYLE_NONE) && (tmpCounter->numbering() == KoParagCounter::NUM_CHAPTER) ) { int _depth = tmpCounter->depth(); if ( _depth == 0 ) { if ( item->childCount() == 0 ) parags.replace( _depth, new KWDocStructParagItem( item,QString( tmpCounter->text(parag) + " " +parag->string()->toString().mid( 0, parag->string()->length() ) ),parag) ); else parags.replace( _depth, new KWDocStructParagItem( item, parags[ _depth ],QString( tmpCounter->text(parag) + " " +parag->string()->toString().mid( 0, parag->string()->length() ) ),parag) ); } else { if (parags[ _depth - 1 ]==0) parags.replace( _depth, new KWDocStructParagItem( item,QString( tmpCounter->text(parag) + " " +parag->string()->toString().mid( 0, parag->string()->length() ) ), parag) ); else if ( parags[ _depth - 1 ]->childCount() == 0 ) parags.replace( _depth, new KWDocStructParagItem( parags[ _depth - 1 ],QString( tmpCounter->text(parag) + " " +parag->string()->toString().mid( 0, parag->string()->length() ) ), parag) ); else parags.replace( _depth, new KWDocStructParagItem( parags[ _depth - 1 ], parags[ _depth ],QString( tmpCounter->text(parag) + " " +parag->string()->toString().mid( 0, parag->string()->length() ) ), parag) ); } } parag = static_cast<KWTextParag *>(parag->next()); } } } if ( childCount() == 0 ) ( void )new KListViewItem( this, i18n( "Empty" ) ); }
void KeyMappings::clear() { for(QMap<int, CodeMaps*>::Iterator it = m_keymaps.begin(); it!=m_keymaps.end(); ++it){ delete (*it); } m_keymaps.clear(); g_mapCache.setAutoDelete(true); g_mapCache.clear(); }
void Scribble::slotSave() { QPopupMenu *menu = new QPopupMenu( 0 ); QIntDict<QString> formats; formats.setAutoDelete( TRUE ); for ( unsigned int i = 0; i < QImageIO::outputFormats().count(); i++ ) { QString str = QString( QImageIO::outputFormats().at( i ) ); formats.insert( menu->insertItem( QString( "%1..." ).arg( str ) ), new QString( str ) ); } menu->setMouseTracking( TRUE ); int id = menu->exec( bSave->mapToGlobal( QPoint( 0, bSave->height() + 1 ) ) ); if ( id != -1 ) { QString format = *formats[ id ]; QString filename = QFileDialog::getSaveFileName( QString::null, QString( "*.%1" ).arg( format.lower() ), this ); if ( !filename.isEmpty() ) canvas->save( filename, format ); } delete menu; }
void PukeController::insertPObject(int fd, int iWinId, WidgetS *obj){ // If no widget list exists for this fd, create one if(WidgetList[fd] == NULL){ QIntDict<WidgetS> *qidWS = new QIntDict<WidgetS>; qidWS->setAutoDelete(TRUE); WidgetList.insert(fd, qidWS); } // Set main widget structure list WidgetList[fd]->insert(iWinId, obj); // Set reverse list used durring delete to remove the widget widgetId *pwi = new widgetId; pwi->fd = fd; pwi->iWinId = iWinId; char key[keySize]; memset(key, 0, keySize); sprintf(key, "%p", obj->pwidget); revWidgetList.insert(key, pwi); // Now connect to the destroyed signal so we can remove the object from the lists // Once it is deleted connect(obj->pwidget, SIGNAL(destroyed()), this, SLOT(pobjectDestroyed())); }