printdialog.cpp
00001 /* 00002 * This file only: 00003 * Copyright (C) 2003 Mark Bucciarelli <mark@hubcapconsutling.com> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, write to the 00017 * Free Software Foundation, Inc. 00018 * 51 Franklin Street, Fifth Floor 00019 * Boston, MA 02110-1301 USA. 00020 * 00021 */ 00022 00023 #include <tqbuttongroup.h> 00024 #include <tqcheckbox.h> 00025 #include <tqhbox.h> 00026 #include <tqlabel.h> 00027 #include <tqlayout.h> 00028 #include <tqlineedit.h> 00029 #include <tqpixmap.h> 00030 #include <tqpushbutton.h> 00031 #include <tqstring.h> 00032 #include <tqwidget.h> 00033 #include <tqwhatsthis.h> 00034 00035 #include <kiconloader.h> 00036 #include <tdelocale.h> // i18n 00037 #include <twinmodule.h> 00038 00039 #include "printdialog.h" 00040 #include <libtdepim/kdateedit.h> 00041 00042 00043 PrintDialog::PrintDialog() 00044 : KDialogBase(0, "PrintDialog", true, i18n("Print Dialog"), Ok|Cancel, 00045 Ok, true ) 00046 { 00047 TQWidget *page = new TQWidget( this ); 00048 setMainWidget(page); 00049 int year, month; 00050 00051 TQVBoxLayout *layout = new TQVBoxLayout(page, KDialog::spacingHint()); 00052 layout->addSpacing(10); 00053 layout->addStretch(1); 00054 00055 // Date Range 00056 TQGroupBox *rangeGroup = new TQGroupBox(1, Qt::Horizontal, i18n("Date Range"), 00057 page); 00058 layout->addWidget(rangeGroup); 00059 00060 TQWidget *rangeWidget = new TQWidget(rangeGroup); 00061 TQHBoxLayout *rangeLayout = new TQHBoxLayout(rangeWidget, 0, spacingHint()); 00062 00063 rangeLayout->addWidget(new TQLabel(i18n("From:"), rangeWidget)); 00064 _from = new KDateEdit(rangeWidget); 00065 00066 // Default from date to beginning of the month 00067 year = TQDate::currentDate().year(); 00068 month = TQDate::currentDate().month(); 00069 _from->setDate(TQDate(year, month, 1)); 00070 rangeLayout->addWidget(_from); 00071 rangeLayout->addWidget(new TQLabel(i18n("To:"), rangeWidget)); 00072 _to = new KDateEdit(rangeWidget); 00073 rangeLayout->addWidget(_to); 00074 00075 layout->addSpacing(10); 00076 layout->addStretch(1); 00077 00078 _allTasks = new TQComboBox( page ); 00079 _allTasks->insertItem( i18n( "Selected Task" ) ); 00080 _allTasks->insertItem( i18n( "All Tasks" ) ); 00081 layout->addWidget( _allTasks ); 00082 00083 _perWeek = new TQCheckBox( i18n( "Summarize per week" ), page ); 00084 layout->addWidget( _perWeek ); 00085 _totalsOnly = new TQCheckBox( i18n( "Totals only" ), page ); 00086 layout->addWidget( _totalsOnly ); 00087 00088 layout->addSpacing(10); 00089 layout->addStretch(1); 00090 } 00091 00092 TQDate PrintDialog::from() const 00093 { 00094 return _from->date(); 00095 } 00096 00097 TQDate PrintDialog::to() const 00098 { 00099 return _to->date(); 00100 } 00101 00102 bool PrintDialog::perWeek() const 00103 { 00104 return _perWeek->isChecked(); 00105 } 00106 00107 bool PrintDialog::allTasks() const 00108 { 00109 return _allTasks->currentItem() == 1; 00110 } 00111 00112 bool PrintDialog::totalsOnly() const 00113 { 00114 return _totalsOnly->isChecked(); 00115 } 00116 00117 #include "printdialog.moc"