OSSP CVS Repository

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

Check-in Number: 3853
Date: 2002-Dec-10 14:08:29 (local)
2002-Dec-10 13:08:29 (UTC)
User:ms
Branch:
Comment: Integrate formal data fields GUID, CRC, and rev to load and save ops.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/as_const.h      1.17 -> 1.18     11 inserted, 7 deleted
ossp-pkg/as/as-gui/as_dataop.cpp      1.16 -> 1.17     68 inserted, 41 deleted

ossp-pkg/as/as-gui/as_const.h 1.17 -> 1.18

--- as_const.h   2002/12/10 12:06:56     1.17
+++ as_const.h   2002/12/10 13:08:29     1.18
@@ -56,13 +56,17 @@
 
 // Indexes of table columns
 #define TITRAQ_IDXALLCTRLS     -1
-#define TITRAQ_IDXDATE          0
-#define TITRAQ_IDXSTART         1
-#define TITRAQ_IDXFINISH        2
-#define TITRAQ_IDXAMOUNT        3
-#define TITRAQ_IDXTASK          4
-#define TITRAQ_IDXREMARK        5
-#define TITRAQ_IDXTAIL          6
+#define TITRAQ_IDXUSER          0
+#define TITRAQ_IDXGUID          1
+#define TITRAQ_IDXCRC           2
+#define TITRAQ_IDXREV           3
+#define TITRAQ_IDXDATE          4
+#define TITRAQ_IDXSTART         5
+#define TITRAQ_IDXFINISH        6
+#define TITRAQ_IDXAMOUNT        7
+#define TITRAQ_IDXTASK          8
+#define TITRAQ_IDXREMARK        9
+#define TITRAQ_IDXTAIL          10
 
 // Indexes of popup menu submenus
 #define TITRAQ_IDXFILEBAR       1


ossp-pkg/as/as-gui/as_dataop.cpp 1.16 -> 1.17

--- as_dataop.cpp        2002/12/06 15:40:50     1.16
+++ as_dataop.cpp        2002/12/10 13:08:29     1.17
@@ -75,36 +75,70 @@
     // Set the table text by linewise reading from the input stream
     // and parsing date, time, account, and other columns out of it
     while (!Line.isEmpty()) {
-        QString Date, Start, Finish, Account, Amount, Remark; // Valid fields
+        QString User, Guid, Crc, Rev;                           // Valid admin fields
+        QString Date, Start, Finish, Account, Amount, Remark;   // Valid user fields
         QTextStream Asline(&Line, IO_ReadOnly); // Convert a single line now
 
         if (nIter % g_knBlocks == 0) // Add blocks of rows to optimize loading
             m_pMaintable->setNumRows(m_pMaintable->numRows() + g_knBlocks);
 
         Asline.skipWhiteSpace();    // Remove whitespaces
+        Asline >> User;             // Copy the user field
+        if (User != NULL)
+            m_pMaintable->setText(nIter, TITRAQ_IDXUSER, User);
+        else
+            bValid = false;
+
+        Asline.skipWhiteSpace();    // Remove whitespaces
+        Asline >> Guid;             // Copy the GUID field
+        if (Guid != NULL)
+            m_pMaintable->setText(nIter, TITRAQ_IDXGUID, Guid);
+        else
+            bValid = false;
+
+        Asline.skipWhiteSpace();    // Remove whitespaces
+        Asline >> Crc;              // Copy the CRC field
+        if (Crc != NULL)
+            m_pMaintable->setText(nIter, TITRAQ_IDXCRC, Crc);
+        else
+            bValid = false;
+
+        Asline.skipWhiteSpace();    // Remove whitespaces
+        Asline >> Rev;              // Copy the rev field
+        if (Rev != NULL)
+            m_pMaintable->setText(nIter, TITRAQ_IDXREV, Rev);
+        else
+            bValid = false;
+
+        Asline.skipWhiteSpace();    // Remove whitespaces
         Asline >> Date;             // Copy the date field
         if (Date != NULL)
             m_pMaintable->setText(nIter, TITRAQ_IDXDATE, Date);
         else
             bValid = false;
 
-        Asline >> Bitbucket;        // Ignore user field
-
         Asline.skipWhiteSpace();    // Remove whitespaces
-        Asline >> Start;            // Copy the date field
+        Asline >> Start;            // Copy the start field
         if (Start != NULL)
             m_pMaintable->setText(nIter, TITRAQ_IDXSTART, Start);
         else
             bValid = false;
 
         Asline.skipWhiteSpace();    // Remove whitespaces
-        Asline >> Finish;           // Copy the date field
+        Asline >> Finish;           // Copy the finish field
         if (Start != NULL)
             m_pMaintable->setText(nIter, TITRAQ_IDXFINISH, Finish);
         else
             bValid = false;
 
         Asline.skipWhiteSpace();    // Remove whitespaces
+        Asline >> Amount;           // Copy the amount field
+        if (Amount != NULL)
+            m_pMaintable->setText(nIter, TITRAQ_IDXAMOUNT, Amount);
+        else
+            bValid = false;
+
+        Asline.skipWhiteSpace();    // Remove whitespaces
         Asline >> Account;          // Copy the account field
         if (Account != NULL) {
             QTableItem *pOld = m_pMaintable->item(nIter, TITRAQ_IDXTASK);
@@ -115,13 +149,6 @@
             bValid = false;
 
         Asline.skipWhiteSpace();    // Remove whitespaces
-        Asline >> Amount;           // Copy the amount field
-        if (Amount != NULL)
-            m_pMaintable->setText(nIter, TITRAQ_IDXAMOUNT, Amount);
-        else
-            bValid = false;
-
-        Asline.skipWhiteSpace();    // Remove whitespaces
         Remark = Asline.read();     // Copy the remark field
         if (Remark != NULL)
             m_pMaintable->setText(nIter, TITRAQ_IDXREMARK, Remark);
@@ -170,56 +197,56 @@
 void Titraqform::saveData(QTextStream &Tstream)
 {
     const int nRows = m_pMaintable->numRows();      // Max rows used in loop
-    bool bValid = true;                             // Warn on invalid data
     QString Tempfield;                              // Current field string
     QString Strsearch;                              // String to strip search
     QRegExp Stripper("\\s*$");                      // Pattern to strip off
 
     // Linewise save from the main table date, time, account, and others
     for (int nIter = 0; nIter < nRows; nIter++) {
-        Tempfield = m_pMaintable->text(nIter, 0);   // Load date field text
+        Tempfield = m_pMaintable->text(nIter, TITRAQ_IDXUSER);      // Load user field text
         if (Tempfield != NULL)
-            Tstream << Tempfield;                   // Save date field text
-        else
-            bValid = false;
+            Tstream << Tempfield;                                   // Save user field text
 
-        // Save user field text
-        Tstream << trUtf8(" ") << m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER);
+        Tempfield = m_pMaintable->text(nIter, TITRAQ_IDXGUID);      // Load GUID field text
+        if (Tempfield != NULL)
+            Tstream << trUtf8(" ") << Tempfield;                    // Save GUID field text
 
-        Tempfield = m_pMaintable->text(nIter, 1);   // Load start field text
+        Tempfield = m_pMaintable->text(nIter, TITRAQ_IDXCRC);       // Load CRC field text
         if (Tempfield != NULL)
-            Tstream << trUtf8(" ") << Tempfield;    // Save start field text
-//        else
-//            bValid = false;
+            Tstream << trUtf8(" ") << Tempfield;                    // Save CRC field text
 
-        Tempfield = m_pMaintable->text(nIter, 2);   // Load end field text
+        Tempfield = m_pMaintable->text(nIter, TITRAQ_IDXREV);       // Load rev field text
         if (Tempfield != NULL)
-            Tstream << trUtf8(" ") << Tempfield;    // Save end field text
-//        else
-//            bValid = false;
+            Tstream << trUtf8(" ") << Tempfield;                    // Save rev field text
 
-        Tempfield = m_pMaintable->text(nIter, 4);   // Load amount field text
+        Tempfield = m_pMaintable->text(nIter, TITRAQ_IDXDATE);      // Load date field text
         if (Tempfield != NULL)
-            Tstream << trUtf8(" ") << Tempfield;    // Save amount field text
-        else
-            bValid = false;
+            Tstream << trUtf8(" ") << Tempfield;                    // Save date field text
 
-        Tempfield = m_pMaintable->text(nIter, 3);   // Load acct field text
+        Tempfield = m_pMaintable->text(nIter, TITRAQ_IDXSTART);     // Load start field text
         if (Tempfield != NULL)
-            Tstream << trUtf8(" ") << Tempfield;    // Save acct field text
-        else
-            bValid = false;
+            Tstream << trUtf8(" ") << Tempfield;                    // Save start field text
 
-        Tempfield = m_pMaintable->text(nIter, 5);   // Load remark field text
+        Tempfield = m_pMaintable->text(nIter, TITRAQ_IDXFINISH);    // Load end field text
+        if (Tempfield != NULL)
+            Tstream << trUtf8(" ") << Tempfield;                    // Save end field text
+
+        Tempfield = m_pMaintable->text(nIter, TITRAQ_IDXAMOUNT);    // Load amount field text
+        if (Tempfield != NULL)
+            Tstream << trUtf8(" ") << Tempfield;                    // Save amount field text
+
+        Tempfield = m_pMaintable->text(nIter, TITRAQ_IDXTASK);      // Load acct field text
+        if (Tempfield != NULL)
+            Tstream << trUtf8(" ") << Tempfield;                    // Save acct field text
+
+        Tempfield = m_pMaintable->text(nIter, TITRAQ_IDXREMARK);    // Load remark field text
         if (Tempfield != NULL) {
-            Strsearch = QRegExp::escape(Tempfield); // Incoming string escaped
+            Strsearch = QRegExp::escape(Tempfield);                 // Incoming string escaped
             Stripper.search(Strsearch);
             Tempfield.truncate(Stripper.pos());
-            Tstream << trUtf8(" ") << Tempfield;    // Save remark field text
+            Tstream << trUtf8(" ") << Tempfield;                    // Save remark field text
         }
-        else
-            bValid = false;
 
-        Tstream << endl;                            // Append a newline
+        Tstream << endl;                                            // Append a newline
     }
 }

CVSTrac 2.0.1