OSSP CVS Repository

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

ossp-pkg/as/as-gui/as_slot.cpp 1.106 -> 1.107

--- as_slot.cpp  2003/02/03 14:12:09     1.106
+++ as_slot.cpp  2003/02/03 21:14:58     1.107
@@ -29,6 +29,9 @@
 //  titslot.cpp: ISO C++ implementation
 //
 
+// system headers
+#include <memory>
+
 // Qt headers
 #include <qfiledialog.h>
 #include <qcombobox.h>
@@ -43,6 +46,7 @@
 #include "as_generic.h"         // Generic classes
 #include "as_uuid.h"            // UUID classes
 #include "as_datedit.h"         // Derived from QDateEdit
+#include "as_crc.h"             // Useful qualistring class
 
 // RPC headers
 #ifdef HAVE_ESOAP
@@ -154,7 +158,7 @@
             m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXGUID, pGuid->getString());
             m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXCRC, "0"); // 0 = invalid entry
             m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXREV, "0"); // Entry not revised
-            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXDATE, QDate::currentDate().toString("yyyy.MM.dd"));
+            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXDATE, QDate::currentDate().toString(Qt::ISODate));
             m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXSTART, "00:00");
             m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXFINISH, "00:00");
             m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXAMOUNT, "00:00");
@@ -178,7 +182,7 @@
             m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXGUID, pGuid->getString());
             m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXCRC, "0");
             m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXREV, "0");
-            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXDATE, QDate::currentDate().toString("yyyy.MM.dd"));
+            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXDATE, QDate::currentDate().toString(Qt::ISODate));
             m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXSTART, "00:00");
             m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXFINISH, "00:00");
             m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXAMOUNT, "00:00");
@@ -763,20 +767,21 @@
 {
     if (nCol != TITRAQ_IDXSTATUS && nCol != TITRAQ_IDXLINE \
                                  && m_pMaintable->numRows() > 0) {
-        Q_UINT16 Valcrc, Testcrc;
-        QString Wholerow;
+        U32 Testcrc, Valcrc;
+        std::auto_ptr<Qualistring>pWholerow(new Qualistring);
         int nRealrow = -1;
-//        int nNewrev = -1;
 
         // Build the data that will be used in testing CRC calculation
         nRealrow = (nRow >= 0) ? nRow : m_pMaintable->currentRow();
-        Wholerow = m_pMaintable->text(nRealrow, TITRAQ_IDXUSER);
+        *pWholerow = m_pMaintable->text(nRealrow, TITRAQ_IDXUSER);
         for (int nIter = TITRAQ_IDXUSER + 1; nIter < TITRAQ_IDXTAIL; nIter++)
             if (nIter != TITRAQ_IDXCRC) // Don't checksum the checksum!
-                Wholerow += ' ' + m_pMaintable->text(nRealrow, nIter);
+                *pWholerow += m_pMaintable->text(nRealrow, nIter);
 
         // Update the checksum and revision only if necessary
-        Testcrc = qChecksum(Wholerow.ascii(), Wholerow.length());
+        Testcrc = pWholerow->getCrc();
+
+        // FIXME: This thing is not very unportable, because toUInt != U32
         if (Testcrc != m_pMaintable->text(nRealrow, TITRAQ_IDXCRC).toUInt()) {
 
 //            // Bump the revision number of our entry to control conflicts
@@ -784,14 +789,14 @@
 //            m_pMaintable->setText(nRealrow, TITRAQ_IDXREV, QString::number(nNewrev));
 
             // Build the data that will be used in setting CRC calculation
-            Wholerow = m_pMaintable->text(nRealrow, TITRAQ_IDXUSER);
+            *pWholerow = m_pMaintable->text(nRealrow, TITRAQ_IDXUSER);
             for (int nIter = TITRAQ_IDXUSER + 1; nIter < TITRAQ_IDXTAIL; nIter++)
                 if (nIter != TITRAQ_IDXCRC) // Don't checksum the checksum!
-                    Wholerow += ' ' + m_pMaintable->text(nRealrow, nIter);
+                    *pWholerow += m_pMaintable->text(nRealrow, nIter);
 
-            // Finally set the checksum to its new value
-            Valcrc = qChecksum(Wholerow.ascii(), Wholerow.length());
-            m_pMaintable->setText(nRealrow, TITRAQ_IDXCRC, QString::number(Valcrc));
+            Valcrc = pWholerow->getCrc(); // Finally set the checksum to its new value
+            m_pMaintable->setText(nRealrow, TITRAQ_IDXCRC, "0x" + QString::number(Valcrc, 16));
+            m_pCrcedit->setText("0x" + QString::number(Valcrc, 16));
         }
     }
 }

CVSTrac 2.0.1