--- as_slot.cpp 2002/12/17 14:08:33 1.67
+++ as_slot.cpp 2002/12/18 12:36:16 1.68
@@ -716,33 +716,36 @@
//
void Titraqform::validateData(int nRow, int nCol)
{
- if (m_pMaintable->numRows() > 0) {
- // Field strings to check for validity and process
- QString Textstat(m_pMaintable->text(nRow, TITRAQ_IDXSTATUS));
- QString Textline(m_pMaintable->text(nRow, TITRAQ_IDXLINE));
- QString Textuser(m_pMaintable->text(nRow, TITRAQ_IDXUSER));
- QString Textguid(m_pMaintable->text(nRow, TITRAQ_IDXGUID));
- QString Textcrc(m_pMaintable->text(nRow, TITRAQ_IDXCRC));
- QString Textrev(m_pMaintable->text(nRow, TITRAQ_IDXREV));
- QString Textdate(m_pMaintable->text(nRow, TITRAQ_IDXDATE));
- QString Textstart(m_pMaintable->text(nRow, TITRAQ_IDXSTART));
- QString Textfinish(m_pMaintable->text(nRow, TITRAQ_IDXFINISH));
- QString Textamount(m_pMaintable->text(nRow, TITRAQ_IDXAMOUNT));
- QString Texttask(m_pMaintable->text(nRow, TITRAQ_IDXTASK));
- QString Textremark(m_pMaintable->text(nRow, TITRAQ_IDXREMARK));
+ if (!m_pMaintable->numRows() > 0) { // If no rows exist then short circuit
+ m_pStatbar->message(trUtf8("Timesheet contains no data"), 4000);
+ return;
+ }
+
+ QString Statis = m_pMaintable->text(nRow, TITRAQ_IDXSTATUS); // Get text
- // Quick review of data validity, and set pixmaps accordingly
- if (Textuser.isEmpty() || Textguid.isEmpty() || Textcrc.isEmpty() ||
- Textrev.isEmpty() || Textdate.isEmpty() || Textstart.isEmpty() ||
- Textfinish.isEmpty() || Textamount.isEmpty() || Texttask.isEmpty()) {
- m_pStatusedit->setPixmap(QPixmap(s_kpcStaterror_xpm));
+ // Quick review of data validity, and set pixmaps accordingly
+ if (m_pMaintable->text(nRow, TITRAQ_IDXUSER).isEmpty() ||
+ m_pMaintable->text(nRow, TITRAQ_IDXGUID).isEmpty() ||
+ m_pMaintable->text(nRow, TITRAQ_IDXCRC).isEmpty() ||
+ m_pMaintable->text(nRow, TITRAQ_IDXREV).isEmpty() ||
+ m_pMaintable->text(nRow, TITRAQ_IDXDATE).isEmpty() ||
+ m_pMaintable->text(nRow, TITRAQ_IDXSTART).isEmpty() ||
+ m_pMaintable->text(nRow, TITRAQ_IDXFINISH).isEmpty() ||
+ m_pMaintable->text(nRow, TITRAQ_IDXAMOUNT).isEmpty() ||
+ m_pMaintable->text(nRow, TITRAQ_IDXTASK).isEmpty())
+ { // No K&R style to show where actual code begins
+ if (!Statis.startsWith(QString("E"))) { // Conditionally set pixmap to avoid overhead
+ m_pMaintable->setText(nRow, TITRAQ_IDXSTATUS, Statis.replace(0, sizeof(char), 'E'));
m_pMaintable->setPixmap(nRow, TITRAQ_IDXSTATUS, QPixmap(s_kpcStaterror_xpm));
}
- else {
- m_pStatusedit->setPixmap(QPixmap(s_kpcStatokay_xpm));
+ }
+ else {
+ if (!Statis.startsWith(QString("O"))) { // Conditionally set pixmap to avoid overhead
+ m_pMaintable->setText(nRow, TITRAQ_IDXSTATUS, Statis.replace(0, sizeof(char), 'O'));
m_pMaintable->setPixmap(nRow, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatokay_xpm));
}
}
+ m_pStatbar->message(trUtf8("Refreshed display"), 4000); // Announce result
}
//
|