kplato

kptrequestresourcespanel.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003 - 2005 Dag Andersen <danders@get2net.dk>
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;
00007    version 2 of the License.
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 KPTREQUESTRESOURCESPANEL_H
00021 #define KPTREQUESTRESOURCESPANEL_H
00022 
00023 #include "kpttaskresourcespanelbase.h"
00024 #include "kptduration.h"
00025 
00026 #include <qlistview.h>
00027 #include <qstring.h>
00028 #include <qtable.h>
00029 //class QCheckTableItem;
00030 
00031 class KCommand;
00032 class KMacroCommand;
00033 
00034 namespace KPlato
00035 {
00036 
00037 class Account;
00038 class Accounts;
00039 class Task;
00040 class ResourceGroup;
00041 class Resource;
00042 class ResourceGroupRequest;
00043 class ResourceRequest;
00044 class StandardWorktime;
00045 class Part;
00046 class Duration;
00047 
00048 class ResourceTableItem {
00049 public:
00050     ResourceTableItem(Resource *resource, ResourceRequest *request, bool check = false);
00051     ~ResourceTableItem() ;
00052 
00053     void update();
00054     void insert(QTable *table, int row);
00055     void ok(ResourceGroupRequest *group);
00056 
00057     bool isChecked() const { return m_checked; }
00058     bool isOrigChecked() const { return m_origChecked; }
00059     Resource *resource() { return m_resource; }
00060     ResourceRequest *request() { return m_request; }
00061     int numRequests() const { return m_checked ? 1 : 0; }
00062     int units() const { return m_units; }
00063 
00064     Resource *m_resource;
00065     int m_units, m_origUnits;
00066     bool m_checked, m_origChecked;
00067     QCheckTableItem *m_checkitem;
00068     ResourceRequest *m_request;
00069     int m_curAccountItem;
00070     QString m_curAccountText;
00071 };
00072 
00073 class GroupLVItem : public QListViewItem {
00074 public:
00075     GroupLVItem(QListView *parent, ResourceGroup *group, Task &task);
00076     ~GroupLVItem();
00077 
00078     void update();
00079     void insert(QTable *table);
00080     const QPtrList<ResourceTableItem> &resources() const { return m_resources; }
00081     void ok(Task &task);
00082 
00083     int numRequests();
00084     bool isNull() const;
00085     
00086     ResourceGroup *m_group;
00087     int m_units;
00088     QPtrList<ResourceTableItem> m_resources;
00089     ResourceGroupRequest *m_request;
00090 };
00091 
00092 
00093 class RequestResourcesPanel : public TaskResourcesPanelBase {
00094     Q_OBJECT
00095 public:
00096     RequestResourcesPanel(QWidget *parent, Task &task, bool baseline=false);
00097 
00098     KCommand *buildCommand(Part *part);
00099     
00100     bool ok();
00101     
00102 private slots:
00103     void sendChanged();
00104 
00105     void groupChanged(QListViewItem *item);
00106     void resourceChanged(int, int);
00107     void unitsChanged(int);
00108     
00109 signals:
00110     void changed();
00111 
00112 private:
00113     Task &m_task;
00114     StandardWorktime *m_worktime;
00115     GroupLVItem *selectedGroup;
00116     bool m_blockChanged;
00117     
00118 };
00119 
00120 }  //KPlato namespace
00121 
00122 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys