head 1.6; access; symbols; locks; strict; comment @// @; 1.6 date 2002.12.12.18.48.16; author ms; state dead; branches; next 1.5; 1.5 date 2002.12.11.17.15.35; author ms; state Exp; branches; next 1.4; 1.4 date 2002.12.05.14.51.29; author ms; state Exp; branches; next 1.3; 1.3 date 2002.12.04.23.22.52; author ms; state Exp; branches; next 1.2; 1.2 date 2002.12.04.20.30.54; author ms; state Exp; branches; next 1.1; 1.1 date 2002.12.04.19.11.26; author ms; state Exp; branches; next ; desc @@ 1.6 log @Moved methods from as_util to as_dataop, corrected load empty field validation, use new bitmaps for validation. @ text @// // OSSP asgui - Accounting system graphical user interface // Copyright (c) 2002-2003 The OSSP Project (http://www.ossp.org/) // Copyright (c) 2002-2003 Cable & Wireless Deutschland (http://www.cw.com/de/) // Copyright (c) 2002-2003 Ralf S. Engelschall // Copyright (c) 2002-2003 Michael Schloh von Bennewitz // // This file is part of OSSP asgui, an accounting system graphical user // interface which can be found at http://www.ossp.org/pkg/tool/asgui/. // // Permission to use, copy, modify, and distribute this software for // any purpose with or without fee is hereby granted, provided that // the above copyright notice and this permission notice appear in all // copies. // // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. // IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF // USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT // OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF // SUCH DAMAGE. // // as_util.cpp: ISO C++ implementation // #include "as_gui.h" #include "as_tableitem.h" // // Get a whole row of data // const QString Titraqform::getRowdata(void) const { QString Rowdata; // For output string QTableSelection Select = m_pMaintable->selection(0); // Highlighted text int nTotal = Select.bottomRow() - Select.topRow() + 1; // Total row select // Calculate rows to delete from selection highlight for (int nIter = 0; nIter < nTotal; ++nIter) { // Build the row data string one field at a time, adding seps inbetween Rowdata += m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXDATE); Rowdata += trUtf8(TITRAQ_SEPARATORTOK); // Rowdata += m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXUSER); // Rowdata += trUtf8(TITRAQ_SEPARATORTOK); Rowdata += m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXSTART); Rowdata += trUtf8(TITRAQ_SEPARATORTOK); Rowdata += m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXFINISH); Rowdata += trUtf8(TITRAQ_SEPARATORTOK); Rowdata += m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXAMOUNT); Rowdata += trUtf8(TITRAQ_SEPARATORTOK); Rowdata += m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXTASK); Rowdata += trUtf8(TITRAQ_SEPARATORTOK); Rowdata += m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXREMARK); Rowdata += trUtf8("\n"); // Finish off line } return Rowdata; } // // Set a whole row of data // void Titraqform::setRowdata(QString &Rowdata) const { int nRows = Rowdata.contains(QChar('\n')); // Set so many rows int nCurrentrow = m_pMaintable->currentRow(); // Current table row QTableItem *pItem = NULL; // Old item to change out QString Date, Start, Finish, Amount, Task, Remark; // Text fields in table QTextStream Datastream(&Rowdata, IO_ReadOnly); // Convert data to stream for (int nIter = 0; nIter < nRows; ++nIter) { Datastream >> Date >> Start; // Stream data fields Datastream >> Finish >> Amount >> Task; // to corresponding vars Datastream.skipWhiteSpace(); // Remove whitespaces Remark = Datastream.readLine(); // Remark is a whole line // Set the table row data one field at a time, skipping seps inbetween m_pMaintable->setText(nCurrentrow + nIter, TITRAQ_IDXDATE, Date); // m_pMaintable->setText(nCurrentrow + nIter, TITRAQ_IDXUSER, User); m_pMaintable->setText(nCurrentrow + nIter, TITRAQ_IDXSTART, Start); m_pMaintable->setText(nCurrentrow + nIter, TITRAQ_IDXFINISH, Finish); m_pMaintable->setText(nCurrentrow + nIter, TITRAQ_IDXAMOUNT, Amount); // // FIXME: Why doesn't this code change the RtTableItem text in place? // RtTableItem *pTask = NULL; // Derived and special // pItem = m_pMaintable->item(nCurrentrow + nIter, TITRAQ_IDXTASK); // pTask = static_cast(pItem); // pTask->setText(Task); // Change out old item and replace with new task data pItem = m_pMaintable->item(nCurrentrow + nIter, TITRAQ_IDXTASK); delete(pItem); // Get rid of the old before going with the new m_pMaintable->setItem(nCurrentrow + nIter, TITRAQ_IDXTASK, new RtTableItem(m_pMaintable, QTableItem::WhenCurrent, Task)); // Continue with field processing business as usual m_pMaintable->setText(nCurrentrow + nIter, TITRAQ_IDXREMARK, Remark); } } // // Discover which column is the first in view // const int Titraqform::getFirstcol(void) const { int nIter = 0; // Is both iterator in loop and column number returned // Use column selector menu popup as sole key to determining column state while (nIter < TITRAQ_IDXTAIL && !m_pColspopup->isItemChecked(m_pColspopup->idAt(++nIter))) TITRAQ_NOP; return nIter - 1; // Return one less to account for start of item offset } @ 1.5 log @Fix bottom control layout by detecting first viewable column and adjusting control size accordingly. @ text @@ 1.4 log @Flush dirty state saving changes without considering broken build. @ text @d106 14 @ 1.3 log @Implement multirow edition including complete cut copy and paste. @ text @d81 1 @ 1.2 log @Various edition repairs and improvements. @ text @d36 3 d41 22 a62 17 QString Rowdata; // For output string int nCurrentrow = m_pMaintable->currentRow(); // Current table row // Build the row data string one field at a time, adding seps inbetween Rowdata = m_pMaintable->text(nCurrentrow, TITRAQ_IDXDATE); Rowdata += trUtf8(TITRAQ_SEPARATORTOK); // Rowdata += m_pMaintable->text(nCurrentrow, TITRAQ_IDXUSER); // Rowdata += trUtf8(TITRAQ_SEPARATORTOK); Rowdata += m_pMaintable->text(nCurrentrow, TITRAQ_IDXSTART); Rowdata += trUtf8(TITRAQ_SEPARATORTOK); Rowdata += m_pMaintable->text(nCurrentrow, TITRAQ_IDXFINISH); Rowdata += trUtf8(TITRAQ_SEPARATORTOK); Rowdata += m_pMaintable->text(nCurrentrow, TITRAQ_IDXAMOUNT); Rowdata += trUtf8(TITRAQ_SEPARATORTOK); Rowdata += m_pMaintable->text(nCurrentrow, TITRAQ_IDXTASK); Rowdata += trUtf8(TITRAQ_SEPARATORTOK); Rowdata += m_pMaintable->text(nCurrentrow, TITRAQ_IDXREMARK); d67 3 d72 1 d78 26 a103 24 Datastream >> Date >> Start; // Stream data fields Datastream >> Finish >> Amount >> Task; // to corresponding vars Remark = Datastream.readLine(); // Remark is a whole line // Set the table row data one field at a time, skipping seps inbetween m_pMaintable->setText(nCurrentrow, TITRAQ_IDXDATE, Date); // m_pMaintable->setText(nCurrentrow, TITRAQ_IDXUSER, User); m_pMaintable->setText(nCurrentrow, TITRAQ_IDXSTART, Start); m_pMaintable->setText(nCurrentrow, TITRAQ_IDXFINISH, Finish); m_pMaintable->setText(nCurrentrow, TITRAQ_IDXAMOUNT, Amount); // // FIXME: Why doesn't this code change the RtTableItem text in place? // RtTableItem *pTask = NULL; // Derived and special // pItem = m_pMaintable->item(nCurrentrow, TITRAQ_IDXTASK); // pTask = static_cast(pItem); // pTask->setText(Task); // Change out old item and replace with new task data pItem = m_pMaintable->item(nCurrentrow, TITRAQ_IDXTASK); delete(pItem); // Get rid of the old before going with the new m_pMaintable->setItem(nCurrentrow, TITRAQ_IDXTASK, new RtTableItem(m_pMaintable, QTableItem::WhenCurrent, Task)); // Continue with field processing business as usual m_pMaintable->setText(nCurrentrow, TITRAQ_IDXREMARK, Remark); @ 1.1 log @Complete row by row cut copy and paste implementation. @ text @d62 1 d76 13 a88 1 m_pMaintable->setText(nCurrentrow, TITRAQ_IDXAMOUNT, Task); @