F:/KPlato/koffice/kplato/kptconfigdialog.cc

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Dag Andersen <danders@get2net.dk>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation;
00007    version 2 of the License.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include "kptconfigdialog.h"
00021 
00022 #include "kpttaskdefaultpanel.h"
00023 //#include "kptconfigbehaviorpanel.h"
00024 
00025 #include "kptconfig.h"
00026 #include "kptproject.h"
00027 #include "kpttask.h"
00028 #include "kptcalendar.h"
00029 
00030 #include <kiconloader.h>
00031 #include <klocale.h>
00032 #include <kcommand.h>
00033 #include <kinstance.h>
00034 
00035 //Added by qt3to4:
00036 #include <QPixmap>
00037 
00038 #include <kdebug.h>
00039 #include <kvbox.h>
00040 
00041 namespace KPlato
00042 {
00043 
00044 // little helper stolen from kmail/kword
00045 static inline QPixmap loadIcon( const char * name ) {
00046   return KGlobal::instance()->iconLoader()
00047     ->loadIcon( QString::fromLatin1(name), K3Icon::NoGroup, K3Icon::SizeMedium );
00048 }
00049 
00050 
00051 ConfigDialog::ConfigDialog(Config &config, Project &project, QWidget *parent, const char *)
00052     : KPageDialog(parent),
00053       m_config(config)
00054 {
00055     setCaption( i18n("Configure KPlato") );
00056     setButtons( KDialog::Ok | KDialog::Apply | KDialog::Cancel| KDialog::Default );
00057     setDefaultButton( Ok );
00058     setFaceType( KPageDialog::List );
00059 
00060 /*    QVBox *page = addVBoxPage(i18n("Behavior"), i18n("Behavior"), loadIcon("misc"));
00061     m_behaviorPage = new ConfigBehaviorPanel(config.behavior(), page);*/
00062 
00063     KVBox *page = new KVBox();
00064     addPage( page, i18n("Task Defaults") );
00065     //addVBoxPage(i18n("Task Defaults"), i18n("Task Defaults"), loadIcon("misc"));
00066     m_taskDefaultPage = new TaskDefaultPanel(config.taskDefaults(), project.standardWorktime(), page);
00067 
00068     enableButtonOk(false);
00069     enableButtonApply(false);
00070 
00071 //    connect(m_behaviorPage, SIGNAL(changed()), SLOT(slotChanged()));
00072     connect(m_taskDefaultPage, SIGNAL(changed()), SLOT(slotChanged()));
00073 }
00074 
00075 
00076 void ConfigDialog::slotApply() {
00077     if (!m_taskDefaultPage->ok())
00078         return;
00079 /*    if (!m_behaviorPage->ok())
00080         return;*/
00081     KCommand *cmd = m_taskDefaultPage->buildCommand(0);
00082     if (cmd)
00083         cmd->execute();
00084 
00085 //    m_behaviorPage->apply();
00086 }
00087 
00088 void ConfigDialog::slotOk() {
00089     slotApply();
00090     accept();
00091 }
00092 
00093 void ConfigDialog::slotDefault() {
00094     kDebug()<<k_funcinfo<<endl;
00095     m_taskDefaultPage->setStartValues(m_config.taskDefaults());
00096 //    m_behaviorPage->setStartValues();
00097 
00098     enableButtonOk(false);
00099     enableButtonApply(false);
00100 }
00101 
00102 void ConfigDialog::slotChanged() {
00103     enableButtonOk(true);
00104     enableButtonApply(true);
00105 }
00106 
00107 }  //KPlato namespace
00108 
00109 #include "kptconfigdialog.moc"

Généré le Wed Nov 22 23:40:56 2006 pour KPlato par  doxygen 1.5.1-p1