-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 @@ -607,130 +607,124 @@ void CalPrintBase::drawAgendaItem( PrintCellItem *item, QPainter &p, // set the colors according to the categories if ( mUseColors ) setCategoryColors( p, event ); else p.setBrush( Qt::white ); // start/end of print area for event QDateTime startTime = event->dtStart(); QDateTime endTime = event->dtEnd(); if ( event->doesRecur() ) { startTime.setDate( qd ); endTime.setDate( qd ); } if ( ( startTime < endPrintDate && endTime > startPrintDate ) || ( endTime > startPrintDate && startTime < endPrintDate ) ) { if ( startTime < startPrintDate ) startTime = startPrintDate; if ( endTime > endPrintDate ) endTime = endPrintDate; int eventLength = int( startTime.secsTo( endTime ) / 60. * minlen ); int currentyPos = int( y + startPrintDate.secsTo( startTime ) * minlen / 60. ); int currentWidth = width / item->subCells(); int currentX = x + item->subCell() * currentWidth; QString text = KGlobal::locale()->formatTime(event->dtStart().time())+ "-"+KGlobal::locale()->formatTime(event->dtEnd().time())+ " "+event->summary(); if ( !event->location().isEmpty() ) text += " (" +event->location()+")"; // p.save(); QPen pe = p.pen(); pe.setWidth( 2 ); p.setPen( pe ); p.drawRect( currentX, currentyPos+1, currentWidth+1, eventLength+1 ); p.drawText( currentX+3, currentyPos+2, currentWidth-5, eventLength-3, AlignLeft | AlignTop | AlignJustify | WordBreak, text); // p.restore(); } } void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, int x, int y, int width, int height, bool fullDate) { QString dayNumStr; QString ampm; const KLocale*local = KGlobal::locale(); // This has to be localized if (fullDate) { - /*int index; - dayNumStr= qd.toString(); - index = dayNumStr.find(' '); - dayNumStr.remove(0, index); - index = dayNumStr.findRev(' '); - dayNumStr.truncate(index);*/ - - const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); - dayNumStr = i18n("weekday month date", "%1 %2 %3") - .arg( calSys->weekDayName( qd ) ) - .arg( calSys->monthName( qd ) ) - .arg( qd.day() ); -// dayNumStr = local->formatDate(qd); + dayNumStr = local->formatDate(qd); } else { dayNumStr = QString::number( qd.day() ); } p.eraseRect( x, y, width, height ); p.drawRect( x, y, width, height ); // p.fillRect( x+1, y+1, width-2,height, QBrush(Dense7Pattern) ); p.drawRect( x, y, width, mSubHeaderHeight ); //p.fillRect( x+1, y+1, width-2, mSubHeaderHeight-2, QBrush(Dense7Pattern) ); QString hstring; #ifndef KORG_NOPLUGINS hstring=KOCore::self()->holiday(qd); #endif if (!hstring.isEmpty()) { p.setFont( QFont( "helvetica", 8, QFont::Bold, true ) ); p.drawText( x+5, y, width-25, mSubHeaderHeight, AlignLeft | AlignVCenter, hstring ); } p.setFont(QFont("helvetica", 10, QFont::Bold)); + if ( fullDate) { + // use short date format, if long date is too long + QFontMetrics fm ( p.font() ); + if ( fm.width( dayNumStr ) > width -10 ) + dayNumStr = local->formatDate(qd, true); + } p.drawText(x+5, y, width-10, mSubHeaderHeight, AlignRight | AlignVCenter, dayNumStr); Event::List eventList; eventList.fill( mCalendar->events( qd, true )); Todo::List todos; todos.fill( mCalendar->todos( qd )); QString outStr; p.setFont( QFont( "helvetica", 8 ) ); int lineSpacing = p.fontMetrics().lineSpacing(); int textY=mSubHeaderHeight+3; // gives the relative y-coord of the next printed entry Event::List::ConstIterator it; int entryCount = eventList.count() +todos.count(); if ( p.fontMetrics().lineSpacing()* entryCount > height-textY ) { if ( (p.fontMetrics().lineSpacing()-1) * entryCount > height-textY ) { p.setFont( QFont( "helvetica", 7 ) ); if ( (p.fontMetrics().lineSpacing()-1) * entryCount > height-textY ) p.setFont( QFont( "helvetica", 6 ) ); } lineSpacing = p.fontMetrics().lineSpacing()-1; } // qDebug("fm %d %d %d ",p.fontMetrics().height(), eventList.count() , height-textY ); for( it = eventList.begin(); it != eventList.end() && textY<height; ++it ) { Event *currEvent = *it; if (currEvent->doesFloat() || currEvent->isMultiDay()) outStr = currEvent->summary(); else { if ( fullDate ) { outStr = KGlobal::locale()->formatTime( currEvent->dtStart().time())+ "-"+KGlobal::locale()->formatTime( currEvent->dtEnd().time())+ " "+ currEvent->summary(); if ( ! currEvent->location().isEmpty() ) outStr += " (" + currEvent->location()+")"; } else { QTime t1 = currEvent->dtStart().time(); outStr = local->formatTime(t1); outStr += " " + currEvent->summary(); } } // doesFloat p.drawText(x+5, y+textY, width-10, lineSpacing, AlignLeft|AlignBottom, outStr); textY+=lineSpacing; } diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index e8b7c94..8c2996b 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -1959,97 +1959,97 @@ void KOAgenda::restorePosition() if ( mContentPosition == 0 ) posY = 0; else posY = (max/mContentPosition)-(viewport()->height()/2); setContentsPos (0, posY ); //qDebug("posY %d hei %d", posY, max); } void KOAgenda::moveChild( QWidget *w, int x , int y ) { ++x; QScrollView::moveChild( w, x , y ); } #include <qmessagebox.h> #ifdef DESKTOP_VERSION #include <qprinter.h> #include <qpainter.h> #include <qpaintdevicemetrics.h> #endif void KOAgenda::printSelection() { #ifdef DESKTOP_VERSION if ( mStartCellY == mCurrentCellY ) { int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), i18n("Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. "), i18n("OK"), 0, 0, 0, 1 ); return; } float dx, dy; int x,y,w,h; x= 0; w= contentsWidth()+2; // h= contentsHeight(); y = mGridSpacingY*mStartCellY; h = mGridSpacingY*(mCurrentCellY+1)-y+2; //return; QPrinter* printer = new QPrinter(); if ( !printer->setup()) { delete printer; return; } QPainter p( printer ); QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer ); QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() ); - date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); + //date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height(); // p.drawText( 0, 0, date ); int offset = m.width()/8; // compute the scale dx = ((float) m.width()-offset) / (float)w; dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h; float scale; // scale to fit the width or height of the paper if ( dx < dy ) scale = dx; else scale = dy; // set the scale p.drawText( offset* scale, offset* scale*3/4, date ); int selDay; float widOffset = ((float) m.width()-offset) / ((float)(mSelectedDates.count())); float startX = 1; for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) { QString text = KGlobal::locale()->formatDate( mSelectedDates[selDay],true ); p.setClipRect(offset* scale+startX , 0, widOffset-4, offset* scale+(2*hei* scale) ); p.drawText( offset* scale+startX, (offset+hei)* scale, text ); startX += widOffset; } p.translate( offset* scale,offset* scale+ (-y * scale)+(2*hei* scale)); p.scale( scale, scale ); p.setClipRect( offset* scale, offset* scale+(2*hei* scale), w*scale, h*scale ); // now printing with y offset: 2 hei // p.translate( 0, -y*scale); drawContentsToPainter(&p, true ); globalFlagBlockAgendaItemUpdate = false; KOAgendaItem *item; for ( item=mItems.first(); item != 0; item=mItems.next() ) { item->select(false); item->paintMe( false, &p ); } globalFlagBlockAgendaItemUpdate = true; p.end(); delete printer; #else int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), i18n("Not supported \non PDA!\n"), i18n("OK"), 0, 0, 0, 1 ); #endif diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp index ac7d205..a09b278 100644 --- a/libkdepim/kpimglobalprefs.cpp +++ b/libkdepim/kpimglobalprefs.cpp @@ -12,97 +12,97 @@ 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. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <kglobal.h> #include <kconfig.h> #include <klocale.h> #include <kdebug.h> #include <kglobalsettings.h> #include <kstaticdeleter.h> #include <qregexp.h> #include <qfile.h> #include <stdlib.h> #include <qtextstream.h> #include <qapplication.h> #include "kpimglobalprefs.h" KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP; KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) : KPrefs("microkdeglobalrc") { mLocaleDict = 0; KPrefs::setCurrentGroup("Fonts"); addItemFont("ApplicationFont",&mApplicationFont,KGlobalSettings::generalFont() ); KPrefs::setCurrentGroup("Locale"); addItemInt("PreferredLanguage",&mPreferredLanguage,0); addItemInt("PreferredTime",&mPreferredTime,0); addItemInt("PreferredDate",&mPreferredDate,0); addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); - addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); + addItemString("UserDateFormatLong", &mUserDateFormatLong, "%AK %d. %b %y"); addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); KPrefs::setCurrentGroup("Time & Date"); addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); KPrefs::setCurrentGroup( "ExternalApplications" ); addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); addItemString( "EmailChannel", &mEmailOtherChannel, "" ); addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); addItemString( "FaxChannel", &mFaxOtherChannel, "" ); addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); addItemString( "SMSChannel", &mSMSOtherChannel, "" ); addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); addItemString( "PagerChannel", &mPagerOtherChannel, "" ); addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); addItemString( "SIPChannel", &mSipOtherChannel, "" ); addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); KPrefs::setCurrentGroup( "PhoneAccess" ); addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); |