OSSP CVS Repository

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

Check-in Number: 3875
Date: 2002-Dec-13 22:25:32 (local)
2002-Dec-13 21:25:32 (UTC)
User:ms
Branch:
Comment: Better initialization by disabling edit controls until a new document.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/as_assist.cpp      1.66 -> 1.67     11 inserted, 7 deleted
ossp-pkg/as/as-gui/as_gui.h      1.52 -> 1.53     0 inserted, 1 deleted
ossp-pkg/as/as-gui/as_slot.cpp      1.59 -> 1.60     59 inserted, 32 deleted

ossp-pkg/as/as-gui/as_assist.cpp 1.66 -> 1.67

--- as_assist.cpp        2002/12/13 20:50:18     1.66
+++ as_assist.cpp        2002/12/13 21:25:32     1.67
@@ -548,7 +548,6 @@
     m_pStatusedit = new QLabel(m_pCenframe, "Status");
     if (m_pStatusedit == NULL) // Sanity check
         throw Genexcept("Main window status edit creation failed.");
-    m_pStatusedit->setPixmap(QPixmap(s_kpcStatwarn_xpm));
     QToolTip::add(m_pStatusedit, trUtf8("Status Item"));
     m_pEditlayout->addWidget(m_pStatusedit);  // Finally add the item status edit
 
@@ -562,11 +561,11 @@
     m_pLineedit = new QLineEdit(m_pCenframe, "Lineno");
     if (m_pLineedit == NULL) // Sanity check
         throw Genexcept("Main window line number edit creation failed.");
-    m_pLineedit->setText(trUtf8("0"));
     m_pLineedit->setFrameShape(QLineEdit::LineEditPanel);
     m_pLineedit->setFrameShadow(QLineEdit::Sunken);
     m_pLineedit->setFrame(true);
     m_pLineedit->setReadOnly(true);
+    m_pLineedit->setEnabled(false);
     m_pLineedit->setAlignment(Qt::AlignRight);
     QToolTip::add(m_pLineedit, trUtf8("Line Number"));
     m_pEditlayout->addWidget(m_pLineedit);  // Finally add the line number edit
@@ -581,11 +580,11 @@
     m_pUseredit = new QLineEdit(m_pCenframe, "User");
     if (m_pUseredit == NULL) // Sanity check
         throw Genexcept("Main window user edit creation failed.");
-    m_pUseredit->setText(m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER));
     m_pUseredit->setFrameShape(QLineEdit::LineEditPanel);
     m_pUseredit->setFrameShadow(QLineEdit::Sunken);
     m_pUseredit->setFrame(true);
     m_pUseredit->setReadOnly(false);
+    m_pUseredit->setEnabled(false);
     QToolTip::add(m_pUseredit, trUtf8("User Name"));
     m_pEditlayout->addWidget(m_pUseredit);  // Finally add the user edit
 
@@ -599,11 +598,11 @@
     m_pGuidedit = new QLineEdit(m_pCenframe, "Guid");
     if (m_pGuidedit == NULL) // Sanity check
         throw Genexcept("Main window GUID edit creation failed.");
-    m_pGuidedit->setText(trUtf8("."));
     m_pGuidedit->setFrameShape(QLineEdit::LineEditPanel);
     m_pGuidedit->setFrameShadow(QLineEdit::Sunken);
     m_pGuidedit->setFrame(true);
     m_pGuidedit->setReadOnly(true);
+    m_pGuidedit->setEnabled(false);
     QToolTip::add(m_pGuidedit, trUtf8("GUID"));
     m_pEditlayout->addWidget(m_pGuidedit);  // Finally add the GUID edit
 
@@ -617,11 +616,11 @@
     m_pCrcedit = new QLineEdit(m_pCenframe, "Crc");
     if (m_pCrcedit == NULL) // Sanity check
         throw Genexcept("Main window CRC edit creation failed.");
-    m_pCrcedit->setText(trUtf8("."));
     m_pCrcedit->setFrameShape(QLineEdit::LineEditPanel);
     m_pCrcedit->setFrameShadow(QLineEdit::Sunken);
     m_pCrcedit->setFrame(true);
     m_pCrcedit->setReadOnly(true);
+    m_pCrcedit->setEnabled(false);
     QToolTip::add(m_pCrcedit, trUtf8("CRC"));
     m_pEditlayout->addWidget(m_pCrcedit);  // Finally add the CRC edit
 
@@ -635,11 +634,11 @@
     m_pRevedit = new QLineEdit(m_pCenframe, "Revision");
     if (m_pRevedit == NULL) // Sanity check
         throw Genexcept("Main window revision edit creation failed.");
-    m_pRevedit->setText(trUtf8("."));
     m_pRevedit->setFrameShape(QLineEdit::LineEditPanel);
     m_pRevedit->setFrameShadow(QLineEdit::Sunken);
     m_pRevedit->setFrame(true);
     m_pRevedit->setReadOnly(true);
+    m_pRevedit->setEnabled(false);
     QToolTip::add(m_pRevedit, trUtf8("Revision"));
     m_pEditlayout->addWidget(m_pRevedit);  // Finally add the revision edit
 
@@ -659,6 +658,7 @@
     m_pDateedit->setOrder(QDateEdit::YMD);
     m_pDateedit->setAutoAdvance(true);
     m_pDateedit->setSeparator(trUtf8("."));
+    m_pDateedit->setEnabled(false);
 
     m_pEditlayout->addWidget(m_pDateedit);                          // Finally add the date editor
     QToolTip::add(m_pDateedit, trUtf8("Task Date"));
@@ -677,6 +677,7 @@
     // Configure attributes
     m_pStarttime->setDisplay(QTimeEdit::Hours | QTimeEdit::Minutes);
     m_pStarttime->setAutoAdvance(true);
+    m_pStarttime->setEnabled(false);
 
     m_pEditlayout->addWidget(m_pStarttime);                         // Finally add the start editor
     QToolTip::add(m_pStarttime, trUtf8("Task Starting Time"));
@@ -695,6 +696,7 @@
     // Configure attributes
     m_pEndtime->setDisplay(QTimeEdit::Hours | QTimeEdit::Minutes);
     m_pEndtime->setAutoAdvance(true);
+    m_pEndtime->setEnabled(false);
 
     m_pEditlayout->addWidget(m_pEndtime);                           // Finally add the end editor
     QToolTip::add(m_pEndtime, trUtf8("Task Ending Time"));
@@ -713,6 +715,7 @@
     // Configure attributes
     m_pAmount->setButtonSymbols(QSpinBox::PlusMinus);
     m_pAmount->setSuffix(trUtf8(" Minutes"));
+    m_pAmount->setEnabled(false);
 //    m_pAmount->setSpecialValueText(trUtf8("In progress"));
 
     m_pEditlayout->addWidget(m_pAmount);    // Finally add the amount editor
@@ -748,6 +751,7 @@
     m_pTasks->setCurrentText(NULL);
     m_pTasks->setAutoCompletion(true);
     m_pTasks->setDuplicatesEnabled(false);
+    m_pTasks->setEnabled(false);
 //    m_pTasks->setEditable(false);   // Only idiots define noneditable and autocompletion
 
     // Add an auto scroll bar if possible under current GUI style
@@ -765,11 +769,11 @@
     m_pRemark = new QLineEdit(m_pCenframe, "Remark");
     if (m_pRemark == NULL)  // Sanity check
         throw Genexcept("Main window remark line creation failed.");
-    m_pRemark->setText(trUtf8("Happy birthday to Ralf"));
     m_pRemark->setFrameShape(QLineEdit::LineEditPanel);
     m_pRemark->setFrameShadow(QLineEdit::Sunken);
     m_pRemark->setFrame(true);
     m_pRemark->setReadOnly(false);
+    m_pRemark->setEnabled(false);
     QToolTip::add(m_pRemark, trUtf8("Remark Line"));
     m_pEditlayout->addWidget(m_pRemark);    // Finally add the remark line
 


ossp-pkg/as/as-gui/as_gui.h 1.52 -> 1.53

--- as_gui.h     2002/12/13 20:50:18     1.52
+++ as_gui.h     2002/12/13 21:25:32     1.53
@@ -136,7 +136,6 @@
     void inplaceEdit(int, int, int, const QPoint &); // Enter in place edit mode
     void updEdit(int, int);             // Update edit controls
     void validateData(int, int);        // Validate one row of matrix data
-    void validateData(void);            // Validation overloaded convenience method
     void updSizes(int, int, int);       // Update edit sizes
     void dataChanged(void);             // Timesheet data changed
     void updateStatus(const QString &); // Update status column


ossp-pkg/as/as-gui/as_slot.cpp 1.59 -> 1.60

--- as_slot.cpp  2002/12/13 20:50:18     1.59
+++ as_slot.cpp  2002/12/13 21:25:32     1.60
@@ -194,10 +194,32 @@
             m_pRemark->setText(NULL);
 
             m_pMaintable->setNumRows(0);    // Remove all data in table
+            m_pLineedit->setEnabled(true);
+            m_pUseredit->setEnabled(true);
+            m_pGuidedit->setEnabled(true);
+            m_pCrcedit->setEnabled(true);
+            m_pRevedit->setEnabled(true);
+            m_pDateedit->setEnabled(true);
+            m_pStarttime->setEnabled(true);
+            m_pEndtime->setEnabled(true);
+            m_pAmount->setEnabled(true);
+            m_pTasks->setEnabled(true);
+            m_pRemark->setEnabled(true);
             this->setDirty(false);          // Reset data to clean state
             break;
         case 1: // Second button selected, so don't save first but do new
             m_pMaintable->setNumRows(0);    // Remove all data in table
+            m_pLineedit->setEnabled(true);
+            m_pUseredit->setEnabled(true);
+            m_pGuidedit->setEnabled(true);
+            m_pCrcedit->setEnabled(true);
+            m_pRevedit->setEnabled(true);
+            m_pDateedit->setEnabled(true);
+            m_pStarttime->setEnabled(true);
+            m_pEndtime->setEnabled(true);
+            m_pAmount->setEnabled(true);
+            m_pTasks->setEnabled(true);
+            m_pRemark->setEnabled(true);
             this->setDirty(false);          // Reset data to clean state
             break;
         case 2: // Third button selected, so don't do a new timesheet
@@ -214,6 +236,17 @@
         m_pTasks->setCurrentText(NULL);
         m_pRemark->setText(NULL);
         m_pMaintable->setNumRows(0);        // Remove all data in table
+        m_pLineedit->setEnabled(true);
+        m_pUseredit->setEnabled(true);
+        m_pGuidedit->setEnabled(true);
+        m_pCrcedit->setEnabled(true);
+        m_pRevedit->setEnabled(true);
+        m_pDateedit->setEnabled(true);
+        m_pStarttime->setEnabled(true);
+        m_pEndtime->setEnabled(true);
+        m_pAmount->setEnabled(true);
+        m_pTasks->setEnabled(true);
+        m_pRemark->setEnabled(true);
         this->setDirty(false);              // Reset data to clean state
     }
 }
@@ -563,42 +596,36 @@
 //
 void Titraqform::validateData(int nRow, int nCol)
 {
-    // Field strings to check for validity and process
-    QString Textstat(m_pMaintable->text(nRow, TITRAQ_IDXSTATUS));
-    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));
-
-    // Quick review of data validity, and set pixmaps accordingly
-    if (Textuser.isEmpty() || Textguid.isEmpty() || Textcrc.isEmpty() ||
-        Textrev.isEmpty() || Textdate.isEmpty() || Textstart.isEmpty() ||
-        Textfinish.isEmpty() || Textamount.isEmpty() || Texttask.isEmpty()) {
-        m_pStatusedit->setPixmap(QPixmap(s_kpcStaterror_xpm));
-        m_pMaintable->setPixmap(nRow, TITRAQ_IDXSTATUS, QPixmap(s_kpcStaterror_xpm));
-    }
-    else {
-        m_pStatusedit->setPixmap(QPixmap(s_kpcStatokay_xpm));
-        m_pMaintable->setPixmap(nRow, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatokay_xpm));
+    if (m_pMaintable->numRows() > 0) {
+        // Field strings to check for validity and process
+        QString Textstat(m_pMaintable->text(nRow, TITRAQ_IDXSTATUS));
+        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));
+
+        // Quick review of data validity, and set pixmaps accordingly
+        if (Textuser.isEmpty() || Textguid.isEmpty() || Textcrc.isEmpty() ||
+            Textrev.isEmpty() || Textdate.isEmpty() || Textstart.isEmpty() ||
+            Textfinish.isEmpty() || Textamount.isEmpty() || Texttask.isEmpty()) {
+            m_pStatusedit->setPixmap(QPixmap(s_kpcStaterror_xpm));
+            m_pMaintable->setPixmap(nRow, TITRAQ_IDXSTATUS, QPixmap(s_kpcStaterror_xpm));
+        }
+        else {
+            m_pStatusedit->setPixmap(QPixmap(s_kpcStatokay_xpm));
+            m_pMaintable->setPixmap(nRow, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatokay_xpm));
+        }
     }
 }
 
 //
-// Validation overloaded convenience method
-//
-void Titraqform::validateData(void)
-{
-    validateData(m_pMaintable->currentRow(), 0);
-}
-
-//
 // Update the current status column item
 //
 void Titraqform::updateStatus(const QString &Instring)

CVSTrac 2.0.1