OSSP CVS Repository

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

Check-in Number: 3840
Date: 2002-Dec-05 00:22:52 (local)
2002-Dec-04 23:22:52 (UTC)
User:ms
Branch:
Comment: Implement multirow edition including complete cut copy and paste.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/TODO      1.30 -> 1.31     2 inserted, 0 deleted
ossp-pkg/as/as-gui/as_gui.h      1.40 -> 1.41     5 inserted, 5 deleted
ossp-pkg/as/as-gui/as_slot.cpp      1.39 -> 1.40     41 inserted, 21 deleted

ossp-pkg/as/as-gui/TODO 1.30 -> 1.31

--- TODO 2002/12/04 21:31:26     1.30
+++ TODO 2002/12/04 23:22:52     1.31
@@ -31,6 +31,8 @@
 Check all identifiers for undeutig unique scope
 Some signals implemented in Titraqform really belong in satellite classes
 Write M4 macro for detecting cuserid, and prefer cuserid in ac_assist when present
+Consistently initilize fields when selecting multiple rows
+Remove extremely stupid as_uuid logic in favor of built in QUuid class!
 
 Beim Editmodus
 ---------------


ossp-pkg/as/as-gui/as_gui.h 1.40 -> 1.41

--- as_gui.h     2002/12/04 18:56:59     1.40
+++ as_gui.h     2002/12/04 23:22:52     1.41
@@ -112,11 +112,11 @@
     QLineEdit   *m_pRemark;             // Control used to edit remark
 
 protected slots:
-    void cutEntry(void);                // Cut a task entry from the list
-    void copyEntry(void);               // Copy a task entry from the list
-    void pasteEntry(void);              // Paste a task entry to the list
-    void addEntry(void);                // Add a task entry to the list
-    void delEntry(void);                // Delete a task entry from the list
+    void cutEntry(void);                // Cut task entries from the list
+    void copyEntry(void);               // Copy task entries from the list
+    void pasteEntry(void);              // Paste task entries to the list
+    void addEntry(int nRows= -1);       // Add task entries to the list
+    void delEntry(int nRows= -1);       // Delete task entries from the list
     void newDoc(void);                  // Make and display a new document window
     void chooseFile(void);              // Choose a file using a handy file dialog
     void saveFile(void);                // Serialize to the current file


ossp-pkg/as/as-gui/as_slot.cpp 1.39 -> 1.40

--- as_slot.cpp  2002/12/04 21:35:55     1.39
+++ as_slot.cpp  2002/12/04 23:22:52     1.40
@@ -77,41 +77,61 @@
 //
 void Titraqform::pasteEntry(void)
 {
+    int nRows = 0;              // Paste so many rows as are stored
     QString Selection;          // Will receive the clipboard text
     QClipboard *pClip;          // Will reference the global clipboard
 
-    this->addEntry();           // Reuse slot
     Selection = pClip->text(QClipboard::Clipboard); // Windows and Unix
+    nRows = Selection.contains(QChar('\n'));        // How many rows
+    this->addEntry(nRows);                          // Reuse slot
 
     if (Selection)
-        setRowdata(Selection);  // Use accessor
+        setRowdata(Selection);                      // Use accessor
 }
 
 //
 // Append a blank row entry
 //
-void Titraqform::addEntry(void)
+void Titraqform::addEntry(int nRows)
 {
-    int nCurrentrow = 0;
-
-    // Add a row after selection and focus to the new row
-    if (m_pMaintable->currentRow() + 1 != m_pMaintable->numRows()) { // Add upwards
-        m_pMaintable->insertRows(m_pMaintable->currentRow());
-        m_pMaintable->setCurrentCell(m_pMaintable->currentRow() - 2, m_pMaintable->currentColumn());
-        updateDate(*m_pDatezero);
-        updateStart(QTime::QTime(0, 0));
-        updateFinish(QTime::QTime(0, 0));
-        updateAmount(trUtf8("00:00"));
+    QTableSelection Select; // Highlighted text
+    int nTotal = 0;         // Total row select
+    int nCurrent = 0;       // Current row
+
+    if (nRows == -1) {      // Assume a user selection range
+        Select = m_pMaintable->selection(0);
+        nTotal = Select.bottomRow() - Select.topRow() + 1;
+        // Add a row after selection and focus to the new row
+        if (Select.bottomRow() + 1 != m_pMaintable->numRows()) { // Add upwards
+            m_pMaintable->insertRows(Select.topRow(), nTotal);
+            m_pMaintable->setCurrentCell(Select.topRow(), m_pMaintable->currentColumn());
+        }
+        else { // Special case on last row add downwards
+            m_pMaintable->insertRows(Select.bottomRow() + 1, nTotal);
+            m_pMaintable->setCurrentCell(Select.bottomRow() + 1, m_pMaintable->currentColumn());
+            m_pMaintable->ensureCellVisible(m_pMaintable->numRows() - 1, 0); // Scroll please
+        }
     }
-    else { // Special case on last row add downwards
-        m_pMaintable->insertRows(m_pMaintable->currentRow() + 1);
-        m_pMaintable->setCurrentCell(m_pMaintable->currentRow() + 1, m_pMaintable->currentColumn());
-        updateDate(*m_pDatezero);
-        updateStart(QTime::QTime(0, 0));
-        updateFinish(QTime::QTime(0, 0));
-        updateAmount(trUtf8("00:00"));
+    else {                  // Do not count a user selection
+        nTotal   = nRows;
+        nCurrent = m_pMaintable->currentRow();
+        // Add a row after selection and focus to the new row
+        if (nCurrent + 1 != m_pMaintable->numRows()) { // Add upwards
+            m_pMaintable->insertRows(nCurrent, nTotal);
+            m_pMaintable->setCurrentCell(nCurrent, m_pMaintable->currentColumn());
+        }
+        else { // Special case on last row add downwards
+            m_pMaintable->insertRows(nCurrent + 1, nTotal);
+            m_pMaintable->setCurrentCell(nCurrent + 1, m_pMaintable->currentColumn());
+            m_pMaintable->ensureCellVisible(m_pMaintable->numRows() - 1, 0); // Scroll please
+        }
     }
 
+//    updateDate(*m_pDatezero);
+//    updateStart(QTime::QTime(0, 0));
+//    updateFinish(QTime::QTime(0, 0));
+//    updateAmount(trUtf8("00:00"));
+
 //    char szGuitext[37];
 //    uuid_t Guid;
 //
@@ -123,7 +143,7 @@
 //
 // Delete a row entry
 //
-void Titraqform::delEntry(void)
+void Titraqform::delEntry(int nRows)
 {
     QTableSelection Select = m_pMaintable->selection(0);    // Highlighted text
     int nTotal = Select.bottomRow() - Select.topRow() + 1;  // Total row select

CVSTrac 2.0.1