KMyMoneyView Class Reference

Handles the view of the MyMoneyFile. More...

#include <kmymoneyview.h>

Inheritance diagram for KMyMoneyView:

KJanusWidget
Collaboration diagram for KMyMoneyView:

Collaboration graph
[legend]

List of all members.

Public Types

enum  viewID {
  HomeView = 0, AccountsView, InstitutionsView, SchedulesView,
  CategoriesView, PayeesView, LedgersView, InvestmentsView,
  ReportsView, BudgetView, ForecastView
}
enum  fileActions {
  preOpen, postOpen, preSave, postSave,
  preClose, postClose
}

Public Slots

void slotRememberPage (QWidget *widget)
void slotRefreshViews ()
void slotLedgerSelected (const QString &acc, const QString &transaction=QString())
void slotPayeeSelected (const QString &payeeId, const QString &accountId, const QString &transactionId)
void slotScheduleSelected (const QString &schedule)
void slotShowReport (const QString &reportid)
void slotShowReport (const MyMoneyReport &report)
void slotPrintView (void)
void slotShowHomePage (void)

Signals

void viewActivated (int view)
void accountSelectedForContextMenu (const MyMoneyAccount &acc)
void viewStateChanged (bool enabled)
void kmmFilePlugin (unsigned int action)
void reconciliationStarts (const MyMoneyAccount &account, const QDate &reconciliationDate, const MyMoneyMoney &endingBalance)

Public Member Functions

 KMyMoneyView (QWidget *parent=0, const char *name=0)
 ~KMyMoneyView ()
bool fileOpen (void)
void closeFile (void)
bool readFile (const KURL &url)
bool saveFile (const KURL &url, const QString &keyList=QString())
bool saveAsDatabase (const KURL &url)
bool isNativeFile ()
bool isDatabase ()
bool dirty (void)
void newFile (void)
void viewUp (void)
void enableViews (int state=-1)
KMyMoneyViewBaseaddPage (const QString &title, const QString &icon=QString())
void addWidget (QWidget *w)
virtual bool showPage (int index)
bool canCreateTransactions (const KMyMoneyRegister::SelectedTransactions &list, QString &tooltip) const
bool canModifyTransactions (const KMyMoneyRegister::SelectedTransactions &list, QString &tooltip) const
bool canDuplicateTransactions (const KMyMoneyRegister::SelectedTransactions &list, QString &tooltip) const
bool canEditTransactions (const KMyMoneyRegister::SelectedTransactions &list, QString &tooltip) const
bool canPrint (void)
TransactionEditorstartEdit (const KMyMoneyRegister::SelectedTransactions &)
bool createNewTransaction (void)
bool startReconciliation (const MyMoneyAccount &account, const QDate &reconciliationDate, const MyMoneyMoney &endingBalance)
void finishReconciliation (const MyMoneyAccount &account)
void loadDefaultCurrencies (void)
void loadAncientCurrencies (void)
void showTitleBar (bool show)

Protected Slots

void slotShowTransactionDetail (bool detailed)
void slotSetBaseCurrency (const MyMoneySecurity &baseCurrency)

Private Types

enum  menuID {
  AccountNew = 1, AccountOpen, AccountReconcile, AccountEdit,
  AccountDelete, AccountOnlineMap, AccountOnlineUpdate, AccountOfxConnect,
  CategoryNew
}
enum  storageTypeE { Memory = 0, Database }
enum  _fileTypeE {
  KmmBinary = 0, KmmXML, KmmDb, MaxNativeFileType,
  GncXML
}
typedef enum
KMyMoneyView::storageTypeE 
_storageType
typedef enum
KMyMoneyView::_fileTypeE 
fileTypeE

Private Member Functions

void addTitleBar (QWidget *parent, const QString &title)
void ungetString (QIODevice *qfile, char *buf, int len)
void loadDefaultCurrency (const MyMoneySecurity &curr, const bool create)
void loadAncientCurrency (const QString &id, const QString &name, const QString &sym, const QDate &date, const MyMoneyMoney &rate, const QString &newId, const int partsPerUnit=100, const int smallestCashFraction=100, const int smallestAccountFraction=0)
void selectBaseCurrency (void)
void newStorage (storageTypeE=Memory)
void removeStorage (void)
void viewAccountList (const QString &selectAccount)
void fixFile_0 (void)
void fixFile_1 (void)
void fixFile_2 (void)
void fixLoanAccount_0 (MyMoneyAccount acc)
void fixTransactions_0 (void)
void fixSchedule_0 (MyMoneySchedule sched)
void fixDuplicateAccounts_0 (MyMoneyTransaction &t)
void createSchedule (MyMoneySchedule s, MyMoneyAccount &a)
void checkAccountName (const MyMoneyAccount &acc, const QString &name) const
bool openDatabase (const KURL &dbaseURL)
bool initializeStorage ()
void saveToLocalFile (QFile *qf, IMyMoneyStorageFormat *writer, bool plaintext=false, const QString &keyList=QString())
void accountNew (const bool createCategory)

Static Private Member Functions

static void progressCallback (int current, int total, const QString &)

Private Attributes

KHomeViewm_homeView
KAccountsViewm_accountsView
KInstitutionsViewm_institutionsView
KCategoriesViewm_categoriesView
KPayeesViewm_payeesView
KBudgetViewm_budgetView
KScheduledViewm_scheduledView
KGlobalLedgerViewm_ledgerView
KInvestmentViewm_investmentView
KReportsViewm_reportsView
KForecastViewm_forecastView
QVBoxm_homeViewFrame
QVBoxm_accountsViewFrame
QVBoxm_institutionsViewFrame
QVBoxm_categoriesViewFrame
QVBoxm_payeesViewFrame
QVBoxm_budgetViewFrame
QVBoxm_scheduleViewFrame
QVBoxm_ledgerViewFrame
QVBoxm_investmentViewFrame
QVBoxm_reportsViewFrame
QVBoxm_forecastViewFrame
bool m_inConstructor
bool m_fileOpen
int m_fmode
fileTypeE m_fileType


Detailed Description

This class represents the view of the MyMoneyFile which contains Banks/Accounts/Transactions, Recurring transactions (or Bills & Deposits) and scripts (yet to be implemented). Each different aspect of the file is represented by a tab within the view.

Author:
Michael Edwardes 2001 Copyright 2000-2001

Member Typedef Documentation


Member Enumeration Documentation

Enumerator:
HomeView 
AccountsView 
InstitutionsView 
SchedulesView 
CategoriesView 
PayeesView 
LedgersView 
InvestmentsView 
ReportsView 
BudgetView 
ForecastView 

Enumerator:
preOpen 
postOpen 
preSave 
postSave 
preClose 
postClose 

enum KMyMoneyView::menuID [private]

Enumerator:
AccountNew 
AccountOpen 
AccountReconcile 
AccountEdit 
AccountDelete 
AccountOnlineMap 
AccountOnlineUpdate 
AccountOfxConnect 
CategoryNew 

Enumerator:
Memory 
Database 

enum KMyMoneyView::_fileTypeE [private]

Enumerator:
KmmBinary 
KmmXML 
KmmDb 
MaxNativeFileType 
GncXML 


Constructor & Destructor Documentation

KMyMoneyView::KMyMoneyView ( QWidget parent = 0,
const char *  name = 0 
)

The constructor for KMyMoneyView. Just creates all the tabs for the different aspects of the MyMoneyFile.

KMyMoneyView::~KMyMoneyView (  ) 

Destructor


Member Function Documentation

void KMyMoneyView::addTitleBar ( QWidget parent,
const QString &  title 
) [private]

void KMyMoneyView::ungetString ( QIODevice *  qfile,
char *  buf,
int  len 
) [private]

void KMyMoneyView::loadDefaultCurrency ( const MyMoneySecurity curr,
const bool  create 
) [private]

This method creates the currency curr if it does not exist and create is true. If the currency already exists, it checks if the name is equal. If it is not, the name of the object in the engine is updated to the name passed with curr.

Parameters:
curr MyMoneySecurity to be checked
create If true and currency does not exist it will be created If false currency will not be created even if it does not exist

void KMyMoneyView::loadAncientCurrency ( const QString &  id,
const QString &  name,
const QString &  sym,
const QDate &  date,
const MyMoneyMoney rate,
const QString &  newId,
const int  partsPerUnit = 100,
const int  smallestCashFraction = 100,
const int  smallestAccountFraction = 0 
) [private]

void KMyMoneyView::selectBaseCurrency ( void   )  [private]

if no base currency is defined, start the dialog and force it to be set

void KMyMoneyView::newStorage ( storageTypeE  = Memory  )  [private]

This method attaches an empty storage object to the MyMoneyFile object. It calls removeStorage() to remove a possibly attached storage object.

void KMyMoneyView::removeStorage ( void   )  [private]

This method removes an attached storage from the MyMoneyFile object.

void KMyMoneyView::viewAccountList ( const QString &  selectAccount  )  [private]

static void KMyMoneyView::progressCallback ( int  current,
int  total,
const QString &   
) [static, private]

void KMyMoneyView::fixFile_0 ( void   )  [private]

void KMyMoneyView::fixFile_1 ( void   )  [private]

void KMyMoneyView::fixFile_2 ( void   )  [private]

void KMyMoneyView::fixLoanAccount_0 ( MyMoneyAccount  acc  )  [private]

void KMyMoneyView::fixTransactions_0 ( void   )  [private]

void KMyMoneyView::fixSchedule_0 ( MyMoneySchedule  sched  )  [private]

void KMyMoneyView::fixDuplicateAccounts_0 ( MyMoneyTransaction t  )  [private]

void KMyMoneyView::createSchedule ( MyMoneySchedule  s,
MyMoneyAccount a 
) [private]

void KMyMoneyView::checkAccountName ( const MyMoneyAccount acc,
const QString &  name 
) const [private]

bool KMyMoneyView::fileOpen ( void   ) 

Makes sure that a MyMoneyFile is open and has been created succesfully.

Returns:
Whether the file is open and initialised

void KMyMoneyView::closeFile ( void   ) 

Closes the open MyMoneyFile and frees all the allocated memory, I hope !

bool KMyMoneyView::readFile ( const KURL &  url  ) 

Calls MyMoneyFile::readAllData which reads a MyMoneyFile into appropriate data structures in memory. The return result is examined to make sure no errors occured whilst parsing.

Parameters:
url The URL to read from. If no protocol is specified, file:// is assumed.
Returns:
Whether the read was successfull.

bool KMyMoneyView::saveFile ( const KURL &  url,
const QString &  keyList = QString() 
)

Saves the data into permanent storage using the XML format.

Parameters:
url The URL to save into. If no protocol is specified, file:// is assumed.
keyList QString containing a comma separated list of keys to be used for encryption. If keyList is empty, the file will be saved unencrypted (the default)
Return values:
false save operation failed
true save operation was successful

bool KMyMoneyView::saveAsDatabase ( const KURL &  url  ) 

Saves the data into permanent storage on a new or empty SQL database.

Parameters:
url The pseudo of tyhe database
Return values:
false save operation failed
true save operation was successful Saves the data into permanent storage on a new or empty SQL database.
Parameters:
url The pseudo URL of the database
Return values:
false save operation failed
true save operation was successful

bool KMyMoneyView::isNativeFile (  )  [inline]

Call this to find out if the currently open file is native KMM

Return values:
true file is native
false file is foreign

bool KMyMoneyView::isDatabase (  )  [inline]

Call this to find out if the currently open file is a sql database

Return values:
true file is database
false file is serial

bool KMyMoneyView::dirty ( void   ) 

Call this to see if the MyMoneyFile contains any unsaved data.

Return values:
true if any data has been modified but not saved
false otherwise

void KMyMoneyView::newFile ( void   ) 

Close the currently opened file and create an empty new file.

See also:
MyMoneyFile

void KMyMoneyView::viewUp ( void   ) 

Moves the view up from transaction to Bank/Account view.

void KMyMoneyView::enableViews ( int  state = -1  ) 

This method allows to set the enable state of all views (except home view) The argument state controls the availability.

Parameters:
state Controls whether views are disabled (0), enabled (1) or enabled/disabled according to an open file (-1). The latter is the default.

KMyMoneyViewBase* KMyMoneyView::addPage ( const QString &  title,
const QString &  icon = QString() 
)

void KMyMoneyView::addWidget ( QWidget w  ) 

virtual bool KMyMoneyView::showPage ( int  index  )  [virtual]

bool KMyMoneyView::canCreateTransactions ( const KMyMoneyRegister::SelectedTransactions list,
QString &  tooltip 
) const

check if the current view allows to create a transaction

Parameters:
list list of selected transactions
tooltip reference to string receiving the tooltip text which explains why the modify function is not available (in case of returning false)
Return values:
true Yes, view allows to create a transaction (tooltip is not changed)
false No, view cannot to create a transaction (tooltip is updated with message)

bool KMyMoneyView::canModifyTransactions ( const KMyMoneyRegister::SelectedTransactions list,
QString &  tooltip 
) const

check if the current view allows to modify (edit/delete) the selected transactions

Parameters:
list list of selected transactions
tooltip reference to string receiving the tooltip text which explains why the modify function is not available (in case of returning false)
Return values:
true Yes, view allows to edit/delete transactions (tooltip is not changed)
false No, view cannot edit/delete transactions (tooltip is updated with message)

bool KMyMoneyView::canDuplicateTransactions ( const KMyMoneyRegister::SelectedTransactions list,
QString &  tooltip 
) const

bool KMyMoneyView::canEditTransactions ( const KMyMoneyRegister::SelectedTransactions list,
QString &  tooltip 
) const

check if the current view allows to edit the selected transactions

Parameters:
list list of selected transactions
tooltip reference to string receiving the tooltip text which explains why the edit function is not available (in case of returning false)
Return values:
true Yes, view allows to enter/edit transactions
false No, view cannot enter/edit transactions

bool KMyMoneyView::canPrint ( void   ) 

check if the current view allows to print something

Return values:
true Yes, view allows to print
false No, view cannot print

TransactionEditor* KMyMoneyView::startEdit ( const KMyMoneyRegister::SelectedTransactions  ) 

bool KMyMoneyView::createNewTransaction ( void   ) 

bool KMyMoneyView::startReconciliation ( const MyMoneyAccount account,
const QDate &  reconciliationDate,
const MyMoneyMoney endingBalance 
)

Used to start reconciliation of account account. It switches the ledger view into reconciliation mode and updates the view.

Parameters:
account account which should be reconciled
reconciliationDate the statement date
endingBalance the ending balance entered for this account
Return values:
true Reconciliation started
false Account cannot be reconciled

void KMyMoneyView::finishReconciliation ( const MyMoneyAccount account  ) 

Used to finish reconciliation of account account. It switches the ledger view to normal mode and updates the view.

Parameters:
account account which should be reconciled

void KMyMoneyView::loadDefaultCurrencies ( void   ) 

This method preloads all known currencies into the engine.

void KMyMoneyView::loadAncientCurrencies ( void   ) 

void KMyMoneyView::showTitleBar ( bool  show  ) 

void KMyMoneyView::slotRememberPage ( QWidget widget  )  [slot]

This slot writes information about the page passed as argument widget in the kmymoney2.rc file so that in can be selected automatically when the application is started again.

Parameters:
widget pointer to page widget

void KMyMoneyView::slotRefreshViews (  )  [slot]

Brings up a dialog to change the list(s) settings and saves them into the class KMyMoneySettings (a singleton).

See also:
KListSettingsDlg Refreshs all views. Used e.g. after settings have been changed or data has been loaded from external sources (QIF import).

void KMyMoneyView::slotLedgerSelected ( const QString &  acc,
const QString &  transaction = QString() 
) [slot]

Called, whenever the ledger view should pop up and a specific transaction in an account should be shown. If transaction is empty, the last transaction should be selected

Parameters:
acc The ID of the account to be shown
transaction The ID of the transaction to be selected

void KMyMoneyView::slotPayeeSelected ( const QString &  payeeId,
const QString &  accountId,
const QString &  transactionId 
) [slot]

Called, whenever the payees view should pop up and a specific transaction in an account should be shown.

Parameters:
payeeId The ID of the payee to be shown
accountId The ID of the account to be shown
transactionId The ID of the transaction to be selected

void KMyMoneyView::slotScheduleSelected ( const QString &  schedule  )  [slot]

Called, whenever the schedule view should pop up and a specific schedule should be shown.

Parameters:
schedule The ID of the schedule to be shown

void KMyMoneyView::slotShowReport ( const QString &  reportid  )  [slot]

Called, whenever the report view should pop up and a specific report should be shown.

Parameters:
reportid The ID of the report to be shown

void KMyMoneyView::slotShowReport ( const MyMoneyReport report  )  [slot]

Same as the above, but the caller passes in an actual report definition to be shown.

Parameters:
report The report to be shown

void KMyMoneyView::slotPrintView ( void   )  [slot]

This slot prints the current view.

void KMyMoneyView::slotShowHomePage ( void   )  [inline, slot]

This slot switches the view to present the home page

void KMyMoneyView::slotShowTransactionDetail ( bool  detailed  )  [protected, slot]

Called when the user changes the detail setting of the transaction register

Parameters:
detailed if true, the register is shown with all details

void KMyMoneyView::slotSetBaseCurrency ( const MyMoneySecurity baseCurrency  )  [protected, slot]

eventually replace this with KMyMoney2App::slotCurrencySetBase(void). it contains the same code

Deprecated:

bool KMyMoneyView::openDatabase ( const KURL &  dbaseURL  )  [private]

This method is called from readFile to open a database file which is to be processed in 'proper' database mode, i.e. in-place updates

Parameters:
dbaseURL pseudo-KURL representation of database
Return values:
true Database opened successfully
false Could not open or read database

bool KMyMoneyView::initializeStorage (  )  [private]

This method is used after a file or database has been read into storage, and performs various initialization tasks

Return values:
true all went okay
false an exception occurred during this process

void KMyMoneyView::saveToLocalFile ( QFile *  qf,
IMyMoneyStorageFormat writer,
bool  plaintext = false,
const QString &  keyList = QString() 
) [private]

This method is used by saveFile() to store the data either directly in the destination file if it is on the local file system or in a temporary file when the final destination is reached over a network protocol (e.g. FTP)

Parameters:
qf pointer to QFile representing the opened file
writer pointer to the formatter
plaintext whether to override any compression & encryption settings
keyList QString containing a comma separated list of keys to be used for encryption If keyList is empty, the file will be saved unencrypted
Note:
This method will close the file when it is written.

void KMyMoneyView::accountNew ( const bool  createCategory  )  [private]

Internal method used by slotAccountNew() and slotAccountCategory().

void KMyMoneyView::viewActivated ( int  view  )  [signal]

This signal is emitted whenever a view is selected. The parameter view is identified as one of KMyMoneyView::viewID.

void KMyMoneyView::accountSelectedForContextMenu ( const MyMoneyAccount acc  )  [signal]

void KMyMoneyView::viewStateChanged ( bool  enabled  )  [signal]

void KMyMoneyView::kmmFilePlugin ( unsigned int  action  )  [signal]

This signal is emitted to inform the kmmFile plugin when various file actions occur. The Action parameter distinguishes between them.

void KMyMoneyView::reconciliationStarts ( const MyMoneyAccount account,
const QDate &  reconciliationDate,
const MyMoneyMoney endingBalance 
) [signal]

Signal is emitted when reconciliation starts or ends. In case of end, account is MyMoneyAccount()

Parameters:
account account for which reconciliation starts or MyMoneyAccount() if reconciliation ends.
reconciliationDate the statement date
endingBalance collected ending balance when reconciliation starts 0 otherwise


Member Data Documentation

bool KMyMoneyView::m_fileOpen [private]

int KMyMoneyView::m_fmode [private]


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

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