OSSP CVS Repository

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

ossp-pkg/as/as-gui/as_slot.cpp 1.143 -> 1.144

--- as_slot.cpp  2004/08/13 12:36:03     1.143
+++ as_slot.cpp  2004/08/20 17:47:07     1.144
@@ -133,7 +133,7 @@
 
         // Do basic data validation to warn against missing fields
         for (int nIter = 0; nIter < nRows; nIter++)
-            this->validateData(m_pMaintable->currentRow() + nIter, 0);
+            this->validateRow(m_pMaintable->currentRow() + nIter, 0);
 
         m_pStatbar->message(QString::number(nRows) + trUtf8(" rows pasted"), 4000);
         updEdit(m_pMaintable->currentRow()); // Reflect in the update controls
@@ -332,7 +332,7 @@
     // Sweep through matrix validating linewise
     // data and updating line numbers for all rows
     while (nIter < nRows) {
-        this->validateData(nIter, 0);
+        this->validateRow(nIter, 0);
         m_pMaintable->setText(nIter, TITRAQ_IDXLINE, QString::number(nIter).rightJustify(4, QChar('0')));
         nIter++;
     }
@@ -430,19 +430,21 @@
 
         // We might have a filename to work on, so do something with it
         if (!Filestring.isEmpty()) {
-            setFilename(Filestring);            // Set the new file name
-            m_pMaintable->setNumRows(0);        // Clear out old data
-            m_pMaintable->setDirty(false);      // Reset dirty flag
-            QFile Filetemp(Filestring);         // File to load
+            QFile Filetemp(Filestring);             // File to load
             try {
-                loadData(Filetemp);             // Pass to helper method
-                this->setCaption(Filestring);   // Caption in the titlebar
-                m_pStatbar->message(trUtf8("Loaded document ") + Filestring, 4000);
-                this->enableIface(true);        // Turn on the lights
+                if (Filetemp.exists() && validateData(Filetemp)) { // Be extra sure
+                    setFilename(Filestring);        // Set the new file name
+                    m_pMaintable->setNumRows(0);    // Clear out old data
+                    m_pMaintable->setDirty(false);  // Reset dirty flag
+                    loadData(Filetemp);             // Pass to helper method
+                    this->setCaption(Filestring);   // Caption in the titlebar
+                    m_pStatbar->message(trUtf8("Loaded document ") + Filestring, 4000);
+                    this->enableIface(true);        // Turn on the lights
+                    this->setOpen(true);            // Indicate doc is open
+                }
             }
             catch (Genexcept& Genex) { // Crap, we failed
                 m_pStatbar->message(trUtf8("Loading failed"), 4000);
-                this->setOpen(false);
                 Genex.reportErr();
                 return;
             }
@@ -947,17 +949,17 @@
 }
 
 //
-// Validate current row of matrix data
+// Validate current row of the matrix
 //
-void Titraqform::validateData(void)
+void Titraqform::validateRow(void)
 {
-    this->validateData(-1, -1);
+    this->validateRow(-1, -1);
 }
 
 //
-// Validate specified row of matrix data
+// Validate specified row of the matrix
 //
-void Titraqform::validateData(int nRow, int nCol)
+void Titraqform::validateRow(int nRow, int nCol)
 {
     int nRealrow = -1;
 

CVSTrac 2.0.1