OSSP CVS Repository

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

Check-in Number: 3930
Date: 2003-Jan-22 20:20:30 (local)
2003-Jan-22 19:20:30 (UTC)
User:ms
Branch:
Comment: Implement primitive UUID generation on new entry.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/as_slot.cpp      1.80 -> 1.81     11 inserted, 15 deleted

ossp-pkg/as/as-gui/as_slot.cpp 1.80 -> 1.81

--- as_slot.cpp  2003/01/22 11:36:53     1.80
+++ as_slot.cpp  2003/01/22 19:20:30     1.81
@@ -46,6 +46,7 @@
 #include "as_except.h"          // Exception classes
 #include "as_tableitem.h"       // For our custom table items
 #include "as_generic.h"         // Generic classes
+#include "as_uuid.h"            // UUID classes
 
 // Icon pixel maps
 #include "as_gfx/cwlogo.xpm"    // static const char *s_kpcCwlogo_xpm[]
@@ -116,6 +117,7 @@
     QTableSelection Select; // Highlighted text
     int nTotal = 0;         // Total row select
     int nCurrent = 0;       // Current row
+    auto_ptr<AS::Uuid> pGuid(new AS::Uuid); // For GUID production
 
     // Decide how many rows to add
     Select = m_pMaintable->selection(0);
@@ -138,9 +140,10 @@
             m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXSTATUS, QString(QChar('W')));
             m_pMaintable->setPixmap(Select.topRow() + nIter, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatwarn_xpm));
             m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXUSER, m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER));
-            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXGUID, ".");
-            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXCRC, ".");
-            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXREV, ".");
+            pGuid->genId();
+            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXGUID, pGuid->getString());
+            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXCRC, "0");
+            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXREV, "0");
             m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXDATE, QDate::currentDate().toString("yyyy.MM.dd"));
             m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXSTART, "00:00");
             m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXFINISH, "00:00");
@@ -148,7 +151,6 @@
 //            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXTASK, "/");
 //            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXREMARK, "Remark");
         }
-        updEdit(Select.topRow()); // Reflect in the update controls
     }
     else { // Special case on last row add downwards
         m_pMaintable->insertRows(Select.bottomRow() + 1, nTotal);
@@ -161,9 +163,10 @@
             m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXSTATUS, QString(QChar('W')));
             m_pMaintable->setPixmap(Select.bottomRow() + nIter, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatwarn_xpm));
             m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXUSER, m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER));
-            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXGUID, ".");
-            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXCRC, ".");
-            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXREV, ".");
+            pGuid->genId();
+            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_IDXSTART, "00:00");
             m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXFINISH, "00:00");
@@ -171,22 +174,15 @@
 //            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXTASK, "/");
 //            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXREMARK, "Remark");
         }
-        updEdit(Select.bottomRow() + 1); // Reflect in the update controls
     }
 
     // Update line numbers for this new row and all subsequent rows
     for (int nIter = m_pMaintable->currentRow(); nIter < m_pMaintable->numRows(); nIter++)
         m_pMaintable->setText(nIter, TITRAQ_IDXLINE, QString::number(nIter).rightJustify(4, QChar('0')));
 
+    updEdit(m_pMaintable->currentRow()); // Reflect in the update controls
     m_pStatusedit->setPixmap(QPixmap(s_kpcStatwarn_xpm)); // Show pixmap
 
-//    char szGuitext[37];
-//    uuid_t Guid;
-//
-//    uuid_generate(Guid);
-//    uuid_unparse(Guid, szGuitext);
-//    m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXGUID, szGuitext);
-
     m_pMaintable->setUpdatesEnabled(true);  // Turn updates back on
     m_pMaintable->repaintContents(true);    // Do a general repaint of table
 }

CVSTrac 2.0.1