kplato

kptmainprojectdialog.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2003 - 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 <tqvbox.h>
21
22#include <tdelocale.h>
23#include <kcommand.h>
24
25#include <kdebug.h>
26
27#include "kptmainprojectdialog.h"
28#include "kptproject.h"
29#include "kptmainprojectpanel.h"
30
31namespace KPlato
32{
33
34MainProjectDialog::MainProjectDialog(Project &p, TQWidget *parent, const char *name)
35 : KDialogBase( Swallow, i18n("Project Settings"), Ok|Cancel, Ok, parent, name, true, true),
36 project(p)
37{
38 panel = new MainProjectPanel(project, this);
39
40 setMainWidget(panel);
41 enableButtonOK(false);
42 resize( TQSize(500, 410).expandedTo(minimumSizeHint()));
43 connect(panel, TQ_SIGNAL(obligatedFieldsFilled(bool)), TQ_SLOT(enableButtonOK(bool)));
44}
45
46
47void MainProjectDialog::slotOk() {
48 if (!panel->ok())
49 return;
50
51 accept();
52}
53
54KCommand *MainProjectDialog::buildCommand(Part *part) {
55 KMacroCommand *m = 0;
56 TQString c = i18n("Modify main project");
57 KCommand *cmd = panel->buildCommand(part);
58 if (cmd) {
59 if (!m) m = new KMacroCommand(c);
60 m->addCommand(cmd);
61 }
62 return m;
63}
64
65} //KPlato namespace
66
67#include "kptmainprojectdialog.moc"
Project is the main node in a project, it contains child nodes and possibly sub-projects.
Definition kptproject.h:52