File r893477.diff of Package kdepim4
Subject: korganizer: fix printing
From: wstephenson@suse.de
Bug:
Patch-upstream: 893477
--- korganizer/printing/calprintdefaultplugins.cpp (revision 893476)
+++ korganizer/printing/calprintdefaultplugins.cpp (revision 893477)
@@ -560,7 +560,7 @@ void CalPrintDay::loadConfig()
{
if ( mConfig ) {
KConfigGroup grp( mConfig, "General" );
- QDate dt;
+ QDate dt = QDate::currentDate(); // any valid QDate will do
QTime tm1( dayStart() );
QDateTime startTm( dt, tm1 );
QDateTime endTm( dt, tm1.addSecs( 12 * 60 * 60 ) );
@@ -577,8 +577,11 @@ void CalPrintDay::saveConfig()
readSettingsWidget();
if ( mConfig ) {
KConfigGroup grp( mConfig, "General" );
- grp.writeEntry( "Start time", QDateTime( QDate(), mStartTime ) );
- grp.writeEntry( "End time", QDateTime( QDate(), mEndTime ) );
+ QDateTime dt = QDateTime::currentDateTime(); // any valid QDateTime will do
+ dt.setTime( mStartTime );
+ grp.writeEntry( "Start time", dt );
+ dt.setTime( mEndTime );
+ grp.writeEntry( "End time", dt );
grp.writeEntry( "Include todos", mIncludeTodos );
grp.writeEntry( "Include all events", mIncludeAllEvents );
}
@@ -706,7 +709,7 @@ void CalPrintWeek::loadConfig()
{
if ( mConfig ) {
KConfigGroup grp( mConfig, "General" );
- QDate dt;
+ QDate dt = QDate::currentDate(); // any valid QDate will do
QTime tm1( dayStart() );
QDateTime startTm( dt, tm1 );
QDateTime endTm( dt, tm1.addSecs( 43200 ) );
@@ -722,9 +725,13 @@ void CalPrintWeek::saveConfig()
{
readSettingsWidget();
if ( mConfig ) {
+
KConfigGroup grp( mConfig, "General" );
- grp.writeEntry( "Start time", QDateTime( QDate(), mStartTime ) );
- grp.writeEntry( "End time", QDateTime( QDate(), mEndTime ) );
+ QDateTime dt = QDateTime::currentDateTime(); // any valid QDateTime will do
+ dt.setTime( mStartTime );
+ grp.writeEntry( "Start time", dt );
+ dt.setTime( mEndTime );
+ grp.writeEntry( "End time", dt );
grp.writeEntry( "Include todos", mIncludeTodos );
grp.writeEntry( "Print type", int( mWeekPrintType ) );
}
--- korganizer/printing/calprintpluginbase.cpp (revision 893476)
+++ korganizer/printing/calprintpluginbase.cpp (revision 893477)
@@ -165,9 +165,9 @@ void CalPrintPluginBase::doLoadConfig()
if ( mConfig ) {
KConfigGroup group( mConfig, description() );
mConfig->sync();
- QDateTime currDate( QDate::currentDate() );
- mFromDate = group.readEntry( "FromDate", currDate ).date();
- mToDate = group.readEntry( "ToDate", QDateTime() ).date();
+ QDateTime dt = QDateTime::currentDateTime();
+ mFromDate = group.readEntry( "FromDate", dt ).date();
+ mToDate = group.readEntry( "ToDate", dt ).date();
mUseColors = group.readEntry( "UseColors", true );
setUseColors( mUseColors );
loadConfig();
@@ -181,8 +181,11 @@ void CalPrintPluginBase::doSaveConfig()
if ( mConfig ) {
KConfigGroup group( mConfig, description() );
saveConfig();
- group.writeEntry( "FromDate", QDateTime( mFromDate ) );
- group.writeEntry( "ToDate", QDateTime( mToDate ) );
+ QDateTime dt = QDateTime::currentDateTime(); // any valid QDateTime will do
+ dt.setDate( mFromDate );
+ group.writeEntry( "FromDate", dt );
+ dt.setDate( mToDate );
+ group.writeEntry( "ToDate", dt );
group.writeEntry( "UseColors", mUseColors );
mConfig->sync();
} else {
@@ -1640,7 +1643,7 @@ void CalPrintPluginBase::drawJournal( Jo
void CalPrintPluginBase::drawSplitHeaderRight( QPainter &p, const QDate &fd,
const QDate &td, const QDate &,
- int width, int height)
+ int width, int height )
{
QFont oldFont( p.font() );
@@ -1663,10 +1666,11 @@ void CalPrintPluginBase::drawSplitHeader
}
}
- if ( height < 60 )
+ if ( height < 60 ) {
p.setFont( QFont( "Times", 22 ) );
- else
+ } else {
p.setFont( QFont( "Times", 28 ) );
+ }
int lineSpacing = p.fontMetrics().lineSpacing();
p.drawText( 0, 0, width, lineSpacing,
@@ -1678,10 +1682,11 @@ void CalPrintPluginBase::drawSplitHeader
p.drawLine( 300, lineSpacing, width, lineSpacing );
p.setPen( oldPen );
- if ( height < 60 )
+ if ( height < 60 ) {
p.setFont( QFont( "Times", 14, QFont::Bold, true ) );
- else
+ } else {
p.setFont( QFont( "Times", 18, QFont::Bold, true ) );
+ }
title += QString::number( fd.year() );
p.drawText( 0, lineSpacing, width, lineSpacing,
Index: korganizer/printing/calprintdefaultplugins.cpp
===================================================================
Index: korganizer/printing/calprintpluginbase.cpp
===================================================================