20#include <tqpushbutton.h>
21#include <tqcombobox.h>
23#include <tqtextedit.h>
24#include <tqlineedit.h>
25#include <tqdatetimeedit.h>
26#include <tqdatetime.h>
27#include <tqtabwidget.h>
28#include <tqtextbrowser.h>
30#include <kdatepicker.h>
33#include <tdeabc/addressee.h>
34#include <tdeabc/addresseedialog.h>
38#include "kptprojectdialog.h"
39#include "kptproject.h"
40#include "kptresource.h"
41#include "kptprojectdialogbase.h"
42#include "kptresourcespanel.h"
47ProjectDialog::ProjectDialog(
Project &p, TQWidget *parent,
const char *name)
48 : KDialogBase( Swallow, i18n(
"Project Settings"), Ok|Cancel, Ok, parent, name, true, true),
51 dia =
new ProjectDialogImpl(
this);
52 resourcesTab =
new ResourcesPanel(dia, &project);
53 dia->daTabs->insertTab(resourcesTab, i18n(
"Resources"), 1);
55 enableButtonOK(
false);
57 dia->namefield->setText(project.name());
58 dia->leaderfield->setText(project.leader());
60 connect(dia, TQ_SIGNAL( obligatedFieldsFilled(
bool) ),
this, TQ_SLOT( enableButtonOK(
bool) ));
61 connect(dia, TQ_SIGNAL( schedulingTypeChanged(
int) ),
this, TQ_SLOT( slotSchedulingChanged(
int) ));
63 slotSchedulingChanged(dia->schedulerType->currentItem());
64 dia->namefield->setFocus();
66 connect(resourcesTab, TQ_SIGNAL( changed() ), dia, TQ_SLOT( slotCheckAllFieldsFilled() ));
70void ProjectDialog::slotOk() {
71 project.setConstraint((Node::ConstraintType) dia->schedulerType->currentItem());
73 project.setStartTime(TQDateTime(dia->schedulerDate->date(), dia->schedulerTime->time()));
74 project.setConstraintStartTime(TQDateTime(dia->schedulerDate->date(), dia->schedulerTime->time()));
76 project.setName(dia->namefield->text());
77 project.setLeader(dia->leaderfield->text());
78 project.setDescription(dia->descriptionfield->text());
85void ProjectDialog::slotSchedulingChanged(
int activated) {
86 bool needDate = activated >= 2;
87 dia->schedulerTime->setEnabled(needDate);
88 dia->schedulerDate->setEnabled(needDate);
90 TQString label = TQString(
"<p><font size=\"4\" color=\"#7797BC\"><b>%1</b></font></p><p>%2</p>");
94 label = label.arg(i18n(
"As Soon as Possible"));
95 label = label.arg(i18n(
"Place all events at the earliest possible moment permitted in the schedule"));
98 label = label.arg(i18n(
"As Late as Possible"));
99 label = label.arg(i18n(
"Place all events at the last possible moment permitted in the schedule"));
102 label = label.arg(i18n(
"Start not Earlier then"));
103 label = label.arg(
"");
106 label = label.arg(i18n(
"Finish not Later then"));
107 label = label.arg(
"");
110 label = label.arg(i18n(
"Must Start on"));
111 label = label.arg(
"");
114 dia->lSchedulingExplain->setText(
"");
117 dia->lSchedulingExplain->setText(label);
120ProjectDialogImpl::ProjectDialogImpl (TQWidget *parent) : ProjectDialogBase(parent) {
121 connect (namefield, TQ_SIGNAL(textChanged(
const TQString& )),
this, TQ_SLOT(slotCheckAllFieldsFilled()) );
122 connect (leaderfield, TQ_SIGNAL(textChanged(
const TQString& )),
this, TQ_SLOT(slotCheckAllFieldsFilled()) );
123 connect (schedulerType, TQ_SIGNAL(activated(
int )),
this, TQ_SLOT(slotSchedulingChanged(
int )) );
124 connect (chooseLeader, TQ_SIGNAL(pressed()),
this, TQ_SLOT(slotChooseLeader()));
127void ProjectDialogImpl::slotCheckAllFieldsFilled() {
128 emit obligatedFieldsFilled( !(namefield->text().isEmpty() || leaderfield->text().isEmpty()));
131void ProjectDialogImpl::slotSchedulingChanged(
int activated) {
132 emit schedulingTypeChanged(activated);
135void ProjectDialogImpl::slotChooseLeader()
137 TDEABC::Addressee a = TDEABC::AddresseeDialog::getAddressee(
this);
139 leaderfield->setText(a.fullEmail());
145#include "kptprojectdialog.moc"
Project is the main node in a project, it contains child nodes and possibly sub-projects.