@ -1088,7 +1088,7 @@ bool KMyMoney2App::slotFileSaveAs(void)
for ( TQStringList : : iterator it = keyList . begin ( ) ; it ! = keyList . end ( ) ; + + it ) {
for ( TQStringList : : iterator it = keyList . begin ( ) ; it ! = keyList . end ( ) ; + + it ) {
TQStringList fields = TQStringList : : split ( " : " , * it ) ;
TQStringList fields = TQStringList : : split ( " : " , * it ) ;
if ( fields [ 0 ] ! = RECOVER_KEY_ID ) {
if ( fields [ 0 ] ! = RECOVER_KEY_ID ) {
// replace tq parenthesis in name field with brackets
// replace parenthesis in name field with brackets
TQString name = fields [ 1 ] ;
TQString name = fields [ 1 ] ;
name . tqreplace ( ' ( ' , " [ " ) ;
name . tqreplace ( ' ( ' , " [ " ) ;
name . tqreplace ( ' ) ' , " ] " ) ;
name . tqreplace ( ' ) ' , " ] " ) ;
@ -2235,25 +2235,25 @@ const MyMoneyAccount& KMyMoney2App::findAccount(const MyMoneyAccount& acc, const
static MyMoneyAccount nullAccount ;
static MyMoneyAccount nullAccount ;
MyMoneyFile * file = MyMoneyFile : : instance ( ) ;
MyMoneyFile * file = MyMoneyFile : : instance ( ) ;
TQValueList < MyMoneyAccount > tq parents;
TQValueList < MyMoneyAccount > parents;
try {
try {
// search by id
// search by id
if ( ! acc . id ( ) . isEmpty ( ) ) {
if ( ! acc . id ( ) . isEmpty ( ) ) {
return file - > account ( acc . id ( ) ) ;
return file - > account ( acc . id ( ) ) ;
}
}
// collect the tq parents. in case tqparent does not have an id, we scan the all top-level accounts
// collect the parents. in case tqparent does not have an id, we scan the all top-level accounts
if ( tqparent . id ( ) . isEmpty ( ) ) {
if ( tqparent . id ( ) . isEmpty ( ) ) {
tq parents < < file - > asset ( ) ;
parents < < file - > asset ( ) ;
tq parents < < file - > liability ( ) ;
parents < < file - > liability ( ) ;
tq parents < < file - > income ( ) ;
parents < < file - > income ( ) ;
tq parents < < file - > expense ( ) ;
parents < < file - > expense ( ) ;
tq parents < < file - > equity ( ) ;
parents < < file - > equity ( ) ;
} else {
} else {
tq parents < < tqparent ;
parents < < tqparent ;
}
}
TQValueList < MyMoneyAccount > : : const_iterator it_p ;
TQValueList < MyMoneyAccount > : : const_iterator it_p ;
for ( it_p = tq parents. begin ( ) ; it_p ! = tq parents. end ( ) ; + + it_p ) {
for ( it_p = parents. begin ( ) ; it_p ! = parents. end ( ) ; + + it_p ) {
MyMoneyAccount tq parentAccount = * it_p ;
MyMoneyAccount parentAccount = * it_p ;
// search by name (allow hierarchy)
// search by name (allow hierarchy)
int pos ;
int pos ;
// check for ':' in the name and use it as separator for a hierarchy
// check for ':' in the name and use it as separator for a hierarchy
@ -2261,14 +2261,14 @@ const MyMoneyAccount& KMyMoney2App::findAccount(const MyMoneyAccount& acc, const
while ( ( pos = name . tqfind ( MyMoneyFile : : AccountSeperator ) ) ! = - 1 ) {
while ( ( pos = name . tqfind ( MyMoneyFile : : AccountSeperator ) ) ! = - 1 ) {
TQString part = name . left ( pos ) ;
TQString part = name . left ( pos ) ;
TQString remainder = name . mid ( pos + 1 ) ;
TQString remainder = name . mid ( pos + 1 ) ;
const MyMoneyAccount & existingAccount = file - > subAccountByName ( tq parentAccount, part ) ;
const MyMoneyAccount & existingAccount = file - > subAccountByName ( parentAccount, part ) ;
if ( existingAccount . id ( ) . isEmpty ( ) ) {
if ( existingAccount . id ( ) . isEmpty ( ) ) {
return existingAccount ;
return existingAccount ;
}
}
tq parentAccount = existingAccount ;
parentAccount = existingAccount ;
name = remainder ;
name = remainder ;
}
}
const MyMoneyAccount & existingAccount = file - > subAccountByName ( tq parentAccount, name ) ;
const MyMoneyAccount & existingAccount = file - > subAccountByName ( parentAccount, name ) ;
if ( ! existingAccount . id ( ) . isEmpty ( ) ) {
if ( ! existingAccount . id ( ) . isEmpty ( ) ) {
if ( acc . accountType ( ) ! = MyMoneyAccount : : UnknownAccountType ) {
if ( acc . accountType ( ) ! = MyMoneyAccount : : UnknownAccountType ) {
if ( acc . accountType ( ) ! = existingAccount . accountType ( ) )
if ( acc . accountType ( ) ! = existingAccount . accountType ( ) )
@ -2284,7 +2284,7 @@ const MyMoneyAccount& KMyMoney2App::findAccount(const MyMoneyAccount& acc, const
return nullAccount ;
return nullAccount ;
}
}
void KMyMoney2App : : createAccount ( MyMoneyAccount & newAccount , MyMoneyAccount & tq parentAccount, MyMoneyAccount & brokerageAccount , MyMoneyMoney openingBal )
void KMyMoney2App : : createAccount ( MyMoneyAccount & newAccount , MyMoneyAccount & parentAccount, MyMoneyAccount & brokerageAccount , MyMoneyMoney openingBal )
{
{
MyMoneyFile * file = MyMoneyFile : : instance ( ) ;
MyMoneyFile * file = MyMoneyFile : : instance ( ) ;
@ -2300,14 +2300,14 @@ void KMyMoney2App::createAccount(MyMoneyAccount& newAccount, MyMoneyAccount& tqp
while ( ( pos = newAccount . name ( ) . tqfind ( MyMoneyFile : : AccountSeperator ) ) ! = - 1 ) {
while ( ( pos = newAccount . name ( ) . tqfind ( MyMoneyFile : : AccountSeperator ) ) ! = - 1 ) {
TQString part = newAccount . name ( ) . left ( pos ) ;
TQString part = newAccount . name ( ) . left ( pos ) ;
TQString remainder = newAccount . name ( ) . mid ( pos + 1 ) ;
TQString remainder = newAccount . name ( ) . mid ( pos + 1 ) ;
const MyMoneyAccount & existingAccount = file - > subAccountByName ( tq parentAccount, part ) ;
const MyMoneyAccount & existingAccount = file - > subAccountByName ( parentAccount, part ) ;
if ( existingAccount . id ( ) . isEmpty ( ) ) {
if ( existingAccount . id ( ) . isEmpty ( ) ) {
newAccount . setName ( part ) ;
newAccount . setName ( part ) ;
file - > addAccount ( newAccount , tq parentAccount) ;
file - > addAccount ( newAccount , parentAccount) ;
tq parentAccount = newAccount ;
parentAccount = newAccount ;
} else {
} else {
tq parentAccount = existingAccount ;
parentAccount = existingAccount ;
}
}
newAccount . setParentAccountId ( TQString ( ) ) ; // make sure, there's no tqparent
newAccount . setParentAccountId ( TQString ( ) ) ; // make sure, there's no tqparent
newAccount . clearId ( ) ; // and no id set for adding
newAccount . clearId ( ) ; // and no id set for adding
@ -2336,7 +2336,7 @@ void KMyMoney2App::createAccount(MyMoneyAccount& newAccount, MyMoneyAccount& tqp
return ;
return ;
}
}
file - > addAccount ( newAccount , tq parentAccount) ;
file - > addAccount ( newAccount , parentAccount) ;
// in case of a loan account, we add the initial payment
// in case of a loan account, we add the initial payment
if ( ( newAccount . accountType ( ) = = MyMoneyAccount : : Loan
if ( ( newAccount . accountType ( ) = = MyMoneyAccount : : Loan
@ -2371,7 +2371,7 @@ void KMyMoney2App::createAccount(MyMoneyAccount& newAccount, MyMoneyAccount& tqp
// a brokerage account
// a brokerage account
} else if ( newAccount . accountType ( ) = = MyMoneyAccount : : Investment
} else if ( newAccount . accountType ( ) = = MyMoneyAccount : : Investment
& & ! brokerageAccount . name ( ) . isEmpty ( ) ) {
& & ! brokerageAccount . name ( ) . isEmpty ( ) ) {
file - > addAccount ( brokerageAccount , tq parentAccount) ;
file - > addAccount ( brokerageAccount , parentAccount) ;
// set a link from the investment account to the brokerage account
// set a link from the investment account to the brokerage account
file - > modifyAccount ( newAccount ) ;
file - > modifyAccount ( newAccount ) ;
@ -2450,11 +2450,11 @@ void KMyMoney2App::createCategory(MyMoneyAccount& account, const MyMoneyAccount&
KNewAccountDlg dialog ( account , false , true , 0 , 0 , i18n ( " Create a new Category " ) ) ;
KNewAccountDlg dialog ( account , false , true , 0 , 0 , i18n ( " Create a new Category " ) ) ;
if ( dialog . exec ( ) = = TQDialog : : Accepted ) {
if ( dialog . exec ( ) = = TQDialog : : Accepted ) {
MyMoneyAccount tq parentAccount, brokerageAccount ;
MyMoneyAccount parentAccount, brokerageAccount ;
account = dialog . account ( ) ;
account = dialog . account ( ) ;
tq parentAccount = dialog . tq parentAccount( ) ;
parentAccount = dialog . parentAccount( ) ;
createAccount ( account , tq parentAccount, brokerageAccount , MyMoneyMoney ( 0 , 1 ) ) ;
createAccount ( account , parentAccount, brokerageAccount , MyMoneyMoney ( 0 , 1 ) ) ;
}
}
}
}
@ -2483,7 +2483,7 @@ void KMyMoney2App::slotAccountNew(MyMoneyAccount& account)
MyMoneyFile * file = MyMoneyFile : : instance ( ) ;
MyMoneyFile * file = MyMoneyFile : : instance ( ) ;
try {
try {
// create the account
// create the account
MyMoneyAccount tqparent = wizard - > tq parentAccount( ) ;
MyMoneyAccount tqparent = wizard - > parentAccount( ) ;
file - > addAccount ( acc , tqparent ) ;
file - > addAccount ( acc , tqparent ) ;
// tell the wizard about the account id which it
// tell the wizard about the account id which it
@ -2845,13 +2845,13 @@ void KMyMoney2App::slotAccountDelete(void)
}
}
// case B - we have some subcategories, maybe the user does not want to
// case B - we have some subcategories, maybe the user does not want to
// delete them all, but just the category itself?
// delete them all, but just the category itself?
MyMoneyAccount tq parentAccount = file - > account ( m_selectedAccount . tq parentAccountId( ) ) ;
MyMoneyAccount parentAccount = file - > account ( m_selectedAccount . parentAccountId( ) ) ;
TQStringList accountsToRetqparent ;
TQStringList accountsToRetqparent ;
int result = KMessageBox : : questionYesNoCancel ( this , TQString ( " <qt> " ) +
int result = KMessageBox : : questionYesNoCancel ( this , TQString ( " <qt> " ) +
i18n ( " Do you want to delete category <b>%1</b> with all its sub-categories or only "
i18n ( " Do you want to delete category <b>%1</b> with all its sub-categories or only "
" the category itself? If you only delete the category itself, all its sub-categories "
" the category itself? If you only delete the category itself, all its sub-categories "
" will be made sub-categories of <b>%2</b>. " ) . tqarg ( m_selectedAccount . name ( ) ) . tqarg ( tq parentAccount. name ( ) ) + TQString ( " </qt> " ) ,
" will be made sub-categories of <b>%2</b>. " ) . tqarg ( m_selectedAccount . name ( ) ) . tqarg ( parentAccount. name ( ) ) + TQString ( " </qt> " ) ,
TQString ( ) ,
TQString ( ) ,
KGuiItem ( i18n ( " Delete all " ) ) ,
KGuiItem ( i18n ( " Delete all " ) ) ,
KGuiItem ( i18n ( " Just the category " ) ) ) ;
KGuiItem ( i18n ( " Just the category " ) ) ) ;
@ -2885,13 +2885,13 @@ void KMyMoney2App::slotAccountDelete(void)
}
}
if ( ! accountsToRetqparent . isEmpty ( ) & & need_confirmation ) {
if ( ! accountsToRetqparent . isEmpty ( ) & & need_confirmation ) {
if ( KMessageBox : : questionYesNo ( this , TQString ( " <p> " ) + i18n ( " Some sub-categories of category <b>%1</b> cannot "
if ( KMessageBox : : questionYesNo ( this , TQString ( " <p> " ) + i18n ( " Some sub-categories of category <b>%1</b> cannot "
" be deleted, because they are still used. They will be made sub-categories of <b>%2</b>. Proceed? " ) . tqarg ( m_selectedAccount . name ( ) ) . tqarg ( tq parentAccount. name ( ) ) ) ! = KMessageBox : : Yes ) {
" be deleted, because they are still used. They will be made sub-categories of <b>%2</b>. Proceed? " ) . tqarg ( m_selectedAccount . name ( ) ) . tqarg ( parentAccount. name ( ) ) ) ! = KMessageBox : : Yes ) {
return ; // user gets wet feet...
return ; // user gets wet feet...
}
}
}
}
// all good, now first reparent selected sub-categories
// all good, now first reparent selected sub-categories
try {
try {
MyMoneyAccount tqparent = file - > account ( m_selectedAccount . tq parentAccountId( ) ) ;
MyMoneyAccount tqparent = file - > account ( m_selectedAccount . parentAccountId( ) ) ;
for ( TQStringList : : const_iterator it = accountsToRetqparent . begin ( ) ; it ! = accountsToRetqparent . end ( ) ; + + it ) {
for ( TQStringList : : const_iterator it = accountsToRetqparent . begin ( ) ; it ! = accountsToRetqparent . end ( ) ; + + it ) {
MyMoneyAccount child = file - > account ( * it ) ;
MyMoneyAccount child = file - > account ( * it ) ;
file - > reparentAccount ( child , tqparent ) ;
file - > reparentAccount ( child , tqparent ) ;
@ -2998,7 +2998,7 @@ void KMyMoney2App::slotAccountEdit(void)
MyMoneyFileTransaction ft ;
MyMoneyFileTransaction ft ;
MyMoneyAccount account = dlg . account ( ) ;
MyMoneyAccount account = dlg . account ( ) ;
MyMoneyAccount tqparent = dlg . tq parentAccount( ) ;
MyMoneyAccount tqparent = dlg . parentAccount( ) ;
if ( it_plugin ! = m_onlinePlugins . end ( ) ) {
if ( it_plugin ! = m_onlinePlugins . end ( ) ) {
account . setOnlineBankingSettings ( ( * it_plugin ) - > onlineBankingSettings ( account . onlineBankingSettings ( ) ) ) ;
account . setOnlineBankingSettings ( ( * it_plugin ) - > onlineBankingSettings ( account . onlineBankingSettings ( ) ) ) ;
}
}
@ -3009,7 +3009,7 @@ void KMyMoney2App::slotAccountEdit(void)
// we need to modify first, as reparent would override all other changes
// we need to modify first, as reparent would override all other changes
file - > modifyAccount ( account ) ;
file - > modifyAccount ( account ) ;
if ( account . tq parentAccountId( ) ! = tqparent . id ( ) ) {
if ( account . parentAccountId( ) ! = tqparent . id ( ) ) {
file - > reparentAccount ( account , tqparent ) ;
file - > reparentAccount ( account , tqparent ) ;
}
}
if ( ! tid . isEmpty ( ) & & dlg . openingBalance ( ) . isZero ( ) ) {
if ( ! tid . isEmpty ( ) & & dlg . openingBalance ( ) . isZero ( ) ) {
@ -3388,7 +3388,7 @@ void KMyMoney2App::slotAccountReopen(void)
while ( a . isClosed ( ) ) {
while ( a . isClosed ( ) ) {
a . setClosed ( false ) ;
a . setClosed ( false ) ;
file - > modifyAccount ( a ) ;
file - > modifyAccount ( a ) ;
a = file - > account ( a . tq parentAccountId( ) ) ;
a = file - > account ( a . parentAccountId( ) ) ;
}
}
ft . commit ( ) ;
ft . commit ( ) ;
} catch ( MyMoneyException * e ) {
} catch ( MyMoneyException * e ) {
@ -3396,7 +3396,7 @@ void KMyMoney2App::slotAccountReopen(void)
}
}
}
}
void KMyMoney2App : : slotRe tq parentAccount( const MyMoneyAccount & _src , const MyMoneyInstitution & _dst )
void KMyMoney2App : : slotRe parentAccount( const MyMoneyAccount & _src , const MyMoneyInstitution & _dst )
{
{
MyMoneyAccount src ( _src ) ;
MyMoneyAccount src ( _src ) ;
src . setInstitutionId ( _dst . id ( ) ) ;
src . setInstitutionId ( _dst . id ( ) ) ;
@ -3410,7 +3410,7 @@ void KMyMoney2App::slotRetqparentAccount(const MyMoneyAccount& _src, const MyMon
}
}
}
}
void KMyMoney2App : : slotRe tq parentAccount( const MyMoneyAccount & _src , const MyMoneyAccount & _dst )
void KMyMoney2App : : slotRe parentAccount( const MyMoneyAccount & _src , const MyMoneyAccount & _dst )
{
{
MyMoneyAccount src ( _src ) ;
MyMoneyAccount src ( _src ) ;
MyMoneyAccount dst ( _dst ) ;
MyMoneyAccount dst ( _dst ) ;
@ -5584,7 +5584,7 @@ void KMyMoney2App::slotSelectTransactions(const KMyMoneyRegister::SelectedTransa
if ( ! acc . isIncomeExpense ( ) ) {
if ( ! acc . isIncomeExpense ( ) ) {
// for stock accounts we show the portfolio account
// for stock accounts we show the portfolio account
if ( acc . isInvest ( ) ) {
if ( acc . isInvest ( ) ) {
acc = MyMoneyFile : : instance ( ) - > account ( acc . tq parentAccountId( ) ) ;
acc = MyMoneyFile : : instance ( ) - > account ( acc . parentAccountId( ) ) ;
}
}
m_accountGoto = acc . id ( ) ;
m_accountGoto = acc . id ( ) ;
TQString name = acc . name ( ) ;
TQString name = acc . name ( ) ;