kpayeesview.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           kpayeesview.h
00003                           -------------
00004     begin                : Thu Jan 24 2002
00005     copyright            : (C) 2000-2002 by Michael Edwardes
00006                                     2005 by Andrea Nicolai
00007                                     2006 by Thomas Baumgart
00008     email                : mte@users.sourceforge.net
00009                            Javier Campos Morales <javi_c@users.sourceforge.net>
00010                            Felix Rodriguez <frodriguez@users.sourceforge.net>
00011                            John C <thetacoturtle@users.sourceforge.net>
00012                            Thomas Baumgart <ipwizard@users.sourceforge.net>
00013                            Kevin Tambascio <ktambascio@users.sourceforge.net>
00014                            Andreas Nicolai <Andreas.Nicolai@gmx.net>
00015 ***************************************************************************/
00016 
00017 /***************************************************************************
00018  *                                                                         *
00019  *   This program is free software; you can redistribute it and/or modify  *
00020  *   it under the terms of the GNU General Public License as published by  *
00021  *   the Free Software Foundation; either version 2 of the License, or     *
00022  *   (at your option) any later version.                                   *
00023  *                                                                         *
00024  ***************************************************************************/
00025 
00026 #ifndef KPAYEESVIEW_H
00027 #define KPAYEESVIEW_H
00028 
00029 // ----------------------------------------------------------------------------
00030 // QT Includes
00031 
00032 #include <qwidget.h>
00033 class QSplitter;
00034 
00035 // ----------------------------------------------------------------------------
00036 // KDE Includes
00037 
00038 #include <klistview.h>
00039 #include <kpopupmenu.h>
00040 
00041 // ----------------------------------------------------------------------------
00042 // Project Includes
00043 
00044 #include "kpayeesviewdecl.h"
00045 #include "kmymoneytransaction.h"
00046 #include <kmymoney/mymoneypayee.h>
00047 
00048 class KListViewSearchLineWidget;
00049 
00060 class KTransactionPtrVector : public QPtrVector<KMyMoneyTransaction> {
00061 public:
00067   enum TransactionSortE {
00068     SortEntryDate = 0,      
00071     SortPostDate,           
00074     SortTypeNr,             
00077     SortReceiver,           
00080     SortValue,              
00083     SortNr,                 
00086     SortEntryOrder          
00089   };
00090 
00091   KTransactionPtrVector() { m_sortType = SortPostDate; };
00092   ~KTransactionPtrVector() {}
00093 
00099   void setSortType(const TransactionSortE type);
00100 
00107   TransactionSortE sortType(void) const { return m_sortType; };
00108 
00114   void setAccountId(const QString& id);
00115 
00121   void setPayeeId(const QString& id);
00122 
00123 protected:
00124   int compareItems(KTransactionPtrVector::Item d1, KTransactionPtrVector::Item d2);
00125 
00126 private:
00127   int compareItems(const QString& s1, const QString& s2) const;
00128 
00129 private:
00130   enum {
00131     AccountMode = 0,
00132     PayeeMode
00133   };
00134   short             m_idMode;
00135   QString           m_id;
00136   TransactionSortE  m_sortType;
00137 };
00138 
00139 
00140 
00144 class KPayeeListItem : public KListViewItem
00145 {
00146 public:
00155   KPayeeListItem(KListView *parent, const MyMoneyPayee& payee);
00156   ~KPayeeListItem();
00157 
00163   void paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int align);
00164 
00165   const MyMoneyPayee& payee(void) const { return m_payee; };
00166 
00167 private:
00168   MyMoneyPayee  m_payee;
00169 };
00170 
00175 class KTransactionListItem : public KListViewItem
00176 {
00177 public:
00178   KTransactionListItem(KListView* view, KTransactionListItem* parent, const QString& accountId, const QString& transaction);
00179   ~KTransactionListItem();
00180 
00181   const QString& transactionId(void) const { return m_transactionId; };
00182 
00183   const QString& accountId(void) const { return m_accountId; };
00184 
00188   void paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment);
00189 
00193   const QColor backgroundColor();
00194 
00195 private:
00196   QString m_transactionId;
00197   QString m_accountId;
00198 };
00199 
00200 class KPayeesView : public KPayeesViewDecl
00201 {
00202   Q_OBJECT
00203 
00204 public:
00205   KPayeesView(QWidget *parent=0, const char *name=0);
00206   ~KPayeesView();
00207   void show(void);
00208 
00209 public slots:
00210   void slotSelectPayeeAndTransaction(const QString& payeeId, const QString& accountId = QString(), const QString& transactionId = QString());
00211   void slotLoadPayees(void);
00212   void slotStartRename(void);
00213   void slotHelp(void);
00214 
00215 protected:
00216   void resizeEvent(QResizeEvent*);
00217   void loadPayees(void);
00218   void selectedPayees(QValueList<MyMoneyPayee>& payeesList) const;
00219   void ensurePayeeVisible(const QString& id);
00220   void clearItemData(void);
00221 
00222 protected slots:
00229   void showTransactions(void);
00230 
00235   void slotSelectPayee(void);
00236 
00240   void slotPayeeDataChanged(void);
00241   void slotKeyListChanged(void);
00242 
00247   void slotRenamePayee(QListViewItem *p, int col, const QString& txt);
00248 
00253   void slotUpdatePayee(void);
00254 
00255   void slotTransactionDoubleClicked(QListViewItem *);
00256 
00257 private slots:
00258   void rearrange(void);
00259 
00268   void slotOpenContextMenu(KListView* lv, QListViewItem* item, const QPoint& p);
00269 
00270   void slotQueueUpdate(void);
00271 
00272   void slotActivateUpdate(void);
00273 
00274   void slotChooseDefaultAccount(void);
00275 
00276 private:
00277   void readConfig(void);
00278 
00279 signals:
00280   void transactionSelected(const QString& accountId, const QString& transactionId);
00281   void openContextMenu(const MyMoneyObject& obj);
00282   void selectObjects(const QValueList<MyMoneyPayee>& payees);
00283 
00284 private:
00285   MyMoneyPayee m_payee;
00286   QString      m_newName;
00287 
00288   QSplitter*    m_splitter;
00289 
00293   QValueList<KMyMoneyTransaction> m_transactionList;
00294 
00300   KTransactionPtrVector m_transactionPtrVector;
00301 
00306   bool m_needReload;
00307 
00311   KListViewSearchLineWidget*  m_searchWidget;
00312   bool m_needConnection;
00313 
00317   int m_updatesQueued;
00318 
00322   bool m_inSelection;
00323 };
00324 
00325 #endif

Generated on Wed Jan 26 13:03:17 2011 for KMyMoney by  doxygen 1.5.6