summaryrefslogtreecommitdiffabout
path: root/korganizer/calprintplugins.cpp
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/calprintplugins.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'korganizer/calprintplugins.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calprintplugins.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/korganizer/calprintplugins.cpp b/korganizer/calprintplugins.cpp
index bc35ca4..9b6dc6e 100644
--- a/korganizer/calprintplugins.cpp
+++ b/korganizer/calprintplugins.cpp
@@ -1,160 +1,160 @@
/*
This file is part of KOrganizer.
Copyright (c) 1998 Preston Brown
Copyright (c) 2003 Reinhold Kainhofer <reinhold@kainhofer.com>
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qpainter.h>
-#include <qdatetimeedit.h>
+#include <q3datetimeedit.h>
#include <qdatetime.h>
#include <qcheckbox.h>
#include <qlineedit.h>
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
#include <kprinter.h>
#include <kconfig.h>
#include <kcalendarsystem.h>
#include <libkcal/todo.h>
#include <libkcal/calendar.h>
#include <libkdepim/kdateedit.h>
#include "koprefs.h"
#include "koglobals.h"
#include "calprintplugins.h"
#ifndef KORG_NOPRINTER
//#include "calprintplugins.moc"
#define LEFT_DISTANCE 45
/**************************************************************
* Print Day
**************************************************************/
CalPrintDay::CalPrintDay( KPrinter *printer, Calendar *cal, KConfig *cfg )
: CalPrintBase( printer, cal, cfg )
{
}
CalPrintDay::~CalPrintDay()
{
}
QWidget *CalPrintDay::configWidget( QWidget *w )
{
mConfigWidget = new CalPrintDayConfig_Base( w );
setSettingsWidget();
return mConfigWidget;
}
void CalPrintDay::readSettingsWidget()
{
CalPrintDayConfig_Base *cfg = mConfigWidget;
if ( cfg ) {
mFromDate = cfg->mFromDate->date();
mToDate = cfg->mToDate->date();
mStartTime = cfg->mFromTime->time();
mEndTime = cfg->mToTime->time();
mIncludeAllEvents = cfg->mIncludeAllEvents->isChecked();
mIncludeTodos = cfg->mIncludeTodos->isChecked();
mUseColors = cfg->mColors->isChecked();
}
}
void CalPrintDay::setSettingsWidget()
{
CalPrintDayConfig_Base *cfg =( mConfigWidget );
if ( cfg ) {
cfg->mFromDate->setDate( mFromDate );
cfg->mToDate->setDate( mToDate );
cfg->mFromTime->setTime( mStartTime );
cfg->mToTime->setTime( mEndTime );
cfg->mIncludeAllEvents->setChecked( mIncludeAllEvents );
cfg->mIncludeTodos->setChecked( mIncludeTodos );
cfg->mColors->setChecked( mUseColors );
}
}
void CalPrintDay::loadConfig()
{
if ( mConfig ) {
QDate dt;
QTime tm1 = QTime( KOPrefs::instance()->mDayBegins, 0,0 );
QDateTime startTm( dt, tm1 );
QDateTime endTm( dt, tm1.addSecs( 12 * 60 * 60 ) );
mStartTime = mConfig->readDateTimeEntry( "Start time", &startTm ).time();
mEndTime = mConfig->readDateTimeEntry( "End time", &endTm ).time();
mIncludeTodos = mConfig->readBoolEntry( "Include todos", false );
mIncludeAllEvents = mConfig->readBoolEntry( "Include all events", false );
}
setSettingsWidget();
}
void CalPrintDay::saveConfig()
{
readSettingsWidget();
if ( mConfig ) {
mConfig->writeEntry( "Start time", QDateTime( QDate(), mStartTime ) );
mConfig->writeEntry( "End time", QDateTime( QDate(), mEndTime ) );
mConfig->writeEntry( "Include todos", mIncludeTodos );
mConfig->writeEntry( "Include all events", mIncludeAllEvents );
}
}
void CalPrintDay::setDateRange( const QDate& from, const QDate& to )
{
CalPrintBase::setDateRange( from, to );
CalPrintDayConfig_Base *cfg = mConfigWidget ;
if ( cfg ) {
cfg->mFromDate->setDate( from );
cfg->mToDate->setDate( to );
}
}
void CalPrintDay::print( QPainter &p, int width, int height )
{
QDate curDay( mFromDate );
int yoffset = 0, xoffset = 0;
if ( width > height ) {
yoffset += LEFT_DISTANCE;
} else {
xoffset += LEFT_DISTANCE;
}
width -= xoffset;
height -= yoffset;
do {
int x = 0;
int y = 0;
int currHeight=( height - y ) / 20;
QTime curStartTime( mStartTime );