You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
2.9 KiB
103 lines
2.9 KiB
15 years ago
|
/* This file is part of the KDE project
|
||
|
Copyright (C) 2004 Dag Andersen <danders@get2net.dk>
|
||
|
|
||
|
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>
|
||
12 years ago
|
#include <tdelocale.h>
|
||
15 years ago
|
#include <kcommand.h>
|
||
|
|
||
14 years ago
|
#include <tqvbox.h>
|
||
15 years ago
|
|
||
|
#include <kdebug.h>
|
||
|
|
||
|
namespace KPlato
|
||
|
{
|
||
|
|
||
|
// little helper stolen from kmail/kword
|
||
14 years ago
|
static inline TQPixmap loadIcon( const char * name ) {
|
||
12 years ago
|
return TDEGlobal::instance()->iconLoader()
|
||
12 years ago
|
->loadIcon( TQString::fromLatin1(name), TDEIcon::NoGroup, TDEIcon::SizeMedium );
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
13 years ago
|
ConfigDialog::ConfigDialog(Config &config, Project &project, TQWidget *parent, const char *)
|
||
15 years ago
|
: KDialogBase(KDialogBase::IconList, i18n("Configure KPlato"),
|
||
|
KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel| KDialogBase::Default,
|
||
13 years ago
|
KDialogBase::Ok, parent),
|
||
15 years ago
|
m_config(config)
|
||
|
{
|
||
|
|
||
10 years ago
|
/* TQVBox *page = addVBoxPage(i18n("Behavior"), i18n("Behavior"), loadIcon("misc"));
|
||
15 years ago
|
m_behaviorPage = new ConfigBehaviorPanel(config.behavior(), page);*/
|
||
|
|
||
10 years ago
|
TQVBox *page = addVBoxPage(i18n("Task Defaults"), i18n("Task Defaults"), loadIcon("misc"));
|
||
15 years ago
|
m_taskDefaultPage = new TaskDefaultPanel(config.taskDefaults(), project.standardWorktime(), page);
|
||
|
|
||
|
enableButtonOK(false);
|
||
|
enableButtonApply(false);
|
||
|
|
||
14 years ago
|
// connect(m_behaviorPage, TQT_SIGNAL(changed()), TQT_SLOT(slotChanged()));
|
||
|
connect(m_taskDefaultPage, TQT_SIGNAL(changed()), TQT_SLOT(slotChanged()));
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
|
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"
|