00001 /* This file is part of the KDE project 00002 Copyright (C) 2003 - 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; 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 KPTRESOURCEDIALOG_H 00021 #define KPTRESOURCEDIALOG_H 00022 00023 #include "ui_resourcedialogbase.h" 00024 #include "kptresource.h" 00025 00026 #include <kdialog.h> 00027 00028 #include <QMap> 00029 #include <QComboBox> 00030 00031 class KCommand; 00032 00033 class QTime; 00034 class QString; 00035 00036 namespace KPlato 00037 { 00038 00039 class Part; 00040 class Project; 00041 class Resource; 00042 class Calendar; 00043 00044 class ResourceDialogImpl : public QWidget, public Ui_ResourceDialogBase { 00045 Q_OBJECT 00046 public: 00047 ResourceDialogImpl (QWidget *parent); 00048 00049 public slots: 00050 void slotChanged(); 00051 void slotCalculationNeeded(const QString&); 00052 void slotChooseResource(); 00053 00054 signals: 00055 void changed(); 00056 void calculate(); 00057 00058 protected slots: 00059 void slotAvailableFromChanged(const QDateTime& dt); 00060 void slotAvailableUntilChanged(const QDateTime& dt); 00061 }; 00062 00063 class ResourceDialog : public KDialog { 00064 Q_OBJECT 00065 public: 00066 ResourceDialog(Project &project, Resource *resource, QWidget *parent=0, const char *name=0); 00067 00068 bool calculationNeeded() { return m_calculationNeeded; } 00069 00070 Calendar *calendar() { return m_calendars[dia->calendarList->currentIndex()]; } 00071 KCommand *buildCommand(Part *part = 0); 00072 00073 static KCommand *buildCommand(Resource *original, Resource &resource, Part *part); 00074 00075 protected slots: 00076 void enableButtonOk(); 00077 void slotCalculationNeeded(); 00078 void slotOk(); 00079 void slotCalendarChanged(int); 00080 00081 private: 00082 Resource *m_original; 00083 Resource m_resource; 00084 ResourceDialogImpl *dia; 00085 bool m_calculationNeeded; 00086 00087 QMap<int, Calendar*> m_calendars; 00088 }; 00089 00090 } //KPlato namespace 00091 00092 #endif