예제 #1
0
/**
 * Setup dialog operations list.
 */
void SelectOperationDialog::setupOperationsList()
{
    m_pOpCB->clear();
    UMLOperationList list = m_classifier->getOpList(true);
    if (list.count() > 0)
        m_pOpCB->insertItem(0, QString());
    qSort(list.begin(), list.end(), caseInsensitiveLessThan);
    foreach(UMLOperation * obj, list) {
        QString s = obj->toString(Uml::SignatureType::SigNoVis);
        m_pOpCB->insertItem(list.count(), s);
        m_pOpCB->completionObject()->addItem(s);
    }
예제 #2
0
SelectOpDlg::SelectOpDlg(UMLView * parent, UMLClassifier * c)
        : KDialog( parent)
{
    setCaption( i18n("Select Operation") );
    setButtons( Ok | Cancel );
    setDefaultButton( Yes );
    setModal( true );
    showButtonSeparator( true );

    QFrame *frame = new QFrame( this );
    setMainWidget( frame );

    m_pView = parent;
    QVBoxLayout * topLayout = new QVBoxLayout(frame);

    m_pOpGB = new QGroupBox(i18n("Select Operation"), frame);
    topLayout->addWidget(m_pOpGB);

    QGridLayout * mainLayout = new QGridLayout(m_pOpGB);
    mainLayout->setSpacing(spacingHint());
    mainLayout->setMargin(fontMetrics().height());

    Dialog_Utils::makeLabeledEditField( m_pOpGB, mainLayout, 0,
                                    m_pSeqL, i18n("Sequence number:"),
                                    m_pSeqLE );

    m_pOpRB = new QRadioButton(i18n("Class operation:"), m_pOpGB);
    connect(m_pOpRB, SIGNAL(clicked()), this, SLOT(slotSelectedOp()));
    mainLayout->addWidget(m_pOpRB, 1, 0);

    m_pOpCB = new KComboBox(m_pOpGB);
    m_pOpCB->setCompletionMode( KGlobalSettings::CompletionPopup );
    m_pOpCB->setDuplicatesEnabled(false); // only allow one of each type in box
    mainLayout->addWidget(m_pOpCB, 1, 1);

    m_pCustomRB = new QRadioButton(i18n("Custom operation:"), m_pOpGB);
    connect(m_pCustomRB, SIGNAL(clicked()), this, SLOT(slotSelectedCustom()));
    mainLayout->addWidget(m_pCustomRB, 2, 0);

    m_pOpLE = new KLineEdit(m_pOpGB);
    mainLayout->addWidget(m_pOpLE, 2, 1);

    UMLOperationList list = c->getOpList(true);
    foreach (UMLOperation* obj, list ) {
        insertOperation( obj->toString(Uml::st_SigNoVis), list.count() );
    }