NamePartWidget::NamePartWidget( const QString &title, const QString &label, QWidget *parent, const char *name ) : QGroupBox( title, parent ) , mTitle( title ) , mLabel( label ) { setObjectName( name ); QHBoxLayout *layout = new QHBoxLayout( this ); layout->setSpacing( KDialog::spacingHint() ); layout->setMargin( KDialog::marginHint() ); mBox = new QListWidget( this ); connect( mBox, SIGNAL( currentItemChanged( QListWidgetItem *, QListWidgetItem * ) ), SLOT( selectionChanged( QListWidgetItem * ) ) ); layout->addWidget( mBox ); KDialogButtonBox *bbox = new KDialogButtonBox( this, Qt::Vertical ); mAddButton = bbox->addButton( i18n( "Add..." ), QDialogButtonBox::ActionRole, this, SLOT( add() ) ); mEditButton = bbox->addButton( i18n( "Edit..." ), QDialogButtonBox::ActionRole, this, SLOT( edit() ) ); mEditButton->setEnabled( false ); mRemoveButton = bbox->addButton( i18n( "Remove" ), QDialogButtonBox::ActionRole, this, SLOT( remove() ) ); mRemoveButton->setEnabled( false ); bbox->layout(); layout->addWidget( bbox ); }
/** * Sets up the action buttons. * @param itemType The item type. * @param parentLayout The parent layout to which this group belongs. */ void ClassifierListTab::setupActionButtons(const QString& itemType, QVBoxLayout* parentLayout) { KDialogButtonBox* buttonBox = new KDialogButtonBox(m_pItemListGB); m_pNewClassifierListItemButton = buttonBox->addButton( itemType, KDialogButtonBox::ActionRole, this, SLOT(slotNewListItem()) ); m_pDeleteListItemButton = buttonBox->addButton( i18n("&Delete"), KDialogButtonBox::ActionRole, this, SLOT(slotDelete()) ); m_pPropertiesButton = buttonBox->addButton( i18n("&Properties"), KDialogButtonBox::ActionRole, this,SLOT(slotProperties()) ); parentLayout->addWidget(buttonBox); }
LdapSearchDialog::LdapSearchDialog( QWidget *parent ) : KDialog( parent ), d( new Private( this ) ) { setCaption( i18n( "Import Contacts from LDAP" ) ); #ifdef _WIN32_WCE setButtons( Help | User1 | Cancel ); #else setButtons( Help | User1 | User2 | Cancel ); #endif setDefaultButton( User1 ); setModal( false ); showButtonSeparator( true ); setButtonGuiItem( KDialog::Cancel, KStandardGuiItem::close() ); QFrame *page = new QFrame( this ); setMainWidget( page ); QVBoxLayout *topLayout = new QVBoxLayout( page ); topLayout->setSpacing( spacingHint() ); topLayout->setMargin( marginHint() ); QGroupBox *groupBox = new QGroupBox( i18n( "Search for Addresses in Directory" ), page ); QGridLayout *boxLayout = new QGridLayout(); groupBox->setLayout( boxLayout ); boxLayout->setSpacing( spacingHint() ); boxLayout->setColumnStretch( 1, 1 ); QLabel *label = new QLabel( i18n( "Search for:" ), groupBox ); boxLayout->addWidget( label, 0, 0 ); d->mSearchEdit = new KLineEdit( groupBox ); boxLayout->addWidget( d->mSearchEdit, 0, 1 ); label->setBuddy( d->mSearchEdit ); label = new QLabel( i18nc( "In LDAP attribute", "in" ), groupBox ); boxLayout->addWidget( label, 0, 2 ); d->mFilterCombo = new KComboBox( groupBox ); d->mFilterCombo->addItem( i18nc( "@item:inlistbox Name of the contact", "Name" ) ); d->mFilterCombo->addItem( i18nc( "@item:inlistbox email address of the contact", "Email" ) ); d->mFilterCombo->addItem( i18nc( "@item:inlistbox", "Home Number" ) ); d->mFilterCombo->addItem( i18nc( "@item:inlistbox", "Work Number" ) ); boxLayout->addWidget( d->mFilterCombo, 0, 3 ); QSize buttonSize; d->mSearchButton = new QPushButton( i18n( "Stop" ), groupBox ); buttonSize = d->mSearchButton->sizeHint(); d->mSearchButton->setText( i18nc( "@action:button Start searching", "&Search" ) ); if ( buttonSize.width() < d->mSearchButton->sizeHint().width() ) { buttonSize = d->mSearchButton->sizeHint(); } d->mSearchButton->setFixedWidth( buttonSize.width() ); d->mSearchButton->setDefault( true ); boxLayout->addWidget( d->mSearchButton, 0, 4 ); d->mRecursiveCheckbox = new QCheckBox( i18n( "Recursive search" ), groupBox ); d->mRecursiveCheckbox->setChecked( true ); boxLayout->addWidget( d->mRecursiveCheckbox, 1, 0, 1, 5 ); d->mSearchType = new KComboBox( groupBox ); d->mSearchType->addItem( i18n( "Contains" ) ); d->mSearchType->addItem( i18n( "Starts With" ) ); boxLayout->addWidget( d->mSearchType, 1, 3, 1, 2 ); topLayout->addWidget( groupBox ); d->mResultView = new QTableView( page ); d->mResultView->setSelectionMode( QTableView::MultiSelection ); d->mResultView->setSelectionBehavior( QTableView::SelectRows ); d->mModel = new ContactListModel( d->mResultView ); d->mResultView->setModel( d->mModel ); d->mResultView->verticalHeader()->hide(); connect( d->mResultView, SIGNAL(clicked(QModelIndex)), SLOT(slotSelectionChanged()) ); topLayout->addWidget( d->mResultView ); KDialogButtonBox *buttons = new KDialogButtonBox( page, Qt::Horizontal ); buttons->addButton( i18n( "Select All" ), QDialogButtonBox::ActionRole, this, SLOT(slotSelectAll()) ); buttons->addButton( i18n( "Unselect All" ), QDialogButtonBox::ActionRole, this, SLOT(slotUnselectAll()) ); topLayout->addWidget( buttons ); resize( QSize( 600, 400 ).expandedTo( minimumSizeHint() ) ); setButtonText( User1, i18n( "Add Selected" ) ); #ifndef _WIN32_WCE setButtonText( User2, i18n( "Configure LDAP Servers..." ) ); #endif connect( d->mRecursiveCheckbox, SIGNAL(toggled(bool)), this, SLOT(slotSetScope(bool)) ); connect( d->mSearchButton, SIGNAL(clicked()), this, SLOT(slotStartSearch()) ); setTabOrder( d->mSearchEdit, d->mFilterCombo ); setTabOrder( d->mFilterCombo, d->mSearchButton ); d->mSearchEdit->setFocus(); connect( this, SIGNAL(user1Clicked()), this, SLOT(slotUser1()) ); #ifndef _WIN32_WCE connect( this, SIGNAL(user2Clicked()), this, SLOT(slotUser2()) ); #endif d->slotSelectionChanged(); d->restoreSettings(); }
/** * Sets up the dialog. */ void UMLOperationDialog::setupDialog() { QFrame *frame = new QFrame(this); setMainWidget(frame); int margin = fontMetrics().height(); QVBoxLayout * topLayout = new QVBoxLayout(frame); m_pGenGB = new QGroupBox(i18n("General Properties"), frame); QGridLayout * genLayout = new QGridLayout(m_pGenGB); genLayout->setColumnStretch(1, 1); genLayout->setColumnStretch(3, 1); genLayout->addItem(new QSpacerItem(200, 0), 0, 1); genLayout->addItem(new QSpacerItem(200, 0), 0, 3); genLayout->setMargin(margin); genLayout->setSpacing(10); Dialog_Utils::makeLabeledEditField(genLayout, 0, m_pNameL, i18nc("operation name", "&Name:"), m_pNameLE, m_operation->name()); m_pRtypeL = new QLabel(i18n("&Type:"), m_pGenGB); genLayout->addWidget(m_pRtypeL, 0, 2); m_pRtypeCB = new KComboBox(true, m_pGenGB); genLayout->addWidget(m_pRtypeCB, 0, 3); m_pRtypeL->setBuddy(m_pRtypeCB); m_stereotypeWidget = new UMLStereotypeWidget(m_operation); m_stereotypeWidget->addToLayout(genLayout, 1); m_pAbstractCB = new QCheckBox(i18n("&Abstract operation"), m_pGenGB); m_pAbstractCB->setChecked(m_operation->isAbstract()); genLayout->addWidget(m_pAbstractCB, 2, 0); m_pStaticCB = new QCheckBox(i18n("Classifier &scope (\"static\")"), m_pGenGB); m_pStaticCB->setChecked(m_operation->isStatic()); genLayout->addWidget(m_pStaticCB, 2, 1); m_pQueryCB = new QCheckBox(i18n("&Query (\"const\")"), m_pGenGB); m_pQueryCB->setChecked(m_operation->getConst()); genLayout->addWidget(m_pQueryCB, 2, 2); m_visibilityEnumWidget = new VisibilityEnumWidget(m_operation, this); m_docWidget = new DocumentationWidget(m_operation, this); m_pParmsGB = new QGroupBox(i18n("Parameters"), frame); QVBoxLayout* parmsLayout = new QVBoxLayout(m_pParmsGB); parmsLayout->setMargin(margin); parmsLayout->setSpacing(10); // horizontal box contains the list box and the move up/down buttons QHBoxLayout* parmsHBoxLayout = new QHBoxLayout(); m_pParmsLW = new QListWidget(m_pParmsGB); m_pParmsLW->setContextMenuPolicy(Qt::CustomContextMenu); // the move up/down buttons (another vertical box) QVBoxLayout* buttonLayout = new QVBoxLayout(); m_pUpButton = new QToolButton(m_pParmsGB); m_pUpButton->setArrowType(Qt::UpArrow); m_pUpButton->setEnabled(false); buttonLayout->addWidget(m_pUpButton); m_pDownButton = new QToolButton(m_pParmsGB); m_pDownButton->setArrowType(Qt::DownArrow); m_pDownButton->setEnabled(false); buttonLayout->addWidget(m_pDownButton); KDialogButtonBox* buttonBox = new KDialogButtonBox(m_pParmsGB); buttonBox->addButton(i18n("Ne&w Parameter..."), KDialogButtonBox::ActionRole, this, SLOT(slotNewParameter())); m_pDeleteButton = buttonBox->addButton(i18n("&Delete"), KDialogButtonBox::ActionRole, this, SLOT(slotDeleteParameter())); m_pPropertiesButton = buttonBox->addButton(i18n("&Properties"), KDialogButtonBox::ActionRole, this, SLOT(slotParameterProperties())); parmsHBoxLayout->addWidget(m_pParmsLW); parmsHBoxLayout->addLayout(buttonLayout); parmsLayout->addLayout(parmsHBoxLayout); parmsLayout->addWidget(buttonBox); topLayout->addWidget(m_pGenGB); topLayout->addWidget(m_visibilityEnumWidget); topLayout->addWidget(m_docWidget); topLayout->addWidget(m_pParmsGB); m_pDeleteButton->setEnabled(false); m_pPropertiesButton->setEnabled(false); m_pUpButton->setEnabled(false); m_pDownButton->setEnabled(false); m_pRtypeCB->setDuplicatesEnabled(false); // only allow one of each type in box m_pRtypeCB->setCompletionMode(KGlobalSettings::CompletionPopup); // add the return types insertTypesSorted(m_operation->getTypeName()); // fill in parm list box UMLAttributeList list = m_operation->getParmList(); foreach (UMLAttribute* pAtt, list) { m_pParmsLW->addItem(pAtt->toString(Uml::SignatureType::SigNoVis)); }