karm

printdialog.cpp
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
23#include <tqbuttongroup.h>
24#include <tqcheckbox.h>
25#include <tqhbox.h>
26#include <tqlabel.h>
27#include <tqlayout.h>
28#include <tqlineedit.h>
29#include <tqpixmap.h>
30#include <tqpushbutton.h>
31#include <tqstring.h>
32#include <tqwidget.h>
33#include <tqwhatsthis.h>
34
35#include <kiconloader.h>
36#include <tdelocale.h> // i18n
37#include <twinmodule.h>
38
39#include "printdialog.h"
40#include <libtdepim/kdateedit.h>
41
42
43PrintDialog::PrintDialog()
44 : KDialogBase(0, "PrintDialog", true, i18n("Print Dialog"), Ok|Cancel,
45 Ok, true )
46{
47 TQWidget *page = new TQWidget( this );
48 setMainWidget(page);
49 int year, month;
50
51 TQVBoxLayout *layout = new TQVBoxLayout(page, KDialog::spacingHint());
52 layout->addSpacing(10);
53 layout->addStretch(1);
54
55 // Date Range
56 TQGroupBox *rangeGroup = new TQGroupBox(1, TQt::Horizontal, i18n("Date Range"),
57 page);
58 layout->addWidget(rangeGroup);
59
60 TQWidget *rangeWidget = new TQWidget(rangeGroup);
61 TQHBoxLayout *rangeLayout = new TQHBoxLayout(rangeWidget, 0, spacingHint());
62
63 rangeLayout->addWidget(new TQLabel(i18n("From:"), rangeWidget));
64 _from = new KDateEdit(rangeWidget);
65
66 // Default from date to beginning of the month
67 year = TQDate::currentDate().year();
68 month = TQDate::currentDate().month();
69 _from->setDate(TQDate(year, month, 1));
70 rangeLayout->addWidget(_from);
71 rangeLayout->addWidget(new TQLabel(i18n("To:"), rangeWidget));
72 _to = new KDateEdit(rangeWidget);
73 rangeLayout->addWidget(_to);
74
75 layout->addSpacing(10);
76 layout->addStretch(1);
77
78 _allTasks = new TQComboBox( page );
79 _allTasks->insertItem( i18n( "Selected Task" ) );
80 _allTasks->insertItem( i18n( "All Tasks" ) );
81 layout->addWidget( _allTasks );
82
83 _perWeek = new TQCheckBox( i18n( "Summarize per week" ), page );
84 layout->addWidget( _perWeek );
85 _totalsOnly = new TQCheckBox( i18n( "Totals only" ), page );
86 layout->addWidget( _totalsOnly );
87
88 layout->addSpacing(10);
89 layout->addStretch(1);
90}
91
92TQDate PrintDialog::from() const
93{
94 return _from->date();
95}
96
97TQDate PrintDialog::to() const
98{
99 return _to->date();
100}
101
102bool PrintDialog::perWeek() const
103{
104 return _perWeek->isChecked();
105}
106
107bool PrintDialog::allTasks() const
108{
109 return _allTasks->currentItem() == 1;
110}
111
112bool PrintDialog::totalsOnly() const
113{
114 return _totalsOnly->isChecked();
115}
116
117#include "printdialog.moc"