karm

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 <qbuttongroup.h>
00024 #include <qcheckbox.h>
00025 #include <qhbox.h>
00026 #include <qlabel.h>
00027 #include <qlayout.h>
00028 #include <qlineedit.h>
00029 #include <qpixmap.h>
00030 #include <qpushbutton.h>
00031 #include <qstring.h>
00032 #include <qwidget.h>
00033 #include <qwhatsthis.h>
00034 
00035 #include <kiconloader.h>
00036 #include <klocale.h>            // i18n
00037 #include <kwinmodule.h>
00038 
00039 #include "printdialog.h"
00040 #include <libkdepim/kdateedit.h>
00041 
00042 
00043 PrintDialog::PrintDialog()
00044   : KDialogBase(0, "PrintDialog", true, i18n("Print Dialog"), Ok|Cancel,
00045       Ok, true )
00046 {
00047   QWidget *page = new QWidget( this );
00048   setMainWidget(page);
00049   int year, month;
00050 
00051   QVBoxLayout *layout = new QVBoxLayout(page, KDialog::spacingHint());
00052   layout->addSpacing(10);
00053   layout->addStretch(1);
00054 
00055   // Date Range
00056   QGroupBox *rangeGroup = new QGroupBox(1, Horizontal, i18n("Date Range"),
00057       page);
00058   layout->addWidget(rangeGroup);
00059 
00060   QWidget *rangeWidget = new QWidget(rangeGroup);
00061   QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget, 0, spacingHint());
00062 
00063   rangeLayout->addWidget(new QLabel(i18n("From:"), rangeWidget));
00064   _from = new KDateEdit(rangeWidget);
00065 
00066   // Default from date to beginning of the month
00067   year = QDate::currentDate().year();
00068   month = QDate::currentDate().month();
00069   _from->setDate(QDate(year, month, 1));
00070   rangeLayout->addWidget(_from);
00071   rangeLayout->addWidget(new QLabel(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 QComboBox( page );
00079   _allTasks->insertItem( i18n( "Selected Task" ) );
00080   _allTasks->insertItem( i18n( "All Tasks" ) );
00081   layout->addWidget( _allTasks );
00082 
00083   _perWeek = new QCheckBox( i18n( "Summarize per week" ), page );
00084   layout->addWidget( _perWeek );
00085   _totalsOnly = new QCheckBox( i18n( "Totals only" ), page );
00086   layout->addWidget( _totalsOnly );
00087 
00088   layout->addSpacing(10);
00089   layout->addStretch(1);
00090 }
00091 
00092 QDate PrintDialog::from() const
00093 {
00094   return _from->date();
00095 }
00096 
00097 QDate 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"
KDE Home | KDE Accessibility Home | Description of Access Keys