@ -82,13 +82,13 @@ class MyMoneyQifReader::Private {
bool isTransfer ( TQString & name , const TQString & leftDelim , const TQString & rightDelim ) ;
bool isTransfer ( TQString & name , const TQString & leftDelim , const TQString & rightDelim ) ;
/**
/**
* Converts the T QIF specific N - record of investment transactions into
* Converts the QIF specific N - record of investment transactions into
* a category name
* a category name
*/
*/
TQString typeToAccountName ( const TQString & type ) const ;
TQString typeToAccountName ( const TQString & type ) const ;
/**
/**
* Converts the T QIF reconcile state to the KMyMoney reconcile state
* Converts the QIF reconcile state to the KMyMoney reconcile state
*/
*/
MyMoneySplit : : reconcileFlagE reconcileState ( const TQString & state ) const ;
MyMoneySplit : : reconcileFlagE reconcileState ( const TQString & state ) const ;
@ -202,7 +202,7 @@ TQString MyMoneyQifReader::Private::typeToAccountName(const TQString& type) cons
if ( type = = " sell " | | type = = " buy " )
if ( type = = " sell " | | type = = " buy " )
return i18n ( " Category name " , " Investment fees " ) ;
return i18n ( " Category name " , " Investment fees " ) ;
return i18n ( " Unknown T QIF type %1" ) . arg ( type ) ;
return i18n ( " Unknown QIF type %1" ) . arg ( type ) ;
}
}
bool MyMoneyQifReader : : Private : : isTransfer ( TQString & tmp , const TQString & leftDelim , const TQString & rightDelim )
bool MyMoneyQifReader : : Private : : isTransfer ( TQString & tmp , const TQString & leftDelim , const TQString & rightDelim )
@ -288,7 +288,7 @@ void MyMoneyQifReader::slotSendDataToFilter(void)
} else {
} else {
len = m_file - > readBlock ( m_buffer , sizeof ( m_buffer ) ) ;
len = m_file - > readBlock ( m_buffer , sizeof ( m_buffer ) ) ;
if ( len = = - 1 ) {
if ( len = = - 1 ) {
tqWarning ( " Failed to read block from T QIF import file" ) ;
tqWarning ( " Failed to read block from QIF import file" ) ;
m_filter . closeStdin ( ) ;
m_filter . closeStdin ( ) ;
m_filter . kill ( ) ;
m_filter . kill ( ) ;
} else {
} else {
@ -363,7 +363,7 @@ void MyMoneyQifReader::slotProcessData(void)
tqDebug ( " Selected date format: '%s' " , list . first ( ) . data ( ) ) ;
tqDebug ( " Selected date format: '%s' " , list . first ( ) . data ( ) ) ;
signalProgress ( 0 , m_qifLines . count ( ) , i18n ( " Importing T QIF ..." ) ) ;
signalProgress ( 0 , m_qifLines . count ( ) , i18n ( " Importing QIF ..." ) ) ;
TQStringList : : iterator it ;
TQStringList : : iterator it ;
for ( it = m_qifLines . begin ( ) ; m_userAbort = = false & & it ! = m_qifLines . end ( ) ; + + it ) {
for ( it = m_qifLines . begin ( ) ; m_userAbort = = false & & it ! = m_qifLines . end ( ) ; + + it ) {
+ + m_linenumber ;
+ + m_linenumber ;
@ -419,7 +419,7 @@ bool MyMoneyQifReader::startImport(void)
while ( ! m_file - > atEnd ( ) ) {
while ( ! m_file - > atEnd ( ) ) {
len = m_file - > readBlock ( m_buffer , sizeof ( m_buffer ) ) ;
len = m_file - > readBlock ( m_buffer , sizeof ( m_buffer ) ) ;
if ( len = = - 1 ) {
if ( len = = - 1 ) {
tqWarning ( " Failed to read block from T QIF import file" ) ;
tqWarning ( " Failed to read block from QIF import file" ) ;
} else {
} else {
slotReceivedDataFromFilter ( 0 , m_buffer , len ) ;
slotReceivedDataFromFilter ( 0 , m_buffer , len ) ;
}
}
@ -439,7 +439,7 @@ bool MyMoneyQifReader::startImport(void)
if ( m_filter . start ( KProcess : : NotifyOnExit , KProcess : : All ) ) {
if ( m_filter . start ( KProcess : : NotifyOnExit , KProcess : : All ) ) {
m_filter . resume ( ) ;
m_filter . resume ( ) ;
signalProgress ( 0 , m_file - > size ( ) , i18n ( " Reading T QIF ..." ) ) ;
signalProgress ( 0 , m_file - > size ( ) , i18n ( " Reading QIF ..." ) ) ;
slotSendDataToFilter ( ) ;
slotSendDataToFilter ( ) ;
rc = true ;
rc = true ;
} else {
} else {
@ -571,12 +571,12 @@ void MyMoneyQifReader::processQifSpecial(const TQString& _line)
d - > firstTransaction = true ;
d - > firstTransaction = true ;
d - > transactionType = m_entryType = EntryTransaction ;
d - > transactionType = m_entryType = EntryTransaction ;
} else if ( line . lower ( ) = = " oth l " | | line . lower ( ) = = i18n ( " T QIF tag for liability account" , " Oth L " ) . lower ( ) ) {
} else if ( line . lower ( ) = = " oth l " | | line . lower ( ) = = i18n ( " QIF tag for liability account" , " Oth L " ) . lower ( ) ) {
d - > accountType = MyMoneyAccount : : Liability ;
d - > accountType = MyMoneyAccount : : Liability ;
d - > firstTransaction = true ;
d - > firstTransaction = true ;
d - > transactionType = m_entryType = EntryTransaction ;
d - > transactionType = m_entryType = EntryTransaction ;
} else if ( line . lower ( ) = = " invst " | | line . lower ( ) = = i18n ( " T QIF tag for investment account" , " Invst " ) . lower ( ) ) {
} else if ( line . lower ( ) = = " invst " | | line . lower ( ) = = i18n ( " QIF tag for investment account" , " Invst " ) . lower ( ) ) {
d - > transactionType = m_entryType = EntryInvestmentTransaction ;
d - > transactionType = m_entryType = EntryInvestmentTransaction ;
} else if ( line . lower ( ) = = " invoice " | | KMyMoneyGlobalSettings : : qifInvoice ( ) . lower ( ) . contains ( line . lower ( ) ) ) {
} else if ( line . lower ( ) = = " invoice " | | KMyMoneyGlobalSettings : : qifInvoice ( ) . lower ( ) . contains ( line . lower ( ) ) ) {
@ -589,19 +589,19 @@ void MyMoneyQifReader::processQifSpecial(const TQString& _line)
m_entryType = EntrySkip ;
m_entryType = EntrySkip ;
// exportable lists
// exportable lists
} else if ( line . lower ( ) = = " cat " | | line . lower ( ) = = i18n ( " T QIF tag for category" , " Cat " ) . lower ( ) ) {
} else if ( line . lower ( ) = = " cat " | | line . lower ( ) = = i18n ( " QIF tag for category" , " Cat " ) . lower ( ) ) {
m_entryType = EntryCategory ;
m_entryType = EntryCategory ;
} else if ( line . lower ( ) = = " security " | | line . lower ( ) = = i18n ( " T QIF tag for security" , " Security " ) . lower ( ) ) {
} else if ( line . lower ( ) = = " security " | | line . lower ( ) = = i18n ( " QIF tag for security" , " Security " ) . lower ( ) ) {
m_entryType = EntrySecurity ;
m_entryType = EntrySecurity ;
} else if ( line . lower ( ) = = " prices " | | line . lower ( ) = = i18n ( " T QIF tag for prices" , " Prices " ) . lower ( ) ) {
} else if ( line . lower ( ) = = " prices " | | line . lower ( ) = = i18n ( " QIF tag for prices" , " Prices " ) . lower ( ) ) {
m_entryType = EntryPrice ;
m_entryType = EntryPrice ;
} else if ( line . lower ( ) = = " payee " ) {
} else if ( line . lower ( ) = = " payee " ) {
m_entryType = EntryPayee ;
m_entryType = EntryPayee ;
} else if ( line . lower ( ) = = " class " | | line . lower ( ) = = i18n ( " T QIF tag for a class" , " Class " ) . lower ( ) ) {
} else if ( line . lower ( ) = = " class " | | line . lower ( ) = = i18n ( " QIF tag for a class" , " Class " ) . lower ( ) ) {
m_entryType = EntryClass ;
m_entryType = EntryClass ;
} else if ( line . lower ( ) = = " memorized " ) {
} else if ( line . lower ( ) = = " memorized " ) {
@ -617,7 +617,7 @@ void MyMoneyQifReader::processQifSpecial(const TQString& _line)
m_entryType = EntrySkip ;
m_entryType = EntrySkip ;
} else {
} else {
tqWarning ( " Unknown export header '!Type:%s' in T QIF file on line %d: Skipping section." , line . data ( ) , m_linenumber ) ;
tqWarning ( " Unknown export header '!Type:%s' in QIF file on line %d: Skipping section." , line . data ( ) , m_linenumber ) ;
m_entryType = EntrySkip ;
m_entryType = EntrySkip ;
}
}
@ -635,7 +635,7 @@ void MyMoneyQifReader::processQifSpecial(const TQString& _line)
void MyMoneyQifReader : : processQifEntry ( void )
void MyMoneyQifReader : : processQifEntry ( void )
{
{
// This method processes a ' T QIF Entry' which is everything between two caret
// This method processes a ' QIF Entry' which is everything between two caret
// signs
// signs
//
//
try {
try {
@ -773,7 +773,7 @@ void MyMoneyQifReader::processMSAccountEntry(const MyMoneyAccount::accountTypeE
const MyMoneySecurity & sec = file - > security ( m_account . currencyId ( ) ) ;
const MyMoneySecurity & sec = file - > security ( m_account . currencyId ( ) ) ;
if ( KMessageBox : : questionYesNo (
if ( KMessageBox : : questionYesNo (
tqApp - > mainWidget ( ) ,
tqApp - > mainWidget ( ) ,
i18n ( " The %1 account currently has an opening balance of %2. This T QIF file reports an opening balance of %3. Would you like to overwrite the current balance with the one from the T QIF file?" ) . arg ( m_account . name ( ) , split . shares ( ) . formatMoney ( m_account , sec ) , balance . formatMoney ( m_account , sec ) ) ,
i18n ( " The %1 account currently has an opening balance of %2. This QIF file reports an opening balance of %3. Would you like to overwrite the current balance with the one from the QIF file?" ) . arg ( m_account . name ( ) , split . shares ( ) . formatMoney ( m_account , sec ) , balance . formatMoney ( m_account , sec ) ) ,
i18n ( " Overwrite opening balance " ) ,
i18n ( " Overwrite opening balance " ) ,
KStdGuiItem : : yes ( ) ,
KStdGuiItem : : yes ( ) ,
KStdGuiItem : : no ( ) ,
KStdGuiItem : : no ( ) ,
@ -817,7 +817,7 @@ void MyMoneyQifReader::processMSAccountEntry(const MyMoneyAccount::accountTypeE
// Lines 1-5 are processed via processQifEntry() and processAccountEntry()
// Lines 1-5 are processed via processQifEntry() and processAccountEntry()
// Then Quicken issues line 6 but since the account does not carry any
// Then Quicken issues line 6 but since the account does not carry any
// transaction does not write an end delimiter. Arrrgh! So we end up with
// transaction does not write an end delimiter. Arrrgh! So we end up with
// a T QIF entry comprising of lines 6-11 and end up in this routine. Actually,
// a QIF entry comprising of lines 6-11 and end up in this routine. Actually,
// lines 7-11 are the leadin for the next account. So we check here if
// lines 7-11 are the leadin for the next account. So we check here if
// the !Type:xxx record also contains an !Account line and process the
// the !Type:xxx record also contains an !Account line and process the
// entry as required.
// entry as required.
@ -899,7 +899,7 @@ TQString MyMoneyQifReader::transferAccount(TQString name, bool useBrokerage)
m_qifEntry . clear ( ) ; // and construct a temp entry to create/search the account
m_qifEntry . clear ( ) ; // and construct a temp entry to create/search the account
m_qifEntry < < TQString ( " N%1 " ) . arg ( name ) ;
m_qifEntry < < TQString ( " N%1 " ) . arg ( name ) ;
m_qifEntry < < TQString ( " Tunknown " ) ;
m_qifEntry < < TQString ( " Tunknown " ) ;
m_qifEntry < < TQString ( " D%1 " ) . arg ( i18n ( " Autogenerated by T QIF importer" ) ) ;
m_qifEntry < < TQString ( " D%1 " ) . arg ( i18n ( " Autogenerated by QIF importer" ) ) ;
accountId = processAccountEntry ( false ) ;
accountId = processAccountEntry ( false ) ;
// in case we found a reference to an investment account, we need
// in case we found a reference to an investment account, we need
@ -910,7 +910,7 @@ TQString MyMoneyQifReader::transferAccount(TQString name, bool useBrokerage)
m_qifEntry . clear ( ) ; // and construct a temp entry to create/search the account
m_qifEntry . clear ( ) ; // and construct a temp entry to create/search the account
m_qifEntry < < TQString ( " N%1 " ) . arg ( name ) ;
m_qifEntry < < TQString ( " N%1 " ) . arg ( name ) ;
m_qifEntry < < TQString ( " Tunknown " ) ;
m_qifEntry < < TQString ( " Tunknown " ) ;
m_qifEntry < < TQString ( " D%1 " ) . arg ( i18n ( " Autogenerated by T QIF importer" ) ) ;
m_qifEntry < < TQString ( " D%1 " ) . arg ( i18n ( " Autogenerated by QIF importer" ) ) ;
accountId = processAccountEntry ( false ) ;
accountId = processAccountEntry ( false ) ;
}
}
m_qifEntry = tmpEntry ; // restore local copies
m_qifEntry = tmpEntry ; // restore local copies
@ -927,14 +927,14 @@ void MyMoneyQifReader::createOpeningBalance(MyMoneyAccount::_accountTypeE accTyp
if ( m_account . name ( ) . isEmpty ( ) ) {
if ( m_account . name ( ) . isEmpty ( ) ) {
TQString name = extractLine ( ' L ' ) ;
TQString name = extractLine ( ' L ' ) ;
if ( name . isEmpty ( ) ) {
if ( name . isEmpty ( ) ) {
name = i18n ( " T QIF imported, no account name supplied" ) ;
name = i18n ( " QIF imported, no account name supplied" ) ;
}
}
d - > isTransfer ( name , m_qifProfile . accountDelimiter ( ) . left ( 1 ) , m_qifProfile . accountDelimiter ( ) . mid ( 1 , 1 ) ) ;
d - > isTransfer ( name , m_qifProfile . accountDelimiter ( ) . left ( 1 ) , m_qifProfile . accountDelimiter ( ) . mid ( 1 , 1 ) ) ;
TQStringList entry = m_qifEntry ; // keep a temp copy
TQStringList entry = m_qifEntry ; // keep a temp copy
m_qifEntry . clear ( ) ; // and construct a temp entry to create/search the account
m_qifEntry . clear ( ) ; // and construct a temp entry to create/search the account
m_qifEntry < < TQString ( " N%1 " ) . arg ( name ) ;
m_qifEntry < < TQString ( " N%1 " ) . arg ( name ) ;
m_qifEntry < < TQString ( " T%1 " ) . arg ( d - > accountTypeToQif ( accType ) ) ;
m_qifEntry < < TQString ( " T%1 " ) . arg ( d - > accountTypeToQif ( accType ) ) ;
m_qifEntry < < TQString ( " D%1 " ) . arg ( i18n ( " Autogenerated by T QIF importer" ) ) ;
m_qifEntry < < TQString ( " D%1 " ) . arg ( i18n ( " Autogenerated by QIF importer" ) ) ;
processAccountEntry ( ) ;
processAccountEntry ( ) ;
m_qifEntry = entry ; // restore local copy
m_qifEntry = entry ; // restore local copy
}
}
@ -1053,7 +1053,7 @@ void MyMoneyQifReader::processTransactionEntry(void)
" date profile setting of \" %2 \" . \n \n Pressing \" Continue \" will "
" date profile setting of \" %2 \" . \n \n Pressing \" Continue \" will "
" assign todays date to the transaction. Pressing \" Cancel \" will abort "
" assign todays date to the transaction. Pressing \" Cancel \" will abort "
" the import operation. You can then restart the import and select a different "
" the import operation. You can then restart the import and select a different "
" T QIF profile or create a new one." )
" QIF profile or create a new one." )
. arg ( extractLine ( ' D ' ) ) . arg ( m_qifProfile . inputDateFormat ( ) ) ,
. arg ( extractLine ( ' D ' ) ) . arg ( m_qifProfile . inputDateFormat ( ) ) ,
i18n ( " Invalid date format " ) ) ;
i18n ( " Invalid date format " ) ) ;
switch ( rc ) {
switch ( rc ) {
@ -1081,7 +1081,7 @@ void MyMoneyQifReader::processTransactionEntry(void)
// t.setMemo(tmp);
// t.setMemo(tmp);
// Assign the "#" field to the transaction's bank id
// Assign the "#" field to the transaction's bank id
// This is the custom KMM extension to T QIF for a unique ID
// This is the custom KMM extension to QIF for a unique ID
tmp = extractLine ( ' # ' ) ;
tmp = extractLine ( ' # ' ) ;
if ( ! tmp . isEmpty ( ) )
if ( ! tmp . isEmpty ( ) )
{
{
@ -1101,7 +1101,7 @@ void MyMoneyQifReader::processTransactionEntry(void)
tmp = tmp . mid ( 1 , tmp . length ( ) - 2 ) ;
tmp = tmp . mid ( 1 , tmp . length ( ) - 2 ) ;
s1 . m_strCategoryName = tmp ;
s1 . m_strCategoryName = tmp ;
# endif
# endif
// TODO (Ace) Deal with currencies more gracefully. T QIF cannot deal with multiple
// TODO (Ace) Deal with currencies more gracefully. QIF cannot deal with multiple
// currencies, so we should assume that transactions imported into a given
// currencies, so we should assume that transactions imported into a given
// account are in THAT ACCOUNT's currency. If one of those involves a transfer
// account are in THAT ACCOUNT's currency. If one of those involves a transfer
// to an account with a different currency, value and shares should be
// to an account with a different currency, value and shares should be
@ -1300,7 +1300,7 @@ void MyMoneyQifReader::processInvestmentTransactionEntry(void)
" date profile setting of \" %2 \" . \n \n Pressing \" Continue \" will "
" date profile setting of \" %2 \" . \n \n Pressing \" Continue \" will "
" assign todays date to the transaction. Pressing \" Cancel \" will abort "
" assign todays date to the transaction. Pressing \" Cancel \" will abort "
" the import operation. You can then restart the import and select a different "
" the import operation. You can then restart the import and select a different "
" T QIF profile or create a new one." )
" QIF profile or create a new one." )
. arg ( extractLine ( ' D ' ) ) . arg ( m_qifProfile . inputDateFormat ( ) ) ,
. arg ( extractLine ( ' D ' ) ) . arg ( m_qifProfile . inputDateFormat ( ) ) ,
i18n ( " Invalid date format " ) ) ;
i18n ( " Invalid date format " ) ) ;
switch ( rc ) {
switch ( rc ) {
@ -1379,10 +1379,10 @@ void MyMoneyQifReader::processInvestmentTransactionEntry(void)
// abbreviations or ordered words differently, etc.
// abbreviations or ordered words differently, etc.
//
//
// If there is a perfect name match with a subordinate stock account, great.
// If there is a perfect name match with a subordinate stock account, great.
// More likely, we have to rely on the T QIF file containing !Type:Security
// More likely, we have to rely on the QIF file containing !Type:Security
// records, which tell us the mapping from name to symbol.
// records, which tell us the mapping from name to symbol.
//
//
// Therefore, generally it is not recommended to import a T QIF file containing
// Therefore, generally it is not recommended to import a QIF file containing
// investment transactions but NOT containing security records.
// investment transactions but NOT containing security records.
TQString securitysymbol = m_investmentMap [ securityname ] ;
TQString securitysymbol = m_investmentMap [ securityname ] ;
@ -2042,7 +2042,7 @@ TQString MyMoneyQifReader::processAccountEntry(bool resetAccountId)
// in case it's a stock account, we need to setup a fix investment account
// in case it's a stock account, we need to setup a fix investment account
if ( account . isInvest ( ) ) {
if ( account . isInvest ( ) ) {
acc . setName ( i18n ( " %1 (Investment) " ) . arg ( account . name ( ) ) ) ; // use the same name for the investment account
acc . setName ( i18n ( " %1 (Investment) " ) . arg ( account . name ( ) ) ) ; // use the same name for the investment account
acc . setDescription ( i18n ( " Autogenerated by T QIF importer from type Mutual account entry" ) ) ;
acc . setDescription ( i18n ( " Autogenerated by QIF importer from type Mutual account entry" ) ) ;
acc . setAccountType ( MyMoneyAccount : : Investment ) ;
acc . setAccountType ( MyMoneyAccount : : Investment ) ;
parentAccount = file - > asset ( ) ;
parentAccount = file - > asset ( ) ;
kmymoney2 - > createAccount ( acc , parentAccount , brokerage , MyMoneyMoney ( ) ) ;
kmymoney2 - > createAccount ( acc , parentAccount , brokerage , MyMoneyMoney ( ) ) ;
@ -2175,7 +2175,7 @@ void MyMoneyQifReader::selectOrCreateAccount(const SelectCreateMode mode, MyMone
}
}
} else {
} else {
accountSelect . setHeader ( i18n ( " Import transactions to %1 " ) . arg ( typeStr ) ) ;
accountSelect . setHeader ( i18n ( " Import transactions to %1 " ) . arg ( typeStr ) ) ;
msg = i18n ( " No %1 information has been found in the selected T QIF file. "
msg = i18n ( " No %1 information has been found in the selected QIF file. "
" Please select an account using the selection box in the dialog or "
" Please select an account using the selection box in the dialog or "
" create a new %2 by pressing the <b>Create</b> button. " )
" create a new %2 by pressing the <b>Create</b> button. " )
. arg ( typeStr ) . arg ( typeStr ) ;
. arg ( typeStr ) . arg ( typeStr ) ;
@ -2223,7 +2223,7 @@ void MyMoneyQifReader::selectOrCreateAccount(const SelectCreateMode mode, MyMone
const MyMoneySecurity & sec = file - > security ( account . currencyId ( ) ) ;
const MyMoneySecurity & sec = file - > security ( account . currencyId ( ) ) ;
if ( KMessageBox : : questionYesNo (
if ( KMessageBox : : questionYesNo (
tqApp - > mainWidget ( ) ,
tqApp - > mainWidget ( ) ,
i18n ( " The %1 account currently has an opening balance of %2. This T QIF file reports an opening balance of %3. Would you like to overwrite the current balance with the one from the T QIF file?" ) . arg ( account . name ( ) , split . shares ( ) . formatMoney ( account , sec ) , balance . formatMoney ( account , sec ) ) ,
i18n ( " The %1 account currently has an opening balance of %2. This QIF file reports an opening balance of %3. Would you like to overwrite the current balance with the one from the QIF file?" ) . arg ( account . name ( ) , split . shares ( ) . formatMoney ( account , sec ) , balance . formatMoney ( account , sec ) ) ,
i18n ( " Overwrite opening balance " ) ,
i18n ( " Overwrite opening balance " ) ,
KStdGuiItem : : yes ( ) ,
KStdGuiItem : : yes ( ) ,
KStdGuiItem : : no ( ) ,
KStdGuiItem : : no ( ) ,