TDE personal information management applications
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.

118 lines
3.1KB

  1. /*
  2. * This file only:
  3. * Copyright (C) 2003 Mark Bucciarelli <mark@hubcapconsutling.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program; if not, write to the
  17. * Free Software Foundation, Inc.
  18. * 51 Franklin Street, Fifth Floor
  19. * Boston, MA 02110-1301 USA.
  20. *
  21. */
  22. #include <tqbuttongroup.h>
  23. #include <tqcheckbox.h>
  24. #include <tqhbox.h>
  25. #include <tqlabel.h>
  26. #include <tqlayout.h>
  27. #include <tqlineedit.h>
  28. #include <tqpixmap.h>
  29. #include <tqpushbutton.h>
  30. #include <tqstring.h>
  31. #include <tqwidget.h>
  32. #include <tqwhatsthis.h>
  33. #include <kiconloader.h>
  34. #include <klocale.h> // i18n
  35. #include <kwinmodule.h>
  36. #include "printdialog.h"
  37. #include <libtdepim/kdateedit.h>
  38. PrintDialog::PrintDialog()
  39. : KDialogBase(0, "PrintDialog", true, i18n("Print Dialog"), Ok|Cancel,
  40. Ok, true )
  41. {
  42. TQWidget *page = new TQWidget( this );
  43. setMainWidget(page);
  44. int year, month;
  45. TQVBoxLayout *tqlayout = new TQVBoxLayout(page, KDialog::spacingHint());
  46. tqlayout->addSpacing(10);
  47. tqlayout->addStretch(1);
  48. // Date Range
  49. TQGroupBox *rangeGroup = new TQGroupBox(1, Qt::Horizontal, i18n("Date Range"),
  50. page);
  51. tqlayout->addWidget(rangeGroup);
  52. TQWidget *rangeWidget = new TQWidget(rangeGroup);
  53. TQHBoxLayout *rangeLayout = new TQHBoxLayout(rangeWidget, 0, spacingHint());
  54. rangeLayout->addWidget(new TQLabel(i18n("From:"), rangeWidget));
  55. _from = new KDateEdit(rangeWidget);
  56. // Default from date to beginning of the month
  57. year = TQDate::tqcurrentDate().year();
  58. month = TQDate::tqcurrentDate().month();
  59. _from->setDate(TQDate(year, month, 1));
  60. rangeLayout->addWidget(_from);
  61. rangeLayout->addWidget(new TQLabel(i18n("To:"), rangeWidget));
  62. _to = new KDateEdit(rangeWidget);
  63. rangeLayout->addWidget(_to);
  64. tqlayout->addSpacing(10);
  65. tqlayout->addStretch(1);
  66. _allTasks = new TQComboBox( page );
  67. _allTasks->insertItem( i18n( "Selected Task" ) );
  68. _allTasks->insertItem( i18n( "All Tasks" ) );
  69. tqlayout->addWidget( _allTasks );
  70. _perWeek = new TQCheckBox( i18n( "Summarize per week" ), page );
  71. tqlayout->addWidget( _perWeek );
  72. _totalsOnly = new TQCheckBox( i18n( "Totals only" ), page );
  73. tqlayout->addWidget( _totalsOnly );
  74. tqlayout->addSpacing(10);
  75. tqlayout->addStretch(1);
  76. }
  77. TQDate PrintDialog::from() const
  78. {
  79. return _from->date();
  80. }
  81. TQDate PrintDialog::to() const
  82. {
  83. return _to->date();
  84. }
  85. bool PrintDialog::perWeek() const
  86. {
  87. return _perWeek->isChecked();
  88. }
  89. bool PrintDialog::allTasks() const
  90. {
  91. return _allTasks->currentItem() == 1;
  92. }
  93. bool PrintDialog::totalsOnly() const
  94. {
  95. return _totalsOnly->isChecked();
  96. }
  97. #include "printdialog.moc"