ShiptoCluster::ShiptoCluster(QWidget *pParent, const char *pName) : VirtualCluster(pParent, pName) { addNumberWidget(new ShiptoEdit(this, pName)); setLabel(tr("Ship To#")); setNameVisible(true); setDescriptionVisible(true); setCustid(-1); }
ShiptoEdit::ShiptoEdit(QWidget *pParent, const char *pName) : VirtualClusterLineEdit(pParent, "shiptoinfo", "shipto_id", "shipto_num", "shipto_name", "addr_line1", " (false) ", pName, "shipto_active") { setTitles(tr("Ship To Address"), tr("Ship To Addresses")); setUiName("shipTo"); setEditPriv("MaintainShiptos"); setViewPriv("ViewShiptos"); setNewPriv("MaintainShiptos"); _custid = 0; setCustid(-1); _query = "SELECT shipto_id AS id, shipto_num AS number, shipto_name AS name, " " addr_line1 AS description, " " (addr_city || ', ' || addr_state || ' ' || addr_postalcode) AS csv," " shipto_active AS active " "FROM shiptoinfo " " LEFT OUTER JOIN addr ON (shipto_addr_id=addr_id) " "WHERE (true) "; }
ShiptoCluster::ShiptoCluster(QWidget *pParent, const char *name) : QWidget(pParent, name) { // Create the component Widgets QHBoxLayout *_layoutMain = new QHBoxLayout( this, 0, 5, "_layoutMain"); QVBoxLayout *_layoutLit = new QVBoxLayout( 0, 0, 0, "_layoutLit"); QVBoxLayout *_layoutData = new QVBoxLayout( 0, 0, 0, "_layoutData"); QHBoxLayout *_layoutShipto = new QHBoxLayout( 0, 0, 0, "_layoutShipto"); QHBoxLayout *_layoutShiptoNumber = new QHBoxLayout( 0, 0, 7, "_layoutShiptoNumber"); QLabel *_shiptoNumberLit = new QLabel(tr("Ship-To #:"), this, "_shiptoNumberLit"); _shiptoNumberLit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); _shiptoNumberLit->setAlignment( int( Qt::AlignVCenter | Qt::AlignRight ) ); QSize size = _shiptoNumberLit->minimumSize(); size.setHeight(28); _shiptoNumberLit->setMinimumSize(size); _layoutLit->addWidget( _shiptoNumberLit ); QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); _layoutLit->addItem( spacer ); _layoutMain->addLayout( _layoutLit ); _shiptoNumber = new ShiptoEdit( this, "_shiptoNumber" ); _shiptoNumber->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _layoutShiptoNumber->addWidget( _shiptoNumber ); _list = new QPushButton(tr( "..." ), this, "_list"); _list->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); #ifndef Q_WS_MAC _list->setMaximumWidth(25); #endif _list->setFocusPolicy(Qt::NoFocus); _layoutShiptoNumber->addWidget( _list ); _layoutShipto->addLayout( _layoutShiptoNumber ); QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); _layoutShipto->addItem( spacer_2 ); _layoutData->addLayout( _layoutShipto ); _shiptoName = new QLabel(this, "_shiptoName"); _shiptoName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _shiptoName->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); _layoutData->addWidget( _shiptoName ); _shiptoAddress1 = new QLabel( this, "_shiptoAddress1" ); _shiptoAddress1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _shiptoAddress1->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); _layoutData->addWidget( _shiptoAddress1 ); _layoutMain->addLayout( _layoutData ); // Make some internal connections connect(_list, SIGNAL(clicked()), this, SLOT(sList())); connect(_shiptoNumber, SIGNAL(requestList()), this, SLOT(sList())); connect(_shiptoNumber, SIGNAL(nameChanged(const QString &)), _shiptoName, SLOT(setText(const QString &))); connect(_shiptoNumber, SIGNAL(address1Changed(const QString &)), _shiptoAddress1, SLOT(setText(const QString &))); connect(_shiptoNumber, SIGNAL(disableList(bool)), _list, SLOT(setDisabled(bool))); connect(_shiptoNumber, SIGNAL(newId(int)), this, SIGNAL(newId(int))); connect(_shiptoNumber, SIGNAL(valid(bool)), this, SIGNAL(valid(bool))); connect(_shiptoNumber, SIGNAL(newCustid(int)), this, SIGNAL(newCustid(int))); setFocusProxy(_shiptoNumber); setCustid(-1); }