kplato

kptaccountsview.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2005 Dag Andersen <kplato@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KPTACCOUNTSVIEW_H
00021 #define KPTACCOUNTSVIEW_H
00022 
00023 #include <qdatetime.h>
00024 
00025 #include <klistview.h>
00026 
00027 #include "kptaccount.h"
00028 #include "kptcontext.h"
00029 #include "kpteffortcostmap.h"
00030 #include "kptdoublelistviewbase.h"
00031 
00032 class QComboBox;
00033 class QDateEdit;
00034 class QPushButton;
00035 class QSplitter;
00036 class QListViewItem;
00037 class QLabel;
00038 class QPushButton;
00039 
00040 class KListView;
00041 class KListViewItem;
00042 class KPrinter;
00043 
00044 namespace KPlato
00045 {
00046 
00047 class Label;
00048 class Account;
00049 class View;
00050 class Project;
00051 class Resource;
00052 class Node;
00053 
00054 class ResourceGroup;
00055 class Resource;
00056 class ResourceItemPrivate;
00057 
00058 class AccountsView : public QWidget
00059 {
00060     Q_OBJECT
00061 public:
00062 
00063     AccountsView(Project &project, View *view, QWidget *parent);
00064 
00065     //~AccountsView();
00066 
00067     void zoom(double zoom);
00068 
00069     View *mainView() { return m_mainview; }
00070     void draw();
00071     void print(KPrinter &printer);
00072     
00073     virtual bool setContext(Context::Accountsview &context);
00074     virtual void getContext(Context::Accountsview &context) const;
00075 
00076 signals:
00077     void update();
00078     
00079 public slots:
00080     void slotConfigure();
00081 
00082 protected slots:
00083     void slotUpdate();
00084     
00085 protected:
00086     void getContextClosedItems(Context::Accountsview &context, QListViewItem *item) const;
00087     void setContextClosedItems(Context::Accountsview &context);
00088 
00089 private:
00090     class AccountItem : public DoubleListViewBase::MasterListItem {
00091     public:
00092         AccountItem(Account *a, QListView *parent, bool highlight=false);
00093         AccountItem(Account *a, QListViewItem *parent, bool highlight=false);
00094         AccountItem(QString text, Account *a, QListViewItem *parent, bool _highlight=false);
00095         
00096         void add(int col, const QDate &date, const EffortCost &ec);
00097         
00098         Account *account;
00099         EffortCostMap costMap;
00100     };
00101 
00102     void init();
00103     void initAccList(const AccountList &list);
00104     void initAccSubItems(Account *acc, AccountItem *parent);
00105     void initAccList(const AccountList &list, AccountItem *parent);
00106     void createPeriods();
00107     void clearPeriods();
00108     QString periodText(int offset);
00109     
00110 private:
00111     View *m_mainview;
00112     Project &m_project;
00113     Accounts &m_accounts;
00114     
00115     int m_defaultFontSize;
00116 
00117     QDate m_date;
00118     int m_period;
00119     bool m_cumulative;
00120     
00121     DoubleListViewBase *m_dlv;
00122 
00123     QStringList m_periodTexts;
00124     QPushButton *m_changeBtn;
00125     Label *m_label;
00126     
00127 };
00128 
00129 }  //KPlato namespace
00130 
00131 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys