@ -236,9 +236,9 @@ TQString GncObject::hide (TQString data, unsigned int anonClass) {
// dump current object data values // only called if gncdebug set
// dump current object data values // only called if gncdebug set
void GncObject : : debugDump ( ) {
void GncObject : : debugDump ( ) {
uint i ;
uint i ;
tqDebug ( " Object %s " , m_elementName . latin1 ( ) ) ;
tqDebug ( TQString ( " Object %1 " ) . arg ( m_elementName ) ) ;
for ( i = 0 ; i < m_dataElementListCount ; i + + ) {
for ( i = 0 ; i < m_dataElementListCount ; i + + ) {
tqDebug ( " %s = %s " , m_dataElementList [ i ] . latin1 ( ) , m_v . at ( i ) - > latin1 ( ) ) ;
tqDebug ( TQString ( " %1 = %2 " ) . arg ( m_dataElementList [ i ] ) . arg ( * ( m_v . at ( i ) ) ) ) ;
}
}
}
}
//*****************************************************************
//*****************************************************************
@ -409,7 +409,7 @@ void GncCountData::terminate () {
if ( i ! = 0 ) {
if ( i ! = 0 ) {
if ( m_countType = = " budget " ) pMain - > setBudgetsFound ( true ) ;
if ( m_countType = = " budget " ) pMain - > setBudgetsFound ( true ) ;
else if ( m_countType . left ( 7 ) = = " gnc:Gnc " ) pMain - > setSmallBusinessFound ( true ) ;
else if ( m_countType . left ( 7 ) = = " gnc:Gnc " ) pMain - > setSmallBusinessFound ( true ) ;
else if ( pMain - > xmldebug ) tqDebug ( " Unknown count type %s " , m_countType . latin1 ( ) ) ;
else if ( pMain - > xmldebug ) tqDebug ( TQString ( " Unknown count type %1 " ) . arg ( m_countType ) ) ;
}
}
return ;
return ;
}
}
@ -887,7 +887,7 @@ bool XmlReader::startDocument() {
bool XmlReader : : startElement ( const TQString & , const TQString & , const TQString & elName ,
bool XmlReader : : startElement ( const TQString & , const TQString & , const TQString & elName ,
const TQXmlAttributes & elAttrs ) {
const TQXmlAttributes & elAttrs ) {
try {
try {
if ( pMain - > gncdebug ) tqDebug ( " XML start - %s " , elName . latin1 ( ) ) ;
if ( pMain - > gncdebug ) tqDebug ( TQString ( " XML start - %1 " ) . arg ( elName ) ) ;
# ifdef _GNCFILEANON
# ifdef _GNCFILEANON
int i ;
int i ;
TQString spaces ;
TQString spaces ;
@ -938,9 +938,9 @@ bool XmlReader::startElement (const TQString&, const TQString&, const TQString&
# ifndef _GNCFILEANON
# ifndef _GNCFILEANON
// we can't pass on exceptions here coz the XML reader won't catch them and we just abort
// we can't pass on exceptions here coz the XML reader won't catch them and we just abort
KMessageBox : : error ( 0 , i18n ( " Import failed: \n \n %1 " ) . arg ( e - > what ( ) ) , PACKAGE ) ;
KMessageBox : : error ( 0 , i18n ( " Import failed: \n \n %1 " ) . arg ( e - > what ( ) ) , PACKAGE ) ;
tqFatal ( " %s " , e - > what ( ) . latin1 ( ) ) ;
tqFatal ( e - > what ( ) ) ;
# else
# else
tqFatal ( " %s " , e - > latin1 ( ) ) ;
tqFatal ( e ) ;
# endif // _GNCFILEANON
# endif // _GNCFILEANON
}
}
return true ; // to keep compiler happy
return true ; // to keep compiler happy
@ -948,7 +948,7 @@ bool XmlReader::startElement (const TQString&, const TQString&, const TQString&
bool XmlReader : : endElement ( const TQString & , const TQString & , const TQString & elName ) {
bool XmlReader : : endElement ( const TQString & , const TQString & , const TQString & elName ) {
try {
try {
if ( pMain - > xmldebug ) tqDebug ( " XML end - %s " , elName . latin1 ( ) ) ;
if ( pMain - > xmldebug ) tqDebug ( TQString ( " XML end - %1 " ) . arg ( elName ) ) ;
# ifdef _GNCFILEANON
# ifdef _GNCFILEANON
TQString spaces ;
TQString spaces ;
switch ( lastType ) {
switch ( lastType ) {
@ -973,9 +973,9 @@ bool XmlReader::endElement( const TQString&, const TQString&, const TQString&elN
# ifndef _GNCFILEANON
# ifndef _GNCFILEANON
// we can't pass on exceptions here coz the XML reader won't catch them and we just abort
// we can't pass on exceptions here coz the XML reader won't catch them and we just abort
KMessageBox : : error ( 0 , i18n ( " Import failed: \n \n %1 " ) . arg ( e - > what ( ) ) , PACKAGE ) ;
KMessageBox : : error ( 0 , i18n ( " Import failed: \n \n %1 " ) . arg ( e - > what ( ) ) , PACKAGE ) ;
tqFatal ( " %s " , e - > what ( ) . latin1 ( ) ) ;
tqFatal ( e - > what ( ) ) ;
# else
# else
tqFatal ( " %s " , e - > latin1 ( ) ) ;
tqFatal ( e ) ;
# endif // _GNCFILEANON
# endif // _GNCFILEANON
}
}
return ( true ) ; // to keep compiler happy
return ( true ) ; // to keep compiler happy
@ -985,7 +985,7 @@ bool XmlReader::characters (const TQString &data) {
if ( pMain - > xmldebug ) tqDebug ( " XML Data received - %d bytes " , data . length ( ) ) ;
if ( pMain - > xmldebug ) tqDebug ( " XML Data received - %d bytes " , data . length ( ) ) ;
TQString pData = data . stripWhiteSpace ( ) ; // data may contain line feeds and indentation spaces
TQString pData = data . stripWhiteSpace ( ) ; // data may contain line feeds and indentation spaces
if ( ! pData . isEmpty ( ) ) {
if ( ! pData . isEmpty ( ) ) {
if ( pMain - > developerDebug ) tqDebug ( " XML Data - %s " , pData . latin1 ( ) ) ;
if ( pMain - > developerDebug ) tqDebug ( TQString ( " XML Data - %1 " ) . arg ( pData ) ) ;
m_co - > storeData ( pData ) ; //go store it
m_co - > storeData ( pData ) ; //go store it
# ifdef _GNCFILEANON
# ifdef _GNCFILEANON
TQString anonData = m_co - > getData ( ) ;
TQString anonData = m_co - > getData ( ) ;
@ -1063,7 +1063,7 @@ void MyMoneyGncReader::readFile(TQIODevice* pDevice, IMyMoneySerialize* storage)
ft . commit ( ) ;
ft . commit ( ) ;
} catch ( MyMoneyException * e ) {
} catch ( MyMoneyException * e ) {
KMessageBox : : error ( 0 , i18n ( " Import failed: \n \n %1 " ) . arg ( e - > what ( ) ) , PACKAGE ) ;
KMessageBox : : error ( 0 , i18n ( " Import failed: \n \n %1 " ) . arg ( e - > what ( ) ) , PACKAGE ) ;
tqFatal ( " %s " , e - > what ( ) . latin1 ( ) ) ;
tqFatal ( e - > what ( ) ) ;
} // end catch
} // end catch
signalProgress ( 0 , 1 , i18n ( " Import complete " ) ) ; // switch off progress bar
signalProgress ( 0 , 1 , i18n ( " Import complete " ) ) ; // switch off progress bar
delete m_xr ;
delete m_xr ;
@ -1085,7 +1085,7 @@ void MyMoneyGncReader::readFile(TQString in, TQString out) {
try {
try {
m_xr - > processFile ( & pDevice ) ;
m_xr - > processFile ( & pDevice ) ;
} catch ( MyMoneyException * e ) {
} catch ( MyMoneyException * e ) {
tqFatal ( " %s " , e - > latin1 ( ) ) ;
tqFatal ( e ) ;
} // end catch
} // end catch
delete m_xr ;
delete m_xr ;
pDevice . close ( ) ;
pDevice . close ( ) ;
@ -1149,7 +1149,7 @@ void MyMoneyGncReader::convertCommodity (const GncCommodity *gcm) {
m_storage - > addSecurity ( equ ) ;
m_storage - > addSecurity ( equ ) ;
//assign the gnucash id as the key into the map to find our id
//assign the gnucash id as the key into the map to find our id
if ( gncdebug ) tqDebug ( " mapping, key = %s, id = %s " , gcm - > id ( ) . latin1 ( ) , equ . id ( ) . data ( ) ) ;
if ( gncdebug ) tqDebug ( TQString ( " mapping, key = %1, id = %2 " ) . arg ( gcm - > id ( ) ) . arg ( equ . id ( ) ) ) ;
m_mapEquities [ gcm - > id ( ) . utf8 ( ) ] = equ . id ( ) ;
m_mapEquities [ gcm - > id ( ) . utf8 ( ) ] = equ . id ( ) ;
}
}
signalProgress ( + + m_commodityCount , 0 ) ;
signalProgress ( + + m_commodityCount , 0 ) ;
@ -1168,8 +1168,8 @@ void MyMoneyGncReader::convertPrice (const GncPrice *gpr) {
m_storage - > addPrice ( exchangeRate ) ;
m_storage - > addPrice ( exchangeRate ) ;
} else {
} else {
MyMoneySecurity e = m_storage - > security ( m_mapEquities [ gpr - > commodity ( ) - > id ( ) . utf8 ( ) ] ) ;
MyMoneySecurity e = m_storage - > security ( m_mapEquities [ gpr - > commodity ( ) - > id ( ) . utf8 ( ) ] ) ;
if ( gncdebug ) tqDebug ( " Searching map, key = %s, found id = %s " ,
if ( gncdebug ) tqDebug ( TQString ( " Searching map, key = %1, found id = %2 " ) .
gpr - > commodity ( ) - > id ( ) .latin1 ( ) , e . id ( ) . data ( ) ) ;
arg ( gpr - > commodity ( ) - > id ( ) ). arg ( e . id ( ) ) ) ;
e . setTradingCurrency ( gpr - > currency ( ) - > id ( ) . utf8 ( ) ) ;
e . setTradingCurrency ( gpr - > currency ( ) - > id ( ) . utf8 ( ) ) ;
MyMoneyPrice stockPrice ( e . id ( ) , gpr - > currency ( ) - > id ( ) . utf8 ( ) , gpr - > priceDate ( ) , rate , i18n ( " Imported History " ) ) ;
MyMoneyPrice stockPrice ( e . id ( ) , gpr - > currency ( ) - > id ( ) . utf8 ( ) , gpr - > priceDate ( ) , rate , i18n ( " Imported History " ) ) ;
m_storage - > addPrice ( stockPrice ) ;
m_storage - > addPrice ( stockPrice ) ;
@ -1272,12 +1272,12 @@ void MyMoneyGncReader::convertAccount (const GncAccount* gac) {
m_stockList . append ( gac - > id ( ) ) ;
m_stockList . append ( gac - > id ( ) ) ;
// set the equity type
// set the equity type
MyMoneySecurity e = m_storage - > security ( m_mapEquities [ gac - > commodity ( ) - > id ( ) . utf8 ( ) ] ) ;
MyMoneySecurity e = m_storage - > security ( m_mapEquities [ gac - > commodity ( ) - > id ( ) . utf8 ( ) ] ) ;
if ( gncdebug ) tqDebug ( " Acct equity search, key = %s, found id = %s " ,
if ( gncdebug ) tqDebug ( TQString ( " Acct equity search, key = %1, found id = %2 " ) .
gac - > commodity ( ) - > id ( ) .latin1 ( ) , e . id ( ) . data ( ) ) ;
arg ( gac - > commodity ( ) - > id ( ) ). arg ( e . id ( ) ) ) ;
acc . setCurrencyId ( e . id ( ) ) ; // actually, the security id
acc . setCurrencyId ( e . id ( ) ) ; // actually, the security id
if ( " MUTUAL " = = gac - > type ( ) ) {
if ( " MUTUAL " = = gac - > type ( ) ) {
e . setSecurityType ( MyMoneySecurity : : SECURITY_MUTUALFUND ) ;
e . setSecurityType ( MyMoneySecurity : : SECURITY_MUTUALFUND ) ;
if ( gncdebug ) tqDebug ( " Setting %s to mutual " , e . name ( ) . latin1 ( ) ) ;
if ( gncdebug ) tqDebug ( TQString ( " Setting %1 to mutual " ) . arg ( e . name ( ) ) ) ;
m_storage - > modifySecurity ( e ) ;
m_storage - > modifySecurity ( e ) ;
}
}
// See if he wants online quotes for this account
// See if he wants online quotes for this account
@ -1313,9 +1313,10 @@ void MyMoneyGncReader::convertAccount (const GncAccount* gac) {
m_storage - > addAccount ( acc ) ;
m_storage - > addAccount ( acc ) ;
m_mapIds [ gac - > id ( ) . utf8 ( ) ] = acc . id ( ) ; // to link gnucash id to ours for tx posting
m_mapIds [ gac - > id ( ) . utf8 ( ) ] = acc . id ( ) ; // to link gnucash id to ours for tx posting
if ( gncdebug ) tqDebug ( " Gnucash account %s has id of %s, type of %s, parent is %s " ,
if ( gncdebug ) tqDebug ( TQString ( " Gnucash account %1 has id of %2, type of %3, parent is %4 " ) .
gac - > id ( ) . latin1 ( ) , acc . id ( ) . data ( ) ,
arg ( gac - > id ( ) ) . arg ( acc . id ( ) ) .
KMyMoneyUtils : : accountTypeToString ( acc . accountType ( ) ) . latin1 ( ) , acc . parentAccountId ( ) . data ( ) ) ;
arg ( KMyMoneyUtils : : accountTypeToString ( acc . accountType ( ) ) ) .
arg ( acc . parentAccountId ( ) ) ) ;
signalProgress ( + + m_accountCount , 0 ) ;
signalProgress ( + + m_accountCount , 0 ) ;
return ;
return ;
@ -1403,9 +1404,9 @@ void MyMoneyGncReader::convertSplit (const GncSplit *gsp) {
splitAccount = m_storage - > account ( kmmAccountId ) ;
splitAccount = m_storage - > account ( kmmAccountId ) ;
// print some data so we can maybe identify this split later
// print some data so we can maybe identify this split later
// TODO : prints personal data
// TODO : prints personal data
//if (gncdebug) tqDebug ("Split data - gncid %s, kmmid %s, memo %s, value %s, recon state %s",
//if (gncdebug) tqDebug (TQString("Split data - gncid %1, kmmid %2, memo %3, value %4, recon state %5").
// gsp->acct().latin1(), kmmAccountId.data(), gsp->memo().latin1(), gsp->value().latin1(),
// arg(gsp->acct()).arg(kmmAccountId).arg(gsp->memo()).arg(gsp->value()).
// gsp->recon().latin1( ));
// arg(gsp->recon() ));
// payee id
// payee id
split . setPayeeId ( m_txPayeeId . utf8 ( ) ) ;
split . setPayeeId ( m_txPayeeId . utf8 ( ) ) ;
// reconciled state and date
// reconciled state and date
@ -1467,9 +1468,9 @@ void MyMoneyGncReader::convertSplit (const GncSplit *gsp) {
// we can't use m_storage->security coz security list is not built yet
// we can't use m_storage->security coz security list is not built yet
m_storage - > currency ( m_txCommodity ) ; // will throw exception if not currency
m_storage - > currency ( m_txCommodity ) ; // will throw exception if not currency
e . setTradingCurrency ( m_txCommodity ) ;
e . setTradingCurrency ( m_txCommodity ) ;
if ( gncdebug ) tqDebug ( " added price for %s, %s date %s " ,
if ( gncdebug ) tqDebug ( TQString ( " added price for %1, %2 date %3 " ) .
e. name ( ) . latin1 ( ) , newPrice . toString ( ) . latin1 ( ) ,
arg( e . name ( ) ) . arg ( newPrice . toString ( ) ) .
TQStrin g( m_txDatePosted . toString ( Qt : : ISODate ) ) . latin1 ( ) ) ;
ar g( m_txDatePosted . toString ( Qt : : ISODate ) ) ) ;
m_storage - > modifySecurity ( e ) ;
m_storage - > modifySecurity ( e ) ;
MyMoneyPrice dealPrice ( e . id ( ) , m_txCommodity , m_txDatePosted , newPrice , i18n ( " Imported Transaction " ) ) ;
MyMoneyPrice dealPrice ( e . id ( ) , m_txCommodity , m_txDatePosted , newPrice , i18n ( " Imported Transaction " ) ) ;
m_storage - > addPrice ( dealPrice ) ;
m_storage - > addPrice ( dealPrice ) ;
@ -1631,8 +1632,8 @@ void MyMoneyGncReader::convertTemplateSplit (const TQString& schedName, const Gn
}
}
// all data read, now check we have everything
// all data read, now check we have everything
if ( ( bFoundStringCreditFormula ) & & ( bFoundStringDebitFormula ) & & ( bFoundGuidAccountId ) ) {
if ( ( bFoundStringCreditFormula ) & & ( bFoundStringDebitFormula ) & & ( bFoundGuidAccountId ) ) {
if ( gncdebug ) tqDebug ( " Found valid slot; credit %s, debit %s, acct %s " ,
if ( gncdebug ) tqDebug ( TQString ( " Found valid slot; credit %1, debit %2, acct %3 " ) .
gncCreditFormula . latin1 ( ) , gncDebitFormula . latin1 ( ) , gncAccountId . latin1 ( ) ) ;
arg ( gncCreditFormula ) . arg ( gncDebitFormula ) . arg ( gncAccountId ) ) ;
validSlotCount + + ;
validSlotCount + + ;
}
}
// validate numeric, work out sign
// validate numeric, work out sign
@ -1657,7 +1658,7 @@ void MyMoneyGncReader::convertTemplateSplit (const TQString& schedName, const Gn
exFormula = numericTest ;
exFormula = numericTest ;
}
}
} else {
} else {
if ( gncdebug ) tqDebug ( " %s is not numeric " , numericTest . latin1 ( ) ) ;
if ( gncdebug ) tqDebug ( TQString ( " %1 is not numeric " ) . arg ( numericTest ) ) ;
nonNumericFormula = true ;
nonNumericFormula = true ;
}
}
split . setValue ( exFormula ) ;
split . setValue ( exFormula ) ;
@ -1901,7 +1902,7 @@ void MyMoneyGncReader::terminate () {
// this code is just temporary to show us what is in the file.
// this code is just temporary to show us what is in the file.
if ( gncdebug ) tqDebug ( " %d accounts found in the GnuCash file " , ( unsigned int ) m_mapIds . count ( ) ) ;
if ( gncdebug ) tqDebug ( " %d accounts found in the GnuCash file " , ( unsigned int ) m_mapIds . count ( ) ) ;
for ( map_accountIds : : Iterator it = m_mapIds . begin ( ) ; it ! = m_mapIds . end ( ) ; + + it ) {
for ( map_accountIds : : Iterator it = m_mapIds . begin ( ) ; it ! = m_mapIds . end ( ) ; + + it ) {
if ( gncdebug ) tqDebug ( " key = %s, value = %s " , it . key ( ) . data ( ) , it . data ( ) . data ( ) ) ;
if ( gncdebug ) tqDebug ( TQString ( " key = %1, value = %2 " ) . arg ( it . key ( ) ) . arg ( it . data ( ) ) ) ;
}
}
// first step is to implement the users investment option, now we
// first step is to implement the users investment option, now we
// have all the accounts available
// have all the accounts available
@ -1919,34 +1920,34 @@ void MyMoneyGncReader::terminate () {
if ( ( * acc ) . parentAccountId ( ) = = m_storage - > asset ( ) . id ( ) ) {
if ( ( * acc ) . parentAccountId ( ) = = m_storage - > asset ( ) . id ( ) ) {
MyMoneyAccount assets = m_storage - > asset ( ) ;
MyMoneyAccount assets = m_storage - > asset ( ) ;
m_storage - > addAccount ( assets , ( * acc ) ) ;
m_storage - > addAccount ( assets , ( * acc ) ) ;
if ( gncdebug ) tqDebug ( " Account id %s is a child of the main asset account " , ( * acc ) . id ( ) . data ( ) ) ;
if ( gncdebug ) tqDebug ( TQString ( " Account id %1 is a child of the main asset account " ) . arg ( ( * acc ) . id ( ) ) ) ;
} else if ( ( * acc ) . parentAccountId ( ) = = m_storage - > liability ( ) . id ( ) ) {
} else if ( ( * acc ) . parentAccountId ( ) = = m_storage - > liability ( ) . id ( ) ) {
MyMoneyAccount liabilities = m_storage - > liability ( ) ;
MyMoneyAccount liabilities = m_storage - > liability ( ) ;
m_storage - > addAccount ( liabilities , ( * acc ) ) ;
m_storage - > addAccount ( liabilities , ( * acc ) ) ;
if ( gncdebug ) tqDebug ( " Account id %s is a child of the main liability account " , ( * acc ) . id ( ) . data ( ) ) ;
if ( gncdebug ) tqDebug ( TQString ( " Account id %1 is a child of the main liability account " ) . arg ( ( * acc ) . id ( ) ) ) ;
} else if ( ( * acc ) . parentAccountId ( ) = = m_storage - > income ( ) . id ( ) ) {
} else if ( ( * acc ) . parentAccountId ( ) = = m_storage - > income ( ) . id ( ) ) {
MyMoneyAccount incomes = m_storage - > income ( ) ;
MyMoneyAccount incomes = m_storage - > income ( ) ;
m_storage - > addAccount ( incomes , ( * acc ) ) ;
m_storage - > addAccount ( incomes , ( * acc ) ) ;
if ( gncdebug ) tqDebug ( " Account id %s is a child of the main income account " , ( * acc ) . id ( ) . data ( ) ) ;
if ( gncdebug ) tqDebug ( TQString ( " Account id %1 is a child of the main income account " ) . arg ( ( * acc ) . id ( ) ) ) ;
} else if ( ( * acc ) . parentAccountId ( ) = = m_storage - > expense ( ) . id ( ) ) {
} else if ( ( * acc ) . parentAccountId ( ) = = m_storage - > expense ( ) . id ( ) ) {
MyMoneyAccount expenses = m_storage - > expense ( ) ;
MyMoneyAccount expenses = m_storage - > expense ( ) ;
m_storage - > addAccount ( expenses , ( * acc ) ) ;
m_storage - > addAccount ( expenses , ( * acc ) ) ;
if ( gncdebug ) tqDebug ( " Account id %s is a child of the main expense account " , ( * acc ) . id ( ) . data ( ) ) ;
if ( gncdebug ) tqDebug ( TQString ( " Account id %1 is a child of the main expense account " ) . arg ( ( * acc ) . id ( ) ) ) ;
} else if ( ( * acc ) . parentAccountId ( ) = = m_storage - > equity ( ) . id ( ) ) {
} else if ( ( * acc ) . parentAccountId ( ) = = m_storage - > equity ( ) . id ( ) ) {
MyMoneyAccount equity = m_storage - > equity ( ) ;
MyMoneyAccount equity = m_storage - > equity ( ) ;
m_storage - > addAccount ( equity , ( * acc ) ) ;
m_storage - > addAccount ( equity , ( * acc ) ) ;
if ( gncdebug ) tqDebug ( " Account id %s is a child of the main equity account " , ( * acc ) . id ( ) . data ( ) ) ;
if ( gncdebug ) tqDebug ( TQString ( " Account id %1 is a child of the main equity account " ) . arg ( ( * acc ) . id ( ) ) ) ;
} else if ( ( * acc ) . parentAccountId ( ) = = m_rootId ) {
} else if ( ( * acc ) . parentAccountId ( ) = = m_rootId ) {
if ( gncdebug ) tqDebug ( " Account id %s is a child of root " , ( * acc ) . id ( ) . data ( ) ) ;
if ( gncdebug ) tqDebug ( TQString ( " Account id %1 is a child of root " ) . arg ( ( * acc ) . id ( ) ) ) ;
} else {
} else {
// it is not under one of the main accounts, so find gnucash parent
// it is not under one of the main accounts, so find gnucash parent
TQString parentKey = ( * acc ) . parentAccountId ( ) ;
TQString parentKey = ( * acc ) . parentAccountId ( ) ;
if ( gncdebug ) tqDebug ( " acc %s, parent %s " , ( * acc ) . id ( ) . data ( ) ,
if ( gncdebug ) tqDebug ( TQString ( " acc %1, parent %2 " ) . arg ( ( * acc ) . id ( ) ) .
( * acc ) . parentAccountId ( ) . data ( ) ) ;
arg ( ( * acc ) . parentAccountId ( ) ) ) ;
map_accountIds : : Iterator id = m_mapIds . find ( parentKey ) ;
map_accountIds : : Iterator id = m_mapIds . find ( parentKey ) ;
if ( id ! = m_mapIds . end ( ) ) {
if ( id ! = m_mapIds . end ( ) ) {
if ( gncdebug ) tqDebug ( " Setting account id %s's parent account id to %s " ,
if ( gncdebug ) tqDebug ( TQString ( " Setting account id %1's parent account id to %1 " ) .
( * acc ) . id ( ) . data ( ) , id . data ( ) . data ( ) ) ;
arg ( ( * acc ) . id ( ) ) . arg ( id . data ( ) ) ) ;
MyMoneyAccount parent = m_storage - > account ( id . data ( ) ) ;
MyMoneyAccount parent = m_storage - > account ( id . data ( ) ) ;
parent = checkConsistency ( parent , ( * acc ) ) ;
parent = checkConsistency ( parent , ( * acc ) ) ;
m_storage - > addAccount ( parent , ( * acc ) ) ;
m_storage - > addAccount ( parent , ( * acc ) ) ;
@ -2074,13 +2075,13 @@ TQString MyMoneyGncReader::buildReportSection (const TQString& source) {
}
}
if ( more ) s . append ( i18n ( " \n \n Press More for further information " ) ) ;
if ( more ) s . append ( i18n ( " \n \n Press More for further information " ) ) ;
} else { // we need to retrieve the posted messages for this source
} else { // we need to retrieve the posted messages for this source
if ( gncdebug ) tqDebug ( " Building messages for source % s" , source . latin1 ( ) ) ;
if ( gncdebug ) tqDebug ( TQString ( " Building messages for source % 1" ) . arg ( source ) ) ;
unsigned int i , j ;
unsigned int i , j ;
for ( i = 0 ; i < m_messageList . count ( ) ; i + + ) {
for ( i = 0 ; i < m_messageList . count ( ) ; i + + ) {
GncMessageArgs * m = m_messageList . at ( i ) ;
GncMessageArgs * m = m_messageList . at ( i ) ;
if ( m - > source = = source ) {
if ( m - > source = = source ) {
if ( gncdebug ) tqDebug ( " %s " , TQString ( " build text source %1, code %2, argcount %3 " )
if ( gncdebug ) tqDebug ( TQString ( " build text source %1, code %2, argcount %3 " )
. arg ( m - > source ) . arg ( m - > code ) . arg ( m - > args . count ( ) ) .data ( ) );
. arg ( m - > source ) . arg ( m - > code ) . arg ( m - > args . count ( ) ) );
TQString ss = GncMessages : : text ( m - > source , m - > code ) ;
TQString ss = GncMessages : : text ( m - > source , m - > code ) ;
// add variable args. the .arg function seems always to replace the
// add variable args. the .arg function seems always to replace the
// lowest numbered placeholder it finds, so translating messages
// lowest numbered placeholder it finds, so translating messages
@ -2090,7 +2091,7 @@ TQString MyMoneyGncReader::buildReportSection (const TQString& source) {
}
}
}
}
}
}
if ( gncdebug ) tqDebug ( " %s " , s . latin1 ( ) ) ;
if ( gncdebug ) tqDebug ( s ) ;
return ( static_cast < const TQString > ( s ) ) ;
return ( static_cast < const TQString > ( s ) ) ;
PASS
PASS
}
}
@ -2220,9 +2221,9 @@ void MyMoneyGncReader::checkInvestmentOption (TQString stockId) {
invAcc . setParentAccountId ( parentKey ) ; // intersperse it between old parent and child stock acct
invAcc . setParentAccountId ( parentKey ) ; // intersperse it between old parent and child stock acct
m_storage - > addAccount ( invAcc ) ;
m_storage - > addAccount ( invAcc ) ;
m_mapIds [ invAcc . id ( ) ] = invAcc . id ( ) ; // so stock account gets parented (again) to investment account later
m_mapIds [ invAcc . id ( ) ] = invAcc . id ( ) ; // so stock account gets parented (again) to investment account later
if ( gncdebug ) tqDebug ( " Created investment account %s as id %s, parent %s " , invAcc . name ( ) . data ( ) , invAcc . id ( ) . data ( ) ,
if ( gncdebug ) tqDebug ( TQString ( " Created investment account %1 as id %2, parent %3 " ) . arg ( invAcc . name ( ) ) . arg ( invAcc . id ( ) ) .
invAcc . parentAccountId ( ) . data ( ) ) ;
arg ( invAcc . parentAccountId ( ) ) ) ;
if ( gncdebug ) tqDebug ( " Setting stock %s, id %s, as child of %s " , stockAcc . name ( ) . data ( ) , stockAcc . id ( ) . data ( ) , invAcc . id ( ) . data ( ) ) ;
if ( gncdebug ) tqDebug ( TQString ( " Setting stock %1, id %2, as child of %3 " ) . arg ( stockAcc . name ( ) ) . arg ( stockAcc . id ( ) ) . arg ( invAcc . id ( ) ) ) ;
stockAcc . setParentAccountId ( invAcc . id ( ) ) ;
stockAcc . setParentAccountId ( invAcc . id ( ) ) ;
m_storage - > addAccount ( invAcc , stockAcc ) ;
m_storage - > addAccount ( invAcc , stockAcc ) ;
// investment option 1 creates a single investment account for all stocks
// investment option 1 creates a single investment account for all stocks
@ -2243,8 +2244,8 @@ void MyMoneyGncReader::checkInvestmentOption (TQString stockId) {
singleInvAcc . setParentAccountId ( m_storage - > asset ( ) . id ( ) ) ;
singleInvAcc . setParentAccountId ( m_storage - > asset ( ) . id ( ) ) ;
m_storage - > addAccount ( singleInvAcc ) ;
m_storage - > addAccount ( singleInvAcc ) ;
m_mapIds [ singleInvAcc . id ( ) ] = singleInvAcc . id ( ) ; // so stock account gets parented (again) to investment account later
m_mapIds [ singleInvAcc . id ( ) ] = singleInvAcc . id ( ) ; // so stock account gets parented (again) to investment account later
if ( gncdebug ) tqDebug ( " Created investment account %s as id %s, parent %s, reparenting stock " ,
if ( gncdebug ) tqDebug ( TQString ( " Created investment account %1 as id %2, parent %3, reparenting stock " ) .
singleInvAcc . name ( ) . data ( ) , singleInvAcc . id ( ) . data ( ) , singleInvAcc . parentAccountId ( ) . data ( ) ) ;
arg ( singleInvAcc . name ( ) ) . arg ( singleInvAcc . id ( ) ) . arg ( singleInvAcc . parentAccountId ( ) ) ) ;
singleInvAccId = singleInvAcc . id ( ) ;
singleInvAccId = singleInvAcc . id ( ) ;
} else { // the account has already been created
} else { // the account has already been created
singleInvAcc = m_storage - > account ( singleInvAccId ) ;
singleInvAcc = m_storage - > account ( singleInvAccId ) ;
@ -2397,8 +2398,8 @@ void MyMoneyGncReader::postMessage (const TQString& source, const unsigned int c
// get the number of args this message requires
// get the number of args this message requires
const unsigned int argCount = GncMessages : : argCount ( source , code ) ;
const unsigned int argCount = GncMessages : : argCount ( source , code ) ;
if ( ( gncdebug ) & & ( argCount ! = argList . count ( ) ) )
if ( ( gncdebug ) & & ( argCount ! = argList . count ( ) ) )
tqDebug ( " %s " , TQString ( " MyMoneyGncReader::postMessage debug: Message %1, code %2, requires %3 arguments, got %4 " )
tqDebug ( TQString ( " MyMoneyGncReader::postMessage debug: Message %1, code %2, requires %3 arguments, got %4 " )
. arg ( source ) . arg ( code ) . arg ( argCount ) . arg ( argList . count ( ) ) .data ( ) );
. arg ( source ) . arg ( code ) . arg ( argCount ) . arg ( argList . count ( ) ) );
// store the arguments
// store the arguments
for ( i = 0 ; i < argCount ; i + + ) {
for ( i = 0 ; i < argCount ; i + + ) {
if ( i > argList . count ( ) ) m - > args . append ( TQString ( ) ) ;
if ( i > argList . count ( ) ) m - > args . append ( TQString ( ) ) ;