You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
146 lines
5.1 KiB
146 lines
5.1 KiB
15 years ago
|
/* This file is part of the KDE project
|
||
|
Copyright (C) 2002 Bo Thorsen bo@sonofthor.dk
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License as published by the Free Software Foundation; either
|
||
|
version 2 of the License, or (at your option) any later version.
|
||
|
|
||
|
This library is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
* Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
14 years ago
|
#include <tqpushbutton.h>
|
||
|
#include <tqcombobox.h>
|
||
|
#include <tqlabel.h>
|
||
13 years ago
|
#include <tqtextedit.h>
|
||
14 years ago
|
#include <tqlineedit.h>
|
||
|
#include <tqdatetimeedit.h>
|
||
|
#include <tqdatetime.h>
|
||
|
#include <tqtabwidget.h>
|
||
13 years ago
|
#include <tqtextbrowser.h>
|
||
15 years ago
|
|
||
|
#include <kdatepicker.h>
|
||
12 years ago
|
#include <tdelocale.h>
|
||
15 years ago
|
|
||
12 years ago
|
#include <tdeabc/addressee.h>
|
||
|
#include <tdeabc/addresseedialog.h>
|
||
15 years ago
|
|
||
|
#include <kdebug.h>
|
||
|
|
||
|
#include "kptprojectdialog.h"
|
||
|
#include "kptproject.h"
|
||
|
#include "kptresource.h"
|
||
|
#include "kptprojectdialogbase.h"
|
||
|
#include "kptresourcespanel.h"
|
||
|
|
||
|
namespace KPlato
|
||
|
{
|
||
|
|
||
14 years ago
|
ProjectDialog::ProjectDialog(Project &p, TQWidget *parent, const char *name)
|
||
|
: KDialogBase( Swallow, i18n("Project Settings"), Ok|Cancel, Ok, parent, name, true, true),
|
||
15 years ago
|
project(p)
|
||
|
{
|
||
|
dia = new ProjectDialogImpl(this);
|
||
|
resourcesTab = new ResourcesPanel(dia, &project);
|
||
|
dia->daTabs->insertTab(resourcesTab, i18n("Resources"), 1);
|
||
|
setMainWidget(dia);
|
||
|
enableButtonOK(false);
|
||
|
|
||
|
dia->namefield->setText(project.name());
|
||
|
dia->leaderfield->setText(project.leader());
|
||
|
|
||
14 years ago
|
connect(dia, TQT_SIGNAL( obligatedFieldsFilled(bool) ), this, TQT_SLOT( enableButtonOK(bool) ));
|
||
|
connect(dia, TQT_SIGNAL( schedulingTypeChanged(int) ), this, TQT_SLOT( slotSchedulingChanged(int) ));
|
||
15 years ago
|
|
||
|
slotSchedulingChanged(dia->schedulerType->currentItem());
|
||
|
dia->namefield->setFocus();
|
||
|
|
||
14 years ago
|
connect(resourcesTab, TQT_SIGNAL( changed() ), dia, TQT_SLOT( slotCheckAllFieldsFilled() ));
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
|
void ProjectDialog::slotOk() {
|
||
|
project.setConstraint((Node::ConstraintType) dia->schedulerType->currentItem());
|
||
|
//FIXME
|
||
14 years ago
|
project.setStartTime(TQDateTime(dia->schedulerDate->date(), dia->schedulerTime->time()));
|
||
|
project.setConstraintStartTime(TQDateTime(dia->schedulerDate->date(), dia->schedulerTime->time()));
|
||
15 years ago
|
|
||
|
project.setName(dia->namefield->text());
|
||
|
project.setLeader(dia->leaderfield->text());
|
||
|
project.setDescription(dia->descriptionfield->text());
|
||
|
|
||
|
resourcesTab->ok();
|
||
|
|
||
|
accept();
|
||
|
}
|
||
|
|
||
|
void ProjectDialog::slotSchedulingChanged(int activated) {
|
||
|
bool needDate = activated >= 2;
|
||
|
dia->schedulerTime->setEnabled(needDate);
|
||
|
dia->schedulerDate->setEnabled(needDate);
|
||
|
|
||
14 years ago
|
TQString label = TQString("<p><font size=\"4\" color=\"#7797BC\"><b>%1</b></font></p><p>%2</p>");
|
||
15 years ago
|
switch(activated) {
|
||
|
// TODO please provide nice explenations on this.
|
||
|
case 0: // ASAP
|
||
13 years ago
|
label = label.arg(i18n("As Soon as Possible"));
|
||
|
label = label.arg(i18n("Place all events at the earliest possible moment permitted in the schedule"));
|
||
15 years ago
|
break;
|
||
|
case 1: // ALAP
|
||
13 years ago
|
label = label.arg(i18n("As Late as Possible"));
|
||
|
label = label.arg(i18n("Place all events at the last possible moment permitted in the schedule"));
|
||
15 years ago
|
break;
|
||
|
case 2: // Start not earlier then
|
||
13 years ago
|
label = label.arg(i18n("Start not Earlier then"));
|
||
6 years ago
|
label = label.arg("");
|
||
15 years ago
|
break;
|
||
|
case 3: // Finish not later then
|
||
13 years ago
|
label = label.arg(i18n("Finish not Later then"));
|
||
6 years ago
|
label = label.arg("");
|
||
15 years ago
|
break;
|
||
|
case 4: // Must start on
|
||
13 years ago
|
label = label.arg(i18n("Must Start on"));
|
||
6 years ago
|
label = label.arg("");
|
||
15 years ago
|
break;
|
||
|
default: // error ...
|
||
|
dia->lSchedulingExplain->setText("");
|
||
|
return;
|
||
|
}
|
||
|
dia->lSchedulingExplain->setText(label);
|
||
|
}
|
||
|
|
||
14 years ago
|
ProjectDialogImpl::ProjectDialogImpl (TQWidget *parent) : ProjectDialogBase(parent) {
|
||
14 years ago
|
connect (namefield, TQT_SIGNAL(textChanged( const TQString& )), this, TQT_SLOT(slotCheckAllFieldsFilled()) );
|
||
|
connect (leaderfield, TQT_SIGNAL(textChanged( const TQString& )), this, TQT_SLOT(slotCheckAllFieldsFilled()) );
|
||
|
connect (schedulerType, TQT_SIGNAL(activated( int )), this, TQT_SLOT(slotSchedulingChanged( int )) );
|
||
|
connect (chooseLeader, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotChooseLeader()));
|
||
15 years ago
|
}
|
||
|
|
||
|
void ProjectDialogImpl::slotCheckAllFieldsFilled() {
|
||
|
emit obligatedFieldsFilled( !(namefield->text().isEmpty() || leaderfield->text().isEmpty()));
|
||
|
}
|
||
|
|
||
|
void ProjectDialogImpl::slotSchedulingChanged(int activated) {
|
||
|
emit schedulingTypeChanged(activated);
|
||
|
}
|
||
|
|
||
|
void ProjectDialogImpl::slotChooseLeader()
|
||
|
{
|
||
12 years ago
|
TDEABC::Addressee a = TDEABC::AddresseeDialog::getAddressee(this);
|
||
15 years ago
|
if (!a.isEmpty()) {
|
||
|
leaderfield->setText(a.fullEmail());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
} //KPlato namespace
|
||
|
|
||
|
#include "kptprojectdialog.moc"
|