-rw-r--r-- | korganizer/calprintbase.cpp | 20 | ||||
-rw-r--r-- | korganizer/koagenda.cpp | 2 | ||||
-rw-r--r-- | libkdepim/kpimglobalprefs.cpp | 2 |
3 files changed, 9 insertions, 15 deletions
diff --git a/korganizer/calprintbase.cpp b/korganizer/calprintbase.cpp index f66fddc..7b7d54c 100644 --- a/korganizer/calprintbase.cpp +++ b/korganizer/calprintbase.cpp | |||
@@ -643,58 +643,52 @@ void CalPrintBase::drawAgendaItem( PrintCellItem *item, QPainter &p, | |||
643 | 643 | ||
644 | void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, | 644 | void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, |
645 | int x, int y, int width, int height, | 645 | int x, int y, int width, int height, |
646 | bool fullDate) | 646 | bool fullDate) |
647 | { | 647 | { |
648 | QString dayNumStr; | 648 | QString dayNumStr; |
649 | QString ampm; | 649 | QString ampm; |
650 | const KLocale*local = KGlobal::locale(); | 650 | const KLocale*local = KGlobal::locale(); |
651 | 651 | ||
652 | 652 | ||
653 | // This has to be localized | 653 | // This has to be localized |
654 | if (fullDate) { | 654 | if (fullDate) { |
655 | /*int index; | 655 | dayNumStr = local->formatDate(qd); |
656 | dayNumStr= qd.toString(); | ||
657 | index = dayNumStr.find(' '); | ||
658 | dayNumStr.remove(0, index); | ||
659 | index = dayNumStr.findRev(' '); | ||
660 | dayNumStr.truncate(index);*/ | ||
661 | |||
662 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); | ||
663 | dayNumStr = i18n("weekday month date", "%1 %2 %3") | ||
664 | .arg( calSys->weekDayName( qd ) ) | ||
665 | .arg( calSys->monthName( qd ) ) | ||
666 | .arg( qd.day() ); | ||
667 | // dayNumStr = local->formatDate(qd); | ||
668 | } else { | 656 | } else { |
669 | dayNumStr = QString::number( qd.day() ); | 657 | dayNumStr = QString::number( qd.day() ); |
670 | } | 658 | } |
671 | 659 | ||
672 | p.eraseRect( x, y, width, height ); | 660 | p.eraseRect( x, y, width, height ); |
673 | p.drawRect( x, y, width, height ); | 661 | p.drawRect( x, y, width, height ); |
674 | // p.fillRect( x+1, y+1, width-2,height, QBrush(Dense7Pattern) ); | 662 | // p.fillRect( x+1, y+1, width-2,height, QBrush(Dense7Pattern) ); |
675 | p.drawRect( x, y, width, mSubHeaderHeight ); | 663 | p.drawRect( x, y, width, mSubHeaderHeight ); |
676 | //p.fillRect( x+1, y+1, width-2, mSubHeaderHeight-2, QBrush(Dense7Pattern) ); | 664 | //p.fillRect( x+1, y+1, width-2, mSubHeaderHeight-2, QBrush(Dense7Pattern) ); |
677 | QString hstring; | 665 | QString hstring; |
678 | #ifndef KORG_NOPLUGINS | 666 | #ifndef KORG_NOPLUGINS |
679 | hstring=KOCore::self()->holiday(qd); | 667 | hstring=KOCore::self()->holiday(qd); |
680 | #endif | 668 | #endif |
681 | 669 | ||
682 | if (!hstring.isEmpty()) { | 670 | if (!hstring.isEmpty()) { |
683 | p.setFont( QFont( "helvetica", 8, QFont::Bold, true ) ); | 671 | p.setFont( QFont( "helvetica", 8, QFont::Bold, true ) ); |
684 | 672 | ||
685 | p.drawText( x+5, y, width-25, mSubHeaderHeight, AlignLeft | AlignVCenter, | 673 | p.drawText( x+5, y, width-25, mSubHeaderHeight, AlignLeft | AlignVCenter, |
686 | hstring ); | 674 | hstring ); |
687 | } | 675 | } |
688 | p.setFont(QFont("helvetica", 10, QFont::Bold)); | 676 | p.setFont(QFont("helvetica", 10, QFont::Bold)); |
677 | if ( fullDate) { | ||
678 | // use short date format, if long date is too long | ||
679 | QFontMetrics fm ( p.font() ); | ||
680 | if ( fm.width( dayNumStr ) > width -10 ) | ||
681 | dayNumStr = local->formatDate(qd, true); | ||
682 | } | ||
689 | p.drawText(x+5, y, width-10, mSubHeaderHeight, AlignRight | AlignVCenter, | 683 | p.drawText(x+5, y, width-10, mSubHeaderHeight, AlignRight | AlignVCenter, |
690 | dayNumStr); | 684 | dayNumStr); |
691 | Event::List eventList; | 685 | Event::List eventList; |
692 | eventList.fill( mCalendar->events( qd, true )); | 686 | eventList.fill( mCalendar->events( qd, true )); |
693 | Todo::List todos; | 687 | Todo::List todos; |
694 | todos.fill( mCalendar->todos( qd )); | 688 | todos.fill( mCalendar->todos( qd )); |
695 | QString outStr; | 689 | QString outStr; |
696 | p.setFont( QFont( "helvetica", 8 ) ); | 690 | p.setFont( QFont( "helvetica", 8 ) ); |
697 | int lineSpacing = p.fontMetrics().lineSpacing(); | 691 | int lineSpacing = p.fontMetrics().lineSpacing(); |
698 | 692 | ||
699 | int textY=mSubHeaderHeight+3; // gives the relative y-coord of the next printed entry | 693 | int textY=mSubHeaderHeight+3; // gives the relative y-coord of the next printed entry |
700 | Event::List::ConstIterator it; | 694 | Event::List::ConstIterator it; |
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index e8b7c94..8c2996b 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -1995,25 +1995,25 @@ void KOAgenda::printSelection() | |||
1995 | y = mGridSpacingY*mStartCellY; | 1995 | y = mGridSpacingY*mStartCellY; |
1996 | h = mGridSpacingY*(mCurrentCellY+1)-y+2; | 1996 | h = mGridSpacingY*(mCurrentCellY+1)-y+2; |
1997 | 1997 | ||
1998 | //return; | 1998 | //return; |
1999 | QPrinter* printer = new QPrinter(); | 1999 | QPrinter* printer = new QPrinter(); |
2000 | if ( !printer->setup()) { | 2000 | if ( !printer->setup()) { |
2001 | delete printer; | 2001 | delete printer; |
2002 | return; | 2002 | return; |
2003 | } | 2003 | } |
2004 | QPainter p( printer ); | 2004 | QPainter p( printer ); |
2005 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer ); | 2005 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer ); |
2006 | QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() ); | 2006 | QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() ); |
2007 | date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); | 2007 | //date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); |
2008 | int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height(); | 2008 | int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height(); |
2009 | // p.drawText( 0, 0, date ); | 2009 | // p.drawText( 0, 0, date ); |
2010 | int offset = m.width()/8; | 2010 | int offset = m.width()/8; |
2011 | // compute the scale | 2011 | // compute the scale |
2012 | dx = ((float) m.width()-offset) / (float)w; | 2012 | dx = ((float) m.width()-offset) / (float)w; |
2013 | dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h; | 2013 | dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h; |
2014 | float scale; | 2014 | float scale; |
2015 | // scale to fit the width or height of the paper | 2015 | // scale to fit the width or height of the paper |
2016 | if ( dx < dy ) | 2016 | if ( dx < dy ) |
2017 | scale = dx; | 2017 | scale = dx; |
2018 | else | 2018 | else |
2019 | scale = dy; | 2019 | scale = dy; |
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp index ac7d205..a09b278 100644 --- a/libkdepim/kpimglobalprefs.cpp +++ b/libkdepim/kpimglobalprefs.cpp | |||
@@ -48,25 +48,25 @@ static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP; | |||
48 | 48 | ||
49 | KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) | 49 | KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) |
50 | : KPrefs("microkdeglobalrc") | 50 | : KPrefs("microkdeglobalrc") |
51 | { | 51 | { |
52 | mLocaleDict = 0; | 52 | mLocaleDict = 0; |
53 | KPrefs::setCurrentGroup("Fonts"); | 53 | KPrefs::setCurrentGroup("Fonts"); |
54 | addItemFont("ApplicationFont",&mApplicationFont,KGlobalSettings::generalFont() ); | 54 | addItemFont("ApplicationFont",&mApplicationFont,KGlobalSettings::generalFont() ); |
55 | KPrefs::setCurrentGroup("Locale"); | 55 | KPrefs::setCurrentGroup("Locale"); |
56 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | 56 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); |
57 | addItemInt("PreferredTime",&mPreferredTime,0); | 57 | addItemInt("PreferredTime",&mPreferredTime,0); |
58 | addItemInt("PreferredDate",&mPreferredDate,0); | 58 | addItemInt("PreferredDate",&mPreferredDate,0); |
59 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | 59 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); |
60 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); | 60 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%AK %d. %b %y"); |
61 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | 61 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); |
62 | 62 | ||
63 | KPrefs::setCurrentGroup("Time & Date"); | 63 | KPrefs::setCurrentGroup("Time & Date"); |
64 | 64 | ||
65 | addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); | 65 | addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); |
66 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); | 66 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); |
67 | addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); | 67 | addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); |
68 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); | 68 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); |
69 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); | 69 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); |
70 | 70 | ||
71 | KPrefs::setCurrentGroup( "ExternalApplications" ); | 71 | KPrefs::setCurrentGroup( "ExternalApplications" ); |
72 | 72 | ||