KOffice – TDE office suite
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.

kptconfigdialog.cc 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* This file is part of the KDE project
  2. Copyright (C) 2004 Dag Andersen <danders@get2net.dk>
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public
  5. License as published by the Free Software Foundation;
  6. version 2 of the License.
  7. This library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public License
  12. along with this library; see the file COPYING.LIB. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  14. * Boston, MA 02110-1301, USA.
  15. */
  16. #include "kptconfigdialog.h"
  17. #include "kpttaskdefaultpanel.h"
  18. //#include "kptconfigbehaviorpanel.h"
  19. #include "kptconfig.h"
  20. #include "kptproject.h"
  21. #include "kpttask.h"
  22. #include "kptcalendar.h"
  23. #include <kiconloader.h>
  24. #include <tdelocale.h>
  25. #include <kcommand.h>
  26. #include <tqvbox.h>
  27. #include <kdebug.h>
  28. namespace KPlato
  29. {
  30. // little helper stolen from kmail/kword
  31. static inline TQPixmap loadIcon( const char * name ) {
  32. return TDEGlobal::instance()->iconLoader()
  33. ->loadIcon( TQString::fromLatin1(name), TDEIcon::NoGroup, TDEIcon::SizeMedium );
  34. }
  35. ConfigDialog::ConfigDialog(Config &config, Project &project, TQWidget *parent, const char *)
  36. : KDialogBase(KDialogBase::IconList, i18n("Configure KPlato"),
  37. KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel| KDialogBase::Default,
  38. KDialogBase::Ok, parent),
  39. m_config(config)
  40. {
  41. /* TQVBox *page = addVBoxPage(i18n("Behavior"), i18n("Behavior"), loadIcon(""application-vnd.tde.misc"));
  42. m_behaviorPage = new ConfigBehaviorPanel(config.behavior(), page);*/
  43. TQVBox *page = addVBoxPage(i18n("Task Defaults"), i18n("Task Defaults"), loadIcon(""application-vnd.tde.misc"));
  44. m_taskDefaultPage = new TaskDefaultPanel(config.taskDefaults(), project.standardWorktime(), page);
  45. enableButtonOK(false);
  46. enableButtonApply(false);
  47. // connect(m_behaviorPage, TQT_SIGNAL(changed()), TQT_SLOT(slotChanged()));
  48. connect(m_taskDefaultPage, TQT_SIGNAL(changed()), TQT_SLOT(slotChanged()));
  49. }
  50. void ConfigDialog::slotApply() {
  51. if (!m_taskDefaultPage->ok())
  52. return;
  53. /* if (!m_behaviorPage->ok())
  54. return;*/
  55. KCommand *cmd = m_taskDefaultPage->buildCommand(0);
  56. if (cmd)
  57. cmd->execute();
  58. // m_behaviorPage->apply();
  59. }
  60. void ConfigDialog::slotOk() {
  61. slotApply();
  62. accept();
  63. }
  64. void ConfigDialog::slotDefault() {
  65. kdDebug()<<k_funcinfo<<endl;
  66. m_taskDefaultPage->setStartValues(m_config.taskDefaults());
  67. // m_behaviorPage->setStartValues();
  68. enableButtonOK(false);
  69. enableButtonApply(false);
  70. }
  71. void ConfigDialog::slotChanged() {
  72. enableButtonOK(true);
  73. enableButtonApply(true);
  74. }
  75. } //KPlato namespace
  76. #include "kptconfigdialog.moc"