Index: ossp-pkg/as/as-gui/as_amount.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_amount.cpp,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_amount.cpp,v' 2>/dev/null --- as_amount.cpp 2002/11/25 15:45:56 1.1 +++ as_amount.cpp 2002/11/26 19:33:36 1.2 @@ -1,8 +1,7 @@ #include #include "titamount.h" - -#define HOURAMOUNT 60 +#include "titconst.h" // Sets a text formatted representation @@ -11,12 +10,16 @@ int nTotal = 0; // The total amount of minutes QRegExp Strexpr("(\\d+):(\\d+)"); // Pattern in amount text QString Stramount = QRegExp::escape(Strval); // Incoming string escaped - Strexpr.search(Stramount); - - nTotal = Strexpr.cap(Strexpr.numCaptures() - 1).toInt() * HOURAMOUNT; // Calculate hours - nTotal += Strexpr.cap(Strexpr.numCaptures()).toInt(); // Calculate minutes - this->setValue(nTotal); + if (Strval.isEmpty()) { // Shortcircuit in the + this->setValue(0); // case of empty string + } + else { // Do the real work then + Strexpr.search(Stramount); + nTotal = Strexpr.cap(Strexpr.numCaptures() - 1).toInt() * TITRAQ_MINSINHOUR; + nTotal += Strexpr.cap(Strexpr.numCaptures()).toInt(); + this->setValue(nTotal); + } } // Return a text formatted representation @@ -26,8 +29,8 @@ int nHours = 0; int nMins = this->value(); - nHours = nMins / HOURAMOUNT; // Calculate total hours - nMins = nMins % HOURAMOUNT; // Calculate total minutes + nHours = nMins / TITRAQ_MINSINHOUR; // Calculate total hours + nMins = nMins % TITRAQ_MINSINHOUR; // Calculate total minutes Strout = trUtf8("%1:%2").arg(nHours).arg(nMins); // Format string return Strout; Index: ossp-pkg/as/as-gui/as_assist.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_assist.cpp,v rcsdiff -q -kk '-r1.21' '-r1.22' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_assist.cpp,v' 2>/dev/null --- as_assist.cpp 2002/11/26 19:09:58 1.21 +++ as_assist.cpp 2002/11/26 19:33:37 1.22 @@ -504,7 +504,7 @@ // Configure attributes m_pAmount->setButtonSymbols(QSpinBox::PlusMinus); m_pAmount->setSuffix(trUtf8(" Minutes")); - m_pAmount->setSpecialValueText(trUtf8("In progress")); +// m_pAmount->setSpecialValueText(trUtf8("In progress")); m_pDatelayout->addWidget(m_pAmount); // Finally add the amount editor QToolTip::add(m_pAmount, trUtf8("Task Amount")); Index: ossp-pkg/as/as-gui/as_const.h RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_const.h,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_const.h,v' 2>/dev/null --- as_const.h 2002/11/26 14:10:32 1.4 +++ as_const.h 2002/11/26 19:33:37 1.5 @@ -24,3 +24,4 @@ #define TITRAQ_MAXAMOUNT 960 // Maximum valid amount #define TITRAQ_MINAMOUNT 0 // Minimum valid amount #define TITRAQ_STEPAMOUNT 15 // Line step interval +#define TITRAQ_MINSINHOUR 60 // Only idiots don't know this Index: ossp-pkg/as/as-gui/as_slot.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_slot.cpp,v rcsdiff -q -kk '-r1.17' '-r1.18' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_slot.cpp,v' 2>/dev/null --- as_slot.cpp 2002/11/26 19:09:58 1.17 +++ as_slot.cpp 2002/11/26 19:33:37 1.18 @@ -45,10 +45,6 @@ // void Titraqform::addEntry(void) { -// // Add a row to end of table and focuses to it -// m_pMaintable->setNumRows(m_pMaintable->numRows() + 1); -// m_pMaintable->setCurrentCell(m_pMaintable->numRows(), 0); - // Add a row after selection and focus to the new row if (m_pMaintable->currentRow() + 1 != m_pMaintable->numRows()) { m_pMaintable->insertRows(m_pMaintable->currentRow()); @@ -212,22 +208,26 @@ if (!Textdate.isEmpty()) m_pDateedit->setDate(QDate::fromString(Textdate, Qt::ISODate)); + else + m_pDateedit->setDate(QDate::currentDate()); if (!Textstart.isEmpty()) m_pStarttime->setTime(QTime::fromString(Textstart, Qt::ISODate)); + else + m_pStarttime->setTime(QTime::QTime(0, 0)); if (!Textfinish.isEmpty()) m_pEndtime->setTime(QTime::fromString(Textfinish, Qt::ISODate)); + else + m_pEndtime->setTime(QTime::QTime(0, 0)); - if (!Textamount.isEmpty()) - m_pAmount->setText(Textamount); + m_pAmount->setText(Textamount); // Process the task combo box to compress text length - Texttask.remove(0, Shorten.search(Texttask) + 1); // Strip leading slash + Texttask.remove(0, Shorten.search(Texttask) + 1); // Strip leading slash m_pTasks->setCurrentText(Texttask); - if (!Textremark.isEmpty()) - m_pRemark->setText(Textremark); + m_pRemark->setText(Textremark); } //