--- as_slot.cpp 2003/02/03 21:41:42 1.108
+++ as_slot.cpp 2003/02/04 19:30:31 1.109
@@ -322,9 +322,9 @@
// Check modification state of current data
if (m_pMaintable->isDirty()) {
- nResult = QMessageBox::information(this, trUtf8(TITRAQ_APPTITLE),
- trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"),
- trUtf8("&Discard"), trUtf8("Cancel"), 0, 2);
+ nResult = QMessageBox::information(this, QString(TITRAQ_APPTITLE)
+ + ' ' + asgui_version.v_short, trUtf8(TITRAQ_SAVEFIRST),
+ trUtf8("&Save"), trUtf8("&Discard"), trUtf8("Cancel"), 0, 2);
switch (nResult) {
case 0: // First button selected, so save first
@@ -365,9 +365,9 @@
// not be raised if no open timesheet exists or if it was just serialized.
//
if (m_pMaintable->isDirty()) { // Check modification state
- nResult = QMessageBox::information(this, trUtf8(TITRAQ_APPTITLE),
- trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"),
- trUtf8("&Discard"), trUtf8("Cancel"), 0, 2);
+ nResult = QMessageBox::information(this, QString(TITRAQ_APPTITLE)
+ + ' ' + asgui_version.v_short, trUtf8(TITRAQ_SAVEFIRST),
+ trUtf8("&Save"), trUtf8("&Discard"), trUtf8("Cancel"), 0, 2);
switch (nResult) {
case 0: // Save first
@@ -489,8 +489,9 @@
QString Filestring = QFileDialog::getSaveFileName(Openas, trUtf8("Accounting Data (*.as);;Text files (*.txt);;All Files (*)"), this, trUtf8("ChooserDialog"), trUtf8("Choose a file to save"), NULL, false);
if (!Filestring.isEmpty()) {
if (QFile::exists(Filestring)) {
- nResult = QMessageBox::warning(this, trUtf8(TITRAQ_APPTITLE),
- trUtf8(TITRAQ_OVERWRITE), trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1);
+ nResult = QMessageBox::warning(this, QString(TITRAQ_APPTITLE)
+ + ' ' + asgui_version.v_short, trUtf8(TITRAQ_OVERWRITE),
+ trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1);
switch (nResult) {
case 0: // Overwrite contents
this->setFilename(Filestring);
@@ -532,8 +533,9 @@
QString Filestring = QFileDialog::getSaveFileName(Openas, trUtf8("Accounting Data (*.as);;Text files (*.txt);;All Files (*)"), this, trUtf8("ChooserDialog"), trUtf8("Choose a file to save"), NULL, false);
if (!Filestring.isEmpty()) {
if (QFile::exists(Filestring)) {
- nResult = QMessageBox::warning(this, trUtf8(TITRAQ_APPTITLE),
- trUtf8(TITRAQ_OVERWRITE), trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1);
+ nResult = QMessageBox::warning(this, QString(TITRAQ_APPTITLE)
+ + ' ' + asgui_version.v_short, trUtf8(TITRAQ_OVERWRITE),
+ trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1);
switch (nResult) {
case 0: // Overwrite contents
this->setFilename(Filestring);
@@ -573,9 +575,9 @@
// Check modification state of current data
if (m_pMaintable->isDirty()) {
- nResult = QMessageBox::information(this, trUtf8(TITRAQ_APPTITLE),
- trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"),
- trUtf8("&Discard"), trUtf8("Cancel"), 0, 2);
+ nResult = QMessageBox::information(this, QString(TITRAQ_APPTITLE)
+ + ' ' + asgui_version.v_short, trUtf8(TITRAQ_SAVEFIRST),
+ trUtf8("&Save"), trUtf8("&Discard"), trUtf8("Cancel"), 0, 2);
switch (nResult) { // Maybe save before closing
case 0: // Save first
@@ -594,7 +596,7 @@
if (!m_pMaintable->isDirty()) { // Check again
// Fall through to implicit close code
- this->setCaption(TITRAQ_APPTITLE);
+ this->setCaption(QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short);
try { // There might be problems, so wrap these last ops with error handling
QString Lightsout; // It's late, go to bed
if (this->isOpen())
@@ -853,19 +855,39 @@
m_pRemark->setText(Textremark);
m_pTasks->setCurrentText(Texttask);
- // Members not suitable for empty string text
- if (!Textdate.isEmpty())
+ // Date field not suitable for empty string text
+ if (Textdate == ".")
+ m_pDateedit->setDate(QDate::currentDate());
+ else if (Textdate.isEmpty())
+ m_pDateedit->setDate(QDate::fromString("0000-00-00", Qt::ISODate));
+ else
m_pDateedit->setDate(QDate::fromString(Textdate, Qt::ISODate));
+
+ // Start time not suitable for empty string text
+ if (Textstart == ".")
+ m_pStarttime->setTime(QTime::currentTime());
+ else if (Textstart.isEmpty())
+ m_pStarttime->setTime(QTime::QTime(0, 0));
else
- m_pDateedit->setDate(QDate::currentDate());
- if (!Textstart.isEmpty())
m_pStarttime->setTime(QTime::fromString(Textstart, Qt::ISODate));
+
+ // Finish time not suitable for empty string text
+ if (Textfinish == ".")
+ m_pEndtime->setTime(QTime::currentTime());
+ else if (Textfinish.isEmpty())
+ m_pEndtime->setTime(QTime::QTime(0, 0));
else
- m_pStarttime->setTime(QTime::QTime(0, 0));
- if (!Textfinish.isEmpty())
m_pEndtime->setTime(QTime::fromString(Textfinish, Qt::ISODate));
+
+ // Amount time not suitable for empty string text
+ if (Textamount == ".") {
+ int nDifference = m_pStarttime->time().secsTo(m_pEndtime->time());
+ m_pAmount->setText(QTime(0, 0).addSecs(nDifference).toString("hh:mm"));
+ }
+ else if (Textamount.isEmpty())
+ m_pAmount->setText(QString("00:00"));
else
- m_pEndtime->setTime(QTime::QTime(0, 0));
+ m_pAmount->setText(Textamount);
}
}
@@ -892,7 +914,7 @@
nRealrow = (nRow >= 0) ? nRow : m_pMaintable->currentRow();
QString Statis = m_pMaintable->text(nRealrow, TITRAQ_IDXSTATUS); // Get text
- // Quick review of data validity, and set pixmaps accordingly
+ // Review whole data validity, and set pixmap accordingly
if (m_pMaintable->text(nRealrow, TITRAQ_IDXUSER).isEmpty() ||
m_pMaintable->text(nRealrow, TITRAQ_IDXGUID).isEmpty() ||
m_pMaintable->text(nRealrow, TITRAQ_IDXCRC).isEmpty() ||
@@ -920,6 +942,30 @@
m_pStatusedit->setPixmap(m_pMaintable->pixmap(nRealrow, TITRAQ_IDXSTATUS));
}
}
+
+ // Test for blank user field, and set to default if so
+ if (m_pMaintable->text(nRealrow, TITRAQ_IDXUSER).isEmpty())
+ m_pMaintable->setText(nRealrow, TITRAQ_IDXUSER, m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER));
+
+ // Test for blank date field, and set to default if so
+ if (m_pMaintable->text(nRealrow, TITRAQ_IDXDATE) == ".")
+ m_pMaintable->setText(nRealrow, TITRAQ_IDXDATE, QDate::currentDate().toString(Qt::ISODate));
+
+ // Test for blank start field, and set to default if so
+ if (m_pMaintable->text(nRealrow, TITRAQ_IDXSTART) == ".")
+ m_pMaintable->setText(nRealrow, TITRAQ_IDXSTART, QTime::currentTime().toString("hh:mm"));
+
+ // Test for blank finish field, and set to default if so
+ if (m_pMaintable->text(nRealrow, TITRAQ_IDXFINISH) == ".")
+ m_pMaintable->setText(nRealrow, TITRAQ_IDXFINISH, QTime::currentTime().toString("hh:mm"));
+
+ // Test for blank amount field, and set to default if so
+ if (m_pMaintable->text(nRealrow, TITRAQ_IDXAMOUNT) == ".") {
+ QTime Begin = QTime::fromString(m_pMaintable->text(nRealrow, TITRAQ_IDXSTART), Qt::ISODate);
+ QTime End = QTime::fromString(m_pMaintable->text(nRealrow, TITRAQ_IDXFINISH), Qt::ISODate);
+ QString Diff = QTime(0, 0).addSecs(Begin.secsTo(End)).toString("hh:mm");
+ m_pMaintable->setText(nRealrow, TITRAQ_IDXAMOUNT, Diff);
+ }
}
//
@@ -1612,7 +1658,8 @@
//
void Titraqform::aboutTitraq(void)
{
- QMessageBox *pCwmsg = new QMessageBox("AS Accounting System",
+ QString Namever = QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short;
+ QMessageBox *pCwmsg = new QMessageBox(Namever,
QObject::trUtf8("AS-GUI is a time and task-based\n"
"accounting system that acts as both a\n"
"work-like punch card and time tracker.\n"
@@ -1631,7 +1678,8 @@
//
void Titraqform::aboutOSSP(void)
{
- QMessageBox *pOsspmsg = new QMessageBox("AS Accounting System",
+ QString Namever = QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short;
+ QMessageBox *pOsspmsg = new QMessageBox(Namever,
QObject::trUtf8("The open source software project (OSSP) is\n"
"a collective effort aimed at implementing\n"
"high-quality Unix software components,\n"
@@ -1651,5 +1699,5 @@
//
void Titraqform::aboutQt(void)
{
- QMessageBox::aboutQt(this, "AS Accounting System");
+ QMessageBox::aboutQt(this, QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short);
}
|