CodChangeMsgDialog::CodChangeMsgDialog(QWidget * parent, ColMsg * m)
    : QDialog(parent/*, "Communication message dialog", TRUE*/), msg(m)
{
    setWindowTitle(tr("Communicationg message dialog"));

    QVBoxLayout * vbox = new QVBoxLayout(this);
    QHBoxLayout * hbox;

    vbox->setMargin(5);

    hbox = new QHBoxLayout();
    vbox->addLayout(hbox);
    hbox->setMargin(5);

    SmallPushButton * b = new SmallPushButton(tr("message :"), this);

    hbox->addWidget(b);
    connect(b, SIGNAL(clicked()), this, SLOT(menu_op()));

    edoper = new QComboBox(this);
    edoper->setEditable(true);
    edoper->setAutoCompletion(completion());

    if (msg->operation == 0)
        edoper->addItem(msg->explicit_operation);
    else
        edoper->addItem(msg->operation->definition(TRUE, FALSE));

    CodObjCanvas * from;
    CodObjCanvas * to;

    msg->in->get_from_to(from, to, msg->is_forward);

    // gets operations
    cl = to->get_class();

    if (cl != 0) {
        cl->get_opers(opers, list);
        edoper->addItems(list);

        if (!cl->is_writable())
            cl = 0;
    }

    edoper->setCurrentIndex(0);

    QSizePolicy sp = edoper->sizePolicy();

    sp.setHorizontalPolicy(QSizePolicy::Expanding);
    edoper->setSizePolicy(sp);

    hbox->addWidget(edoper);

    // ok & cancel

    hbox = new QHBoxLayout();
    vbox->addLayout(hbox);
    hbox->setMargin(5);
    QPushButton * ok = new QPushButton(tr("&OK"), this);
    QPushButton * cancel = new QPushButton(tr("&Cancel"), this);
    QSize bs(cancel->sizeHint());

    ok->setDefault(TRUE);
    ok->setFixedSize(bs);
    cancel->setFixedSize(bs);

    hbox->addWidget(ok);
    hbox->addWidget(cancel);

    connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
    connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
}