Beispiel #1
0
void AddressCluster::init()
{
    _titleSingular = tr("Address");
    _titlePlural   = tr("Addresses");
    _query = "SELECT * FROM addr ";

    // handle differences between VirtualCluster and AddressCluster
    _grid->removeWidget(_label);
    _grid->removeWidget(_description);
    _grid->removeWidget(_list);
    _grid->removeWidget(_info);
    delete _description;

    _number        = new QLineEdit(this);
    _addrLit       = new QLabel(tr("Street\nAddress:"), this);
    _addr1         = new QLineEdit(this);
    _addr2         = new QLineEdit(this);
    _addr3         = new QLineEdit(this);
    _cityLit       = new QLabel(tr("City:"), this);
    _city          = new QLineEdit(this);
    _stateLit      = new QLabel(tr("State:"));
    _state         = new XComboBox(this);
    _postalcodeLit = new QLabel(tr("Postal Code:"));
    _postalcode    = new QLineEdit(this);
    _countryLit    = new QLabel(tr("Country:"));
    _country       = new XComboBox(this);
    _active        = new QCheckBox(tr("Active"), this);
    _mapper        = new XDataWidgetMapper(this);

    _number->hide();
    _addrLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _cityLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _stateLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _state->setEditable(true);
    _country->setEditable(true);
    _country->setMaximumWidth(250);
    _postalcodeLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _countryLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

    _grid->setMargin(0);
    _grid->setSpacing(2);
    _grid->addWidget(_label,         0, 0, 1, -1);
    _grid->addWidget(_addrLit,       1, 0, 3, 1);
    _grid->addWidget(_addr1,         1, 1, 1, -1);
    _grid->addWidget(_addr2,         2, 1, 1, -1);
    _grid->addWidget(_addr3,         3, 1, 1, -1);
    _grid->addWidget(_cityLit,       4, 0);
    _grid->addWidget(_city,          4, 1);
    _grid->addWidget(_stateLit,      4, 2);
    _grid->addWidget(_state,         4, 3);
    _grid->addWidget(_postalcodeLit, 4, 4);
    _grid->addWidget(_postalcode,    4, 5, 1, 2);
    _grid->addWidget(_countryLit,    5, 0);
    _grid->addWidget(_country,       5, 1, 1, 3);
    _grid->addWidget(_active,        5, 4);

    QHBoxLayout* hbox = new QHBoxLayout;
    hbox->addWidget(_list);
    hbox->addWidget(_info);
    _grid->addLayout(hbox, 5, 5, 1, -1, Qt::AlignRight);

    _grid->setColumnStretch(0, 0);
    _grid->setColumnStretch(1, 3);
    _grid->setColumnStretch(2, 0);
    _grid->setColumnStretch(3, 1);
    _grid->setColumnStretch(4, 0);
    _grid->setColumnStretch(5, 2);

    connect(_list,      SIGNAL(clicked()), this, SLOT(sEllipses()));
    connect(_info,      SIGNAL(clicked()), this, SLOT(sInfo()));
    connect(_addr1,     SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_addr2,     SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_addr3,     SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_city,      SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_state,     SIGNAL(editTextChanged(const QString&)), this, SIGNAL(changed()));
    connect(_postalcode,SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_country,   SIGNAL(editTextChanged(const QString&)), this, SIGNAL(changed()));

    setFocusProxy(_addr1);
    setFocusPolicy(Qt::StrongFocus);
    setLabel("");
    setActiveVisible(false);
    setInfoVisible(false); // TODO - remove this and implement Info button
    silentSetId(-1);
}
Beispiel #2
0
void ContactCluster::init()
{
    _ignoreSignals = false;

    _titleSingular = tr("Contact");
    _titlePlural = tr("Contacts");
    _query = "SELECT cntct.*, crmacct_name "
	     "FROM cntct LEFT OUTER JOIN crmacct ON (cntct_crmacct_id = crmacct_id) ";

    _layoutDone = false;
    _minimalLayout = false;

    _grid->removeWidget(_label);	// will be reinserted
    _grid->removeWidget(_description);
    _grid->removeWidget(_list);		// will be reinserted
    _grid->removeWidget(_info);		// will be reinserted
    delete _description;

    _grid->setMargin(0);
    _grid->setSpacing(2);

    //_numberBox          = new QHBoxLayout;
    //_numberBox->setSpacing(2);
    _nameBox		= new QHBoxLayout;
    _nameBox->setSpacing(2);
    _titleBox		= new QHBoxLayout;
    _titleBox->setSpacing(2);

    _numberLit		= new QLabel(tr("Number:"), this, "_numberLit");
    _number		= new QLineEdit(this, "_number");
  
    //_numberBox->addWidget(_numberLit,	0);
    //_numberBox->addWidget(_number,	0);
    
    _number->hide();
    _numberLit->hide();
    
    _honorific		= new XComboBox(this, "_honorific");
    _firstLit		= new QLabel(tr("First:"), this, "_firstLit");
    _first		= new QLineEdit(this, "_first");
    _lastLit		= new QLabel(tr("Last:"), this, "_lastLit");
    _last		= new QLineEdit(this, "_last");
    _initialsLit	= new QLabel(tr("Initials:"), this, "_initialsLit");
    _initials		= new QLineEdit(this, "_initials");
    _initials->resize(_initials->size().width() / 3, _initials->size().height());
    _titleLit		= new QLabel(tr("Job Title:"), this, "_titleLit");
    _title		= new QLineEdit(this, "_title");
    
    _mapper		= new XDataWidgetMapper(this);

    _nameBox->addWidget(_honorific,	0);
    _nameBox->addWidget(_firstLit,	0);
    _nameBox->addWidget(_first,		1);
    _nameBox->addWidget(_lastLit,	0);
    _nameBox->addWidget(_last,		2);
    _nameBox->addWidget(_initialsLit,	0);
    _nameBox->addWidget(_initials,	0);
    _nameBox->addWidget(_list,		0, Qt::AlignRight);
    _nameBox->addWidget(_info,		0, Qt::AlignRight);

    _titleBox->addWidget(_titleLit,	0);
    _titleBox->addWidget(_title,	2);

    _buttonBox 		= new QHBoxLayout;
    _crmAcct		= new CRMAcctCluster(this, "_crmAcct");
    _active		= new QCheckBox(tr("Active"), this, "_active");
    _buttonBox->addWidget(_crmAcct,	1, Qt::AlignLeft);
    _buttonBox->addStretch();
    _buttonBox->addWidget(_active,	0);

    _phoneLit		= new QLabel(tr("Voice:"), this, "_phoneLit");
    _phone		= new QLineEdit(this, "_phone");
    _phone2Lit		= new QLabel(tr("Alternate:"), this, "_phone2Lit");
    _phone2		= new QLineEdit(this, "_phone2");
    _faxLit		= new QLabel(tr("Fax:"), this, "_faxLit");
    _fax		= new QLineEdit(this, "_fax");
    _emailLit		= new QLabel(tr("E-Mail:"), this, "_emailLit");
    _email		= new QLineEdit(this, "_email");
    _webaddrLit		= new QLabel(tr("Web:"), this, "_webaddrLit");
    _webaddr		= new QLineEdit(this, "_webaddr");
    _address		= new AddressCluster(this, "_address");

    _numberLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    _firstLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _lastLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _titleLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _phoneLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _phone2Lit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _faxLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _emailLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _initialsLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _webaddrLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

    _honorific->setEditable(true);
    _honorific->setType(XComboBox::Honorifics);

    _crmAcct->setLabel(tr("CRM Account:"));

    layout();

    connect(_list,	SIGNAL(clicked()),	this, SLOT(sEllipses()));
    connect(_info,	SIGNAL(clicked()),	this, SLOT(sInfo()));

    connect(_honorific,	SIGNAL(newID(int)),		     this, SIGNAL(changed()));
    connect(_first,	SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_last,	SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_initials,	SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_crmAcct,	SIGNAL(newId(int)),		     this, SIGNAL(changed()));
    connect(_phone,	SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_phone2,	SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_fax,	SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_email,	SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_webaddr,	SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_address,	SIGNAL(changed()),	       this, SIGNAL(changed()));

    connect(_honorific,	SIGNAL(newID(int)),  this, SLOT(sCheck()));
    connect(_first,	SIGNAL(lostFocus()), this, SLOT(sCheck()));
    connect(_last,	SIGNAL(lostFocus()), this, SLOT(sCheck()));
    connect(_initials,	SIGNAL(lostFocus()), this, SLOT(sCheck()));
    connect(_crmAcct,	SIGNAL(newId(int)),  this, SLOT(sCheck()));
    connect(_phone,	SIGNAL(lostFocus()), this, SLOT(sCheck()));
    connect(_phone2,	SIGNAL(lostFocus()), this, SLOT(sCheck()));
    connect(_fax,	SIGNAL(lostFocus()), this, SLOT(sCheck()));
    connect(_email,	SIGNAL(lostFocus()), this, SLOT(sCheck()));
    connect(_webaddr,	SIGNAL(lostFocus()), this, SLOT(sCheck()));
    connect(_address,	SIGNAL(changed()),   this, SLOT(sCheck()));

    setFocusPolicy(Qt::StrongFocus);
    setFocusProxy(_honorific);
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    setLabel("");
    _limits = 0;
    setInfoVisible(false);	// TODO - remove this and implement Info button
    silentSetId(-1);
}
Beispiel #3
0
ShipmentCluster::ShipmentCluster(QWidget* pParent, const char* pName) :
    VirtualCluster(pParent, pName)
{
    addNumberWidget(new ShipmentClusterLineEdit(this, pName));
    setInfoVisible(false);
}