void Kleo::DNAttributeOrderConfigWidget::load() { // save the _X_ item: takePlaceHolderItem(); // clear the rest: d->availableLV->clear(); d->currentLV->clear(); const QStringList order = d->mapper->attributeOrder(); // fill the RHS listview: Q3ListViewItem * last = 0; for ( QStringList::const_iterator it = order.begin() ; it != order.end() ; ++it ) { const QString attr = (*it).toUpper(); if ( attr == "_X_" ) { takePlaceHolderItem(); d->currentLV->insertItem( d->placeHolderItem ); d->placeHolderItem->moveItem( last ); last = d->placeHolderItem; } else last = new Q3ListViewItem( d->currentLV, last, attr, d->mapper->name2label( attr ) ); } // fill the LHS listview with what's left: const QStringList all = Kleo::DNAttributeMapper::instance()->names(); for ( QStringList::const_iterator it = all.begin() ; it != all.end() ; ++it ) if ( !order.contains( *it ) ) (void)new Q3ListViewItem( d->availableLV, *it, d->mapper->name2label( *it ) ); if ( !d->placeHolderItem->listView() ) d->availableLV->insertItem( d->placeHolderItem ); }
void Kleo::DNAttributeOrderConfigWidget::load() { #ifndef QT_NO_TREEWIDGET // save the _X_ item: takePlaceHolderItem(); // clear the rest: d->availableLV->clear(); d->currentLV->clear(); const QStringList order = d->mapper->attributeOrder(); // fill the RHS listview: QTreeWidgetItem* last = 0; for ( QStringList::const_iterator it = order.begin() ; it != order.end() ; ++it ) { const QString attr = (*it).toUpper(); if ( attr == "_X_" ) { takePlaceHolderItem(); d->currentLV->insertTopLevelItem( d->currentLV->topLevelItemCount(), d->placeHolderItem ); last = d->placeHolderItem; } else { last = new QTreeWidgetItem( d->currentLV, last ); last->setText( 0, attr ); last->setText( 1, d->mapper->name2label( attr ) ); } } // fill the LHS listview with what's left: const QStringList all = Kleo::DNAttributeMapper::instance()->names(); for ( QStringList::const_iterator it = all.begin() ; it != all.end() ; ++it ) { if ( !order.contains( *it ) ) { QTreeWidgetItem *item = new QTreeWidgetItem( d->availableLV ); item->setText( 0, *it ); item->setText( 1, d->mapper->name2label( *it ) ); } } if ( !d->placeHolderItem->treeWidget() ) d->availableLV->addTopLevelItem( d->placeHolderItem ); #endif }