OSSP CVS Repository

ossp - Check-in [3827]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 3827
Date: 2002-Dec-04 15:50:08 (local)
2002-Dec-04 14:50:08 (UTC)
User:ms
Branch:
Comment: Fix row add logic, and automatically fill in date and time values.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/as_amount.h      1.2 -> 1.3     1 inserted, 1 deleted
ossp-pkg/as/as-gui/as_assist.cpp      1.43 -> 1.44     2 inserted, 0 deleted
ossp-pkg/as/as-gui/as_const.h      1.12 -> 1.13     3 inserted, 0 deleted
ossp-pkg/as/as-gui/as_slot.cpp      1.33 -> 1.34     18 inserted, 5 deleted

ossp-pkg/as/as-gui/as_amount.h 1.2 -> 1.3

--- as_amount.h  2002/11/28 20:44:36     1.2
+++ as_amount.h  2002/12/04 14:50:08     1.3
@@ -38,7 +38,7 @@
 class AmountBox : public QSpinBox
 {
 public:
-    AmountBox(int nMinval, int nMaxval, int nStep = 1, QWidget *pParent = 0, const char *szName = 0) : QSpinBox(nMinval, nMaxval, nStep, pParent, szName) {};
+    AmountBox(int nMinval, int nMaxval, int nStep = 1, QWidget *pParent = 0, const char *szName = 0) : QSpinBox(nMinval, nMaxval, nStep, pParent, szName) {setValue(0);};
     void setText(const QString &);  // Sets a text formatted representation
     QString text(void) const;       // Return a text formatted representation
 };


ossp-pkg/as/as-gui/as_assist.cpp 1.43 -> 1.44

--- as_assist.cpp        2002/12/04 11:41:55     1.43
+++ as_assist.cpp        2002/12/04 14:50:08     1.44
@@ -593,6 +593,8 @@
     m_pTasks->insertStringList(*m_pTaskentries);
     m_pTasks->setCurrentText(NULL);
     m_pTasks->setAutoCompletion(true);
+    m_pTasks->setDuplicatesEnabled(false);
+//    m_pTasks->setEditable(false);   // Only idiots define noneditable and autocompletion
 
     // Add an auto scroll bar if possible under current GUI style
     if (m_pTasks->listBox())    // Motif style has no list box


ossp-pkg/as/as-gui/as_const.h 1.12 -> 1.13

--- as_const.h   2002/12/04 11:41:55     1.12
+++ as_const.h   2002/12/04 14:50:08     1.13
@@ -49,6 +49,9 @@
 #define TITRAQ_PREFLOCALLOG     "loglocal"
 #define TITRAQ_DEFLOCALLOG      "no"
 
+// Other string constants
+#define TITRAQ_DATEZERO         "00.00.00"
+
 // Indexes of table columns
 #define TITRAQ_IDXALLCTRLS     -1
 #define TITRAQ_IDXDATE          0


ossp-pkg/as/as-gui/as_slot.cpp 1.33 -> 1.34

--- as_slot.cpp  2002/12/04 11:34:08     1.33
+++ as_slot.cpp  2002/12/04 14:50:08     1.34
@@ -77,14 +77,24 @@
 //
 void Titraqform::addEntry(void)
 {
+    int nCurrentrow = 0;
+
     // Add a row after selection and focus to the new row
-    if (m_pMaintable->currentRow() + 1 != m_pMaintable->numRows()) {
+    if (m_pMaintable->currentRow() + 1 != m_pMaintable->numRows()) { // Add upwards
         m_pMaintable->insertRows(m_pMaintable->currentRow());
-        m_pMaintable->setCurrentCell(m_pMaintable->currentRow() - 3, m_pMaintable->currentColumn());
+        m_pMaintable->setCurrentCell(m_pMaintable->currentRow() - 2, m_pMaintable->currentColumn());
+        updateDate(*m_pDatezero);
+        updateStart(QTime::QTime(0, 0));
+        updateFinish(QTime::QTime(0, 0));
+        updateAmount(trUtf8("00:00"));
     }
-    else // Special case to handle adding an only row or last row
-        m_pMaintable->insertRows(m_pMaintable->currentRow() + 1); {
+    else { // Special case on last row add downwards
+        m_pMaintable->insertRows(m_pMaintable->currentRow() + 1);
         m_pMaintable->setCurrentCell(m_pMaintable->currentRow() + 1, m_pMaintable->currentColumn());
+        updateDate(*m_pDatezero);
+        updateStart(QTime::QTime(0, 0));
+        updateFinish(QTime::QTime(0, 0));
+        updateAmount(trUtf8("00:00"));
     }
 
 //    char szGuitext[37];
@@ -318,7 +328,10 @@
 //
 void Titraqform::updateDate(const QDate &Dateup)
 {
-    m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXDATE, Dateup.toString(Qt::ISODate));
+    if (Dateup == *m_pDatezero) // Complete the already nasty hack
+        m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXDATE, trUtf8(TITRAQ_DATEZERO));
+    else
+        m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXDATE, Dateup.toString(Qt::ISODate));
 }
 
 //

CVSTrac 2.0.1