19 setWindowTitle( tr(
"Manage Investigators" ) );
20 setAttribute( Qt::WA_DeleteOnClose );
23 QGridLayout*
main =
new QGridLayout(
this );
24 main->setContentsMargins( 2, 2, 2, 2 );
25 main->setSpacing( 2 );
28 QLabel* lb_search =
us_label( tr(
"Search:" ) );
29 main->addWidget( lb_search, row, 0 );
32 connect(
le_search, SIGNAL( textChanged(
const QString& ) ),
38 connect(
lw_names, SIGNAL( itemDoubleClicked( QListWidgetItem* ) ),
40 main->addWidget(
lw_names, row, 0, 4, 2 );
44 if ( DB.isEmpty() ) DB <<
"Undefined";
45 QLabel* lb_DB =
us_banner( tr(
"Database: " ) + DB.at( 0 ) );
46 main->addWidget( lb_DB, row++, 0, 1, 2 );
49 QLabel* lb_invID =
us_label( tr(
"Investigator ID:" ) );
50 main->addWidget( lb_invID, row, 0 );
54 main->addWidget(
le_invID, row++, 1 );
57 QLabel* lb_invGuid =
us_label( tr(
"Global Identifier:" ) );
58 main->addWidget( lb_invGuid, row, 0 );
61 gray.setColor( QPalette::Base, QColor( 0xe0, 0xe0, 0xe0 ) );
70 lb_invGuid->setVisible(
false );
75 QLabel* lb_lname =
us_label( tr(
"Last Name:" ) );
76 main->addWidget( lb_lname, row, 0 );
79 main->addWidget(
le_lname, row++, 1 );
82 QLabel* lb_fname =
us_label( tr(
"First Name:" ) );
83 main->addWidget( lb_fname, row, 0 );
86 main->addWidget(
le_fname, row++, 1 );
89 QLabel* lb_address =
us_label( tr(
"Address:" ) );
90 main->addWidget( lb_address, row, 0 );
96 QLabel* lb_city =
us_label( tr(
"City:" ) );
97 main->addWidget( lb_city, row, 0 );
100 main->addWidget(
le_city, row++, 1 );
103 QLabel* lb_state =
us_label( tr(
"State:" ) );
104 main->addWidget( lb_state, row, 0 );
107 main->addWidget(
le_state, row++, 1 );
110 QLabel* lb_zip =
us_label( tr(
"Zip:" ) );
111 main->addWidget( lb_zip, row, 0 );
114 main->addWidget(
le_zip, row++, 1 );
117 QLabel* lb_phone =
us_label( tr(
"Phone:" ) );
118 main->addWidget( lb_phone, row, 0 );
121 main->addWidget(
le_phone, row++, 1 );
124 QLabel* lb_email =
us_label( tr(
"Email:" ) );
125 main->addWidget( lb_email, row, 0 );
130 QFontMetrics fm(
le_email->font() );
131 le_email->setMinimumWidth( fm.maxWidth() * 10 );
133 main->addWidget(
le_email, row++, 1 );
136 QLabel* lb_org =
us_label( tr(
"Organization:" ) );
137 main->addWidget( lb_org, row, 0 );
140 main->addWidget(
le_org, row++, 1 );
143 QHBoxLayout* buttons1 =
new QHBoxLayout;
145 connect( pb_queryDB, SIGNAL( clicked() ), SLOT(
queryDB() ) );
146 buttons1->addWidget( pb_queryDB, row );
151 main->addLayout( buttons1, row++, 0, 1, 2 );
154 QBoxLayout* buttons2 =
new QHBoxLayout;
157 connect( pb_reset, SIGNAL( clicked() ), SLOT(
reset() ) );
158 buttons2->addWidget( pb_reset );
161 connect( pb_help, SIGNAL( clicked() ), SLOT(
help() ) );
162 buttons2->addWidget( pb_help );
164 QPushButton* pb_close;
169 connect( pb_cancel, SIGNAL( clicked() ), SLOT( reject() ) );
170 buttons2->addWidget( pb_cancel );
177 connect( pb_close, SIGNAL( clicked() ), SLOT(
close() ) );
178 buttons2->addWidget( pb_close );
180 main->addLayout( buttons2, row++, 0, 1, 2 );
210 QMessageBox::information(
this,
211 tr(
"DB Connection Problem" ),
212 tr(
"There was an error connecting to the database:\n" )
220 query <<
"get_people" <<
"%" +
le_search->text() +
"%";
234 lw_names->addItem(
new QListWidgetItem(
235 "InvID: (" + QString::number( data.invID ) +
"), " +
236 data.lastName +
", " + data.firstName ) );
244 QMessageBox::information(
this,
246 tr(
"You must select an Investigator from the DB to update." ) );
254 int response = QMessageBox::question(
this,
255 tr(
"Update the entry?" ),
256 tr(
"Clicking 'OK' will update the information\n"
257 "for this investigator in the database." ),
258 QMessageBox::Ok, QMessageBox::Cancel );
260 if ( response == QMessageBox::Ok )
268 QMessageBox::warning(
this,
269 tr(
"Database Error" ),
270 tr(
"US_Investigator::connectDB: Could not open DB\n" ) +
278 QString cipher = info.at( 7 );
279 QString iv = info.at( 8 );
283 query <<
"update_person";
301 QMessageBox::information(
this,
303 tr(
"The entry was updated.\n" ) );
307 QMessageBox::warning(
this,
308 tr(
"Database Error" ),
309 tr(
"US_Investigator::update_person: Could not update DB\n" ) +
322 QRegExp(
".*" + s +
".*", Qt::CaseInsensitive ) ) ||
324 QRegExp(
".*" + s +
".*", Qt::CaseInsensitive ) ) )
325 lw_names->addItem(
new QListWidgetItem(
326 "InvID: (" + QString::number(
investigators[ i ].invID ) +
"), " +
334 QString entry = item->text();
337 int left = entry.indexOf(
'(' ) + 1;
338 int right = entry.indexOf(
')' );
339 QString invID = entry.mid( left, right - left );
347 QMessageBox::information(
this,
348 tr(
"DB Connection Problem" ),
349 tr(
"There was an error connecting to the database:\n" )
355 query <<
"get_person_info" << invID;
397 QMessageBox::information(
this,
399 tr(
"Select an investigator before 'Accept':\n" ) );
417 US_WidgetsDialog::close();
454 QString missing =
"";
455 QRegExp strip(
"^\\s*(.*)\\s*$" );
457 if (
le_lname->text().replace( strip,
"\\1" ).isEmpty() )
458 missing += tr(
"\nLast Name" );
460 if (
le_fname->text().replace( strip,
"\\1" ).isEmpty() )
461 missing += tr(
"\\First Name" );
463 if (
le_address->text().replace( strip,
"\\1" ).isEmpty() )
464 missing += tr(
"\nAddress" );
466 if (
le_city->text().replace( strip,
"\\1" ).isEmpty() )
467 missing += tr(
"\nCity" );
469 if (
le_state->text().replace( strip,
"\\1" ).isEmpty() )
470 missing += tr(
"\nState" );
472 if (
le_zip->text().replace( strip,
"\\1" ).isEmpty() )
473 missing += tr(
"\nZip code" );
475 if (
le_phone->text().replace( strip,
"\\1" ).isEmpty() )
476 missing += tr(
"\nPhone" );
478 if (
le_email->text().replace( strip,
"\\1" ).isEmpty() )
479 missing += tr(
"\nEmail" );
481 if (
le_org->text().replace( strip,
"\\1" ).isEmpty() )
482 missing += tr(
"\nOfganization" );
487 QMessageBox::information(
this,
489 tr(
"Update the following fields before committing data:\n" ) +
510 QMessageBox::information(
this,
512 tr(
"Nothing has changed." ) );