KMyMoneyUtils Class Reference

#include <kmymoneyutils.h>

Collaboration diagram for KMyMoneyUtils:

Collaboration graph
[legend]

List of all members.

Public Types

enum  categoryTypeE {
  none = 0x00, liability = 0x01, asset = 0x02, expense = 0x04,
  income = 0x08, equity = 0x10, last = 0x20
}
enum  transactionTypeE {
  Unknown, Normal, Transfer, SplitTransaction,
  LoanPayment, InvestmentTransaction
}
enum  EnterScheduleResultCodeE { Cancel = 0, Enter, Skip, Ignore }

Public Member Functions

 KMyMoneyUtils ()
 ~KMyMoneyUtils ()

Static Public Member Functions

static const QString accountTypeToString (const MyMoneyAccount::accountTypeE accountType)
static MyMoneyAccount::accountTypeE stringToAccountType (const QString &type)
static
MyMoneySecurity::eSECURITYTYPE 
stringToSecurity (const QString &txt)
static const QString securityTypeToString (const MyMoneySecurity::eSECURITYTYPE securityType)
static const QString occurenceToString (const MyMoneySchedule::occurenceE occurence)
static const QString paymentMethodToString (MyMoneySchedule::paymentTypeE paymentType)
static const QString weekendOptionToString (MyMoneySchedule::weekendOptionE weekendOption)
static const QString scheduleTypeToString (MyMoneySchedule::typeE type)
static const QString homePageItemToString (const int idx)
static int stringToHomePageItem (const QString &txt)
static KGuiItem scheduleNewGuiItem (void)
static KGuiItem accountsFilterGuiItem (void)
static bool appendCorrectFileExt (QString &name, const QString &extension)
static QPixmap billScheduleIcon (int size)
static QPixmap depositScheduleIcon (int size)
static QPixmap transferScheduleIcon (int size)
static QPixmap scheduleIcon (int size)
static void checkConstants (void)
static QString variableCSS (void)
static QString findResource (const char *type, const QString &filename)
static const MyMoneySplit stockSplit (const MyMoneyTransaction &t)
static transactionTypeE transactionType (const MyMoneyTransaction &t)
static void calculateAutoLoan (const MyMoneySchedule &schedule, MyMoneyTransaction &transaction, const QMap< QString, MyMoneyMoney > &balances)
static QString nextCheckNumber (const MyMoneyAccount &acc)
static QString reconcileStateToString (MyMoneySplit::reconcileFlagE flag, bool text=false)
static MyMoneyTransaction scheduledTransaction (const MyMoneySchedule &schedule)
static void previouslyUsedCategories (const QString &investmentAccount, QString &feesId, QString &interestId)

Static Public Attributes

static const int maxHomePageItems = 5


Detailed Description

Author:
Thomas Baumgart

Member Enumeration Documentation

This enum is used to describe the bits of an account type filter mask. Each bit is used to define a specific account class. Multiple classes can be specified by OR'ing multiple entries. The special entry last marks the left most bit in the mask and is used by scanners of this bitmask to determine the end of processing.

Enumerator:
none  no account class selected
liability  liability accounts selected
asset  asset accounts selected
expense  expense accounts selected
income  income accounts selected
equity  equity accounts selected
last  the leftmost bit in the mask

Enumerator:
Unknown  Unknown transaction type (e.g. used for a transaction with only a single split)
Normal  A 'normal' transaction is one that consists out two splits: one referencing an income/expense account, the other referencing an asset/liability account.
Transfer  A transfer denotes a transaction consisting of two splits. Both of the splits reference an asset/liability account.
SplitTransaction  Whenever a transaction consists of more than 2 splits, it is treated as 'split transaction'.
LoanPayment  This transaction denotes a specific transaction where a loan account is involved. Ususally, a special dialog is used to modify this transaction.
InvestmentTransaction  This transaction denotes a specific transaction where an investment is involved. Ususally, a special dialog is used to modify this transaction.

Enumerator:
Cancel 
Enter 
Skip 
Ignore 


Constructor & Destructor Documentation

KMyMoneyUtils::KMyMoneyUtils (  ) 

KMyMoneyUtils::~KMyMoneyUtils (  ) 


Member Function Documentation

static const QString KMyMoneyUtils::accountTypeToString ( const MyMoneyAccount::accountTypeE  accountType  )  [static]

This method is used to convert the internal representation of an account type into a human readable format

Parameters:
accountType numerical representation of the account type. For possible values, see MyMoneyAccount::accountTypeE
Returns:
QString representing the human readable form translated according to the language cataglogue
See also:
MyMoneyAccount::accountTypeToString()

static MyMoneyAccount::accountTypeE KMyMoneyUtils::stringToAccountType ( const QString &  type  )  [static]

This method is used to convert an account type from it's string form to the internal used numeric value.

Parameters:
type reference to a QString containing the string to convert
Returns:
accountTypeE containing the internal used numeric value. For possible values see MyMoneyAccount::accountTypeE

static MyMoneySecurity::eSECURITYTYPE KMyMoneyUtils::stringToSecurity ( const QString &  txt  )  [static]

This method is used to convert a security type from it's string form to the internal used numeric value.

Parameters:
txt reference to a QString containing the string to convert
Returns:
eSECURITYTYPE containing the internal used numeric value. For possible values see MyMoneySecurity::eSECURITYTYPE

static const QString KMyMoneyUtils::securityTypeToString ( const MyMoneySecurity::eSECURITYTYPE  securityType  )  [static]

This method is used to convert the internal representation of an security type into a human readable format

Parameters:
securityType enumerated representation of the security type. For possible values, see MyMoneySecurity::eSECURITYTYPE
Returns:
QString representing the human readable form translated according to the language cataglogue
See also:
MyMoneySecurity::securityTypeToString()

static const QString KMyMoneyUtils::occurenceToString ( const MyMoneySchedule::occurenceE  occurence  )  [static]

This method is used to convert the occurence type from it's internal representation into a human readable format.

Parameters:
occurence numerical representation of the MyMoneySchedule occurence type
Returns:
QString representing the human readable format translated according to the language cataglogue
See also:
MyMoneySchedule::occurenceToString()
Deprecated:
Use i18n(MyMoneySchedule::occurenceToString(occurence)) instead

static const QString KMyMoneyUtils::paymentMethodToString ( MyMoneySchedule::paymentTypeE  paymentType  )  [static]

This method is used to convert the payment type from it's internal representation into a human readable format.

Parameters:
paymentType numerical representation of the MyMoneySchedule payment type
Returns:
QString representing the human readable format translated according to the language cataglogue
See also:
MyMoneySchedule::paymentMethodToString()

static const QString KMyMoneyUtils::weekendOptionToString ( MyMoneySchedule::weekendOptionE  weekendOption  )  [static]

This method is used to convert the schedule weekend option from it's internal representation into a human readable format.

Parameters:
weekendOption numerical representation of the MyMoneySchedule weekend option
Returns:
QString representing the human readable format translated according to the language cataglogue
See also:
MyMoneySchedule::weekendOptionToString()

static const QString KMyMoneyUtils::scheduleTypeToString ( MyMoneySchedule::typeE  type  )  [static]

This method is used to convert the schedule type from it's internal representation into a human readable format.

Parameters:
type numerical representation of the MyMoneySchedule schedule type
Returns:
QString representing the human readable format translated according to the language cataglogue
See also:
MyMoneySchedule::scheduleTypeToString()

static const QString KMyMoneyUtils::homePageItemToString ( const int  idx  )  [static]

This method is used to convert a numeric index of an item represented on the home page into it's string form.

Parameters:
idx numeric index of item
Returns:
QString with text of this item

static int KMyMoneyUtils::stringToHomePageItem ( const QString &  txt  )  [static]

This method is used to convert the name of a home page item to it's internal numerical representation

Parameters:
txt QString reference of the items name
Return values:
0 txt is unknown
>0 numeric value for txt

static KGuiItem KMyMoneyUtils::scheduleNewGuiItem ( void   )  [static]

Retrieve a KDE KGuiItem for the new schedule button.

Returns:
The KGuiItem that can be used to display the icon and text

static KGuiItem KMyMoneyUtils::accountsFilterGuiItem ( void   )  [static]

Retrieve a KDE KGuiItem for the account filter button

Returns:
The KGuiItem that can be used to display the icon and text

static bool KMyMoneyUtils::appendCorrectFileExt ( QString &  name,
const QString &  extension 
) [static]

This method adds the file extension passed as argument extension to the end of the file name passed as argument name if it is not present. If name contains an extension it will be removed.

Parameters:
name filename to be checked
extension extension to be added (w/o the dot)
Return values:
true if name was changed
false if name remained unchanged

static QPixmap KMyMoneyUtils::billScheduleIcon ( int  size  )  [static]

static QPixmap KMyMoneyUtils::depositScheduleIcon ( int  size  )  [static]

static QPixmap KMyMoneyUtils::transferScheduleIcon ( int  size  )  [static]

static QPixmap KMyMoneyUtils::scheduleIcon ( int  size  )  [static]

static void KMyMoneyUtils::checkConstants ( void   )  [static]

Check that internal MyMoney engine constants use the same values as the KDE constants.

static QString KMyMoneyUtils::variableCSS ( void   )  [static]

static QString KMyMoneyUtils::findResource ( const char *  type,
const QString &  filename 
) [static]

This method searches a KDE specific resource and applies country and language settings during the search. Therefore, the parameter filename must contain the characters '1' which gets replaced with the language/country values.

The search is performed in the following order (stopped immediately if a file was found):

  • %1 is replaced with _<country>.<language>
  • %1 is replaced with _<language>
  • %1 is replaced with _<country>
  • %1 is replaced with the empty string

<country> and <language> denote the respective KDE settings.

Example: The KDE settings for country is Spain (es) and language is set to Galician (gl). The code for looking up a file looks like this:

  :
  QString fname = KMyMoneyUtils::findResource("appdata", "html/home%1.html")
  :

The method calls KStandardDirs::findResource() with the following values for the parameter filename:

  • html/home_es.gl.html
  • html/home_gl.html
  • html/home_es.html
  • html/home.html

Note:
See KStandardDirs::findResource() for details on the parameters

static const MyMoneySplit KMyMoneyUtils::stockSplit ( const MyMoneyTransaction t  )  [static]

This method returns the split referencing a stock account if one exists in the transaction passed as t. If none is present in t, an empty MyMoneySplit() object will be returned.

Parameters:
t transaction to be checked for a stock account
Returns:
MyMoneySplit object referencing a stock account or an empty MyMoneySplit object.

static transactionTypeE KMyMoneyUtils::transactionType ( const MyMoneyTransaction t  )  [static]

This method analyses the splits of a transaction and returns the type of transaction. Possible values are defined by the KMyMoneyUtils::transactionTypeE enum.

Parameters:
t const reference to the transaction
Returns:
KMyMoneyUtils::transactionTypeE value of the action

static void KMyMoneyUtils::calculateAutoLoan ( const MyMoneySchedule schedule,
MyMoneyTransaction transaction,
const QMap< QString, MyMoneyMoney > &  balances 
) [static]

This method modifies a scheduled loan transaction such that all references to automatic calculated values are resolved to actual values.

Parameters:
schedule const reference to the schedule the transaction is based on
transaction reference to the transaction to be checked and modified
balances QMap of (account-id,balance) pairs to be used as current balance for the calculation of interest. If map is empty, the engine will be interrogated for current balances.

static QString KMyMoneyUtils::nextCheckNumber ( const MyMoneyAccount acc  )  [static]

Return next check number for account acc.

static QString KMyMoneyUtils::reconcileStateToString ( MyMoneySplit::reconcileFlagE  flag,
bool  text = false 
) [static]

Returns the text representing the reconcile flag. If text is true then the full text will be returned otherwise a short form (usually one character).

static MyMoneyTransaction KMyMoneyUtils::scheduledTransaction ( const MyMoneySchedule schedule  )  [static]

Returns the transaction for schedule. In case of a loan payment the transaction will be modified by calculateAutoLoan(). The ID of the transaction as well as the entryDate will be reset.

Returns:
adjusted transaction

static void KMyMoneyUtils::previouslyUsedCategories ( const QString &  investmentAccount,
QString &  feesId,
QString &  interestId 
) [static]

This method tries to figure out the category to be used for fees and interest from previous transactions in the given investmentAccount and returns the ids of those categories in feesId and interestId. The last used category will be returned.


Member Data Documentation

const int KMyMoneyUtils::maxHomePageItems = 5 [static]


The documentation for this class was generated from the following file:

Generated on Wed Jan 26 13:08:10 2011 for KMyMoney by  doxygen 1.5.6