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