kplato

kptresourcesdialog.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 <tqvbox.h>
21
22#include <tdelocale.h>
23#include <kcommand.h>
24
25#include <kdebug.h>
26
27#include "kptresourcesdialog.h"
28#include "kptproject.h"
29#include "kptresourcespanel.h"
30#include "kptresource.h"
31
32namespace KPlato
33{
34
35ResourcesDialog::ResourcesDialog(Project &p, TQWidget *parent, const char *name)
36 : KDialogBase( Swallow, i18n("Resources"), Ok|Cancel, Ok, parent, name, true, true),
37 project(p)
38{
39 panel = new ResourcesPanel(this, &project);
40
41 setMainWidget(panel);
42 enableButtonOK(false);
43
44 connect(panel, TQ_SIGNAL(changed()), TQ_SLOT(slotChanged()));
45}
46
47
48void ResourcesDialog::slotChanged() {
49 enableButtonOK(true);
50}
51
52void ResourcesDialog::slotOk() {
53 if (!panel->ok())
54 return;
55 accept();
56}
57
58KCommand *ResourcesDialog::buildCommand(Part *part) {
59 KMacroCommand *m = 0;
60 TQString c = i18n("Modify resources");
61 KCommand *cmd = panel->buildCommand(part);
62 if (cmd) {
63 if (!m) m = new KMacroCommand(c);
64 m->addCommand(cmd);
65 }
66 return m;
67}
68
69} //KPlato namespace
70
71#include "kptresourcesdialog.moc"
Project is the main node in a project, it contains child nodes and possibly sub-projects.
Definition kptproject.h:52