kplato

kptmilestoneprogressdialog.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2005 Dag Andersen <danders@get2net.dk>
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#include "kptmilestoneprogressdialog.h"
21#include "kptmilestoneprogresspanel.h"
22
23#include <kcommand.h>
24#include <tdelocale.h>
25
26#include <kdebug.h>
27
28namespace KPlato
29{
30
31MilestoneProgressDialog::MilestoneProgressDialog(Task &task, TQWidget *p)
32 : KDialogBase(Swallow, i18n("Milestone Progress"), Ok|Cancel, Ok, p, "Milestone Progress Dialog", true, true)
33{
34 m_panel = new MilestoneProgressPanel(task, this);
35
36 setMainWidget(m_panel);
37
38 enableButtonOK(false);
39
40 connect(m_panel, TQ_SIGNAL(changed()), TQ_SLOT(slotChanged()));
41}
42
43void MilestoneProgressDialog::slotChanged() {
44 enableButtonOK(true);
45}
46
47KCommand *MilestoneProgressDialog::buildCommand(Part *part) {
48 KMacroCommand *m = new KMacroCommand(i18n("Modify Milestone Progress"));
49 bool modified = false;
50 KCommand *cmd = m_panel->buildCommand(part);
51 if (cmd) {
52 m->addCommand(cmd);
53 modified = true;
54 }
55 if (!modified) {
56 delete m;
57 return 0;
58 }
59 return m;
60}
61
62void MilestoneProgressDialog::slotOk() {
63 if (!m_panel->ok())
64 return;
65 accept();
66}
67
68
69} //KPlato namespace
70
71#include "kptmilestoneprogressdialog.moc"
A task in the scheduling software is represented by this class.
Definition kpttask.h:40