2
0
fiffty-50 4 жил өмнө
parent
commit
f2e8b93e18

+ 1 - 1
openPilotLog.pro.user

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.11.0, 2020-11-08T10:38:17. -->
+<!-- Written by QtCreator 4.11.0, 2020-11-08T18:25:34. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>

+ 4 - 7
src/gui/dialogues/newpilot.cpp

@@ -36,11 +36,10 @@ static const auto EMPLOYEENR_VALID = QPair<QString, QRegularExpression> {
     "employeeidLineEdit", QRegularExpression("\\w+")};
 
 
-
 static const auto LINE_EDIT_VALIDATORS = QVector({FIRSTNAME_VALID, LASTNAME_VALID,
                                            PHONE_VALID,     EMAIL_VALID,
                                            COMPANY_VALID,     EMPLOYEENR_VALID});
-
+// For creating a new entry
 NewPilot::NewPilot(Db::editRole edRole, QWidget *parent) :
     QDialog(parent),
     ui(new Ui::NewPilot)
@@ -49,7 +48,7 @@ NewPilot::NewPilot(Db::editRole edRole, QWidget *parent) :
     ui->setupUi(this);
     setupValidators();
 }
-
+// For editing an existing entry
 NewPilot::NewPilot(Pilot existingEntry, Db::editRole edRole, QWidget *parent) :
     QDialog(parent),
     ui(new Ui::NewPilot)
@@ -58,6 +57,7 @@ NewPilot::NewPilot(Pilot existingEntry, Db::editRole edRole, QWidget *parent) :
     role = edRole;
     ui->setupUi(this);
     setupValidators();
+
     formFiller();
     ui->piclastnameLineEdit->setFocus();
 }
@@ -69,7 +69,6 @@ NewPilot::~NewPilot()
 
 void NewPilot::on_buttonBox_accepted()
 {
-    DEB("accepted.");
     if (ui->piclastnameLineEdit->text().isEmpty() || ui->picfirstnameLineEdit->text().isEmpty()) {
         auto mb = new QMessageBox(this);
         mb->setText("Last Name and First Name are required.");
@@ -126,13 +125,11 @@ void NewPilot::submitForm()
     displayName.append(ui->picfirstnameLineEdit->text().left(1));
     displayName.append(QLatin1Char('.'));
     newData.insert("displayname",displayName);
-    DEB("New Data: " << newData);
-    DEB("Role: " << role);
     //create db object
     switch (role) {
     case Db::createNew: {
         auto newEntry = Pilot(newData);;
-        DEB("New Object: ");
+        DEB("New Object: " << newEntry);
         newEntry.commit();
         break;
     }

+ 3 - 2
src/gui/dialogues/newpilot.ui

@@ -130,6 +130,7 @@
  <tabstops>
   <tabstop>picfirstnameLineEdit</tabstop>
   <tabstop>piclastnameLineEdit</tabstop>
+  <tabstop>companyLineEdit</tabstop>
   <tabstop>aliasLineEdit</tabstop>
   <tabstop>employeeidLineEdit</tabstop>
   <tabstop>phoneLineEdit</tabstop>
@@ -144,8 +145,8 @@
    <slot>reject()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>315</x>
-     <y>410</y>
+     <x>324</x>
+     <y>442</y>
     </hint>
     <hint type="destinationlabel">
      <x>286</x>