kplato

kptresourcedialog.h
1/* This file is part of the KDE project
2 Copyright (C) 2003 - 2005 Dag Andersen <kplato@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation;
7 version 2 of the License.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KPTRESOURCEDIALOG_H
21#define KPTRESOURCEDIALOG_H
22
23#include "resourcedialogbase.h"
24#include "kptresource.h"
25
26#include <kdialogbase.h>
27
28#include <tqmap.h>
29#include <tqcombobox.h>
30
31class KCommand;
32
33class TQTime;
34class TQString;
35
36namespace KPlato
37{
38
39class Part;
40class Project;
41class Resource;
42class Calendar;
43
44class ResourceDialogImpl : public ResourceDialogBase {
45 TQ_OBJECT
46
47public:
48 ResourceDialogImpl (TQWidget *parent);
49
50public slots:
51 void slotChanged();
52 void slotCalculationNeeded(const TQString&);
53 void slotChooseResource();
54
55signals:
56 void changed();
57 void calculate();
58
59protected slots:
60 void slotAvailableFromChanged(const TQDateTime& dt);
61 void slotAvailableUntilChanged(const TQDateTime& dt);
62};
63
64class ResourceDialog : public KDialogBase {
65 TQ_OBJECT
66
67public:
68 ResourceDialog(Project &project, Resource *resource, TQWidget *parent=0, const char *name=0);
69
70 bool calculationNeeded() { return m_calculationNeeded; }
71
72 Calendar *calendar() { return m_calendars[dia->calendarList->currentItem()]; }
73 KCommand *buildCommand(Part *part = 0);
74
75 static KCommand *buildCommand(Resource *original, Resource &resource, Part *part);
76
77protected slots:
78 void enableButtonOk();
79 void slotCalculationNeeded();
80 void slotOk();
81 void slotCalendarChanged(int);
82
83private:
84 Resource *m_original;
85 Resource m_resource;
86 ResourceDialogImpl *dia;
87 bool m_calculationNeeded;
88
89 TQMap<int, Calendar*> m_calendars;
90};
91
92} //KPlato namespace
93
94#endif