Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

kbudgetview.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           kbudgetview.h
00003                           -------------
00004     begin                : Thu Jan 24 2002
00005     copyright            : (C) 2006 by Darren Gould
00006     email                : darren_gould@gmx.de
00007 ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef KBUDGETVIEW_H
00019 #define KBUDGETVIEW_H
00020 
00021 // ----------------------------------------------------------------------------
00022 // QT Includes
00023 
00024 #include <qwidget.h>
00025 
00026 // ----------------------------------------------------------------------------
00027 // KDE Includes
00028 
00029 #include <klistview.h>
00030 #include <kpopupmenu.h>
00031 
00032 // ----------------------------------------------------------------------------
00033 // Project Includes
00034 
00035 #include "kbudgetviewdecl.h"
00036 #include "../mymoney/mymoneybudget.h"
00037 #include "../mymoney/mymoneysecurity.h"
00038 class KMyMoneyAccountTreeBudgetItem;
00039 
00047 class KBudgetListItem : public KListViewItem
00048 {
00049 public:
00058   KBudgetListItem(KListView *parent, const MyMoneyBudget& budget);
00059   ~KBudgetListItem();
00060 
00066   void paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int align);
00067 
00068   const MyMoneyBudget& budget(void) { return m_budget; };
00069   void setBudget(const MyMoneyBudget& budget) { m_budget = budget; }
00070 
00071 private:
00072   MyMoneyBudget  m_budget;
00073 };
00074 
00079 class KBudgetView : public KBudgetViewDecl
00080 {
00081    Q_OBJECT
00082 public:
00083   KBudgetView(QWidget *parent=0, const char *name=0);
00084   ~KBudgetView();
00085   void show();
00086   
00092   void polish(void);
00093   
00109   void suspendUpdate(const bool suspend);
00110 
00111 public slots:
00112   void slotReloadView(void);
00113   void slotRefreshView(void);
00114   void slotSelectBudget(void);
00115   void slotHideUnused(bool);
00116   void slotRefreshHideUnusedButton();
00117   void slotStartRename(void);
00118 
00122   void cb_includesSubaccounts_clicked();
00123 
00124 
00125 protected:
00126   void resizeEvent(QResizeEvent*);
00127   void loadAccounts(void);
00128   bool loadSubAccounts(KMyMoneyAccountTreeBudgetItem* parent, QCStringList& accountList, const MyMoneyBudget& budget);
00129 
00134   void loadBudgets(void);
00135   void ensureBudgetVisible(const QCString& id);
00136   const MyMoneyBudget& selectedBudget(void) const;
00137   KMyMoneyAccountTreeBudgetItem* selectedAccount(void) const;
00138   void setTimeSpan(KMyMoneyAccountTreeBudgetItem *account, MyMoneyBudget::AccountGroup& accountGroup, int iTimeSpan);
00139   void askSave(void);
00140 
00141 protected slots:
00142 
00151   void slotRenameBudget(QListViewItem *p, int col, const QString& txt);
00152 
00157   void slotBudgetedAmountChanged(void);
00158 
00161   void slotSelectAccount(QListViewItem*);
00162 
00163   void AccountEnter();
00164 
00165   void slotUpdateBudget(void);
00166 
00167   void slotResetBudget(void);
00168 
00169   void slotNewBudget(void);
00170 
00171   void languageChange(void);
00172 
00173 private slots:
00174   void slotRearrange(void);
00175 
00184   void slotOpenContextMenu(KListView* lv, QListViewItem* i, const QPoint& p);
00185 
00186 signals:
00190   void openContextMenu(const MyMoneyObject& obj);
00191   void selectObjects(const QValueList<MyMoneyBudget>& budget);
00192 
00193 private:
00194   typedef enum {
00195     eNone=-1,
00196     eYearly=0,
00197     eMonthly=1,
00198     eMonthByMonth=2
00199   } eTimePeriodColumn;
00200 
00201   MyMoneyBudget                       m_budget;
00202 
00203   QMap<QCString, unsigned long>       m_transactionCountMap;
00204   QStringList                         m_yearList;
00205 
00206   KMyMoneyAccountTreeBudgetItem*      m_incomeItem;
00207   KMyMoneyAccountTreeBudgetItem*      m_expenseItem;
00208 
00210   bool                                m_needReload;
00211 
00212   // set if we are in the selection of a different budget
00213   bool                                m_inSelection;
00214   
00215   void adaptHideUnusedButton(void);
00216 
00217   static const int m_iBudgetYearsAhead;
00218   static const int m_iBudgetYearsBack;
00219 };
00220 
00221 #endif

Generated on Mon Oct 13 12:04:07 2008 for KMyMoney by  doxygen 1.4.1