TcpConnector::TcpConnector(QWidget *parent) : QWidget(parent) , mConnect(false) { socket = new QTcpSocket(this); connect(socket , SIGNAL(connected()), this, SLOT(sConnect())); connect(socket, SIGNAL(disconnected()), this, SLOT(sDisconnect())); connect(socket, SIGNAL(readyRead()), this, SLOT(readAndSplit())); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(sError(QAbstractSocket::SocketError))); connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT( sState(QAbstractSocket::SocketState))); checkboxOnline = new QCheckBox(this); layout = new QHBoxLayout(this); layout->addWidget( checkboxOnline ); setLayout(layout); setEnabled(false); connect(checkboxOnline, SIGNAL(clicked(bool)), this, SLOT(online(bool))); checkboxOnline->setMinimumHeight( 19 ); checkboxOnline->setMaximumHeight( 19 ); setMinimumHeight( 19 ); setMaximumHeight( 19 ); checkboxOnline->setStyleSheet("margin: 0px; border: 1px red solid;"); setStyleSheet("margin: 0px; border: 1px red solid;"); layout->setMargin(0); }
void registration::sRegister(bool /*pretry*/) { struct { bool condition; QString msg; QWidget *widget; } error[] = { { _company->text().isEmpty(), tr("Your Company name is required."), _company}, { _contact->first().isEmpty() && _contact->last().isEmpty(), tr("Your Name is required."), _contact}, { _contact->emailAddress().isEmpty(), tr("Your E-Mail address is required."), _contact}, { _username->text().isEmpty(), tr("Your desired Username is required."), _username}, { _password->text().isEmpty(), tr("Your desired Password is required."), _password}, { _password->text() != _password2->text(), tr("The two versions of your Password do not match."), _password}, { true, QString(), 0 } }; int errIndex; for (errIndex = 0; ! error[errIndex].condition; errIndex++) ; if (! error[errIndex].msg.isEmpty()) { QMessageBox::critical(this, tr("Cannot Save CRM Account"), error[errIndex].msg); _wizardStack->setCurrentIndex(0); error[errIndex].widget->setFocus(); return; } int companygroupcnt = (_companyUrl->text().isEmpty() ? 0 : 1) + (_companyAddr->line1().isEmpty() ? 0 : 1) + (_companyAddr->city().isEmpty() ? 0 : 1) + (_companyAddr->state().isEmpty() ? 0 : 1) + (_companyAddr->postalCode().isEmpty() ? 0 : 1) + (_companyAddr->country().isEmpty() ? 0 : 1) + (_revenues->currentIndex() == 0 ? 0 : 1) + (_noemployees->currentIndex() == 0 ? 0 : 1) + (_sic->currentIndex() == 0 ? 0 : 1); if (companygroupcnt > 0 && companygroupcnt < 9 && // almost done! QMessageBox::question(this, tr("Do you want to tell us more?"), tr("You have submitted some of the data required " "for access to extended documentation and " "videos. Would you like to tell us a little " "more about your company to get this access?"), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No) == QMessageBox::Yes) { if (_companyUrl->text().isEmpty()) _companyUrl->setFocus(); else if (_companyAddr->line1().isEmpty()) _companyAddr->setFocus(); else if (_companyAddr->city().isEmpty()) _companyAddr->setFocus(); else if (_companyAddr->state().isEmpty()) _companyAddr->setFocus(); else if (_companyAddr->postalCode().isEmpty()) _companyAddr->setFocus(); else if (_companyAddr->country().isEmpty()) _companyAddr->setFocus(); else if (_revenues->currentIndex() == 0) _revenues->setFocus(); else if (_noemployees->currentIndex() == 0) _noemployees->setFocus(); else if (_sic->currentIndex() == 0) _sic->setFocus(); _wizardStack->setCurrentIndex(1); return; } if (_enduser->isChecked() && _gotvaryes->isChecked() && _varName->text().isEmpty()) { QMessageBox::warning(this, tr("Need Integrator/Consultant Name"), tr("You've told us that you have a systems " "integrator or consultant but haven't given us " "his/her name. Please do so.")); _wizardStack->setCurrentIndex(2); _varName->setFocus(); return; } if (_var->isChecked()) { if (_partnerlevel->currentIndex() == 0) { QMessageBox::warning(this, tr("Partner Level?"), tr("Please tell us what level of partnership you " "would like to pursue with xTuple.")); _wizardStack->setCurrentIndex(3); _partnerlevel->setFocus(); return; } if (! _whaterpquick->isChecked() && ! _whaterpms->isChecked() && ! _whaterpsage->isChecked() && ! _whaterpinfor->isChecked() && ! _whaterporacle->isChecked() && ! _whaterpsap->isChecked() && (! _whaterpotherpropLit->isChecked() || (_whaterpotherpropLit->isChecked() && _whaterpotherprop->text().isEmpty())) && (! _whaterpotherossLit->isChecked() || (_whaterpotherossLit->isChecked() && _whaterpotheross->text().isEmpty())) && ! _whatotherGroup->isChecked() && ! _whatotherErp->isChecked() && ! _whatotherConsulting->isChecked() && ! _whatotherSoftware->isChecked() && ! _whatotherAccounting->isChecked() && ! _whatotherSupport->isChecked() && ! _whatotherHardware->isChecked() && ! _whatotherNetwork->isChecked() && (! _whatotherOtherLit->isChecked() || (_whatotherOtherLit->isChecked() && _whatotherOther->text().isEmpty())) ) { QMessageBox::warning(this, tr("What do you sell or implement?"), tr("Please tell us what products and services you " "sell and what ERP or accounting software you " "currently implement.")); _wizardStack->setCurrentIndex(3); _whaterpquick->setFocus(); return; } } _wizardStack->setCurrentIndex(4); _progressLit->setText(tr("Building data to send")); QString request; request += "&" + encodedPair("company", _company->text()); request += "&" + encodedPair("honorific", _contact->honorific()); request += "&" + encodedPair("first_name", _contact->first()); request += "&" + encodedPair("last_name", _contact->last()); request += "&" + encodedPair("email", _contact->emailAddress()); request += "&" + encodedPair("member_name",_username->text()); request += "&" + encodedPair("jobtitle", _contact->title()); request += "&" + encodedPair("telephone", _contact->phone()); request += "&" + encodedPair("fax", _contact->fax()); request += "&" + encodedPair("password", _password->text()); request += "&" + encodedPair("addr_1", _companyAddr->line1()); request += "&" + encodedPair("addr_2", _companyAddr->line2()); request += "&" + encodedPair("addr_3", _companyAddr->line3()); request += "&" + encodedPair("city", _companyAddr->city()); request += "&" + encodedPair("state", _companyAddr->state()); request += "&" + encodedPair("country", _companyAddr->country()); request += "&" + encodedPair("zip", _companyAddr->postalCode()); _progress->setValue(1); request += "&" + encodedPair("revenues", _revenues->currentText()); request += "&" + encodedPair("num_employees",_noemployees->currentText()); request += "&" + encodedPair("sic_code", _sic->currentText()); request += "&" + encodedPair("cur_mansoft", _erp->text()); request += "&" + encodedPair("cur_accsoft", _accounting->text()); request += "&" + encodedPair("bigchall", _bigchallenge->currentText()); request += "&" + encodedPair("pref_client", _client->currentText()); request += "&" + encodedPair("pref_server", _server->currentText()); request += "&" + encodedPair("pref_db", _db->currentText()); request += "&" + encodedPair("have_integrator", (_gotvaryes->isChecked() ? "Yes" : "No")); request += "&" + encodedPair("var_name", _varName->text()); request += "&" + encodedPair("erp_timeframe", _timeframe->currentText()); request += "&" + encodedPair("erp_budget", _budget->currentText()); request += "&" + encodedPair("provider_type", _partnerlevel->currentText()); _progress->setValue(2); QStringList whaterp; if (_whaterpquick->isChecked()) whaterp.append("Quickbooks"); if (_whaterpms->isChecked()) whaterp.append("Microsoft"); if (_whaterpsage->isChecked()) whaterp.append("Sage"); if (_whaterpinfor->isChecked()) whaterp.append("Infor"); if (_whaterporacle->isChecked()) whaterp.append("Oracle"); if (_whaterpsap->isChecked()) whaterp.append("SAP"); if (! _whaterpotherprop->text().isEmpty()) whaterp.append(_whaterpotherprop->text()); if (! _whaterpotheross->text().isEmpty()) whaterp.append(_whaterpotheross->text()); request += "&" + encodedPair("cur_erp_imp", whaterp.join(", ")); QStringList whatother; if (_whatotherErp->isChecked()) whatother.append("ERP"); if (_whatotherConsulting->isChecked()) whatother.append("Consulting"); if (_whatotherSoftware->isChecked()) whatother.append("Software"); if (_whatotherAccounting->isChecked()) whatother.append("Accounting"); if (_whatotherSupport->isChecked()) whatother.append("Support"); if (_whatotherHardware->isChecked()) whatother.append("Hardware"); if (_whatotherNetwork->isChecked()) whatother.append("Network"); if (! _whatotherOther->text().isEmpty()) whatother.append(_whatotherOther->text()); request += "&" + encodedPair("other_products", whatother.join(", ")); request += "&" + encodedPair("other_info", _otherInfo->text()); request += "&" + encodedPair("website", _companyUrl->text()); request += "&" + encodedPair("manpro",(_enduser->isChecked() ? "Yes" : "No")); request += "&" + encodedPair("solpro",(_var->isChecked() ? "Yes" : "No")); _progress->setValue(3); QHttpRequestHeader header("POST", "/pbregister.php"); header.setValue("Host", "www.xtuple.com"); header.setContentType("application/x-www-form-urlencoded"); _postreq = new QHttp("www.xtuple.com", QHttp::ConnectionModeHttp); _postreq->setHost("www.xtuple.com"); _postreq->request(header, request.utf8()); _xml->setText(request); sState(QHttp::Unconnected); _register->setEnabled(false); _next->setEnabled(false); _back->setEnabled(false); _later->setEnabled(false); _cancel->setEnabled(true); connect(_postreq,SIGNAL(done(bool)), this,SLOT(sDone(bool))); connect(_postreq,SIGNAL(dataReadProgress(int,int)),this,SLOT(sRead(int,int))); connect(_postreq,SIGNAL(dataSendProgress(int,int)),this,SLOT(sSent(int,int))); connect(_postreq,SIGNAL(stateChanged(int)), this,SLOT(sState(int))); _progress->setValue(4); }