FileListDialog::FileListDialog(QWidget* parent, QString const& _dialogTitle, QString const& _listTitle, char const * _filters[]) : QDialog(parent, "FileListDialog", TRUE), // TRUE = modal dialog list_(NULL), delButton_(NULL), fileDialog_(NULL), modified_(false) { resize(300, 200); setCaption(_dialogTitle); Q3VBoxLayout * topBox = new Q3VBoxLayout(this, 0, -1, "boxLayout"); Q3VGroupBox * fileBox = new Q3VGroupBox(this, "fileBox"); list_ = new Q3ListBox(fileBox, "list"); Q3HBox * fileButtonsBox = new Q3HBox(fileBox, "fileButtons"); QPushButton * addButton = new QPushButton("Add...", fileButtonsBox); delButton_ = new QPushButton("Remove", fileButtonsBox); fileDialog_ = new Q3FileDialog(this, "config file dialog", TRUE); topBox->addSpacing(10); topBox->addWidget(fileBox); fileBox->setTitle(_listTitle); topBox->addSpacing(10); Q3HBoxLayout * dialogButtonsBox = new Q3HBoxLayout(topBox, -1, "hBoxLayout"); QSpacerItem * dBSpace = new QSpacerItem(0, 0); QPushButton * okButton = new QPushButton("OK", this); QPushButton * cancelButton = new QPushButton("Cancel", this); topBox->addSpacing(5); dialogButtonsBox->addItem(dBSpace); dialogButtonsBox->addWidget(okButton); dialogButtonsBox->addSpacing(5); dialogButtonsBox->addWidget(cancelButton); dialogButtonsBox->addSpacing(5); okButton->setDefault(true); static const char * filters[3] = { "all files (*)", NULL }; fileDialog_->setCaption("File open dialog"); fileDialog_->setFilters((_filters == NULL)? filters : _filters); // connect the dialogs functionality connect(okButton, SIGNAL(clicked()), SLOT(accept())); connect(cancelButton, SIGNAL(clicked()), SLOT(reject())); connect(addButton, SIGNAL(clicked()), SLOT(add())); connect(delButton_, SIGNAL(clicked()), SLOT(del())); selectListItem(); }
woList::woList(QWidget * parent, const char * name, bool modal, Qt::WFlags fl) : QDialog( parent, name, modal, fl ) { setCaption(tr("Work Orders")); _woid = -1; _type = 0; if ( !name ) setName( "woList" ); Q3VBoxLayout *mainLayout = new Q3VBoxLayout( this, 5, 5, "woListLayout"); Q3HBoxLayout *topLayout = new Q3HBoxLayout( 0, 0, 7, "topLayout"); Q3VBoxLayout *warehouseLayout = new Q3VBoxLayout( 0, 0, 0, "warehouseLayout"); Q3VBoxLayout *buttonsLayout = new Q3VBoxLayout( 0, 0, 5, "buttonsLayout"); Q3VBoxLayout *listLayout = new Q3VBoxLayout( 0, 0, 0, "listLayout"); _warehouse = new WarehouseGroup(this, "_warehouse"); warehouseLayout->addWidget(_warehouse); QSpacerItem* spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Preferred); warehouseLayout->addItem(spacer); topLayout->addLayout(warehouseLayout); QSpacerItem* spacer_2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); topLayout->addItem(spacer_2); _close = new QPushButton(tr("&Cancel"), this, "_close"); buttonsLayout->addWidget(_close); _select = new QPushButton(tr("&Select"), this, "_select"); _select->setAutoDefault(TRUE); _select->setDefault(TRUE); buttonsLayout->addWidget(_select); topLayout->addLayout(buttonsLayout); mainLayout->addLayout(topLayout); QLabel *_workOrdersLit = new QLabel(tr("Work Orders:"), this, "_workOrdersLit"); listLayout->addWidget(_workOrdersLit); _wo = new XTreeWidget(this); _wo->setName("_wo"); listLayout->addWidget( _wo ); mainLayout->addLayout(listLayout); resize( QSize(484, 366).expandedTo(minimumSizeHint()) ); connect( _close, SIGNAL( clicked() ), this, SLOT( sClose() ) ); connect( _select, SIGNAL( clicked() ), this, SLOT( sSelect() ) ); connect( _wo, SIGNAL( itemSelected(int) ), this, SLOT( sSelect() ) ); connect( _warehouse, SIGNAL(updated()), this, SLOT( sFillList() ) ); setTabOrder(_warehouse, _wo); setTabOrder(_wo, _select); setTabOrder(_select, _close); setTabOrder(_close, _warehouse); _wo->setFocus(); _wo->addColumn(tr("W/O #"), _orderColumn, Qt::AlignLeft ); _wo->addColumn(tr("Status"), 40, Qt::AlignCenter ); _wo->addColumn(tr("Whs."), _whsColumn, Qt::AlignCenter ); _wo->addColumn(tr("Item Number"), _itemColumn, Qt::AlignLeft ); _wo->addColumn(tr("Description"), -1, Qt::AlignLeft ); }
salesOrderList::salesOrderList( QWidget* parent, const char* name, bool modal, Qt::WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "salesOrderList" ); _soheadid = -1; _type = (cSoOpen | cSoClosed | cSoReleased); setCaption(tr("Sales Orders")); Q3VBoxLayout *mainLayout = new Q3VBoxLayout(this, 5, 5, "mainLayout"); Q3VBoxLayout *warehouseLayout = new Q3VBoxLayout(0, 0, 0, "warehouseLayout"); Q3HBoxLayout *topLayout = new Q3HBoxLayout( 0, 0, 7, "topLayout"); Q3VBoxLayout *buttonsLayout = new Q3VBoxLayout(0, 0, 5, "buttonsLayout"); Q3VBoxLayout *listLayout = new Q3VBoxLayout( 0, 0, 0, "listLayout"); _warehouse = new WarehouseGroup(this, "_warehouse"); warehouseLayout->addWidget(_warehouse); QSpacerItem* spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Preferred); warehouseLayout->addItem(spacer); topLayout->addLayout(warehouseLayout); QSpacerItem* spacer_2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); topLayout->addItem(spacer_2); _close = new QPushButton(tr("&Cancel"), this, "_close"); buttonsLayout->addWidget(_close); _select = new QPushButton(tr("&Select"), this, "_select"); _select->setEnabled( FALSE ); _select->setDefault( TRUE ); buttonsLayout->addWidget(_select); topLayout->addLayout(buttonsLayout); mainLayout->addLayout(topLayout); QLabel *_salesOrdersLit = new QLabel(tr("Sales Orders:"), this, "_salesOrdersLit"); listLayout->addWidget(_salesOrdersLit); _so = new XTreeWidget(this); _so->setName("_so"); listLayout->addWidget(_so); mainLayout->addLayout(listLayout); resize( QSize(490, 390).expandedTo(minimumSizeHint()) ); connect( _close, SIGNAL( clicked() ), this, SLOT( sClose() ) ); connect( _select, SIGNAL( clicked() ), this, SLOT( sSelect() ) ); connect( _so, SIGNAL( itemSelected(int) ), _select, SLOT( animateClick() ) ); connect( _so, SIGNAL( valid(bool) ), _select, SLOT( setEnabled(bool) ) ); connect( _warehouse, SIGNAL(updated()), this, SLOT( sFillList() ) ); _so->addColumn(tr("Order #"), _orderColumn, Qt::AlignLeft ); _so->addColumn(tr("Customer"), -1, Qt::AlignLeft ); _so->addColumn(tr("P/O #"), _orderColumn, Qt::AlignLeft ); _so->addColumn(tr("Ordered"), _dateColumn, Qt::AlignCenter ); _so->addColumn(tr("Scheduled"), _dateColumn, Qt::AlignCenter ); setTabOrder(_warehouse, _so); setTabOrder(_so, _select); setTabOrder(_select, _close); setTabOrder(_close, _warehouse); _warehouse->setFocus(); }
AttachForm::AttachForm(QWidget *parent, const char *name, bool modal, Qt::WFlags f) : QDialog( parent, name, modal, f ), mNumSims(0), mLibReturnStatus(REG_SUCCESS), mSimGSHSelected(kNULL), mSimName(kNULL), mSimGSH(kNULL), mTable(kNULL), mFilterLineEdit(kNULL), mAttachButton(kNULL), mCancelButton(kNULL) { struct registry_contents content; int i, count; QString lString; bool ok; REG_DBGCON("AttachForm"); // set up arrays for ReG lib call // max list can be is REG_MAX_NUM_STEERED_SIM mSimName = new char *[REG_MAX_NUM_STEERED_SIM]; mSimGSH = new char *[REG_MAX_NUM_STEERED_SIM]; for (i=0; i<REG_MAX_NUM_STEERED_SIM; i++){ mSimName[i] = new char[REG_MAX_STRING_LENGTH + 1]; mSimGSH[i] = new char[REG_MAX_STRING_LENGTH + 1]; } SteererConfig *lConfig = ((SteererMainWindow *)parent)->getConfig(); // #ifdef REG_WSRF if( !(lConfig->mRegistrySecurity.passphrase[0]) ){ // Get the passphrase for the user's key if registry is using // SSL if( lConfig->mRegistrySecurity.use_ssl == REG_TRUE){ lString = QInputDialog::getText("RealityGrid Steerer", "Enter passphrase for X.509 key:", QLineEdit::Password, QString::null, &ok, this ); if ( !ok ) return; // Cancel if user didn't press OK } else{ lString = QInputDialog::getText("RealityGrid Steerer", "Enter passphrase for registry:", QLineEdit::Password, QString::null, &ok, this ); if ( !ok ) return; // Cancel if user didn't press OK } strncpy(lConfig->mRegistrySecurity.passphrase, lString.ascii(), REG_MAX_STRING_LENGTH); } // Now find out what's in the registry... //..._secure only available in steering library >= 2.0 mLibReturnStatus = Get_registry_entries_secure(lConfig->mTopLevelRegistry, &(lConfig->mRegistrySecurity), &content); // #else // mLibReturnStatus = Get_registry_entries((char *)(lConfig->mTopLevelRegistry.ascii()), // &content); // #endif // defined REG_WSRF if(mLibReturnStatus != REG_SUCCESS) return; count = 0; for (i=0; i<content.numEntries; i++){ if(!strcmp(content.entries[i].service_type, "SWS") || !strcmp(content.entries[i].service_type, "SGS")){ sprintf(mSimName[count], "%s %s %s", content.entries[i].application, content.entries[i].user, content.entries[i].start_date_time); sprintf(mSimGSH[count], "%s", content.entries[i].gsh); count++; } } Delete_registry_table(&content); mNumSims = count; // only continue if there is some info to show if(mNumSims>0) { this->setCaption( "Grid Attach" ); resize( 520, 350 ); // create the layouts for the form Q3VBoxLayout *lFormLayout = new Q3VBoxLayout(this, 10, 10, "attachformlayout"); Q3HBoxLayout *lFilterLayout = new Q3HBoxLayout(6, "filterlayout"); Q3VBoxLayout *lListLayout = new Q3VBoxLayout(6, "attachlistlayout"); Q3HBoxLayout *lButtonLayout = new Q3HBoxLayout(6, "attachbuttonlayout"); QSpacerItem* lSpacer = new QSpacerItem( 200, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); // create the list box for the applications on the grid lListLayout->addWidget(new TableLabel("Steerable Applications", this)); mTable = new Q3Table(0, 2, this); mTable->setSelectionMode( Q3Table::Single ); mTable->verticalHeader()->hide(); mTable->setLeftMargin(0); mTable->horizontalHeader()->setLabel(0, "Application"); mTable->horizontalHeader()->setLabel(1, "Handle"); connect(mTable, SIGNAL(valueChanged(int, int)), this, SLOT(editHandleSlot(int, int))); // populate the list box - each listboxitem holds array index // information - this is what is used by the calling code // (via aSimIndexSelected) to identify the aSimGSH selected for (int i=0; i<mNumSims; i++) { REG_DBGMSG1("mSimName ", mSimName[i]); REG_DBGMSG1("mSimGSH ", mSimGSH[i]); mTable->insertRows(mTable->numRows(),1); mTable->setItem(mTable->numRows()-1, 0, new Q3TableItem(mTable, Q3TableItem::Never, QString(mSimName[i]))); mTable->setItem(mTable->numRows()-1, 1, new Q3TableItem(mTable, Q3TableItem::WhenCurrent, QString(mSimGSH[i]))); } mTable->adjustColumn(0); mTable->adjustColumn(1); // We checked that mNumSims was > 0 earlier... mTable->selectRow(0); mFilterLineEdit = new QLineEdit(this, "containsfilter"); connect(mFilterLineEdit, SIGNAL(returnPressed()), this, SLOT(filterSlot())); // Initialize the filter with the user's username - might be handy mFilterLineEdit->setText(QString(getenv("USER"))); mFilterLineEdit->selectAll(); lFilterLayout->addWidget(new QLabel("Contains", this)); lFilterLayout->addWidget(mFilterLineEdit); lListLayout->addWidget(mTable); lListLayout->addLayout(lFilterLayout); mAttachButton = new QPushButton("Attach", this, "attachbutton"); mAttachButton->setMinimumSize(mAttachButton->sizeHint()); mAttachButton->setMaximumSize(mAttachButton->sizeHint()); mAttachButton->setAutoDefault(FALSE); QToolTip::add(mAttachButton, "Attach to selected application"); connect(mAttachButton, SIGNAL(clicked()), this, SLOT(attachSlot())); mCancelButton = new QPushButton("Cancel", this, "cancelbutton"); mCancelButton->setMinimumSize(mCancelButton->sizeHint()); mCancelButton->setMaximumSize(mCancelButton->sizeHint()); mCancelButton->setAutoDefault(FALSE); connect(mCancelButton, SIGNAL(clicked()), this, SLOT( reject())); lButtonLayout->addItem(lSpacer); lButtonLayout->addWidget(mCancelButton); lButtonLayout->addWidget(mAttachButton); lFormLayout->addLayout(lListLayout); lFormLayout->addLayout(lButtonLayout); }