korganizer Library API Documentation

calprintplugins.cpp

00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 1998 Preston Brown
00005     Copyright (c) 2003 Reinhold Kainhofer <reinhold@kainhofer.com>
00006     Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
00007 
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     This program is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License
00019     along with this program; if not, write to the Free Software
00020     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00021 
00022     As a special exception, permission is given to link this program
00023     with any edition of Qt, and distribute the resulting executable,
00024     without including the source code for Qt in the source distribution.
00025 */
00026 
00027 #include <qpainter.h>
00028 #include <qdatetimeedit.h>
00029 #include <qdatetime.h>
00030 #include <qcheckbox.h>
00031 #include <qlineedit.h>
00032 #include <qbuttongroup.h>
00033 
00034 #include <kglobal.h>
00035 #include <klocale.h>
00036 #include <kdebug.h>
00037 #include <kprinter.h>
00038 #include <kconfig.h>
00039 #include <kcalendarsystem.h>
00040 
00041 #include <libkcal/todo.h>
00042 #include <libkcal/calendar.h>
00043 
00044 #include <libkdepim/kdateedit.h>
00045 
00046 #include "koprefs.h"
00047 #include "koglobals.h"
00048 #include "calprintplugins.h"
00049 #ifndef KORG_NOPRINTER
00050 
00051 #include "calprintplugins.moc"
00052 
00053 #include "calprintdayconfig_base.h"
00054 #include "calprintweekconfig_base.h"
00055 #include "calprintmonthconfig_base.h"
00056 #include "calprinttodoconfig_base.h"
00057 
00058 
00059 /**************************************************************
00060  *           Print Day
00061  **************************************************************/
00062 
00063 CalPrintDay::CalPrintDay( KPrinter *printer, Calendar *cal, KConfig *cfg )
00064   : CalPrintBase( printer, cal, cfg )
00065 {
00066 }
00067 
00068 CalPrintDay::~CalPrintDay()
00069 {
00070 }
00071 
00072 QWidget *CalPrintDay::configWidget( QWidget *w )
00073 {
00074   mConfigWidget = new CalPrintDayConfig_Base( w );
00075   setSettingsWidget();
00076   return mConfigWidget;
00077 }
00078 
00079 void CalPrintDay::readSettingsWidget()
00080 {
00081   CalPrintDayConfig_Base *cfg =
00082       dynamic_cast<CalPrintDayConfig_Base*>( mConfigWidget );
00083   if ( cfg ) {
00084     mFromDate = cfg->mFromDate->date();
00085     mToDate = cfg->mToDate->date();
00086 
00087     mStartTime = cfg->mFromTime->time();
00088     mEndTime = cfg->mToTime->time();
00089     mIncludeAllEvents = cfg->mIncludeAllEvents->isChecked();
00090 
00091     mIncludeTodos = cfg->mIncludeTodos->isChecked();
00092     mUseColors = cfg->mColors->isChecked();
00093   }
00094 }
00095 
00096 void CalPrintDay::setSettingsWidget()
00097 {
00098   CalPrintDayConfig_Base *cfg =
00099       dynamic_cast<CalPrintDayConfig_Base*>( mConfigWidget );
00100   if ( cfg ) {
00101     cfg->mFromDate->setDate( mFromDate );
00102     cfg->mToDate->setDate( mToDate );
00103 
00104     cfg->mFromTime->setTime( mStartTime );
00105     cfg->mToTime->setTime( mEndTime );
00106     cfg->mIncludeAllEvents->setChecked( mIncludeAllEvents );
00107 
00108     cfg->mIncludeTodos->setChecked( mIncludeTodos );
00109     cfg->mColors->setChecked( mUseColors );
00110   }
00111 }
00112 
00113 void CalPrintDay::loadConfig()
00114 {
00115   if ( mConfig ) {
00116     QDate dt;
00117     QTime tm1( KOPrefs::instance()->mDayBegins.time() );
00118     QDateTime startTm( dt, tm1  );
00119     QDateTime endTm( dt, tm1.addSecs( 12 * 60 * 60 ) );
00120     mStartTime = mConfig->readDateTimeEntry( "Start time", &startTm ).time();
00121     mEndTime = mConfig->readDateTimeEntry( "End time", &endTm ).time();
00122     mIncludeTodos = mConfig->readBoolEntry( "Include todos", false );
00123     mIncludeAllEvents = mConfig->readBoolEntry( "Include all events", false );
00124   }
00125   setSettingsWidget();
00126 }
00127 
00128 void CalPrintDay::saveConfig()
00129 {
00130   kdDebug() << "CalPrintDay::saveConfig()" << endl;
00131 
00132   readSettingsWidget();
00133   if ( mConfig ) {
00134     mConfig->writeEntry( "Start time", QDateTime( QDate(), mStartTime ) );
00135     mConfig->writeEntry( "End time", QDateTime( QDate(), mEndTime ) );
00136     mConfig->writeEntry( "Include todos", mIncludeTodos );
00137     mConfig->writeEntry( "Include all events", mIncludeAllEvents );
00138   }
00139 }
00140 
00141 void CalPrintDay::setDateRange( const QDate& from, const QDate& to )
00142 {
00143   CalPrintBase::setDateRange( from, to );
00144   CalPrintDayConfig_Base *cfg =
00145       dynamic_cast<CalPrintDayConfig_Base*>( mConfigWidget );
00146   if ( cfg ) {
00147     cfg->mFromDate->setDate( from );
00148     cfg->mToDate->setDate( to );
00149   }
00150 }
00151 
00152 void CalPrintDay::print( QPainter &p, int width, int height )
00153 {
00154   QDate curDay( mFromDate );
00155 
00156   do {
00157     int x = 0;
00158     int y = 0;
00159     int currHeight=( height - y ) / 20;
00160     QTime curStartTime( mStartTime );
00161     QTime curEndTime( mEndTime );
00162     if ( curStartTime.secsTo( curEndTime ) <= 3600 ) {
00163       if ( curStartTime.hour() == 0 ) {
00164         curStartTime = QTime( 0, 0, 0 );
00165         curEndTime = curStartTime.addSecs( 3600 );
00166       } else if ( curEndTime.hour() == 23 ) {
00167         curEndTime=QTime( 23, 59, 59 );
00168         if ( curStartTime > QTime( 23, 0, 0 ) ) {
00169           curStartTime = QTime( 23, 0, 0 );
00170         }
00171       } else {
00172         curStartTime = curStartTime.addSecs( -1200 );
00173       }
00174       curEndTime = curEndTime.addSecs( 1200 );
00175     }
00176 
00177     KLocale *local = KGlobal::locale();
00178     drawHeader( p, local->formatDate( curDay, false ),
00179                 curDay, QDate(), 0, 0, width, mHeaderHeight );
00180 
00181     y += mHeaderHeight + 5;
00182     x = 80;
00183     Event::List eventList = mCalendar->events( curDay, true );
00184 
00185     p.setFont( QFont( "helvetica", 12 ) );
00186     drawAllDayBox( p, eventList, curDay, true, x, y, width - x, currHeight );
00187     y += currHeight;
00188     drawAgendaDayBox( p, eventList, curDay, mIncludeAllEvents,
00189                       curStartTime, curEndTime, x, y, width - x, height - y );
00190     drawTimeLine( p, curStartTime, curEndTime, 0, y, x - 5, height - y );
00191     curDay = curDay.addDays( 1 );
00192     if ( curDay <= mToDate ) mPrinter->newPage();
00193   } while ( curDay <= mToDate );
00194 }
00195 
00196 
00197 
00198 /**************************************************************
00199  *           Print Week
00200  **************************************************************/
00201 
00202 CalPrintWeek::CalPrintWeek(KPrinter *printer, Calendar *cal, KConfig *cfg)
00203   :CalPrintBase(printer,cal,cfg)
00204 {
00205 }
00206 
00207 CalPrintWeek::~CalPrintWeek()
00208 {
00209 }
00210 
00211 QWidget *CalPrintWeek::configWidget( QWidget *w )
00212 {
00213   mConfigWidget = new CalPrintWeekConfig_Base( w );
00214   setSettingsWidget();
00215   return mConfigWidget;
00216 }
00217 
00218 void CalPrintWeek::readSettingsWidget()
00219 {
00220   CalPrintWeekConfig_Base *cfg =
00221       dynamic_cast<CalPrintWeekConfig_Base*>( mConfigWidget );
00222   if ( cfg ) {
00223     mFromDate = cfg->mFromDate->date();
00224     mToDate = cfg->mToDate->date();
00225 
00226     mWeekPrintType = (eWeekPrintType)( cfg->mPrintType->id(
00227       cfg->mPrintType->selected() ) );
00228 
00229     mStartTime = cfg->mFromTime->time();
00230     mEndTime = cfg->mToTime->time();
00231 
00232     mIncludeTodos = cfg->mIncludeTodos->isChecked();
00233     mUseColors = cfg->mColors->isChecked();
00234   }
00235 }
00236 
00237 void CalPrintWeek::setSettingsWidget()
00238 {
00239   CalPrintWeekConfig_Base *cfg =
00240       dynamic_cast<CalPrintWeekConfig_Base*>( mConfigWidget );
00241   if ( cfg ) {
00242     cfg->mFromDate->setDate( mFromDate );
00243     cfg->mToDate->setDate( mToDate );
00244 
00245     cfg->mPrintType->setButton( mWeekPrintType );
00246 
00247     cfg->mFromTime->setTime( mStartTime );
00248     cfg->mToTime->setTime( mEndTime );
00249 
00250     cfg->mIncludeTodos->setChecked( mIncludeTodos );
00251     cfg->mColors->setChecked( mUseColors );
00252   }
00253 }
00254 
00255 void CalPrintWeek::loadConfig()
00256 {
00257   if ( mConfig ) {
00258     QDate dt;
00259     QTime tm1( KOPrefs::instance()->mDayBegins.time() );
00260     QDateTime startTm( dt, tm1  );
00261     QDateTime endTm( dt, tm1.addSecs( 43200 ) );
00262     mStartTime = mConfig->readDateTimeEntry( "Start time", &startTm ).time();
00263     mEndTime = mConfig->readDateTimeEntry( "End time", &endTm ).time();
00264     mIncludeTodos = mConfig->readBoolEntry( "Include todos", false );
00265     mWeekPrintType =(eWeekPrintType)( mConfig->readNumEntry( "Print type", (int)Filofax ) );
00266   }
00267   setSettingsWidget();
00268 }
00269 
00270 void CalPrintWeek::saveConfig()
00271 {
00272   readSettingsWidget();
00273   if ( mConfig ) {
00274     mConfig->writeEntry( "Start time", QDateTime( QDate(), mStartTime ) );
00275     mConfig->writeEntry( "End time", QDateTime( QDate(), mEndTime ) );
00276     mConfig->writeEntry( "Include todos", mIncludeTodos );
00277     mConfig->writeEntry( "Print type", int( mWeekPrintType ) );
00278   }
00279 }
00280 
00281 KPrinter::Orientation CalPrintWeek::orientation()
00282 {
00283   if ( mWeekPrintType == Filofax ) return KPrinter::Portrait;
00284   else if ( mWeekPrintType == SplitWeek ) return KPrinter::Portrait;
00285   else return KPrinter::Landscape;
00286 }
00287 
00288 void CalPrintWeek::setDateRange( const QDate &from, const QDate &to )
00289 {
00290   CalPrintBase::setDateRange( from, to );
00291   CalPrintWeekConfig_Base *cfg =
00292       dynamic_cast<CalPrintWeekConfig_Base*>( mConfigWidget );
00293   if ( cfg ) {
00294     cfg->mFromDate->setDate( from );
00295     cfg->mToDate->setDate( to );
00296   }
00297 }
00298 
00299 void CalPrintWeek::print( QPainter &p, int width, int height )
00300 {
00301   QDate curWeek, fromWeek, toWeek;
00302 
00303   // correct begin and end to first and last day of week
00304   int weekdayCol = weekdayColumn( mFromDate.dayOfWeek() );
00305   fromWeek = mFromDate.addDays( -weekdayCol );
00306   weekdayCol = weekdayColumn( mFromDate.dayOfWeek() );
00307   toWeek = mToDate.addDays( 6 - weekdayCol );
00308 
00309   curWeek = fromWeek.addDays( 6 );
00310   KLocale *local = KGlobal::locale();
00311 
00312   switch ( mWeekPrintType ) {
00313     case Filofax:
00314       do {
00315         QString line1( local->formatDate( curWeek.addDays( -6 ) ) );
00316         QString line2( local->formatDate( curWeek ) );
00317         drawHeader( p, line1 + "\n" + line2, curWeek.addDays( -6 ), QDate(),
00318                     0, 0, width, mHeaderHeight );
00319         int top = mHeaderHeight + 10;
00320         drawWeek( p, curWeek, 0, top, width, height - top );
00321         curWeek = curWeek.addDays( 7 );
00322         if ( curWeek <= toWeek )
00323           mPrinter->newPage();
00324       } while ( curWeek <= toWeek );
00325       break;
00326 
00327     case Timetable:
00328     default:
00329       do {
00330         QString line1( local->formatDate( curWeek.addDays( -6 ) ) );
00331         QString line2( local->formatDate( curWeek ) );
00332         int hh = int(mHeaderHeight * 2./3.);
00333         drawHeader( p, i18n("date from - to", "%1 - %2\nWeek %3").arg( line1 ).arg( line2 ).arg( curWeek.weekNumber() ),
00334                     curWeek, QDate(), 0, 0, width, hh );
00335         drawTimeTable( p, fromWeek, curWeek,
00336                        mStartTime, mEndTime, 0, hh + 5,
00337                        width, height - hh - 5 );
00338         fromWeek = fromWeek.addDays( 7 );
00339         curWeek = fromWeek.addDays( 6 );
00340         if ( curWeek <= toWeek )
00341           mPrinter->newPage();
00342       } while ( curWeek <= toWeek );
00343       break;
00344 
00345     case SplitWeek:
00346       do {
00347         QString line1( local->formatDate( curWeek.addDays( -6 ) ) );
00348         QString line2( local->formatDate( curWeek ) );
00349         QDate endLeft( fromWeek.addDays( 3 ) );
00350         int hh = mHeaderHeight;
00351         
00352         drawTimeTable( p, fromWeek, endLeft,
00353                        mStartTime, mEndTime, 0, hh + 5,
00354                        width, height - hh - 5 );
00355         mPrinter->newPage();
00356         drawSplitHeaderRight( p, fromWeek, curWeek, QDate(), width, hh );
00357         drawTimeTable( p, endLeft.addDays( 1 ), curWeek,
00358                        mStartTime, mEndTime, 0, hh + 5,
00359                        int( ( width - 50 ) * 3. / 4. + 50 ), height - hh - 5 );
00360         
00361         fromWeek = fromWeek.addDays( 7 );
00362         curWeek = fromWeek.addDays( 6 );
00363         if ( curWeek <= toWeek )
00364           mPrinter->newPage();
00365       } while ( curWeek <= toWeek );
00366       break;
00367   }
00368 }
00369 
00370 
00371 
00372 
00373 /**************************************************************
00374  *           Print Month
00375  **************************************************************/
00376 
00377 CalPrintMonth::CalPrintMonth( KPrinter *printer, Calendar *cal, KConfig *cfg )
00378   : CalPrintBase( printer, cal, cfg )
00379 {
00380 }
00381 
00382 CalPrintMonth::~CalPrintMonth()
00383 {
00384 }
00385 
00386 QWidget *CalPrintMonth::configWidget( QWidget *w )
00387 {
00388   mConfigWidget = new CalPrintMonthConfig_Base( w );
00389   return mConfigWidget;
00390 }
00391 
00392 void CalPrintMonth::readSettingsWidget()
00393 {
00394   CalPrintMonthConfig_Base *cfg =
00395       dynamic_cast<CalPrintMonthConfig_Base *>( mConfigWidget );
00396   if ( cfg ) {
00397     mFromDate = cfg->mFromDate->date();
00398     mToDate = cfg->mToDate->date();
00399 
00400     mWeekNumbers =  cfg->mWeekNumbers->isChecked();
00401 
00402     mIncludeTodos = cfg->mIncludeTodos->isChecked();
00403 //    mUseColors = cfg->mColors->isChecked();
00404   }
00405 }
00406 
00407 void CalPrintMonth::setSettingsWidget()
00408 {
00409   CalPrintMonthConfig_Base *cfg =
00410       dynamic_cast<CalPrintMonthConfig_Base *>( mConfigWidget );
00411   if ( cfg ) {
00412     cfg->mFromDate->setDate( mFromDate );
00413     cfg->mToDate->setDate( mToDate );
00414 
00415     cfg->mWeekNumbers->setChecked( mWeekNumbers );
00416 
00417     cfg->mIncludeTodos->setChecked( mIncludeTodos );
00418 //    cfg->mColors->setChecked( mUseColors );
00419   }
00420 }
00421 
00422 void CalPrintMonth::loadConfig()
00423 {
00424   if ( mConfig ) {
00425     mWeekNumbers = mConfig->readBoolEntry( "Print week numbers", true );
00426     mIncludeTodos = mConfig->readBoolEntry( "Include todos", false );
00427   }
00428   setSettingsWidget();
00429 }
00430 
00431 void CalPrintMonth::saveConfig()
00432 {
00433   readSettingsWidget();
00434   if ( mConfig ) {
00435     mConfig->writeEntry( "Print week numbers", mWeekNumbers );
00436     mConfig->writeEntry( "Include todos", mIncludeTodos );
00437   }
00438 }
00439 
00440 void CalPrintMonth::setDateRange( const QDate &from, const QDate &to )
00441 {
00442   CalPrintBase::setDateRange( from, to );
00443   CalPrintMonthConfig_Base *cfg =
00444       dynamic_cast<CalPrintMonthConfig_Base *>( mConfigWidget );
00445   if ( cfg ) {
00446     cfg->mFromDate->setDate( from );
00447     cfg->mToDate->setDate( to );
00448   }
00449 }
00450 
00451 void CalPrintMonth::print( QPainter &p, int width, int height )
00452 {
00453   QDate curMonth, fromMonth, toMonth;
00454 
00455   fromMonth = mFromDate.addDays( -( mFromDate.day() - 1 ) );
00456   toMonth = mToDate.addDays( mToDate.daysInMonth() - mToDate.day() );
00457 
00458   curMonth = fromMonth;
00459   do {
00460     QString title( i18n("monthname year", "%1 %2") );
00461     title = title.arg( KOGlobals::self()->calendarSystem()->monthName( curMonth ) )
00462                  .arg( curMonth.year() );
00463     QDate tmp( fromMonth );
00464     int weekdayCol = weekdayColumn( tmp.dayOfWeek() );
00465     tmp = tmp.addDays( -weekdayCol );
00466 
00467     drawHeader( p, title,
00468                 curMonth.addMonths( -1 ), curMonth.addMonths( 1 ),
00469                 0, 0, width, mHeaderHeight );
00470     drawMonth( p, curMonth, mWeekNumbers, 0, mHeaderHeight + 5,
00471                width, height - mHeaderHeight - 5 );
00472     curMonth = curMonth.addDays( curMonth.daysInMonth() );
00473     if ( curMonth <= toMonth ) mPrinter->newPage();
00474   } while ( curMonth <= toMonth );
00475 
00476 }
00477 
00478 
00479 
00480 
00481 /**************************************************************
00482  *           Print Todos
00483  **************************************************************/
00484 
00485 CalPrintTodos::CalPrintTodos( KPrinter *printer, Calendar *cal, KConfig *cfg )
00486   : CalPrintBase( printer, cal, cfg )
00487 {
00488 }
00489 
00490 CalPrintTodos::~CalPrintTodos()
00491 {
00492 }
00493 
00494 QWidget *CalPrintTodos::configWidget( QWidget *w )
00495 {
00496   mConfigWidget = new CalPrintTodoConfig_Base( w );
00497   return mConfigWidget;
00498 }
00499 
00500 void CalPrintTodos::readSettingsWidget()
00501 {
00502   CalPrintTodoConfig_Base *cfg =
00503       dynamic_cast<CalPrintTodoConfig_Base *>( mConfigWidget );
00504   if ( cfg ) {
00505     mPageTitle = cfg->mTitle->text();
00506 
00507     mTodoPrintType = (eTodoPrintType)( cfg->mPrintType->id(
00508       cfg->mPrintType->selected() ) );
00509 
00510     mFromDate = cfg->mFromDate->date();
00511     mToDate = cfg->mToDate->date();
00512 
00513     mIncludeDescription = cfg->mDescription->isChecked();
00514     mIncludePriority = cfg->mPriority->isChecked();
00515     mIncludeDueDate = cfg->mDueDate->isChecked();
00516     mConnectSubTodos = cfg->mConnectSubTodos->isChecked();
00517   }
00518 }
00519 
00520 void CalPrintTodos::setSettingsWidget()
00521 {
00522   CalPrintTodoConfig_Base *cfg =
00523       dynamic_cast<CalPrintTodoConfig_Base *>( mConfigWidget );
00524   if ( cfg ) {
00525     cfg->mTitle->setText( mPageTitle );
00526 
00527     cfg->mPrintType->setButton( mTodoPrintType );
00528 
00529     cfg->mFromDate->setDate( mFromDate );
00530     cfg->mToDate->setDate( mToDate );
00531 
00532     cfg->mDescription->setChecked( mIncludeDescription );
00533     cfg->mPriority->setChecked( mIncludePriority );
00534     cfg->mDueDate->setChecked( mIncludeDueDate );
00535     cfg->mConnectSubTodos->setChecked( mConnectSubTodos );
00536   }
00537 }
00538 
00539 void CalPrintTodos::loadConfig()
00540 {
00541   if ( mConfig ) {
00542     mPageTitle = mConfig->readEntry( "Page title", i18n("Todo list") );
00543     mTodoPrintType = (eTodoPrintType)mConfig->readNumEntry( "Print type", (int)TodosAll );
00544     mIncludeDescription = mConfig->readBoolEntry( "Include description", true );
00545     mIncludePriority = mConfig->readBoolEntry( "Include priority", true );
00546     mIncludeDueDate = mConfig->readBoolEntry( "Include due date", true );
00547     mConnectSubTodos = mConfig->readBoolEntry( "Connect subtodos", true );
00548   }
00549   setSettingsWidget();
00550 }
00551 
00552 void CalPrintTodos::saveConfig()
00553 {
00554   readSettingsWidget();
00555   if ( mConfig ) {
00556     mConfig->writeEntry( "Page title", mPageTitle );
00557     mConfig->writeEntry( "Print type", int( mTodoPrintType ) );
00558     mConfig->writeEntry( "Include description", mIncludeDescription );
00559     mConfig->writeEntry( "Include priority", mIncludePriority );
00560     mConfig->writeEntry( "Include due date", mIncludeDueDate );
00561     mConfig->writeEntry( "Connect subtodos", mConnectSubTodos );
00562   }
00563 }
00564 
00565 void CalPrintTodos::print( QPainter &p, int width, int height )
00566 {
00567   int pospriority = 10;
00568   int possummary = 60;
00569   int posdue = width - 85;
00570   int lineSpacing = 15;
00571   int fontHeight = 10;
00572 
00573   drawHeader( p, mPageTitle, mFromDate, QDate(),
00574               0, 0, width, mHeaderHeight );
00575 
00576   int mCurrentLinePos = mHeaderHeight + 5;
00577   QString outStr;
00578   QFont oldFont( p.font() );
00579 
00580   // draw the headers
00581   p.setFont( QFont("helvetica", 10, QFont::Bold ) );
00582   lineSpacing = p.fontMetrics().lineSpacing();
00583   mCurrentLinePos += lineSpacing;
00584   if ( mIncludePriority ) {
00585     outStr += i18n("Priority");
00586     p.drawText( pospriority, mCurrentLinePos - 2, outStr);
00587   } else {
00588     possummary = 10;
00589     pospriority = -1;
00590   }
00591 
00592   outStr.truncate( 0 );
00593   outStr += i18n("Summary");
00594   p.drawText( possummary, mCurrentLinePos - 2, outStr );
00595 
00596   if ( mIncludeDueDate ) {
00597     outStr.truncate( 0 );
00598     outStr += i18n("Due");
00599     p.drawText( posdue, mCurrentLinePos - 2, outStr );
00600   } else {
00601     posdue = -1;
00602   }
00603 
00604   p.setFont( QFont( "helvetica", 10 ) );
00605 
00606   fontHeight = p.fontMetrics().height();
00607 
00608   Todo::List todoList;
00609 //   if (mTodoPrintType==TodosSelected) {
00610 //     todoList.append(selectedTodoo);
00611 //   } else {
00612     todoList = mCalendar->todos();
00613 //   }
00614 
00615   int count = 0;
00616   for( int cprior = 1; cprior <= 6; cprior++ ) {
00617     Todo::List::ConstIterator it;
00618     for( it = todoList.begin(); it != todoList.end(); ++it ) {
00619       Todo *currEvent = *it;
00620 
00621       // Filter out the subitems.
00622       if ( currEvent->relatedTo() ) {
00623         continue;
00624       }
00625 
00626       QDate start = currEvent->dtStart().date();
00627       // if it is not to start yet, skip.
00628       if ( ( !start.isValid() ) && ( start >= mToDate ) ) {
00629         continue;
00630       }
00631       // priority
00632       int priority = currEvent->priority();
00633       // 6 is the lowest priority (the unspecified one)
00634       if ( ( priority != cprior ) ||
00635            ( ( cprior == 6 ) && ( priority == 0 ) ) ) {
00636         continue;
00637       }
00638       count++;
00639       drawTodo( count, currEvent, p, mConnectSubTodos,
00640                 mIncludeDescription, pospriority, possummary, posdue, 0,
00641                 0, mCurrentLinePos, width, height, todoList );
00642     }
00643   }
00644   p.setFont( oldFont );
00645 }
00646 
00647 
00648 #endif
KDE Logo
This file is part of the documentation for korganizer Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 17 09:56:22 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003