kplato

kptconfigdialog.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2004 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 "kptconfigdialog.h"
21
22#include "kpttaskdefaultpanel.h"
23//#include "kptconfigbehaviorpanel.h"
24
25#include "kptconfig.h"
26#include "kptproject.h"
27#include "kpttask.h"
28#include "kptcalendar.h"
29
30#include <kiconloader.h>
31#include <tdelocale.h>
32#include <kcommand.h>
33
34#include <tqvbox.h>
35
36#include <kdebug.h>
37
38namespace KPlato
39{
40
41// little helper stolen from kmail/kword
42static inline TQPixmap loadIcon( const char * name ) {
43 return TDEGlobal::instance()->iconLoader()
44 ->loadIcon( TQString::fromLatin1(name), TDEIcon::NoGroup, TDEIcon::SizeMedium );
45}
46
47
48ConfigDialog::ConfigDialog(Config &config, Project &project, TQWidget *parent, const char *)
49 : KDialogBase(KDialogBase::IconList, i18n("Configure KPlato"),
50 KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel| KDialogBase::Default,
51 KDialogBase::Ok, parent),
52 m_config(config)
53{
54
55/* TQVBox *page = addVBoxPage(i18n("Behavior"), i18n("Behavior"), loadIcon("misc"));
56 m_behaviorPage = new ConfigBehaviorPanel(config.behavior(), page);*/
57
58 TQVBox *page = addVBoxPage(i18n("Task Defaults"), i18n("Task Defaults"), loadIcon("misc"));
59 m_taskDefaultPage = new TaskDefaultPanel(config.taskDefaults(), project.standardWorktime(), page);
60
61 enableButtonOK(false);
62 enableButtonApply(false);
63
64// connect(m_behaviorPage, TQ_SIGNAL(changed()), TQ_SLOT(slotChanged()));
65 connect(m_taskDefaultPage, TQ_SIGNAL(changed()), TQ_SLOT(slotChanged()));
66}
67
68
69void ConfigDialog::slotApply() {
70 if (!m_taskDefaultPage->ok())
71 return;
72/* if (!m_behaviorPage->ok())
73 return;*/
74 KCommand *cmd = m_taskDefaultPage->buildCommand(0);
75 if (cmd)
76 cmd->execute();
77
78// m_behaviorPage->apply();
79}
80
81void ConfigDialog::slotOk() {
82 slotApply();
83 accept();
84}
85
86void ConfigDialog::slotDefault() {
87 kdDebug()<<k_funcinfo<<endl;
88 m_taskDefaultPage->setStartValues(m_config.taskDefaults());
89// m_behaviorPage->setStartValues();
90
91 enableButtonOK(false);
92 enableButtonApply(false);
93}
94
95void ConfigDialog::slotChanged() {
96 enableButtonOK(true);
97 enableButtonApply(true);
98}
99
100} //KPlato namespace
101
102#include "kptconfigdialog.moc"
Project is the main node in a project, it contains child nodes and possibly sub-projects.
Definition kptproject.h:52