--- as_dataop.cpp 2002/12/18 12:36:16 1.28
+++ as_dataop.cpp 2002/12/19 12:53:56 1.29
@@ -368,34 +368,46 @@
//
const QString Titraqform::getRowdata(void) const
{
- QString Rowdata; // For output string
+ QString Rowdata, Tempstring; // 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_IDXLINE);
- 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_IDXGUID);
- Rowdata += trUtf8(TITRAQ_SEPARATORTOK);
- Rowdata += m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXCRC);
- Rowdata += trUtf8(TITRAQ_SEPARATORTOK);
- Rowdata += m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXREV);
- Rowdata += trUtf8(TITRAQ_SEPARATORTOK);
- Rowdata += m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXDATE);
- 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);
+ Tempstring = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXLINE);
+ if (!Tempstring.isEmpty())
+ Rowdata = Rowdata + Tempstring;
+ Tempstring = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXUSER);
+ if (!Tempstring.isEmpty())
+ Rowdata = Rowdata + trUtf8(TITRAQ_SEPARATORTOK) + Tempstring;
+ Tempstring = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXGUID);
+ if (!Tempstring.isEmpty())
+ Rowdata = Rowdata + trUtf8(TITRAQ_SEPARATORTOK) + Tempstring;
+ Tempstring = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXCRC);
+ if (!Tempstring.isEmpty())
+ Rowdata = Rowdata + trUtf8(TITRAQ_SEPARATORTOK) + Tempstring;
+ Tempstring = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXREV);
+ if (!Tempstring.isEmpty())
+ Rowdata = Rowdata + trUtf8(TITRAQ_SEPARATORTOK) + Tempstring;
+ Tempstring = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXDATE);
+ if (!Tempstring.isEmpty())
+ Rowdata = Rowdata + trUtf8(TITRAQ_SEPARATORTOK) + Tempstring;
+ Tempstring = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXSTART);
+ if (!Tempstring.isEmpty())
+ Rowdata = Rowdata + trUtf8(TITRAQ_SEPARATORTOK) + Tempstring;
+ Tempstring = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXFINISH);
+ if (!Tempstring.isEmpty())
+ Rowdata = Rowdata + trUtf8(TITRAQ_SEPARATORTOK) + Tempstring;
+ Tempstring = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXAMOUNT);
+ if (!Tempstring.isEmpty())
+ Rowdata = Rowdata + trUtf8(TITRAQ_SEPARATORTOK) + Tempstring;
+ Tempstring = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXTASK);
+ if (!Tempstring.isEmpty())
+ Rowdata = Rowdata + trUtf8(TITRAQ_SEPARATORTOK) + Tempstring;
+ Tempstring = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXREMARK);
+ if (!Tempstring.isEmpty())
+ Rowdata = Rowdata + trUtf8(TITRAQ_SEPARATORTOK) + Tempstring;
Rowdata += trUtf8("\n"); // Finish off line
}
@@ -415,9 +427,12 @@
QTextStream Datastream(&Rowdata, IO_ReadOnly); // Convert data to stream
for (int nIter = 0; nIter < nRows; ++nIter) {
- Datastream >> Line >> User >> Guid >> Crc >> Rev; // Stream data fields
- Datastream >> Date >> Start >> Finish >> Amount >> Task; // to corresponding vars
- Remark = Datastream.readLine(); // Remark is a whole line
+ QString Singlerow = Datastream.readLine(); // For linewise operation
+ QTextStream Rowstream(&Singlerow, IO_ReadOnly); // Convert row to stream
+
+ Rowstream >> Line >> User >> Guid >> Crc >> Rev; // Stream data fields
+ Rowstream >> Date >> Start >> Finish >> Amount >> Task; // to corresponding vars
+ Remark = Rowstream.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_IDXLINE, Line);
|