/** * * @param object * @param parent * @return */ ClassDialog::ClassDialog( Object *object, QWidget *parent) : KDialog(parent) { m_object = object; setModal( false ); showButtonOK( true ); showButtonCancel( true ); showButtonApply( false ); m_tab = new KTabWidget( this ); setMainWidget( m_tab ); QWidget *widget = new QWidget( this ); m_tab->addTab( widget, object->classInfo()->name() ); //connect( this, SIGNAL(okClicked()), SLOT(slotOkClicked()) ); QVBoxLayout *layout = new QVBoxLayout( widget ); LabelsMetaInfo *labels = dynamic_cast<LabelsMetaInfo*>( object->classInfo()->metaInfo( "labels" ) ); QLabel *label; label = new QLabel( widget ); label->setAlignment( Qt::AlignCenter ); if ( labels ) label->setText( "<b>" + labels->label( object->classInfo()->name() ) + "</b>" ); else label->setText( "<b>" + object->classInfo()->name() + "</b>" ); if ( labels ) setCaption( labels->label( object->classInfo()->name() ) + " (" + oidToString(object->oid()) + ")" ); else setCaption( object->classInfo()->name() + " (" + oidToString(object->oid()) + ")" ); layout->addWidget( label ); layout->addSpacing( 10 ); QGridLayout *gridLayout = new QGridLayout( layout, object->numProperties() + object->numObjects() + object->numCollections(), 2, 5 ); int row = 0; PropertiesIterator it( object->propertiesBegin() ); PropertiesIterator end( object->propertiesEnd() ); for ( ; it != end; ++it, ++row ) { Property p = *it; label = new QLabel( widget ); if ( labels ) label->setText( labels->label( p.name() ) ); else label->setText( p.name() ); gridLayout->addWidget( label, row, 0 ); PropertyWidget *tmp = new PropertyWidget( p, widget ); m_mapProperties.insert( p.name(), tmp ); gridLayout->addWidget( tmp, row, 1 ); } const ClassInfo *classInfo = object->classInfo(); RelationInfosConstIterator it2( classInfo->relationsBegin() ); RelationInfosConstIterator end2( classInfo->relationsEnd() ); for ( ; it2 != end2; ++it2, ++row ) { RelationInfo *relObj = it2.data(); label = new QLabel( widget ); if ( labels ) label->setText( labels->label( it2.data()->name() ) ); else label->setText( it2.data()->name() ); gridLayout->addWidget( label, row, 0 ); QHBoxLayout *lay = new QHBoxLayout(); gridLayout->addLayout( lay, row, 1 ); KurlLabel *objLabel = new KurlLabel(widget); objLabel->setAlignment( Qt::AlignCenter ); Object* obj = object->object( relObj->name() ); updateObjectLabel( objLabel, obj ); connect( objLabel, SIGNAL(leftClickedURL(const QString&)), SLOT(slotObjectSelected(const QString&)) ); m_mapObjects.insert( relObj->name(), objLabel ); QPushButton *but = new QPushButton( widget ); but->setText( i18n( "Change" ) ); connect( but, SIGNAL(clicked()), SLOT(slotChangeClicked()) ); m_mapChangeButtons.insert( but, relObj ); lay->addWidget( objLabel ); lay->addWidget( but ); Notifier *notifier = dynamic_cast<Notifier*>( Manager::self()->notificationHandler() ); // if ( notifier && obj ) // notifier->registerSlot( this, SLOT( slotObjectModified(const ClassInfo*,const OidType&,const PropertyInfo*,const QVariant&) ), 0, obj->oid() ); } CollectionInfosConstIterator it3( classInfo->collectionsBegin() ); CollectionInfosConstIterator end3( classInfo->collectionsEnd() ); for ( ; it3 != end3; ++it3 ) { const CollectionInfo *info = it3.data(); CollectionChooser *chooser = new CollectionChooser( m_tab ); chooser->setObject( m_object ); chooser->setCollectionName( info->name() ); m_tab->addTab( chooser, info->name() ); } }
void KProgressDialog::showCancelButton(bool show) { showButtonCancel(show); }