--- as_slot.cpp 2003/02/05 11:33:27 1.111
+++ as_slot.cpp 2003/02/05 12:54:22 1.112
@@ -1512,32 +1512,38 @@
}
// Open an account object on the remote server
- Account_var Account = Asdbase->Open("events.as");
+ Account_var Account = Asdbase->Open("/tmp/events.as");
if (CORBA::is_nil(Account)) { // Verify sanity
m_pStatbar->message(trUtf8("Could not create an account object on the server"));
qWarning("Could not create an account object on the server\n");
return;
}
- // Fill an account object to marshall and transmit
+ // Fill account log object(s) to marshall and transmit
int nRow = m_pMaintable->currentRow();
- Singlerow.szUser = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXUSER));
- Singlerow.szGuid = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXGUID));
- Singlerow.szCrc = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXCRC).remove("0x"));
- Singlerow.szRev = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXREV));
- Singlerow.szDate = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXDATE));
- Singlerow.szStart = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXSTART));
- Singlerow.szFinish = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXFINISH));
- Singlerow.szAmount = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXAMOUNT));
-// Singlerow.nRev = m_pMaintable->text(nRow, TITRAQ_IDXREV).toUInt();
-// Singlerow.nDate = m_pMaintable->text(nRow, TITRAQ_IDXDATE).toUInt();
-// Singlerow.nStart = m_pMaintable->text(nRow, TITRAQ_IDXSTART).toUInt();
-// Singlerow.nFinish = m_pMaintable->text(nRow, TITRAQ_IDXFINISH).toUInt();
-// Singlerow.nAmount = m_pMaintable->text(nRow, TITRAQ_IDXAMOUNT).toUInt();
- Singlerow.szTask = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXTASK));
- Singlerow.szRemark = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXREMARK));
+ QTableSelection Select = m_pMaintable->selection(0); // Capture selected rows
+ int nTotal = Select.bottomRow() - Select.topRow() + 1; // Total rows selected
+
+ // Remember, CORBA::stri_dup creates smart pointers
+ for (int nIter = 0; nIter < nTotal; nIter++) {
+ Singlerow.szUser = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXUSER));
+ Singlerow.szGuid = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXGUID));
+ Singlerow.szCrc = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXCRC).remove("0x"));
+ Singlerow.szRev = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXREV));
+ Singlerow.szDate = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXDATE));
+ Singlerow.szStart = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXSTART));
+ Singlerow.szFinish = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXFINISH));
+ Singlerow.szAmount = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXAMOUNT));
+// Singlerow.nRev = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXREV).toUInt();
+// Singlerow.nDate = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXDATE).toUInt();
+// Singlerow.nStart = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXSTART).toUInt();
+// Singlerow.nFinish = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXFINISH).toUInt();
+// Singlerow.nAmount = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXAMOUNT).toUInt();
+ Singlerow.szTask = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXTASK));
+ Singlerow.szRemark = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXREMARK));
+ Account->Log(Singlerow); // Finally transmit to server
+ }
- Account->Log(Singlerow); // Finally transmit to server
m_pStatbar->message(trUtf8("Successful transmission of accounting data"));
}
catch (const CORBA::Exception &Corbex) {
|