OSSP CVS Repository

ossp - Difference in ossp-pkg/as/as-gui/as_slot.cpp versions 1.98 and 1.99
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/as/as-gui/as_slot.cpp 1.98 -> 1.99

--- as_slot.cpp  2003/01/30 23:17:06     1.98
+++ as_slot.cpp  2003/01/30 23:48:00     1.99
@@ -778,53 +778,59 @@
 //
 void Titraqform::updEdit(int nRow, int nCol)
 {
-//    QRegExp Shorten("/(\\w+)$");    // For stripping prefix off the current task
-
-    // Field strings to check for validity and process
-    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));
-
-    // Reset the edition state member
-    m_pMaintable->setEdition();
-
-    // Set text of member edit controls
-    if (m_pMaintable->text(nRow, TITRAQ_IDXSTATUS).isEmpty())   // If row is empty
-        m_pStatusedit->setPixmap(s_kpcStatvoid_xpm);            // add a placeholder
-    else
-        m_pStatusedit->setPixmap(m_pMaintable->pixmap(nRow, TITRAQ_IDXSTATUS));
-    m_pLineedit->setText(Textline);
-    m_pUseredit->setText(Textuser);
-    m_pGuidedit->setText(Textguid);
-    m_pCrcedit->setText(Textcrc);
-    m_pRevedit->setText(Textrev);
-
-    m_pAmount->setText(Textamount);
-//    Texttask.remove(0, Shorten.search(Texttask) + 1); // Strip leading slash
-    m_pTasks->setCurrentText(Texttask);
-    m_pRemark->setText(Textremark);
-
-    // Members not suitable for empty string text
-    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));
+    // Why is the app sending negative row signal? I don't know yet,
+    // so add in this nasty hack to fend off the debug spew on stderr
+    if (m_pMaintable->numRows() > 0 && nRow >= 0) {
+        // Field strings to check for validity and process
+        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));
+
+        // Reset the edition state member
+        m_pMaintable->setEdition();
+
+        // Set text of member edit controls
+        if (m_pMaintable->text(nRow, TITRAQ_IDXSTATUS).isEmpty())   // If row is empty
+            m_pStatusedit->setPixmap(s_kpcStatvoid_xpm);            // add a placeholder
+        else
+            m_pStatusedit->setPixmap(m_pMaintable->pixmap(nRow, TITRAQ_IDXSTATUS));
+        m_pLineedit->setText(Textline);
+        m_pUseredit->setText(Textuser);
+        m_pGuidedit->setText(Textguid);
+        m_pCrcedit->setText(Textcrc);
+        m_pRevedit->setText(Textrev);
+
+//        QRegExp Shorten("/(\\w+)$");    // For stripping prefix off the current task
+//        Texttask.remove(0, Shorten.search(Texttask) + 1); // Strip leading slash
+
+        m_pAmount->setText(Textamount);
+        m_pRemark->setText(Textremark);
+        m_pTasks->setCurrentText(Texttask);
+
+        // Members not suitable for empty string text
+        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));
+    }
     else
-        m_pEndtime->setTime(QTime::QTime(0, 0));
+        m_pStatbar->message(trUtf8("Empty timesheet, add entries first please"), 4000);
 }
 
 //

CVSTrac 2.0.1