void
RegistrationForm::on_submitRegPushButton_clicked()
{
    if (!ValidateForm())
    {
        QMessageBox msgBox;
        QFont msgBoxFont;
        msgBoxFont.setPointSize(14);
        msgBoxFont.setBold(true);
        msgBox.setWindowTitle("Notice");
        msgBox.setFont(msgBoxFont);
        msgBox.setText("Please enter all required fields");
        msgBox.exec();
        return;
    }
    // All fields have been validated.
    // Create line to be appended file
    QString curLine; // Note: performance here is terrible:
    curLine += ui.firstNameLineEdit->text()
        + "," + ui.lastNameLineEdit->text()
        + "," + ui.gradeComboBox->currentText()
        + "," + ui.schoolLineEdit->text()
        + "," + ui.teenEmailLineEdit->text()
        + "," + ui.parentEmailLineEdit->text()
        + "," + ui.homePhoneLineEdit->text()
        + "," + ui.teenCellLineEdit->text()
        + "," + ui.birthdayLineEdit->text()
        + "," + ui.doyouhaveFacebookComboBox->currentText();
    // Append line to file
    if (!AppendLineToFile(&curLine))
    {
        QMessageBox msgBox;
        QFont msgBoxFont;
        msgBoxFont.setPointSize(14);
        msgBoxFont.setBold(true);
        msgBox.setWindowTitle("Error!");
        msgBox.setFont(msgBoxFont);
        msgBox.setText("Unable to write file: Please get nearest core member!");
        msgBox.exec();
        return;
    }
    // Clear form
    ClearForm();
    // Display "You're done!" box.
    QMessageBox msgBox;
    QFont msgBoxFont;
    msgBoxFont.setPointSize(14);
    msgBoxFont.setBold(true);
    msgBox.setWindowTitle("Contragulations!");
    msgBox.setFont(msgBoxFont);
    msgBox.setText("You have successfully registered!");
    msgBox.exec();
    return;
}
Esempio n. 2
0
CPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail(
    DownloadHints* pHints) {
  if (!m_pDocument)
    return FormAvailable;
  if (m_pLinearized) {
    DocAvailStatus nDocStatus = CheckLinearizedData(pHints);
    if (nDocStatus == DataError)
      return FormError;
    if (nDocStatus == DataNotAvailable)
      return FormNotAvailable;
  }

  if (!m_bLinearizedFormParamLoad) {
    CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
    if (!pRoot)
      return FormAvailable;

    CPDF_Object* pAcroForm = pRoot->GetObjectFor("AcroForm");
    if (!pAcroForm)
      return FormNotExist;

    m_objs_array.push_back(pAcroForm->GetDict());
    m_bLinearizedFormParamLoad = true;
  }

  std::vector<CPDF_Object*> new_objs_array;
  if (!AreObjectsAvailable(m_objs_array, false, pHints, new_objs_array)) {
    m_objs_array = new_objs_array;
    return FormNotAvailable;
  }

  m_objs_array.clear();
  const bool is_form_valid = ValidateForm();
  (void)is_form_valid;
  ASSERT(is_form_valid);
  return FormAvailable;
}