From dadc34655c3ab961b0b0b94a10eaaba710f0b5e8 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 4 Jul 2011 22:38:03 +0000 Subject: Added kmymoney git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239792 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmymoney2/views/khomeview.h | 158 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 kmymoney2/views/khomeview.h (limited to 'kmymoney2/views/khomeview.h') diff --git a/kmymoney2/views/khomeview.h b/kmymoney2/views/khomeview.h new file mode 100644 index 0000000..213fd91 --- /dev/null +++ b/kmymoney2/views/khomeview.h @@ -0,0 +1,158 @@ +/*************************************************************************** + khomeview.h - description + ------------------- + begin : Tue Jan 22 2002 + copyright : (C) 2000-2002 by Michael Edwardes + email : mte@users.sourceforge.net + Javier Campos Morales + Felix Rodriguez + John C + Thomas Baumgart + Kevin Tambascio + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#ifndef KHOMEVIEW_H +#define KHOMEVIEW_H + +// ---------------------------------------------------------------------------- +// QT Includes +#include +class QVBoxLayout; +class QFrame; + +// ---------------------------------------------------------------------------- +// KDE Includes +#include + +// ---------------------------------------------------------------------------- +// Project Includes + +#include "../mymoney/mymoneyscheduled.h" +#include "../mymoney/mymoneyaccount.h" +#include "../mymoney/mymoneyforecast.h" +#include "../views/kmymoneyview.h" + +/** + * Displays a 'home page' for the user. Similar to concepts used in + * quicken and m$-money. + * + * @author Michael Edwardes + * + * @short A view containing the home page for kmymoney2. +**/ +class KHomeView : public KMyMoneyViewBase +{ + Q_OBJECT +public: + /** + * Definition of bitmap used as argument for showAccounts(). + */ + enum paymentTypeE { + Preferred = 1, ///< show preferred accounts + Payment = 2 ///< show payment accounts + }; + + KHomeView(QWidget *parent=0, const char *name=0); + ~KHomeView(); + +protected: + void showPayments(void); + void showPaymentEntry(const MyMoneySchedule&, int cnt = 1); + void showAccounts(paymentTypeE type, const QString& hdr); + void showAccountEntry(const MyMoneyAccount&); + void showFavoriteReports(void); + void showForecast(void); + void showNetWorthGraph(void); + void showSummary(void); + void showAssetsLiabilities(void); + void showIncomeExpenseSummary(void); + void showSchedulesSummary(void); + void showBudget(void); + void showCashFlowSummary(void); + + const QString link(const QString& view, const QString& query, const QString& title = QString()) const; + const QString linkend(void) const; + void loadView(void); + +public slots: + /** + * Overridden so we can emit the activated signal. + * + * @return Nothing. + */ + void show(void); + + void slotOpenURL(const KURL &url, const KParts::URLArgs& args); + void slotLoadView(void); + + /** + * Print the current view + */ + void slotPrintView(void); + +signals: + void ledgerSelected(const QString& id, const QString& transaction); + void scheduleSelected(const QString& id); + void reportSelected(const QString& id); + +private: + /// \internal d-pointer class. + class Private; + /// \internal d-pointer instance. + Private* const d; + + /** + * daily balances of an account + */ + typedef QMap dailyBalances; + + /** + * Print an account and its balance and limit + */ + void showAccountEntry(const MyMoneyAccount& acc, const MyMoneyMoney& value, const MyMoneyMoney& valueToMinBal, const bool showMinBal); + + /** + * @param acc the investment account + * @return the balance in the currency of the investment account + */ + MyMoneyMoney investmentBalance(const MyMoneyAccount& acc); + + /** + * Print text in the color set for negative numbers, if @p amount is negative + * abd @p isNegative is true + */ + QString showColoredAmount(const QString& amount, bool isNegative); + + /** + * Run the forecast + */ + void doForecast(void); + + /** + * Calculate the forecast balance after a payment has been made + */ + MyMoneyMoney forecastPaymentBalance(const MyMoneyAccount& acc, const MyMoneyMoney& payment, QDate& paymentDate); + + KHTMLPart* m_part; + QVBoxLayout* m_qvboxlayoutPage; + QString m_filename; + bool m_showAllSchedules; + bool m_needReload; + MyMoneyForecast m_forecast; + + /** + * daily forecast balance of accounts + */ + QMap m_accountList; + +}; + +#endif -- cgit v1.2.3