@ -137,7 +137,7 @@ void MyMoneySeqAccessMgr::setAccountName(const TQString& id, const TQString& nam
const MyMoneyAccount MyMoneySeqAccessMgr : : account ( const TQString & id ) const
const MyMoneyAccount MyMoneySeqAccessMgr : : account ( const TQString & id ) const
{
{
// locate the account and if present, return it's data
// locate the account and if present, return it's data
if ( m_accountList . tq find( id ) ! = m_accountList . end ( ) )
if ( m_accountList . find( id ) ! = m_accountList . end ( ) )
return m_accountList [ id ] ;
return m_accountList [ id ] ;
// throw an exception, if it does not exist
// throw an exception, if it does not exist
@ -175,7 +175,7 @@ void MyMoneySeqAccessMgr::addPayee(MyMoneyPayee& payee)
const MyMoneyPayee MyMoneySeqAccessMgr : : payee ( const TQString & id ) const
const MyMoneyPayee MyMoneySeqAccessMgr : : payee ( const TQString & id ) const
{
{
TQMap < TQString , MyMoneyPayee > : : ConstIterator it ;
TQMap < TQString , MyMoneyPayee > : : ConstIterator it ;
it = m_payeeList . tq find( id ) ;
it = m_payeeList . find( id ) ;
if ( it = = m_payeeList . end ( ) )
if ( it = = m_payeeList . end ( ) )
throw new MYMONEYEXCEPTION ( " Unknown payee ' " + id + " ' " ) ;
throw new MYMONEYEXCEPTION ( " Unknown payee ' " + id + " ' " ) ;
@ -202,7 +202,7 @@ void MyMoneySeqAccessMgr::modifyPayee(const MyMoneyPayee& payee)
{
{
TQMap < TQString , MyMoneyPayee > : : ConstIterator it ;
TQMap < TQString , MyMoneyPayee > : : ConstIterator it ;
it = m_payeeList . tq find( payee . id ( ) ) ;
it = m_payeeList . find( payee . id ( ) ) ;
if ( it = = m_payeeList . end ( ) ) {
if ( it = = m_payeeList . end ( ) ) {
TQString msg = " Unknown payee ' " + payee . id ( ) + " ' " ;
TQString msg = " Unknown payee ' " + payee . id ( ) + " ' " ;
throw new MYMONEYEXCEPTION ( msg ) ;
throw new MYMONEYEXCEPTION ( msg ) ;
@ -216,7 +216,7 @@ void MyMoneySeqAccessMgr::removePayee(const MyMoneyPayee& payee)
TQMap < TQString , MyMoneySchedule > : : ConstIterator it_s ;
TQMap < TQString , MyMoneySchedule > : : ConstIterator it_s ;
TQMap < TQString , MyMoneyPayee > : : ConstIterator it_p ;
TQMap < TQString , MyMoneyPayee > : : ConstIterator it_p ;
it_p = m_payeeList . tq find( payee . id ( ) ) ;
it_p = m_payeeList . find( payee . id ( ) ) ;
if ( it_p = = m_payeeList . end ( ) ) {
if ( it_p = = m_payeeList . end ( ) ) {
TQString msg = " Unknown payee ' " + payee . id ( ) + " ' " ;
TQString msg = " Unknown payee ' " + payee . id ( ) + " ' " ;
throw new MYMONEYEXCEPTION ( msg ) ;
throw new MYMONEYEXCEPTION ( msg ) ;
@ -253,14 +253,14 @@ void MyMoneySeqAccessMgr::addAccount(MyMoneyAccount& tqparent, MyMoneyAccount& a
TQMap < TQString , MyMoneyAccount > : : ConstIterator theParent ;
TQMap < TQString , MyMoneyAccount > : : ConstIterator theParent ;
TQMap < TQString , MyMoneyAccount > : : ConstIterator theChild ;
TQMap < TQString , MyMoneyAccount > : : ConstIterator theChild ;
theParent = m_accountList . tq find( tqparent . id ( ) ) ;
theParent = m_accountList . find( tqparent . id ( ) ) ;
if ( theParent = = m_accountList . end ( ) ) {
if ( theParent = = m_accountList . end ( ) ) {
TQString msg = " Unknown tqparent account ' " ;
TQString msg = " Unknown tqparent account ' " ;
msg + = tqparent . id ( ) + " ' " ;
msg + = tqparent . id ( ) + " ' " ;
throw new MYMONEYEXCEPTION ( msg ) ;
throw new MYMONEYEXCEPTION ( msg ) ;
}
}
theChild = m_accountList . tq find( account . id ( ) ) ;
theChild = m_accountList . find( account . id ( ) ) ;
if ( theChild = = m_accountList . end ( ) ) {
if ( theChild = = m_accountList . end ( ) ) {
TQString msg = " Unknown child account ' " ;
TQString msg = " Unknown child account ' " ;
msg + = account . id ( ) + " ' " ;
msg + = account . id ( ) + " ' " ;
@ -467,7 +467,7 @@ const MyMoneyInstitution MyMoneySeqAccessMgr::institution(const TQString& id) co
{
{
TQMap < TQString , MyMoneyInstitution > : : ConstIterator pos ;
TQMap < TQString , MyMoneyInstitution > : : ConstIterator pos ;
pos = m_institutionList . tq find( id ) ;
pos = m_institutionList . find( id ) ;
if ( pos ! = m_institutionList . end ( ) )
if ( pos ! = m_institutionList . end ( ) )
return * pos ;
return * pos ;
throw new MYMONEYEXCEPTION ( " unknown institution " ) ;
throw new MYMONEYEXCEPTION ( " unknown institution " ) ;
@ -483,7 +483,7 @@ void MyMoneySeqAccessMgr::modifyAccount(const MyMoneyAccount& account, const boo
TQMap < TQString , MyMoneyAccount > : : ConstIterator pos ;
TQMap < TQString , MyMoneyAccount > : : ConstIterator pos ;
// locate the account in the file global pool
// locate the account in the file global pool
pos = m_accountList . tq find( account . id ( ) ) ;
pos = m_accountList . find( account . id ( ) ) ;
if ( pos ! = m_accountList . end ( ) ) {
if ( pos ! = m_accountList . end ( ) ) {
// check if the new info is based on the old one.
// check if the new info is based on the old one.
// this is the case, when the file and the id
// this is the case, when the file and the id
@ -518,7 +518,7 @@ void MyMoneySeqAccessMgr::modifyInstitution(const MyMoneyInstitution& institutio
TQMap < TQString , MyMoneyInstitution > : : ConstIterator pos ;
TQMap < TQString , MyMoneyInstitution > : : ConstIterator pos ;
// locate the institution in the file global pool
// locate the institution in the file global pool
pos = m_institutionList . tq find( institution . id ( ) ) ;
pos = m_institutionList . find( institution . id ( ) ) ;
if ( pos ! = m_institutionList . end ( ) ) {
if ( pos ! = m_institutionList . end ( ) ) {
m_institutionList . modify ( institution . id ( ) , institution ) ;
m_institutionList . modify ( institution . id ( ) , institution ) ;
@ -553,16 +553,16 @@ void MyMoneySeqAccessMgr::modifyTransaction(const MyMoneyTransaction& transactio
// new data seems to be ok. find old version of transaction
// new data seems to be ok. find old version of transaction
// in our pool. Throw exception if unknown.
// in our pool. Throw exception if unknown.
if ( ! m_transactionKeys . tq contains( transaction . id ( ) ) )
if ( ! m_transactionKeys . contains( transaction . id ( ) ) )
throw new MYMONEYEXCEPTION ( " invalid transaction id " ) ;
throw new MYMONEYEXCEPTION ( " invalid transaction id " ) ;
TQString oldKey = m_transactionKeys [ transaction . id ( ) ] ;
TQString oldKey = m_transactionKeys [ transaction . id ( ) ] ;
if ( ! m_transactionList . tq contains( oldKey ) )
if ( ! m_transactionList . contains( oldKey ) )
throw new MYMONEYEXCEPTION ( " invalid transaction key " ) ;
throw new MYMONEYEXCEPTION ( " invalid transaction key " ) ;
TQMap < TQString , MyMoneyTransaction > : : ConstIterator it_t ;
TQMap < TQString , MyMoneyTransaction > : : ConstIterator it_t ;
it_t = m_transactionList . tq find( oldKey ) ;
it_t = m_transactionList . find( oldKey ) ;
if ( it_t = = m_transactionList . end ( ) )
if ( it_t = = m_transactionList . end ( ) )
throw new MYMONEYEXCEPTION ( " invalid transaction key " ) ;
throw new MYMONEYEXCEPTION ( " invalid transaction key " ) ;
@ -608,14 +608,14 @@ void MyMoneySeqAccessMgr::reparentAccount(MyMoneyAccount &account, MyMoneyAccoun
MyMoneySeqAccessMgr : : account ( tqparent . id ( ) ) ;
MyMoneySeqAccessMgr : : account ( tqparent . id ( ) ) ;
if ( ! account . parentAccountId ( ) . isEmpty ( ) ) {
if ( ! account . parentAccountId ( ) . isEmpty ( ) ) {
MyMoneySeqAccessMgr : : account ( account . parentAccountId ( ) ) ;
MyMoneySeqAccessMgr : : account ( account . parentAccountId ( ) ) ;
oldParent = m_accountList . tq find( account . parentAccountId ( ) ) ;
oldParent = m_accountList . find( account . parentAccountId ( ) ) ;
}
}
if ( account . accountType ( ) = = MyMoneyAccount : : Stock & & tqparent . accountType ( ) ! = MyMoneyAccount : : Investment )
if ( account . accountType ( ) = = MyMoneyAccount : : Stock & & tqparent . accountType ( ) ! = MyMoneyAccount : : Investment )
throw new MYMONEYEXCEPTION ( " Cannot move a stock acocunt into a non-investment account " ) ;
throw new MYMONEYEXCEPTION ( " Cannot move a stock acocunt into a non-investment account " ) ;
newParent = m_accountList . tq find( tqparent . id ( ) ) ;
newParent = m_accountList . find( tqparent . id ( ) ) ;
childAccount = m_accountList . tq find( account . id ( ) ) ;
childAccount = m_accountList . find( account . id ( ) ) ;
MyMoneyAccount acc ;
MyMoneyAccount acc ;
if ( ! account . parentAccountId ( ) . isEmpty ( ) ) {
if ( ! account . parentAccountId ( ) . isEmpty ( ) ) {
@ -648,11 +648,11 @@ void MyMoneySeqAccessMgr::removeTransaction(const MyMoneyTransaction& transactio
TQMap < TQString , TQString > : : ConstIterator it_k ;
TQMap < TQString , TQString > : : ConstIterator it_k ;
TQMap < TQString , MyMoneyTransaction > : : ConstIterator it_t ;
TQMap < TQString , MyMoneyTransaction > : : ConstIterator it_t ;
it_k = m_transactionKeys . tq find( transaction . id ( ) ) ;
it_k = m_transactionKeys . find( transaction . id ( ) ) ;
if ( it_k = = m_transactionKeys . end ( ) )
if ( it_k = = m_transactionKeys . end ( ) )
throw new MYMONEYEXCEPTION ( " invalid transaction to be deleted " ) ;
throw new MYMONEYEXCEPTION ( " invalid transaction to be deleted " ) ;
it_t = m_transactionList . tq find( * it_k ) ;
it_t = m_transactionList . find( * it_k ) ;
if ( it_t = = m_transactionList . end ( ) )
if ( it_t = = m_transactionList . end ( ) )
throw new MYMONEYEXCEPTION ( " invalid transaction key " ) ;
throw new MYMONEYEXCEPTION ( " invalid transaction key " ) ;
@ -708,11 +708,11 @@ void MyMoneySeqAccessMgr::removeAccount(const MyMoneyAccount& account)
// locate the account in the file global pool
// locate the account in the file global pool
it_a = m_accountList . tq find( account . id ( ) ) ;
it_a = m_accountList . find( account . id ( ) ) ;
if ( it_a = = m_accountList . end ( ) )
if ( it_a = = m_accountList . end ( ) )
throw new MYMONEYEXCEPTION ( " Internal error: account not found in list " ) ;
throw new MYMONEYEXCEPTION ( " Internal error: account not found in list " ) ;
it_p = m_accountList . tq find( tqparent . id ( ) ) ;
it_p = m_accountList . find( tqparent . id ( ) ) ;
if ( it_p = = m_accountList . end ( ) )
if ( it_p = = m_accountList . end ( ) )
throw new MYMONEYEXCEPTION ( " Internal error: tqparent account not found in list " ) ;
throw new MYMONEYEXCEPTION ( " Internal error: tqparent account not found in list " ) ;
@ -756,7 +756,7 @@ void MyMoneySeqAccessMgr::removeInstitution(const MyMoneyInstitution& institutio
{
{
TQMap < TQString , MyMoneyInstitution > : : ConstIterator it_i ;
TQMap < TQString , MyMoneyInstitution > : : ConstIterator it_i ;
it_i = m_institutionList . tq find( institution . id ( ) ) ;
it_i = m_institutionList . find( institution . id ( ) ) ;
if ( it_i ! = m_institutionList . end ( ) ) {
if ( it_i ! = m_institutionList . end ( ) ) {
m_institutionList . remove ( institution . id ( ) ) ;
m_institutionList . remove ( institution . id ( ) ) ;
@ -816,14 +816,14 @@ const MyMoneyTransaction MyMoneySeqAccessMgr::transaction(const TQString& id) co
{
{
// get the full key of this transaction, throw exception
// get the full key of this transaction, throw exception
// if it's invalid (unknown)
// if it's invalid (unknown)
if ( ! m_transactionKeys . tq contains( id ) ) {
if ( ! m_transactionKeys . contains( id ) ) {
TQString msg = TQString ( " Invalid transaction id '%1' " ) . tqarg ( id ) ;
TQString msg = TQString ( " Invalid transaction id '%1' " ) . tqarg ( id ) ;
throw new MYMONEYEXCEPTION ( msg ) ;
throw new MYMONEYEXCEPTION ( msg ) ;
}
}
// check if this key is in the list, throw exception if not
// check if this key is in the list, throw exception if not
TQString key = m_transactionKeys [ id ] ;
TQString key = m_transactionKeys [ id ] ;
if ( ! m_transactionList . tq contains( key ) ) {
if ( ! m_transactionList . contains( key ) ) {
TQString msg = TQString ( " Invalid transaction key '%1' " ) . tqarg ( key ) ;
TQString msg = TQString ( " Invalid transaction key '%1' " ) . tqarg ( key ) ;
throw new MYMONEYEXCEPTION ( msg ) ;
throw new MYMONEYEXCEPTION ( msg ) ;
}
}
@ -837,7 +837,7 @@ const MyMoneyTransaction MyMoneySeqAccessMgr::transaction(const TQString& accoun
TQMap < TQString , MyMoneyAccount > : : ConstIterator acc ;
TQMap < TQString , MyMoneyAccount > : : ConstIterator acc ;
// find account object in list, throw exception if unknown
// find account object in list, throw exception if unknown
acc = m_accountList . tq find( account ) ;
acc = m_accountList . find( account ) ;
if ( acc = = m_accountList . end ( ) )
if ( acc = = m_accountList . end ( ) )
throw new MYMONEYEXCEPTION ( " unknown account id " ) ;
throw new MYMONEYEXCEPTION ( " unknown account id " ) ;
@ -872,7 +872,7 @@ const MyMoneyMoney MyMoneySeqAccessMgr::balance(const TQString& id, const TQDate
MyMoneyAccount acc ;
MyMoneyAccount acc ;
// if (date != TQDate()) qDebug ("request balance for %s at %s", id.data(), date.toString(Qt::ISODate).latin1());
// if (date != TQDate()) qDebug ("request balance for %s at %s", id.data(), date.toString(Qt::ISODate).latin1());
if ( ! date . isValid ( ) & & account ( id ) . accountType ( ) ! = MyMoneyAccount : : Stock ) {
if ( ! date . isValid ( ) & & account ( id ) . accountType ( ) ! = MyMoneyAccount : : Stock ) {
if ( m_accountList . tq find( id ) ! = m_accountList . end ( ) )
if ( m_accountList . find( id ) ! = m_accountList . end ( ) )
return m_accountList [ id ] . balance ( ) ;
return m_accountList [ id ] . balance ( ) ;
return MyMoneyMoney ( 0 ) ;
return MyMoneyMoney ( 0 ) ;
}
}
@ -975,12 +975,12 @@ const unsigned int MyMoneyFile::moveSplits(const TQString& oldAccount, const TQS
if ( cnt ! = 0 ) {
if ( cnt ! = 0 ) {
// now update all the accounts that were referenced
// now update all the accounts that were referenced
TQMap < TQString , MyMoneyAccount > : : Iterator acc ;
TQMap < TQString , MyMoneyAccount > : : Iterator acc ;
acc = m_accountList . tq find( oldAccount ) ;
acc = m_accountList . find( oldAccount ) ;
if ( acc ! = m_accountList . end ( ) ) {
if ( acc ! = m_accountList . end ( ) ) {
( * acc ) . touch ( ) ;
( * acc ) . touch ( ) ;
refreshAccountTransactionList ( acc ) ;
refreshAccountTransactionList ( acc ) ;
}
}
acc = m_accountList . tq find( newAccount ) ;
acc = m_accountList . find( newAccount ) ;
if ( acc ! = m_accountList . end ( ) ) {
if ( acc ! = m_accountList . end ( ) ) {
( * acc ) . touch ( ) ;
( * acc ) . touch ( ) ;
refreshAccountTransactionList ( acc ) ;
refreshAccountTransactionList ( acc ) ;
@ -1019,7 +1019,7 @@ void MyMoneySeqAccessMgr::loadAccounts(const TQMap<TQString, MyMoneyAccount>& ma
lastId = ( * it_a ) . id ( ) ;
lastId = ( * it_a ) . id ( ) ;
}
}
int pos = lastId . tq find( TQRegExp ( " \\ d+ " ) , 0 ) ;
int pos = lastId . find( TQRegExp ( " \\ d+ " ) , 0 ) ;
if ( pos ! = - 1 ) {
if ( pos ! = - 1 ) {
m_nextAccountID = atol ( lastId . mid ( pos ) ) ;
m_nextAccountID = atol ( lastId . mid ( pos ) ) ;
}
}
@ -1042,7 +1042,7 @@ void MyMoneySeqAccessMgr::loadTransactions(const TQMap<TQString, MyMoneyTransact
m_transactionKeys = keys ;
m_transactionKeys = keys ;
int pos = lastId . tq find( TQRegExp ( " \\ d+ " ) , 0 ) ;
int pos = lastId . find( TQRegExp ( " \\ d+ " ) , 0 ) ;
if ( pos ! = - 1 ) {
if ( pos ! = - 1 ) {
m_nextTransactionID = atol ( lastId . mid ( pos ) ) ;
m_nextTransactionID = atol ( lastId . mid ( pos ) ) ;
}
}
@ -1060,7 +1060,7 @@ void MyMoneySeqAccessMgr::loadInstitutions(const TQMap<TQString, MyMoneyInstitut
lastId = ( * it_i ) . id ( ) ;
lastId = ( * it_i ) . id ( ) ;
}
}
int pos = lastId . tq find( TQRegExp ( " \\ d+ " ) , 0 ) ;
int pos = lastId . find( TQRegExp ( " \\ d+ " ) , 0 ) ;
if ( pos ! = - 1 ) {
if ( pos ! = - 1 ) {
m_nextInstitutionID = atol ( lastId . mid ( pos ) ) ;
m_nextInstitutionID = atol ( lastId . mid ( pos ) ) ;
}
}
@ -1081,7 +1081,7 @@ void MyMoneySeqAccessMgr::loadPayees(const TQMap<TQString, MyMoneyPayee>& map)
}
}
}
}
int pos = lastId . tq find( TQRegExp ( " \\ d+ " ) , 0 ) ;
int pos = lastId . find( TQRegExp ( " \\ d+ " ) , 0 ) ;
if ( pos ! = - 1 ) {
if ( pos ! = - 1 ) {
m_nextPayeeID = atol ( lastId . mid ( pos ) ) ;
m_nextPayeeID = atol ( lastId . mid ( pos ) ) ;
}
}
@ -1099,7 +1099,7 @@ void MyMoneySeqAccessMgr::loadSecurities(const TQMap<TQString, MyMoneySecurity>&
lastId = ( * it_s ) . id ( ) ;
lastId = ( * it_s ) . id ( ) ;
}
}
int pos = lastId . tq find( TQRegExp ( " \\ d+ " ) , 0 ) ;
int pos = lastId . find( TQRegExp ( " \\ d+ " ) , 0 ) ;
if ( pos ! = - 1 ) {
if ( pos ! = - 1 ) {
m_nextSecurityID = atol ( lastId . mid ( pos ) ) ;
m_nextSecurityID = atol ( lastId . mid ( pos ) ) ;
}
}
@ -1196,7 +1196,7 @@ void MyMoneySeqAccessMgr::modifySchedule(const MyMoneySchedule& sched)
{
{
TQMap < TQString , MyMoneySchedule > : : ConstIterator it ;
TQMap < TQString , MyMoneySchedule > : : ConstIterator it ;
it = m_scheduleList . tq find( sched . id ( ) ) ;
it = m_scheduleList . find( sched . id ( ) ) ;
if ( it = = m_scheduleList . end ( ) ) {
if ( it = = m_scheduleList . end ( ) ) {
TQString msg = " Unknown schedule ' " + sched . id ( ) + " ' " ;
TQString msg = " Unknown schedule ' " + sched . id ( ) + " ' " ;
throw new MYMONEYEXCEPTION ( msg ) ;
throw new MYMONEYEXCEPTION ( msg ) ;
@ -1209,7 +1209,7 @@ void MyMoneySeqAccessMgr::removeSchedule(const MyMoneySchedule& sched)
{
{
TQMap < TQString , MyMoneySchedule > : : ConstIterator it ;
TQMap < TQString , MyMoneySchedule > : : ConstIterator it ;
it = m_scheduleList . tq find( sched . id ( ) ) ;
it = m_scheduleList . find( sched . id ( ) ) ;
if ( it = = m_scheduleList . end ( ) ) {
if ( it = = m_scheduleList . end ( ) ) {
TQString msg = " Unknown schedule ' " + sched . id ( ) + " ' " ;
TQString msg = " Unknown schedule ' " + sched . id ( ) + " ' " ;
throw new MYMONEYEXCEPTION ( msg ) ;
throw new MYMONEYEXCEPTION ( msg ) ;
@ -1224,7 +1224,7 @@ const MyMoneySchedule MyMoneySeqAccessMgr::schedule(const TQString& id) const
TQMap < TQString , MyMoneySchedule > : : ConstIterator pos ;
TQMap < TQString , MyMoneySchedule > : : ConstIterator pos ;
// locate the schedule and if present, return it's data
// locate the schedule and if present, return it's data
pos = m_scheduleList . tq find( id ) ;
pos = m_scheduleList . find( id ) ;
if ( pos ! = m_scheduleList . end ( ) )
if ( pos ! = m_scheduleList . end ( ) )
return ( * pos ) ;
return ( * pos ) ;
@ -1323,7 +1323,7 @@ void MyMoneySeqAccessMgr::loadSchedules(const TQMap<TQString, MyMoneySchedule>&
lastId = ( * it_s ) . id ( ) ;
lastId = ( * it_s ) . id ( ) ;
}
}
int pos = lastId . tq find( TQRegExp ( " \\ d+ " ) , 0 ) ;
int pos = lastId . find( TQRegExp ( " \\ d+ " ) , 0 ) ;
if ( pos ! = - 1 ) {
if ( pos ! = - 1 ) {
m_nextScheduleID = atol ( lastId . mid ( pos ) ) ;
m_nextScheduleID = atol ( lastId . mid ( pos ) ) ;
}
}
@ -1370,7 +1370,7 @@ const TQValueList<MyMoneySchedule> MyMoneySeqAccessMgr::scheduleListEx(int sched
if ( accounts . count ( ) > 0 )
if ( accounts . count ( ) > 0 )
{
{
if ( accounts . tq contains( ( * pos ) . account ( ) . id ( ) ) )
if ( accounts . contains( ( * pos ) . account ( ) . id ( ) ) )
continue ;
continue ;
}
}
@ -1395,7 +1395,7 @@ void MyMoneySeqAccessMgr::modifySecurity(const MyMoneySecurity& security)
{
{
TQMap < TQString , MyMoneySecurity > : : ConstIterator it ;
TQMap < TQString , MyMoneySecurity > : : ConstIterator it ;
it = m_securitiesList . tq find( security . id ( ) ) ;
it = m_securitiesList . find( security . id ( ) ) ;
if ( it = = m_securitiesList . end ( ) )
if ( it = = m_securitiesList . end ( ) )
{
{
TQString msg = " Unknown security ' " ;
TQString msg = " Unknown security ' " ;
@ -1412,7 +1412,7 @@ void MyMoneySeqAccessMgr::removeSecurity(const MyMoneySecurity& security)
// FIXME: check referential integrity
// FIXME: check referential integrity
it = m_securitiesList . tq find( security . id ( ) ) ;
it = m_securitiesList . find( security . id ( ) ) ;
if ( it = = m_securitiesList . end ( ) )
if ( it = = m_securitiesList . end ( ) )
{
{
TQString msg = " Unknown security ' " ;
TQString msg = " Unknown security ' " ;
@ -1425,7 +1425,7 @@ void MyMoneySeqAccessMgr::removeSecurity(const MyMoneySecurity& security)
const MyMoneySecurity MyMoneySeqAccessMgr : : security ( const TQString & id ) const
const MyMoneySecurity MyMoneySeqAccessMgr : : security ( const TQString & id ) const
{
{
TQMap < TQString , MyMoneySecurity > : : ConstIterator it = m_securitiesList . tq find( id ) ;
TQMap < TQString , MyMoneySecurity > : : ConstIterator it = m_securitiesList . find( id ) ;
if ( it ! = m_securitiesList . end ( ) )
if ( it ! = m_securitiesList . end ( ) )
{
{
return it . data ( ) ;
return it . data ( ) ;
@ -1444,7 +1444,7 @@ void MyMoneySeqAccessMgr::addCurrency(const MyMoneySecurity& currency)
{
{
TQMap < TQString , MyMoneySecurity > : : ConstIterator it ;
TQMap < TQString , MyMoneySecurity > : : ConstIterator it ;
it = m_currencyList . tq find( currency . id ( ) ) ;
it = m_currencyList . find( currency . id ( ) ) ;
if ( it ! = m_currencyList . end ( ) ) {
if ( it ! = m_currencyList . end ( ) ) {
throw new MYMONEYEXCEPTION ( TQString ( " Cannot add currency with existing id %1 " ) . tqarg ( currency . id ( ) ) ) ;
throw new MYMONEYEXCEPTION ( TQString ( " Cannot add currency with existing id %1 " ) . tqarg ( currency . id ( ) ) ) ;
}
}
@ -1456,7 +1456,7 @@ void MyMoneySeqAccessMgr::modifyCurrency(const MyMoneySecurity& currency)
{
{
TQMap < TQString , MyMoneySecurity > : : ConstIterator it ;
TQMap < TQString , MyMoneySecurity > : : ConstIterator it ;
it = m_currencyList . tq find( currency . id ( ) ) ;
it = m_currencyList . find( currency . id ( ) ) ;
if ( it = = m_currencyList . end ( ) ) {
if ( it = = m_currencyList . end ( ) ) {
throw new MYMONEYEXCEPTION ( TQString ( " Cannot modify currency with unknown id %1 " ) . tqarg ( currency . id ( ) ) ) ;
throw new MYMONEYEXCEPTION ( TQString ( " Cannot modify currency with unknown id %1 " ) . tqarg ( currency . id ( ) ) ) ;
}
}
@ -1470,7 +1470,7 @@ void MyMoneySeqAccessMgr::removeCurrency(const MyMoneySecurity& currency)
// FIXME: check referential integrity
// FIXME: check referential integrity
it = m_currencyList . tq find( currency . id ( ) ) ;
it = m_currencyList . find( currency . id ( ) ) ;
if ( it = = m_currencyList . end ( ) ) {
if ( it = = m_currencyList . end ( ) ) {
throw new MYMONEYEXCEPTION ( TQString ( " Cannot remove currency with unknown id %1 " ) . tqarg ( currency . id ( ) ) ) ;
throw new MYMONEYEXCEPTION ( TQString ( " Cannot remove currency with unknown id %1 " ) . tqarg ( currency . id ( ) ) ) ;
}
}
@ -1485,7 +1485,7 @@ const MyMoneySecurity MyMoneySeqAccessMgr::currency(const TQString& id) const
}
}
TQMap < TQString , MyMoneySecurity > : : ConstIterator it ;
TQMap < TQString , MyMoneySecurity > : : ConstIterator it ;
it = m_currencyList . tq find( id ) ;
it = m_currencyList . find( id ) ;
if ( it = = m_currencyList . end ( ) ) {
if ( it = = m_currencyList . end ( ) ) {
throw new MYMONEYEXCEPTION ( TQString ( " Cannot retrieve currency with unknown id '%1' " ) . tqarg ( id ) ) ;
throw new MYMONEYEXCEPTION ( TQString ( " Cannot retrieve currency with unknown id '%1' " ) . tqarg ( id ) ) ;
}
}
@ -1525,7 +1525,7 @@ void MyMoneySeqAccessMgr::loadReports(const TQMap<TQString, MyMoneyReport>& map)
lastId = ( * it_r ) . id ( ) ;
lastId = ( * it_r ) . id ( ) ;
}
}
int pos = lastId . tq find( TQRegExp ( " \\ d+ " ) , 0 ) ;
int pos = lastId . find( TQRegExp ( " \\ d+ " ) , 0 ) ;
if ( pos ! = - 1 ) {
if ( pos ! = - 1 ) {
m_nextReportID = atol ( lastId . mid ( pos ) ) ;
m_nextReportID = atol ( lastId . mid ( pos ) ) ;
}
}
@ -1535,7 +1535,7 @@ void MyMoneySeqAccessMgr::modifyReport( const MyMoneyReport& report )
{
{
TQMap < TQString , MyMoneyReport > : : ConstIterator it ;
TQMap < TQString , MyMoneyReport > : : ConstIterator it ;
it = m_reportList . tq find( report . id ( ) ) ;
it = m_reportList . find( report . id ( ) ) ;
if ( it = = m_reportList . end ( ) ) {
if ( it = = m_reportList . end ( ) ) {
TQString msg = " Unknown report ' " + report . id ( ) + " ' " ;
TQString msg = " Unknown report ' " + report . id ( ) + " ' " ;
throw new MYMONEYEXCEPTION ( msg ) ;
throw new MYMONEYEXCEPTION ( msg ) ;
@ -1565,7 +1565,7 @@ void MyMoneySeqAccessMgr::removeReport( const MyMoneyReport& report )
{
{
TQMap < TQString , MyMoneyReport > : : ConstIterator it ;
TQMap < TQString , MyMoneyReport > : : ConstIterator it ;
it = m_reportList . tq find( report . id ( ) ) ;
it = m_reportList . find( report . id ( ) ) ;
if ( it = = m_reportList . end ( ) ) {
if ( it = = m_reportList . end ( ) ) {
TQString msg = " Unknown report ' " + report . id ( ) + " ' " ;
TQString msg = " Unknown report ' " + report . id ( ) + " ' " ;
throw new MYMONEYEXCEPTION ( msg ) ;
throw new MYMONEYEXCEPTION ( msg ) ;
@ -1599,7 +1599,7 @@ void MyMoneySeqAccessMgr::loadBudgets(const TQMap<TQString, MyMoneyBudget>& map)
lastId = ( * it_b ) . id ( ) ;
lastId = ( * it_b ) . id ( ) ;
}
}
int pos = lastId . tq find( TQRegExp ( " \\ d+ " ) , 0 ) ;
int pos = lastId . find( TQRegExp ( " \\ d+ " ) , 0 ) ;
if ( pos ! = - 1 ) {
if ( pos ! = - 1 ) {
m_nextBudgetID = atol ( lastId . mid ( pos ) ) ;
m_nextBudgetID = atol ( lastId . mid ( pos ) ) ;
}
}
@ -1622,7 +1622,7 @@ void MyMoneySeqAccessMgr::modifyBudget( const MyMoneyBudget& budget )
{
{
TQMap < TQString , MyMoneyBudget > : : ConstIterator it ;
TQMap < TQString , MyMoneyBudget > : : ConstIterator it ;
it = m_budgetList . tq find( budget . id ( ) ) ;
it = m_budgetList . find( budget . id ( ) ) ;
if ( it = = m_budgetList . end ( ) ) {
if ( it = = m_budgetList . end ( ) ) {
TQString msg = " Unknown budget ' " + budget . id ( ) + " ' " ;
TQString msg = " Unknown budget ' " + budget . id ( ) + " ' " ;
throw new MYMONEYEXCEPTION ( msg ) ;
throw new MYMONEYEXCEPTION ( msg ) ;
@ -1652,7 +1652,7 @@ void MyMoneySeqAccessMgr::removeBudget( const MyMoneyBudget& budget )
{
{
TQMap < TQString , MyMoneyBudget > : : ConstIterator it ;
TQMap < TQString , MyMoneyBudget > : : ConstIterator it ;
it = m_budgetList . tq find( budget . id ( ) ) ;
it = m_budgetList . find( budget . id ( ) ) ;
if ( it = = m_budgetList . end ( ) ) {
if ( it = = m_budgetList . end ( ) ) {
TQString msg = " Unknown budget ' " + budget . id ( ) + " ' " ;
TQString msg = " Unknown budget ' " + budget . id ( ) + " ' " ;
throw new MYMONEYEXCEPTION ( msg ) ;
throw new MYMONEYEXCEPTION ( msg ) ;
@ -1665,7 +1665,7 @@ void MyMoneySeqAccessMgr::addPrice(const MyMoneyPrice& price)
{
{
MyMoneySecurityPair pricePair ( price . from ( ) , price . to ( ) ) ;
MyMoneySecurityPair pricePair ( price . from ( ) , price . to ( ) ) ;
TQMap < MyMoneySecurityPair , MyMoneyPriceEntries > : : ConstIterator it_m ;
TQMap < MyMoneySecurityPair , MyMoneyPriceEntries > : : ConstIterator it_m ;
it_m = m_priceList . tq find( pricePair ) ;
it_m = m_priceList . find( pricePair ) ;
MyMoneyPriceEntries entries ;
MyMoneyPriceEntries entries ;
if ( it_m ! = m_priceList . end ( ) ) {
if ( it_m ! = m_priceList . end ( ) ) {
@ -1677,7 +1677,7 @@ void MyMoneySeqAccessMgr::addPrice(const MyMoneyPrice& price)
// an existing one.
// an existing one.
MyMoneyPriceEntries : : ConstIterator it ;
MyMoneyPriceEntries : : ConstIterator it ;
it = entries . tq find( price . date ( ) ) ;
it = entries . find( price . date ( ) ) ;
if ( it ! = entries . end ( ) ) {
if ( it ! = entries . end ( ) ) {
if ( ( * it ) . rate ( TQString ( ) ) = = price . rate ( TQString ( ) )
if ( ( * it ) . rate ( TQString ( ) ) = = price . rate ( TQString ( ) )
& & ( * it ) . source ( ) = = price . source ( ) )
& & ( * it ) . source ( ) = = price . source ( ) )
@ -1699,7 +1699,7 @@ void MyMoneySeqAccessMgr::removePrice(const MyMoneyPrice& price)
{
{
MyMoneySecurityPair pricePair ( price . from ( ) , price . to ( ) ) ;
MyMoneySecurityPair pricePair ( price . from ( ) , price . to ( ) ) ;
TQMap < MyMoneySecurityPair , MyMoneyPriceEntries > : : ConstIterator it_m ;
TQMap < MyMoneySecurityPair , MyMoneyPriceEntries > : : ConstIterator it_m ;
it_m = m_priceList . tq find( pricePair ) ;
it_m = m_priceList . find( pricePair ) ;
MyMoneyPriceEntries entries ;
MyMoneyPriceEntries entries ;
if ( it_m ! = m_priceList . end ( ) ) {
if ( it_m ! = m_priceList . end ( ) ) {
@ -1736,7 +1736,7 @@ const MyMoneyPrice MyMoneySeqAccessMgr::price(const TQString& fromId, const TQSt
// If the caller selected an exact entry, we can search for
// If the caller selected an exact entry, we can search for
// it using the date as the key
// it using the date as the key
if ( exactDate ) {
if ( exactDate ) {
it = m_priceList [ MyMoneySecurityPair ( fromId , toId ) ] . tq find( date ) ;
it = m_priceList [ MyMoneySecurityPair ( fromId , toId ) ] . find( date ) ;
if ( it ! = m_priceList [ MyMoneySecurityPair ( fromId , toId ) ] . end ( ) )
if ( it ! = m_priceList [ MyMoneySecurityPair ( fromId , toId ) ] . end ( ) )
rc = * it ;
rc = * it ;
@ -1778,7 +1778,7 @@ void MyMoneySeqAccessMgr::rebuildAccountBalances(void)
if ( ! ( * it_s ) . shares ( ) . isZero ( ) ) {
if ( ! ( * it_s ) . shares ( ) . isZero ( ) ) {
const TQString & id = ( * it_s ) . accountId ( ) ;
const TQString & id = ( * it_s ) . accountId ( ) ;
// locate the account and if present, update data
// locate the account and if present, update data
if ( map . tq find( id ) ! = map . end ( ) ) {
if ( map . find( id ) ! = map . end ( ) ) {
map [ id ] . adjustBalance ( * it_s ) ;
map [ id ] . adjustBalance ( * it_s ) ;
}
}
}
}