summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-01-19 22:57:42 (UTC)
committer zautrix <zautrix>2005-01-19 22:57:42 (UTC)
commitade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e (patch) (unidiff)
tree990ed560fbf9126fba2abdaf98c036cddad2d94f /korganizer
parenta9f8ad6916ea1a849a43fe49c4085f6c44b5c47b (diff)
downloadkdepimpi-ade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e.zip
kdepimpi-ade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e.tar.gz
kdepimpi-ade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e.tar.bz2
many view fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp22
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/komonthview.cpp89
-rw-r--r--korganizer/komonthview.h8
-rw-r--r--korganizer/koviewmanager.cpp6
5 files changed, 85 insertions, 42 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 12af655..f9af769 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -204,64 +204,65 @@ class KOCatPrefs : public QDialog
204private: 204private:
205 QRadioButton* addCatBut; 205 QRadioButton* addCatBut;
206}; 206};
207 207
208 208
209 209
210CalendarView::CalendarView( CalendarResources *calendar, 210CalendarView::CalendarView( CalendarResources *calendar,
211 QWidget *parent, const char *name ) 211 QWidget *parent, const char *name )
212 : CalendarViewBase( parent, name ), 212 : CalendarViewBase( parent, name ),
213 mCalendar( calendar ), 213 mCalendar( calendar ),
214 mResourceManager( calendar->resourceManager() ) 214 mResourceManager( calendar->resourceManager() )
215{ 215{
216 216
217 mEventEditor = 0; 217 mEventEditor = 0;
218 mTodoEditor = 0; 218 mTodoEditor = 0;
219 219
220 init(); 220 init();
221} 221}
222 222
223CalendarView::CalendarView( Calendar *calendar, 223CalendarView::CalendarView( Calendar *calendar,
224 QWidget *parent, const char *name ) 224 QWidget *parent, const char *name )
225 : CalendarViewBase( parent, name ), 225 : CalendarViewBase( parent, name ),
226 mCalendar( calendar ), 226 mCalendar( calendar ),
227 mResourceManager( 0 ) 227 mResourceManager( 0 )
228{ 228{
229 229
230 mEventEditor = 0; 230 mEventEditor = 0;
231 mTodoEditor = 0; 231 mTodoEditor = 0;
232 init();} 232 init();}
233 233
234void CalendarView::init() 234void CalendarView::init()
235{ 235{
236 mBlockShowDates = false;
236 beamDialog = new KOBeamPrefs(); 237 beamDialog = new KOBeamPrefs();
237 mDatePickerMode = 0; 238 mDatePickerMode = 0;
238 mCurrentSyncDevice = ""; 239 mCurrentSyncDevice = "";
239 writeLocale(); 240 writeLocale();
240 mViewManager = new KOViewManager( this ); 241 mViewManager = new KOViewManager( this );
241 mDialogManager = new KODialogManager( this ); 242 mDialogManager = new KODialogManager( this );
242 mEventViewerDialog = 0; 243 mEventViewerDialog = 0;
243 mModified = false; 244 mModified = false;
244 mReadOnly = false; 245 mReadOnly = false;
245 mSelectedIncidence = 0; 246 mSelectedIncidence = 0;
246 mCalPrinter = 0; 247 mCalPrinter = 0;
247 mFilters.setAutoDelete(true); 248 mFilters.setAutoDelete(true);
248 249
249 mCalendar->registerObserver( this ); 250 mCalendar->registerObserver( this );
250 // TODO: Make sure that view is updated, when calendar is changed. 251 // TODO: Make sure that view is updated, when calendar is changed.
251 252
252 mStorage = new FileStorage( mCalendar ); 253 mStorage = new FileStorage( mCalendar );
253 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 254 mNavigator = new DateNavigator( this, "datevav", mViewManager );
254 255
255 QBoxLayout *topLayout = (QBoxLayout*)layout(); 256 QBoxLayout *topLayout = (QBoxLayout*)layout();
256#ifndef KORG_NOSPLITTER 257#ifndef KORG_NOSPLITTER
257 // create the main layout frames. 258 // create the main layout frames.
258 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 259 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
259 topLayout->addWidget(mPanner); 260 topLayout->addWidget(mPanner);
260 261
261 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 262 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
262 "CalendarView::LeftFrame"); 263 "CalendarView::LeftFrame");
263 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 264 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
264 265
265 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, 266 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE,
266 "CalendarView::DateNavigator", QDate::currentDate() ); 267 "CalendarView::DateNavigator", QDate::currentDate() );
267 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 268 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
@@ -317,79 +318,79 @@ void CalendarView::init()
317 if ( QApplication::desktop()->width() < 480 ) { 318 if ( QApplication::desktop()->width() < 480 ) {
318 leftFrameLayout->addWidget(mFilterView); 319 leftFrameLayout->addWidget(mFilterView);
319 leftFrameLayout->addWidget(mTodoList, 2 ); 320 leftFrameLayout->addWidget(mTodoList, 2 );
320 321
321 } else { 322 } else {
322 leftFrameLayout->addWidget(mTodoList,2 ); 323 leftFrameLayout->addWidget(mTodoList,2 );
323 leftFrameLayout->addWidget(mFilterView ); 324 leftFrameLayout->addWidget(mFilterView );
324 } 325 }
325 mFilterView->hide(); 326 mFilterView->hide();
326 QWidget *rightBox = new QWidget( mainBox ); 327 QWidget *rightBox = new QWidget( mainBox );
327 mainBoxLayout->addWidget ( rightBox, 10 ); 328 mainBoxLayout->addWidget ( rightBox, 10 );
328 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 329 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
329 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 330 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
330 mRightFrame = new QWidgetStack( rightBox ); 331 mRightFrame = new QWidgetStack( rightBox );
331 rightLayout->addWidget( mNavigatorBar ); 332 rightLayout->addWidget( mNavigatorBar );
332 rightLayout->addWidget( mRightFrame, 10 ); 333 rightLayout->addWidget( mRightFrame, 10 );
333 334
334 mLeftFrame = leftFrame; 335 mLeftFrame = leftFrame;
335 if ( KOPrefs::instance()->mVerticalScreen ) { 336 if ( KOPrefs::instance()->mVerticalScreen ) {
336 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 337 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
337 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 338 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
338 } else { 339 } else {
339 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 340 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
340 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 341 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
341 } 342 }
342 if ( !KOPrefs::instance()->mShowDateNavigator) 343 if ( !KOPrefs::instance()->mShowDateNavigator)
343 mDateNavigator->hide(); 344 mDateNavigator->hide();
344 //qDebug("Calendarview Size %d %d ", width(), height()); 345 //qDebug("Calendarview Size %d %d ", width(), height());
345#endif 346#endif
346 347
347 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 348 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
348 SLOT( showDates( const KCal::DateList & ) ) ); 349 SLOT( showDates( const KCal::DateList & ) ) );
350
349 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 351 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
350 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 352 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
351
352 connect( mNavigatorBar, SIGNAL( goPrevYear() ), 353 connect( mNavigatorBar, SIGNAL( goPrevYear() ),
353 mNavigator, SLOT( selectPreviousYear() ) ); 354 mNavigator, SLOT( selectPreviousYear() ) );
354 connect( mNavigatorBar, SIGNAL( goNextYear() ), 355 connect( mNavigatorBar, SIGNAL( goNextYear() ),
355 mNavigator, SLOT( selectNextYear() ) ); 356 mNavigator, SLOT( selectNextYear() ) );
356 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), 357 connect( mNavigatorBar, SIGNAL( goPrevMonth() ),
357 mNavigator, SLOT( selectPreviousMonth() ) ); 358 mNavigator, SLOT( selectPreviousMonth() ) );
358 connect( mNavigatorBar, SIGNAL( goNextMonth() ), 359 connect( mNavigatorBar, SIGNAL( goNextMonth() ),
359 mNavigator, SLOT( selectNextMonth() ) ); 360 mNavigator, SLOT( selectNextMonth() ) );
360 361
361 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 362 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
362 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); 363 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) );
363 364
364 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 365 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
365 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 366 mNavigator, SLOT( selectWeek( const QDate & ) ) );
366 367
367 connect( mDateNavigator, SIGNAL( goPrevYear() ), 368 connect( mDateNavigator, SIGNAL( goPrevYear() ),
368 mNavigator, SLOT( selectPreviousYear() ) ); 369 mNavigator, SLOT( selectPreviousYear() ) );
369 connect( mDateNavigator, SIGNAL( goNextYear() ), 370 connect( mDateNavigator, SIGNAL( goNextYear() ),
370 mNavigator, SLOT( selectNextYear() ) ); 371 mNavigator, SLOT( selectNextYear() ) );
371 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 372 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
372 mNavigator, SLOT( selectPreviousMonth() ) ); 373 mNavigator, SLOT( selectPreviousMonth() ) );
373 connect( mDateNavigator, SIGNAL( goNextMonth() ), 374 connect( mDateNavigator, SIGNAL( goNextMonth() ),
374 mNavigator, SLOT( selectNextMonth() ) ); 375 mNavigator, SLOT( selectNextMonth() ) );
375 376
376 connect( mDateNavigator, SIGNAL( goPrevious() ), 377 connect( mDateNavigator, SIGNAL( goPrevious() ),
377 mNavigator, SLOT( selectPrevious() ) ); 378 mNavigator, SLOT( selectPrevious() ) );
378 connect( mDateNavigator, SIGNAL( goNext() ), 379 connect( mDateNavigator, SIGNAL( goNext() ),
379 mNavigator, SLOT( selectNext() ) ); 380 mNavigator, SLOT( selectNext() ) );
380 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 381 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
381 mNavigator, SLOT( slotMonthSelect( int ) ) ); 382 mNavigator, SLOT( slotMonthSelect( int ) ) );
382 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), 383 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ),
383 mNavigator, SLOT( slotMonthSelect( int ) ) ); 384 mNavigator, SLOT( slotMonthSelect( int ) ) );
384 385
385 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 386 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
386 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 387 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
387 388
388 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), 389 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ),
389 SLOT( eventAdded( Event *) ) ); 390 SLOT( eventAdded( Event *) ) );
390 391
391 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 392 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
392 393
393 connect( this, SIGNAL( configChanged() ), 394 connect( this, SIGNAL( configChanged() ),
394 mDateNavigator, SLOT( updateConfig() ) ); 395 mDateNavigator, SLOT( updateConfig() ) );
395 396
@@ -468,65 +469,67 @@ void CalendarView::init()
468 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 469 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
469 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 470 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
470 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 471 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
471 mAlarmDialog = new AlarmDialog( this ); 472 mAlarmDialog = new AlarmDialog( this );
472 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 473 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
473 mAlarmDialog->setServerNotification( false ); 474 mAlarmDialog->setServerNotification( false );
474 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 475 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
475 476
476 477
477#ifndef DESKTOP_VERSION 478#ifndef DESKTOP_VERSION
478//US listen for arriving address resultsets 479//US listen for arriving address resultsets
479 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 480 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
480 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 481 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
481#endif 482#endif
482 483
483} 484}
484 485
485 486
486CalendarView::~CalendarView() 487CalendarView::~CalendarView()
487{ 488{
488 // kdDebug() << "~CalendarView()" << endl; 489 // kdDebug() << "~CalendarView()" << endl;
489 //qDebug("CalendarView::~CalendarView() "); 490 //qDebug("CalendarView::~CalendarView() ");
490 delete mDialogManager; 491 delete mDialogManager;
491 delete mViewManager; 492 delete mViewManager;
492 delete mStorage; 493 delete mStorage;
493 delete mDateFrame ; 494 delete mDateFrame ;
494 delete beamDialog; 495 delete beamDialog;
495 //kdDebug() << "~CalendarView() done" << endl; 496 //kdDebug() << "~CalendarView() done" << endl;
496} 497}
497 498
498void CalendarView::showDay( QDate d ) 499void CalendarView::showDay( QDate d )
499{ 500{
501 dateNavigator()->blockSignals( true );
500 dateNavigator()->selectDate( d ); 502 dateNavigator()->selectDate( d );
503 dateNavigator()->blockSignals( false );
501 mViewManager->showWeekView(); 504 mViewManager->showWeekView();
502 dateNavigator()->selectDate( d ); 505 dateNavigator()->selectDate( d );
503} 506}
504void CalendarView::timerAlarm() 507void CalendarView::timerAlarm()
505{ 508{
506 //qDebug("CalendarView::timerAlarm() "); 509 //qDebug("CalendarView::timerAlarm() ");
507 computeAlarm(mAlarmNotification ); 510 computeAlarm(mAlarmNotification );
508} 511}
509 512
510void CalendarView::suspendAlarm() 513void CalendarView::suspendAlarm()
511{ 514{
512 //qDebug(" CalendarView::suspendAlarm() "); 515 //qDebug(" CalendarView::suspendAlarm() ");
513 computeAlarm(mSuspendAlarmNotification ); 516 computeAlarm(mSuspendAlarmNotification );
514 517
515} 518}
516 519
517void CalendarView::startAlarm( QString mess , QString filename) 520void CalendarView::startAlarm( QString mess , QString filename)
518{ 521{
519 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 522 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
520 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 523 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
521 524
522} 525}
523 526
524void CalendarView::checkNextTimerAlarm() 527void CalendarView::checkNextTimerAlarm()
525{ 528{
526 mCalendar->checkAlarmForIncidence( 0, true ); 529 mCalendar->checkAlarmForIncidence( 0, true );
527} 530}
528 531
529void CalendarView::computeAlarm( QString msg ) 532void CalendarView::computeAlarm( QString msg )
530{ 533{
531 534
532 QString mess = msg; 535 QString mess = msg;
@@ -643,65 +646,67 @@ void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
643 if ( sec > maxSec ) { 646 if ( sec > maxSec ) {
644 mRecheckAlarmTimer->start( maxSec * 1000 ); 647 mRecheckAlarmTimer->start( maxSec * 1000 );
645 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 648 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
646 return; 649 return;
647 } else { 650 } else {
648 mRecheckAlarmTimer->stop(); 651 mRecheckAlarmTimer->stop();
649 } 652 }
650 //qDebug("Alarm timer started with secs: %d ", sec); 653 //qDebug("Alarm timer started with secs: %d ", sec);
651 mAlarmTimer->start( sec *1000 , true ); 654 mAlarmTimer->start( sec *1000 , true );
652 655
653} 656}
654// called by mRecheckAlarmTimer to get next alarm 657// called by mRecheckAlarmTimer to get next alarm
655// we need this, because a QTimer has only a max range of 25 days 658// we need this, because a QTimer has only a max range of 25 days
656void CalendarView::recheckTimerAlarm() 659void CalendarView::recheckTimerAlarm()
657{ 660{
658 mAlarmTimer->stop(); 661 mAlarmTimer->stop();
659 mRecheckAlarmTimer->stop(); 662 mRecheckAlarmTimer->stop();
660 mCalendar->checkAlarmForIncidence( 0, true ); 663 mCalendar->checkAlarmForIncidence( 0, true );
661} 664}
662void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 665void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
663{ 666{
664 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 667 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
665 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 668 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
666#ifndef DESKTOP_VERSION 669#ifndef DESKTOP_VERSION
667 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 670 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
668#endif 671#endif
669 return; 672 return;
670 } 673 }
671 mAlarmTimer->stop(); 674 mAlarmTimer->stop();
672} 675}
673void CalendarView::selectWeekNum ( int num ) 676void CalendarView::selectWeekNum ( int num )
674{ 677{
678 dateNavigator()->blockSignals( true );
675 dateNavigator()->selectWeek( num ); 679 dateNavigator()->selectWeek( num );
680 dateNavigator()->blockSignals( false );
676 mViewManager->showWeekView(); 681 mViewManager->showWeekView();
677} 682}
678KOViewManager *CalendarView::viewManager() 683KOViewManager *CalendarView::viewManager()
679{ 684{
680 return mViewManager; 685 return mViewManager;
681} 686}
682 687
683KODialogManager *CalendarView::dialogManager() 688KODialogManager *CalendarView::dialogManager()
684{ 689{
685 return mDialogManager; 690 return mDialogManager;
686} 691}
687 692
688QDate CalendarView::startDate() 693QDate CalendarView::startDate()
689{ 694{
690 DateList dates = mNavigator->selectedDates(); 695 DateList dates = mNavigator->selectedDates();
691 696
692 return dates.first(); 697 return dates.first();
693} 698}
694 699
695QDate CalendarView::endDate() 700QDate CalendarView::endDate()
696{ 701{
697 DateList dates = mNavigator->selectedDates(); 702 DateList dates = mNavigator->selectedDates();
698 703
699 return dates.last(); 704 return dates.last();
700} 705}
701 706
702 707
703void CalendarView::createPrinter() 708void CalendarView::createPrinter()
704{ 709{
705#ifndef KORG_NOPRINTER 710#ifndef KORG_NOPRINTER
706 if (!mCalPrinter) { 711 if (!mCalPrinter) {
707 mCalPrinter = new CalPrinter(this, mCalendar); 712 mCalPrinter = new CalPrinter(this, mCalendar);
@@ -3436,68 +3441,71 @@ void CalendarView::processIncidenceSelection( Incidence *incidence )
3436 return; 3441 return;
3437 } else { 3442 } else {
3438 emit todoSelected( false ); 3443 emit todoSelected( false );
3439 emit organizerEventsSelected(false); 3444 emit organizerEventsSelected(false);
3440 emit groupEventsSelected(false); 3445 emit groupEventsSelected(false);
3441 } 3446 }
3442 return; 3447 return;
3443 } 3448 }
3444 3449
3445 /* if ( incidence && incidence->type() == "Todo" ) { 3450 /* if ( incidence && incidence->type() == "Todo" ) {
3446 emit todoSelected( true ); 3451 emit todoSelected( true );
3447 } else { 3452 } else {
3448 emit todoSelected( false ); 3453 emit todoSelected( false );
3449 }*/ 3454 }*/
3450} 3455}
3451 3456
3452 3457
3453void CalendarView::checkClipboard() 3458void CalendarView::checkClipboard()
3454{ 3459{
3455#ifndef KORG_NODND 3460#ifndef KORG_NODND
3456 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3461 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3457 emit pasteEnabled(true); 3462 emit pasteEnabled(true);
3458 } else { 3463 } else {
3459 emit pasteEnabled(false); 3464 emit pasteEnabled(false);
3460 } 3465 }
3461#endif 3466#endif
3462} 3467}
3463 3468
3464void CalendarView::showDates(const DateList &selectedDates) 3469void CalendarView::showDates(const DateList &selectedDates)
3465{ 3470{
3466 // kdDebug() << "CalendarView::selectDates()" << endl; 3471 // kdDebug() << "CalendarView::selectDates()" << endl;
3467 3472
3468 if ( mViewManager->currentView() ) { 3473
3469 updateView( selectedDates.first(), selectedDates.last() ); 3474 if ( !mBlockShowDates ) {
3470 } else { 3475 if ( mViewManager->currentView() ) {
3471 mViewManager->showAgendaView(); 3476 updateView( selectedDates.first(), selectedDates.last() );
3477 } else {
3478 mViewManager->showAgendaView();
3479 }
3472 } 3480 }
3473 3481
3474 QString selDates; 3482 QString selDates;
3475 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); 3483 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true);
3476 if (selectedDates.first() < selectedDates.last() ) 3484 if (selectedDates.first() < selectedDates.last() )
3477 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3485 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3478 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 3486 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
3479 3487
3480} 3488}
3481 3489
3482QPtrList<CalFilter> CalendarView::filters() 3490QPtrList<CalFilter> CalendarView::filters()
3483{ 3491{
3484 return mFilters; 3492 return mFilters;
3485 3493
3486} 3494}
3487void CalendarView::editFilters() 3495void CalendarView::editFilters()
3488{ 3496{
3489 // kdDebug() << "CalendarView::editFilters()" << endl; 3497 // kdDebug() << "CalendarView::editFilters()" << endl;
3490 3498
3491 CalFilter *filter = mFilters.first(); 3499 CalFilter *filter = mFilters.first();
3492 while(filter) { 3500 while(filter) {
3493 kdDebug() << " Filter: " << filter->name() << endl; 3501 kdDebug() << " Filter: " << filter->name() << endl;
3494 filter = mFilters.next(); 3502 filter = mFilters.next();
3495 } 3503 }
3496 3504
3497 mDialogManager->showFilterEditDialog(&mFilters); 3505 mDialogManager->showFilterEditDialog(&mFilters);
3498} 3506}
3499void CalendarView::toggleFilter() 3507void CalendarView::toggleFilter()
3500{ 3508{
3501 showFilter(! mFilterView->isVisible()); 3509 showFilter(! mFilterView->isVisible());
3502} 3510}
3503 3511
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 646973d..e27da9a 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -451,75 +451,77 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
451 void setSyncDevice( QString ); 451 void setSyncDevice( QString );
452 void setSyncName( QString ); 452 void setSyncName( QString );
453 void showDay( QDate ); 453 void showDay( QDate );
454 void undo_delete(); 454 void undo_delete();
455 protected slots: 455 protected slots:
456 void timerAlarm(); 456 void timerAlarm();
457 void suspendAlarm(); 457 void suspendAlarm();
458 void beamDone( Ir *ir ); 458 void beamDone( Ir *ir );
459 /** Select a view or adapt the current view to display the specified dates. */ 459 /** Select a view or adapt the current view to display the specified dates. */
460 void showDates( const KCal::DateList & ); 460 void showDates( const KCal::DateList & );
461 void selectWeekNum ( int ); 461 void selectWeekNum ( int );
462 462
463 public: 463 public:
464 // show a standard warning 464 // show a standard warning
465 // returns KMsgBox::yesNoCancel() 465 // returns KMsgBox::yesNoCancel()
466 int msgCalModified(); 466 int msgCalModified();
467 virtual bool sync(KSyncManager* manager, QString filename, int mode); 467 virtual bool sync(KSyncManager* manager, QString filename, int mode);
468 468
469 virtual bool syncExternal(KSyncManager* manager, QString resource); 469 virtual bool syncExternal(KSyncManager* manager, QString resource);
470 virtual void removeSyncInfo( QString syncProfile); 470 virtual void removeSyncInfo( QString syncProfile);
471 void setSyncManager(KSyncManager* manager); 471 void setSyncManager(KSyncManager* manager);
472 void setLoadedFileVersion(QDateTime); 472 void setLoadedFileVersion(QDateTime);
473 bool checkFileVersion(QString fn); 473 bool checkFileVersion(QString fn);
474 bool checkFileChanged(QString fn); 474 bool checkFileChanged(QString fn);
475 Event* getLastSyncEvent(); 475 Event* getLastSyncEvent();
476 /** Adapt navigation units correpsonding to step size of navigation of the 476 /** Adapt navigation units correpsonding to step size of navigation of the
477 * current view. 477 * current view.
478 */ 478 */
479 void adaptNavigationUnits(); 479 void adaptNavigationUnits();
480 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 480 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
481 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 481 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
482 //Attendee* getYourAttendee(Event *event); 482 //Attendee* getYourAttendee(Event *event);
483 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
483 protected: 484 protected:
484 void schedule(Scheduler::Method, Incidence *incidence = 0); 485 void schedule(Scheduler::Method, Incidence *incidence = 0);
485 486
486 // returns KMsgBox::OKCandel() 487 // returns KMsgBox::OKCandel()
487 int msgItemDelete(); 488 int msgItemDelete();
488 void showEventEditor(); 489 void showEventEditor();
489 void showTodoEditor(); 490 void showTodoEditor();
490 void writeLocale(); 491 void writeLocale();
491 Todo *selectedTodo(); 492 Todo *selectedTodo();
492 493
493 private: 494 private:
495 bool mBlockShowDates;
494 KSyncManager* mSyncManager; 496 KSyncManager* mSyncManager;
495 AlarmDialog * mAlarmDialog; 497 AlarmDialog * mAlarmDialog;
496 QString mAlarmNotification; 498 QString mAlarmNotification;
497 QString mSuspendAlarmNotification; 499 QString mSuspendAlarmNotification;
498 QTimer* mSuspendTimer; 500 QTimer* mSuspendTimer;
499 QTimer* mAlarmTimer; 501 QTimer* mAlarmTimer;
500 QTimer* mRecheckAlarmTimer; 502 QTimer* mRecheckAlarmTimer;
501 void computeAlarm( QString ); 503 void computeAlarm( QString );
502 void startAlarm( QString, QString ); 504 void startAlarm( QString, QString );
503 void setSyncEventsReadOnly(); 505 void setSyncEventsReadOnly();
504 506
505 QDateTime loadedFileVersion; 507 QDateTime loadedFileVersion;
506 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 508 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
507 void checkExternalId( Incidence * inc ); 509 void checkExternalId( Incidence * inc );
508 int mGlobalSyncMode; 510 int mGlobalSyncMode;
509 QString mCurrentSyncDevice; 511 QString mCurrentSyncDevice;
510 QString mCurrentSyncName; 512 QString mCurrentSyncName;
511 KOBeamPrefs* beamDialog; 513 KOBeamPrefs* beamDialog;
512 void init(); 514 void init();
513 int mDatePickerMode; 515 int mDatePickerMode;
514 bool mFlagEditDescription; 516 bool mFlagEditDescription;
515 QDateTime mLastCalendarSync; 517 QDateTime mLastCalendarSync;
516 void createPrinter(); 518 void createPrinter();
517 519
518 void calendarModified( bool, Calendar * ); 520 void calendarModified( bool, Calendar * );
519 521
520 CalPrinter *mCalPrinter; 522 CalPrinter *mCalPrinter;
521 523
522 QSplitter *mPanner; 524 QSplitter *mPanner;
523 QSplitter *mLeftSplitter; 525 QSplitter *mLeftSplitter;
524 QWidget *mLeftFrame; 526 QWidget *mLeftFrame;
525 QWidgetStack *mRightFrame; 527 QWidgetStack *mRightFrame;
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 9344567..842f6eb 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -50,67 +50,70 @@
50#endif 50#endif
51#include "koglobals.h" 51#include "koglobals.h"
52#include <libkcal/kincidenceformatter.h> 52#include <libkcal/kincidenceformatter.h>
53 53
54#include "komonthview.h" 54#include "komonthview.h"
55 55
56#define PIXMAP_SIZE 5 56#define PIXMAP_SIZE 5
57#ifdef DESKTOP_VERSION 57#ifdef DESKTOP_VERSION
58 QToolTipGroup *MonthViewCell::mToolTipGroup = 0; 58 QToolTipGroup *MonthViewCell::mToolTipGroup = 0;
59#endif 59#endif
60class KNOWhatsThis :public QWhatsThis 60class KNOWhatsThis :public QWhatsThis
61{ 61{
62public: 62public:
63 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; 63 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { };
64 64
65protected: 65protected:
66 virtual QString text( const QPoint& p) 66 virtual QString text( const QPoint& p)
67 { 67 {
68 return _wid->getWhatsThisText(p) ; 68 return _wid->getWhatsThisText(p) ;
69 }; 69 };
70private: 70private:
71 KNoScrollListBox* _wid; 71 KNoScrollListBox* _wid;
72 72
73}; 73};
74 74
75 75
76KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) 76KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
77 : QListBox(parent, name) 77 : QListBox(parent, name)
78{ 78{
79#ifndef DESKTOP_VERSION 79#ifndef DESKTOP_VERSION
80 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 80 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
81#endif 81#endif
82 new KNOWhatsThis(this); 82 mWT = new KNOWhatsThis(this);
83}
84KNoScrollListBox::~KNoScrollListBox()
85{
86 delete mWT;
83} 87}
84
85QString KNoScrollListBox::getWhatsThisText(QPoint p) 88QString KNoScrollListBox::getWhatsThisText(QPoint p)
86{ 89{
87 QListBoxItem* item = itemAt ( p ); 90 QListBoxItem* item = itemAt ( p );
88 if ( ! item ) { 91 if ( ! item ) {
89 return i18n("Click in the cell\nto add an event!"); 92 return i18n("Click in the cell\nto add an event!");
90 } 93 }
91 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); 94 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence());
92} 95}
93void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 96void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
94{ 97{
95 98
96 switch(e->key()) { 99 switch(e->key()) {
97 case Key_Right: 100 case Key_Right:
98 // if ( e->state() == Qt::ControlButton ) 101 // if ( e->state() == Qt::ControlButton )
99 { 102 {
100 e->ignore(); 103 e->ignore();
101 return; 104 return;
102 } 105 }
103 scrollBy(4,0); 106 scrollBy(4,0);
104 break; 107 break;
105 case Key_Left: 108 case Key_Left:
106 // if ( e->state() == Qt::ControlButton ) 109 // if ( e->state() == Qt::ControlButton )
107 { 110 {
108 e->ignore(); 111 e->ignore();
109 return; 112 return;
110 } 113 }
111 scrollBy(-4,0); 114 scrollBy(-4,0);
112 break; 115 break;
113 case Key_Up: 116 case Key_Up:
114 if(!count()) break; 117 if(!count()) break;
115 setCurrentItem((currentItem()+count()-1)%count()); 118 setCurrentItem((currentItem()+count()-1)%count());
116 if(!itemVisible(currentItem())) { 119 if(!itemVisible(currentItem())) {
@@ -279,78 +282,67 @@ MonthViewCell::MonthViewCell( KOMonthView *parent)
279 mLabel->raise(); 282 mLabel->raise();
280 // QColor( 0,0,255 ) QColor( 160,1600,255 ) 283 // QColor( 0,0,255 ) QColor( 160,1600,255 )
281 mStandardPalette = palette(); 284 mStandardPalette = palette();
282 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); 285 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) );
283 286
284 enableScrollBars( false ); 287 enableScrollBars( false );
285 updateConfig(); 288 updateConfig();
286 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); 289 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() ));
287 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); 290 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() ));
288 connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), 291 connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ),
289 SLOT( defaultAction( QListBoxItem * ) ) ); 292 SLOT( defaultAction( QListBoxItem * ) ) );
290 connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, 293 connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *,
291 const QPoint &) ), 294 const QPoint &) ),
292 SLOT( contextMenu( QListBoxItem * ) ) ); 295 SLOT( contextMenu( QListBoxItem * ) ) );
293 connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), 296 connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ),
294 SLOT( selection( QListBoxItem * ) ) ); 297 SLOT( selection( QListBoxItem * ) ) );
295 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), 298 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
296 SLOT( cellClicked( QListBoxItem * ) ) ); 299 SLOT( cellClicked( QListBoxItem * ) ) );
297 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), 300 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
298 SLOT( selection( QListBoxItem * ) ) ); 301 SLOT( selection( QListBoxItem * ) ) );
299} 302}
300#ifdef DESKTOP_VERSION 303#ifdef DESKTOP_VERSION
301QToolTipGroup *MonthViewCell::toolTipGroup() 304QToolTipGroup *MonthViewCell::toolTipGroup()
302{ 305{
303 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 306 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
304 return mToolTipGroup; 307 return mToolTipGroup;
305} 308}
306#endif 309#endif
307 310
308void MonthViewCell::setDate( const QDate &date ) 311void MonthViewCell::setDate( const QDate &date )
309{ 312{
310// kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; 313// kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl;
311
312 mDate = date; 314 mDate = date;
313 315
314 QString text; 316
315 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
316 if ( KOGlobals::self()->calendarSystem()->day( date ) == 1 || (date.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
317 text = KOGlobals::self()->calendarSystem()->monthName( date, true ) + " ";
318 mLabel->resize( mLabelBigSize );
319 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
320 } else {
321 mLabel->resize( mLabelSize );
322 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
323 }
324 mLabel->setText( text );
325 317
326 //resizeEvent( 0 ); 318 //resizeEvent( 0 );
327} 319}
328 320
329QDate MonthViewCell::date() const 321QDate MonthViewCell::date() const
330{ 322{
331 return mDate; 323 return mDate;
332} 324}
333 325
334void MonthViewCell::setPrimary( bool primary ) 326void MonthViewCell::setPrimary( bool primary )
335{ 327{
336 mPrimary = primary; 328 mPrimary = primary;
337 //setMyPalette(); 329 //setMyPalette();
338} 330}
339void MonthViewCell::setMyPalette() 331void MonthViewCell::setMyPalette()
340{ 332{
341 333
342 if ( mHoliday) { 334 if ( mHoliday) {
343 setPalette( mHolidayPalette ); 335 setPalette( mHolidayPalette );
344 } else { 336 } else {
345 if ( mPrimary ) { 337 if ( mPrimary ) {
346 setPalette( mPrimaryPalette ); 338 setPalette( mPrimaryPalette );
347 } else { 339 } else {
348 setPalette( mNonPrimaryPalette ); 340 setPalette( mNonPrimaryPalette );
349 } 341 }
350 } 342 }
351 QPalette pal = palette(); 343 QPalette pal = palette();
352 344
353 mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); 345 mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) ));
354} 346}
355QPalette MonthViewCell::getPalette () 347QPalette MonthViewCell::getPalette ()
356{ 348{
@@ -363,88 +355,104 @@ QPalette MonthViewCell::getPalette ()
363 return mPrimaryPalette ; 355 return mPrimaryPalette ;
364 } 356 }
365 } 357 }
366 return mNonPrimaryPalette; 358 return mNonPrimaryPalette;
367} 359}
368bool MonthViewCell::isPrimary() const 360bool MonthViewCell::isPrimary() const
369{ 361{
370 return mPrimary; 362 return mPrimary;
371} 363}
372 364
373void MonthViewCell::setHoliday( bool holiday ) 365void MonthViewCell::setHoliday( bool holiday )
374{ 366{
375 mHoliday = holiday; 367 mHoliday = holiday;
376 //setMyPalette(); 368 //setMyPalette();
377} 369}
378 370
379void MonthViewCell::setHoliday( const QString &holiday ) 371void MonthViewCell::setHoliday( const QString &holiday )
380{ 372{
381 mHolidayString = holiday; 373 mHolidayString = holiday;
382 374
383 if ( !holiday.isEmpty() ) { 375 if ( !holiday.isEmpty() ) {
384 setHoliday( true ); 376 setHoliday( true );
385 } 377 }
386} 378}
387void MonthViewCell::keyPressEvent ( QKeyEvent * e ) 379void MonthViewCell::keyPressEvent ( QKeyEvent * e )
388{ 380{
389 381
390 e->ignore(); 382 e->ignore();
391 383
392} 384}
393void MonthViewCell::updateCell() 385void MonthViewCell::updateCell()
394{ 386{
395 387 if ( !mMonthView->isUpdatePossible() )
388 return;
389 if ( !isVisible() ){
390 return;
391 }
396 setPrimary( mDate.month()%2 ); 392 setPrimary( mDate.month()%2 );
397 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); 393 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays);
398 if ( mDate == QDate::currentDate() ) { 394 if ( mDate == QDate::currentDate() ) {
399 mItemList->setLineWidth( 3 ); 395 mItemList->setLineWidth( 3 );
400 } else { 396 } else {
401 mItemList->setLineWidth( 1 ); 397 mItemList->setLineWidth( 1 );
402 } 398 }
403 mItemList->clear(); 399 mItemList->clear();
400
401
402
404#ifdef DESKTOP_VERSION 403#ifdef DESKTOP_VERSION
405 QToolTip::remove(this); 404 QToolTip::remove(this);
406#endif 405#endif
407 QString tipText(""); 406 QString tipText("");
408 //qApp->processEvents(); 407 //qApp->processEvents();
409 if ( !mHolidayString.isEmpty() ) { 408 if ( !mHolidayString.isEmpty() ) {
410 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); 409 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
411 item->setPalette( mHolidayPalette ); 410 item->setPalette( mHolidayPalette );
412 mItemList->insertItem( item ); 411 mItemList->insertItem( item );
413 tipText += mHolidayString+"\n"; 412 tipText += mHolidayString+"\n";
414 } 413 }
415 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 414 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
416 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 415 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
417 Event *event; 416 Event *event;
418 for( event = events.first(); event; event = events.next() ) { 417 for( event = events.first(); event; event = events.next() ) { // for event
418
419 if ( !(event->doesRecur() == Recurrence::rNone) ) {
420 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
421 continue;
422 else
423 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
424 continue;
425 }
426
419 if ( event->categories().contains("Holiday") || 427 if ( event->categories().contains("Holiday") ||
420 event->categories().contains(i18n("Holiday"))) { 428 event->categories().contains(i18n("Holiday"))) {
421 setHoliday( true ); 429 setHoliday( true );
422 if ( mDate.dayOfWeek() == 7 ) 430 if ( mDate.dayOfWeek() == 7 )
423 mItemList->setLineWidth( 3 ); 431 mItemList->setLineWidth( 3 );
424 } 432 }
425 QString text; 433 QString text;
426 if (event->isMultiDay()) { 434 if (event->isMultiDay()) {
427 QString prefix = "<->"; 435 QString prefix = "<->";
428 if ( event->doesRecur() ) { 436 if ( event->doesRecur() ) {
429 if ( event->recursOn( mDate) ) 437 if ( event->recursOn( mDate) )
430 prefix ="->" ; 438 prefix ="->" ;
431 else { 439 else {
432 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 440 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
433 if ( event->recursOn( mDate.addDays( -days)) ) 441 if ( event->recursOn( mDate.addDays( -days)) )
434 prefix ="<-" ; 442 prefix ="<-" ;
435 } 443 }
436 444
437 } else { 445 } else {
438 if (mDate == event->dtStart().date()) { 446 if (mDate == event->dtStart().date()) {
439 prefix ="->" ; 447 prefix ="->" ;
440 } else if (mDate == event->dtEnd().date()) { 448 } else if (mDate == event->dtEnd().date()) {
441 prefix ="<-" ; 449 prefix ="<-" ;
442 } 450 }
443 } 451 }
444 text = prefix + event->summary(); 452 text = prefix + event->summary();
445 tipText += text; 453 tipText += text;
446 } else { 454 } else {
447 if (event->doesFloat()) { 455 if (event->doesFloat()) {
448 text = event->summary(); 456 text = event->summary();
449 tipText += text; 457 tipText += text;
450 } 458 }
@@ -454,141 +462,143 @@ void MonthViewCell::updateCell()
454 tipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 462 tipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
455 } 463 }
456 } 464 }
457 465
458 MonthViewItem *item = new MonthViewItem( event, mDate, text ); 466 MonthViewItem *item = new MonthViewItem( event, mDate, text );
459 QPalette pal; 467 QPalette pal;
460 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 468 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
461 QStringList categories = event->categories(); 469 QStringList categories = event->categories();
462 QString cat = categories.first(); 470 QString cat = categories.first();
463 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 471 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
464 pal = getPalette(); 472 pal = getPalette();
465 if (cat.isEmpty()) { 473 if (cat.isEmpty()) {
466 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 474 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
467 } else { 475 } else {
468 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 476 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
469 } 477 }
470 478
471 } else { 479 } else {
472 if (cat.isEmpty()) { 480 if (cat.isEmpty()) {
473 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 481 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
474 } else { 482 } else {
475 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 483 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
476 } 484 }
477 } 485 }
478 486
479 } else { 487 } else {
480 pal = mStandardPalette ; 488 pal = mStandardPalette ;
481 } 489 }
482 item->setPalette( pal ); 490 item->setPalette( pal );
483 item->setRecur( event->recurrence()->doesRecur() ); 491 item->setRecur( event->recurrence()->doesRecur() );
484 item->setAlarm( event->isAlarmEnabled() ); 492 item->setAlarm( event->isAlarmEnabled() );
485 item->setMoreInfo( event->description().length() > 0 ); 493 item->setMoreInfo( event->description().length() > 0 );
494#ifdef DESKTOP_VERSION
486 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, 495 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
487 KOPrefs::instance()->email()); 496 KOPrefs::instance()->email());
488 if ( me != 0 ) { 497 if ( me != 0 ) {
489 if ( me->status() == Attendee::NeedsAction && me->RSVP()) 498 if ( me->status() == Attendee::NeedsAction && me->RSVP())
490 item->setReply(true); 499 item->setReply(true);
491 else 500 else
492 item->setReply(false); 501 item->setReply(false);
493 } else 502 } else
494 item->setReply(false); 503 item->setReply(false);
495 bool insert = true; 504#endif
496 if ( !(event->doesRecur() == Recurrence::rNone) ) { 505 mItemList->insertItem( item );
497 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) 506 tipText += "\n";
498 insert = false; 507
499 else
500 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
501 insert = false;
502
503 }
504 if ( insert ) {
505 mItemList->insertItem( item );
506 tipText += "\n";
507 } else
508 tipText = "";
509 } 508 }
510 509
511 // insert due todos 510 // insert due todos
512 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 511 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
513 Todo *todo; 512 Todo *todo;
514 for(todo = todos.first(); todo; todo = todos.next()) { 513 for(todo = todos.first(); todo; todo = todos.next()) {
515 QString text; 514 QString text;
516 if (todo->hasDueDate()) { 515 if (todo->hasDueDate()) {
517 if (!todo->doesFloat()) { 516 if (!todo->doesFloat()) {
518 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 517 text += KGlobal::locale()->formatTime(todo->dtDue().time());
519 text += " "; 518 text += " ";
520 } 519 }
521 } 520 }
522 text += i18n("To-Do: %1").arg(todo->summary()); 521 text += i18n("To-Do: %1").arg(todo->summary());
523 522
524 MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 523 MonthViewItem *item = new MonthViewItem( todo, mDate, text );
525 //item->setPalette( mStandardPalette ); 524 //item->setPalette( mStandardPalette );
526 QPalette pal; 525 QPalette pal;
527 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 526 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
528 QStringList categories = todo->categories(); 527 QStringList categories = todo->categories();
529 QString cat = categories.first(); 528 QString cat = categories.first();
530 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 529 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
531 pal = getPalette(); 530 pal = getPalette();
532 if (cat.isEmpty()) { 531 if (cat.isEmpty()) {
533 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 532 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
534 } else { 533 } else {
535 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 534 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
536 } 535 }
537 536
538 } else { 537 } else {
539 if (cat.isEmpty()) { 538 if (cat.isEmpty()) {
540 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 539 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
541 } else { 540 } else {
542 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 541 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
543 } 542 }
544 } 543 }
545 544
546 } else { 545 } else {
547 pal = mStandardPalette ; 546 pal = mStandardPalette ;
548 } 547 }
549 item->setPalette( pal ); 548 item->setPalette( pal );
550 mItemList->insertItem( item ); 549 mItemList->insertItem( item );
551 tipText += text+"\n"; 550 tipText += text+"\n";
552 } 551 }
553#ifdef DESKTOP_VERSION 552#ifdef DESKTOP_VERSION
554 if (tipText != "") 553 if (tipText != "")
555 QToolTip::add(this,tipText,toolTipGroup(),""); 554 QToolTip::add(this,tipText,toolTipGroup(),"");
556#endif 555#endif
557 556
558 //setMyPalette(); 557 //setMyPalette();
559 setMyPalette(); 558 setMyPalette();
559 QString text;
560 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
561 if ( KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
562 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " ";
563 mLabel->resize( mLabelBigSize );
564 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
565 } else {
566 mLabel->resize( mLabelSize );
567 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
568 }
569 mLabel->setText( text );
560 resizeEvent( 0 ); 570 resizeEvent( 0 );
561 // if ( isVisible()) 571 // if ( isVisible())
562 // qApp->processEvents(); 572 qApp->processEvents();
563} 573}
564 574
565void MonthViewCell::updateConfig() 575void MonthViewCell::updateConfig()
566{ 576{
567 577
568 setFont( KOPrefs::instance()->mMonthViewFont ); 578 setFont( KOPrefs::instance()->mMonthViewFont );
569 579
570 QFontMetrics fm( font() ); 580 QFontMetrics fm( font() );
571 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); 581 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 );
572 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); 582 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 );
573 mHolidayPalette = mStandardPalette; 583 mHolidayPalette = mStandardPalette;
574 mPrimaryPalette = mStandardPalette; 584 mPrimaryPalette = mStandardPalette;
575 mNonPrimaryPalette = mStandardPalette; 585 mNonPrimaryPalette = mStandardPalette;
576 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { 586 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) {
577 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); 587 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor );
578 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); 588 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor );
579 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); 589 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark());
580 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); 590 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark());
581 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); 591 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor);
582 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); 592 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor);
583 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); 593 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark());
584 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); 594 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor);
585 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); 595 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor);
586 } 596 }
587 updateCell(); 597 updateCell();
588} 598}
589 599
590void MonthViewCell::enableScrollBars( bool enabled ) 600void MonthViewCell::enableScrollBars( bool enabled )
591{ 601{
592 if ( enabled ) { 602 if ( enabled ) {
593 mItemList->setVScrollBarMode(QScrollView::Auto); 603 mItemList->setVScrollBarMode(QScrollView::Auto);
594 mItemList->setHScrollBarMode(QScrollView::Auto); 604 mItemList->setHScrollBarMode(QScrollView::Auto);
@@ -609,64 +619,69 @@ Incidence *MonthViewCell::selectedIncidence()
609 if ( !item ) return 0; 619 if ( !item ) return 0;
610 620
611 return item->incidence(); 621 return item->incidence();
612} 622}
613 623
614QDate MonthViewCell::selectedIncidenceDate() 624QDate MonthViewCell::selectedIncidenceDate()
615{ 625{
616 QDate qd; 626 QDate qd;
617 int index = mItemList->currentItem(); 627 int index = mItemList->currentItem();
618 if ( index < 0 ) return qd; 628 if ( index < 0 ) return qd;
619 629
620 MonthViewItem *item = 630 MonthViewItem *item =
621 static_cast<MonthViewItem *>( mItemList->item( index ) ); 631 static_cast<MonthViewItem *>( mItemList->item( index ) );
622 632
623 if ( !item ) return qd; 633 if ( !item ) return qd;
624 634
625 return item->incidenceDate(); 635 return item->incidenceDate();
626} 636}
627 637
628void MonthViewCell::deselect() 638void MonthViewCell::deselect()
629{ 639{
630 mItemList->clearSelection(); 640 mItemList->clearSelection();
631 enableScrollBars( false ); 641 enableScrollBars( false );
632 // updateCell(); 642 // updateCell();
633} 643}
634void MonthViewCell::select() 644void MonthViewCell::select()
635{ 645{
636 ;// updateCell(); 646 ;// updateCell();
637} 647}
638 648
639void MonthViewCell::resizeEvent ( QResizeEvent * ) 649void MonthViewCell::resizeEvent ( QResizeEvent * )
640{ 650{
651 if ( !mMonthView->isUpdatePossible() )
652 return;
653 if ( !isVisible() ){
654 return;
655 }
641 int size = height() - mLabel->height(); 656 int size = height() - mLabel->height();
642 if ( size > 0 ) 657 if ( size > 0 )
643 mItemList->verticalScrollBar()->setMaximumHeight( size ); 658 mItemList->verticalScrollBar()->setMaximumHeight( size );
644 size = width() - mLabel->width(); 659 size = width() - mLabel->width();
645 if ( size > 0 ) 660 if ( size > 0 )
646 mItemList->horizontalScrollBar()->setMaximumWidth( size ); 661 mItemList->horizontalScrollBar()->setMaximumWidth( size );
647 mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); 662 mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() );
648 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 663 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
649} 664}
650 665
651void MonthViewCell::defaultAction( QListBoxItem *item ) 666void MonthViewCell::defaultAction( QListBoxItem *item )
652{ 667{
653 if ( !item ) return; 668 if ( !item ) return;
654 669
655 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 670 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
656 Incidence *incidence = eventItem->incidence(); 671 Incidence *incidence = eventItem->incidence();
657 if ( incidence ) mMonthView->defaultAction( incidence ); 672 if ( incidence ) mMonthView->defaultAction( incidence );
658} 673}
659void MonthViewCell::showDay() 674void MonthViewCell::showDay()
660{ 675{
661 emit showDaySignal( date() ); 676 emit showDaySignal( date() );
662} 677}
663void MonthViewCell::newEvent() 678void MonthViewCell::newEvent()
664{ 679{
665 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 680 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
666 emit newEventSignal( dt ); 681 emit newEventSignal( dt );
667} 682}
668void MonthViewCell::cellClicked( QListBoxItem *item ) 683void MonthViewCell::cellClicked( QListBoxItem *item )
669{ 684{
670 static QListBoxItem * lastClicked = 0; 685 static QListBoxItem * lastClicked = 0;
671 if ( item == 0 ) { 686 if ( item == 0 ) {
672 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 687 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
@@ -684,64 +699,65 @@ void MonthViewCell::cellClicked( QListBoxItem *item )
684 mMonthView->setSelectedCell( this ); 699 mMonthView->setSelectedCell( this );
685 if( KOPrefs::instance()->mEnableMonthScroll ) enableScrollBars( true ); 700 if( KOPrefs::instance()->mEnableMonthScroll ) enableScrollBars( true );
686 select(); 701 select();
687} 702}
688 703
689void MonthViewCell::contextMenu( QListBoxItem *item ) 704void MonthViewCell::contextMenu( QListBoxItem *item )
690{ 705{
691 if ( !item ) return; 706 if ( !item ) return;
692 707
693 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 708 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
694 Incidence *incidence = eventItem->incidence(); 709 Incidence *incidence = eventItem->incidence();
695 if ( incidence ) mMonthView->showContextMenu( incidence ); 710 if ( incidence ) mMonthView->showContextMenu( incidence );
696} 711}
697 712
698void MonthViewCell::selection( QListBoxItem *item ) 713void MonthViewCell::selection( QListBoxItem *item )
699{ 714{
700 if ( !item ) return; 715 if ( !item ) return;
701 716
702 mMonthView->setSelectedCell( this ); 717 mMonthView->setSelectedCell( this );
703} 718}
704 719
705 720
706// ******************************************************************************* 721// *******************************************************************************
707// ******************************************************************************* 722// *******************************************************************************
708// ******************************************************************************* 723// *******************************************************************************
709 724
710 725
711KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 726KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
712 : KOEventView( calendar, parent, name ), 727 : KOEventView( calendar, parent, name ),
713 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 728 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
714 mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 729 mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
715{ 730{
731 updatePossible = false;
716 mCells.setAutoDelete( true ); 732 mCells.setAutoDelete( true );
717 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 733 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
718 // mDayLayout = new QGridLayout( this ); 734 // mDayLayout = new QGridLayout( this );
719 // create the day of the week labels (Sun, Mon, etc) and add them to 735 // create the day of the week labels (Sun, Mon, etc) and add them to
720 // the layout. 736 // the layout.
721 mDayLabels.resize( mDaysPerWeek ); 737 mDayLabels.resize( mDaysPerWeek );
722 QFont bfont = font(); 738 QFont bfont = font();
723 if ( QApplication::desktop()->width() < 650 ) { 739 if ( QApplication::desktop()->width() < 650 ) {
724 bfont.setPointSize( bfont.pointSize() - 2 ); 740 bfont.setPointSize( bfont.pointSize() - 2 );
725 } 741 }
726 bfont.setBold( true ); 742 bfont.setBold( true );
727 int i; 743 int i;
728 744
729 for( i = 0; i < mDaysPerWeek; i++ ) { 745 for( i = 0; i < mDaysPerWeek; i++ ) {
730 QLabel *label = new QLabel( this ); 746 QLabel *label = new QLabel( this );
731 label->setFont(bfont); 747 label->setFont(bfont);
732 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 748 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
733 label->setLineWidth(1); 749 label->setLineWidth(1);
734 label->setAlignment(AlignCenter); 750 label->setAlignment(AlignCenter);
735 mDayLabels.insert( i, label ); 751 mDayLabels.insert( i, label );
736 } 752 }
737 753
738 bfont.setBold( false ); 754 bfont.setBold( false );
739 mWeekLabels.resize( mNumWeeks+1 ); 755 mWeekLabels.resize( mNumWeeks+1 );
740 for( i = 0; i < mNumWeeks+1; i++ ) { 756 for( i = 0; i < mNumWeeks+1; i++ ) {
741 KOWeekButton *label = new KOWeekButton( this ); 757 KOWeekButton *label = new KOWeekButton( this );
742 label->setFont(bfont); 758 label->setFont(bfont);
743 connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) ); 759 connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) );
744 label->setFlat(true); 760 label->setFlat(true);
745 QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); 761 QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view"));
746 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 762 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
747 //label->setLineWidth(1); 763 //label->setLineWidth(1);
@@ -891,99 +907,102 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
891 } 907 }
892 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); 908 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 );
893 for( i = 0; i < 6; ++i ) { 909 for( i = 0; i < 6; ++i ) {
894 int wno; 910 int wno;
895 // remember, according to ISO 8601, the first week of the year is the 911 // remember, according to ISO 8601, the first week of the year is the
896 // first week that contains a thursday. Thus we must subtract off 4, 912 // first week that contains a thursday. Thus we must subtract off 4,
897 // not just 1. 913 // not just 1.
898 int dayOfYear = date.dayOfYear(); 914 int dayOfYear = date.dayOfYear();
899 if (dayOfYear % 7 != 0) 915 if (dayOfYear % 7 != 0)
900 wno = dayOfYear / 7 + 1; 916 wno = dayOfYear / 7 + 1;
901 else 917 else
902 wno =dayOfYear / 7; 918 wno =dayOfYear / 7;
903 mWeekLabels[i]->setWeekNum( wno ); 919 mWeekLabels[i]->setWeekNum( wno );
904 date = date.addDays( 7 ); 920 date = date.addDays( 7 );
905 } 921 }
906 updateView(); 922 updateView();
907} 923}
908 924
909void KOMonthView::showEvents(QPtrList<Event>) 925void KOMonthView::showEvents(QPtrList<Event>)
910{ 926{
911 qDebug("KOMonthView::selectEvents is not implemented yet. "); 927 qDebug("KOMonthView::selectEvents is not implemented yet. ");
912} 928}
913 929
914void KOMonthView::changeEventDisplay(Event *, int) 930void KOMonthView::changeEventDisplay(Event *, int)
915{ 931{
916 // this should be re-written to be much more efficient, but this 932 // this should be re-written to be much more efficient, but this
917 // quick-and-dirty-hack gets the job done for right now. 933 // quick-and-dirty-hack gets the job done for right now.
918 updateView(); 934 updateView();
919} 935}
920 936
921void KOMonthView::updateView() 937void KOMonthView::updateView()
922{ 938{
923 939 static int iii = 0;
940 ++iii;
941 if ( !updatePossible )
942 return;
924 uint i; 943 uint i;
925 for( i = 0; i < mCells.count(); ++i ) { 944 for( i = 0; i < mCells.count(); ++i ) {
926 mCells[i]->updateCell(); 945 mCells[i]->updateCell();
927 } 946 }
928 //qDebug("KOMonthView::updateView() "); 947 //qDebug("KOMonthView::updateView() ");
929 processSelectionChange(); 948 processSelectionChange();
930} 949}
931 950
932void KOMonthView::resizeEvent(QResizeEvent * e) 951void KOMonthView::resizeEvent(QResizeEvent * e)
933{ 952{
934 computeLayout(); 953 computeLayout();
935} 954}
936void KOMonthView::computeLayout() 955void KOMonthView::computeLayout()
937{ 956{
938 // select the appropriate heading string size. E.g. "Wednesday" or "Wed". 957 // select the appropriate heading string size. E.g. "Wednesday" or "Wed".
939 // note this only changes the text if the requested size crosses the 958 // note this only changes the text if the requested size crosses the
940 // threshold between big enough to support the full name and not big 959 // threshold between big enough to support the full name and not big
941 // enough. 960 // enough.
942 961
943 int daysToShow = 7; 962 int daysToShow = 7;
944 bool combinedSatSun = false; 963 bool combinedSatSun = false;
945 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 964 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
946 daysToShow = 6; 965 daysToShow = 6;
947 combinedSatSun = true; 966 combinedSatSun = true;
948 } 967 }
949 int tWid = topLevelWidget()->size().width(); 968 int tWid = topLevelWidget()->size().width();
950 int tHei = topLevelWidget()->size().height(); 969 int tHei = topLevelWidget()->size().height();
951 970
952 int wid = size().width();//e 971 int wid = size().width();//e
953 int hei = size().height()-1; 972 int hei = size().height()-1;
954 973
955 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 974 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
956 return; 975 return;
957 976 //qDebug("KOMonthView::computeLayout()------------------------------------ ");
958 QFontMetrics fm ( mWeekLabels[0]->font() ); 977 QFontMetrics fm ( mWeekLabels[0]->font() );
959 int weeklabelwid = fm.width( "888" ); 978 int weeklabelwid = fm.width( "888" );
960 wid -= weeklabelwid; 979 wid -= weeklabelwid;
961 980
962 int colWid = wid / daysToShow; 981 int colWid = wid / daysToShow;
963 int lastCol = wid - ( colWid*6 ); 982 int lastCol = wid - ( colWid*6 );
964 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 983 int dayLabelHei = mDayLabels[0]->sizeHint().height();
965 int cellHei = (hei - dayLabelHei) /6; 984 int cellHei = (hei - dayLabelHei) /6;
966 int colModulo = wid % daysToShow; 985 int colModulo = wid % daysToShow;
967 int rowModulo = (hei- dayLabelHei) % 6; 986 int rowModulo = (hei- dayLabelHei) % 6;
968 //qDebug("rowmod %d ", rowModulo); 987 //qDebug("rowmod %d ", rowModulo);
969 int i; 988 int i;
970 int x,y,w,h; 989 int x,y,w,h;
971 x= 0; 990 x= 0;
972 y= 0; 991 y= 0;
973 w = colWid; 992 w = colWid;
974 h = dayLabelHei ; 993 h = dayLabelHei ;
975 for ( i = 0; i < 7; i++) { 994 for ( i = 0; i < 7; i++) {
976 if ( i == daysToShow-colModulo ) 995 if ( i == daysToShow-colModulo )
977 ++w; 996 ++w;
978 if ( combinedSatSun ) { 997 if ( combinedSatSun ) {
979 if ( i >= daysToShow-1 ) { 998 if ( i >= daysToShow-1 ) {
980 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); 999 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
981 x -= w/2 ; 1000 x -= w/2 ;
982 } 1001 }
983 else 1002 else
984 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1003 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
985 } else 1004 } else
986 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1005 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
987 x += w; 1006 x += w;
988 } 1007 }
989 x= 0; 1008 x= 0;
@@ -1003,64 +1022,68 @@ void KOMonthView::computeLayout()
1003 if ( (i)%7 == daysToShow-1 ) { 1022 if ( (i)%7 == daysToShow-1 ) {
1004 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); 1023 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 );
1005 x -= w ;y += h/2; 1024 x -= w ;y += h/2;
1006 } else { 1025 } else {
1007 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); 1026 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 );
1008 y -= h/2; 1027 y -= h/2;
1009 } 1028 }
1010 } else 1029 } else
1011 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1030 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1012 1031
1013 } 1032 }
1014 else 1033 else
1015 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1034 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1016 x += w; 1035 x += w;
1017 if ( x + w/2 > wid ) { 1036 if ( x + w/2 > wid ) {
1018 x = 0; 1037 x = 0;
1019 y += h; 1038 y += h;
1020 } 1039 }
1021 } 1040 }
1022 y= dayLabelHei; 1041 y= dayLabelHei;
1023 h = cellHei ; 1042 h = cellHei ;
1024 for ( i = 0; i < 6; i++) { 1043 for ( i = 0; i < 6; i++) {
1025 if ( i == (6-rowModulo)) 1044 if ( i == (6-rowModulo))
1026 ++h; 1045 ++h;
1027 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); 1046 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h);
1028 y += h; 1047 y += h;
1029 } 1048 }
1030 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1049 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1031 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1050 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1032 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1051 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1033 mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; 1052 mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ;
1034 updateDayLabels(); 1053 updateDayLabels();
1054 bool forceUpdate = !updatePossible;
1055 updatePossible = true;
1056 if ( forceUpdate )
1057 updateView();
1035} 1058}
1036 1059
1037void KOMonthView::showContextMenu( Incidence *incidence ) 1060void KOMonthView::showContextMenu( Incidence *incidence )
1038{ 1061{
1039 mContextMenu->showIncidencePopup(incidence); 1062 mContextMenu->showIncidencePopup(incidence);
1040 /* 1063 /*
1041 if( incidence && incidence->type() == "Event" ) { 1064 if( incidence && incidence->type() == "Event" ) {
1042 Event *event = static_cast<Event *>(incidence); 1065 Event *event = static_cast<Event *>(incidence);
1043 mContextMenu->showEventPopup(event); 1066 mContextMenu->showEventPopup(event);
1044 } else { 1067 } else {
1045 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; 1068 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl;
1046 } 1069 }
1047 */ 1070 */
1048} 1071}
1049MonthViewCell * KOMonthView::selectedCell( ) 1072MonthViewCell * KOMonthView::selectedCell( )
1050{ 1073{
1051 return mSelectedCell; 1074 return mSelectedCell;
1052} 1075}
1053void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1076void KOMonthView::setSelectedCell( MonthViewCell *cell )
1054{ 1077{
1055 // qDebug("KOMonthView::setSelectedCell "); 1078 // qDebug("KOMonthView::setSelectedCell ");
1056 if ( mSelectedCell && mSelectedCell != cell ) { 1079 if ( mSelectedCell && mSelectedCell != cell ) {
1057 MonthViewCell * mvc = mSelectedCell; 1080 MonthViewCell * mvc = mSelectedCell;
1058 mSelectedCell = cell; 1081 mSelectedCell = cell;
1059 mvc->deselect(); 1082 mvc->deselect();
1060 } else 1083 } else
1061 mSelectedCell = cell; 1084 mSelectedCell = cell;
1062 // if ( mSelectedCell ) 1085 // if ( mSelectedCell )
1063// mSelectedCell->select(); 1086// mSelectedCell->select();
1064 if ( !mSelectedCell ) 1087 if ( !mSelectedCell )
1065 emit incidenceSelected( 0 ); 1088 emit incidenceSelected( 0 );
1066 else 1089 else
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 4c1567c..727f511 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -11,101 +11,105 @@
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#ifndef _KOMONTHVIEW_H 20#ifndef _KOMONTHVIEW_H
21#define _KOMONTHVIEW_H 21#define _KOMONTHVIEW_H
22 22
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qframe.h> 24#include <qframe.h>
25#include <qdatetime.h> 25#include <qdatetime.h>
26#include <qlistbox.h> 26#include <qlistbox.h>
27#include <qpoint.h> 27#include <qpoint.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qintdict.h> 29#include <qintdict.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qvaluelist.h> 31#include <qvaluelist.h>
32#include <qptrvector.h> 32#include <qptrvector.h>
33 33
34#include <libkcal/calendar.h> 34#include <libkcal/calendar.h>
35#include <libkcal/event.h> 35#include <libkcal/event.h>
36 36
37#include "koeventview.h" 37#include "koeventview.h"
38 38
39#ifdef DESKTOP_VERSION 39#ifdef DESKTOP_VERSION
40class QToolTipGroup; 40class QToolTipGroup;
41#endif 41#endif
42 42
43class KNOWhatsThis;
43class KOWeekButton : public QPushButton 44class KOWeekButton : public QPushButton
44{ 45{
45 Q_OBJECT 46 Q_OBJECT
46 public: 47 public:
47 KOWeekButton( QWidget *parent=0, const char *name=0 ) : 48 KOWeekButton( QWidget *parent=0, const char *name=0 ) :
48 QPushButton( parent, name) 49 QPushButton( parent, name)
49 { 50 {
50 connect( this, SIGNAL( clicked() ), 51 connect( this, SIGNAL( clicked() ),
51 SLOT( bottonClicked() )); 52 SLOT( bottonClicked() ));
52 mNumber = -1; 53 mNumber = -1;
53 } 54 }
54 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} 55 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));}
55 signals: 56 signals:
56 void selectWeekNum ( int ); 57 void selectWeekNum ( int );
57private: 58private:
58 int mNumber; 59 int mNumber;
59private slots : 60private slots :
60 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } 61 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
61}; 62};
62 63
63class KNoScrollListBox: public QListBox 64class KNoScrollListBox: public QListBox
64{ 65{
65 Q_OBJECT 66 Q_OBJECT
66 public: 67 public:
67 KNoScrollListBox(QWidget *parent=0, const char *name=0); 68 KNoScrollListBox(QWidget *parent=0, const char *name=0);
68 ~KNoScrollListBox() {} 69 ~KNoScrollListBox();
69 QString getWhatsThisText(QPoint p) ; 70 QString getWhatsThisText(QPoint p) ;
70 71
71 signals: 72 signals:
72 void shiftDown(); 73 void shiftDown();
73 void shiftUp(); 74 void shiftUp();
74 void rightClick(); 75 void rightClick();
75 76
76 protected slots: 77 protected slots:
77 void keyPressEvent(QKeyEvent *); 78 void keyPressEvent(QKeyEvent *);
78 void keyReleaseEvent(QKeyEvent *); 79 void keyReleaseEvent(QKeyEvent *);
79 void mousePressEvent(QMouseEvent *); 80 void mousePressEvent(QMouseEvent *);
81
82 private:
83 KNOWhatsThis * mWT;
80}; 84};
81 85
82 86
83class MonthViewItem: public QListBoxItem 87class MonthViewItem: public QListBoxItem
84{ 88{
85 public: 89 public:
86 MonthViewItem( Incidence *, QDate qd, const QString & title ); 90 MonthViewItem( Incidence *, QDate qd, const QString & title );
87 91
88 void setRecur(bool on) { mRecur = on; } 92 void setRecur(bool on) { mRecur = on; }
89 void setAlarm(bool on) { mAlarm = on; } 93 void setAlarm(bool on) { mAlarm = on; }
90 void setReply(bool on) { mReply = on; } 94 void setReply(bool on) { mReply = on; }
91 void setMoreInfo(bool on) { mInfo = on; } 95 void setMoreInfo(bool on) { mInfo = on; }
92 96
93 97
94 void setPalette(const QPalette &p) { mPalette = p; } 98 void setPalette(const QPalette &p) { mPalette = p; }
95 QPalette palette() const { return mPalette; } 99 QPalette palette() const { return mPalette; }
96 100
97 Incidence *incidence() const { return mIncidence; } 101 Incidence *incidence() const { return mIncidence; }
98 QDate incidenceDate() { return mDate; } 102 QDate incidenceDate() { return mDate; }
99 103
100 protected: 104 protected:
101 virtual void paint(QPainter *); 105 virtual void paint(QPainter *);
102 virtual int height(const QListBox *) const; 106 virtual int height(const QListBox *) const;
103 virtual int width(const QListBox *) const; 107 virtual int width(const QListBox *) const;
104 108
105 private: 109 private:
106 bool mRecur; 110 bool mRecur;
107 bool mAlarm; 111 bool mAlarm;
108 bool mReply; 112 bool mReply;
109 bool mInfo; 113 bool mInfo;
110 114
111 QPalette mPalette; 115 QPalette mPalette;
@@ -183,83 +187,85 @@ class MonthViewCell : public QWidget
183 QPalette mStandardPalette; 187 QPalette mStandardPalette;
184 QPalette mPrimaryPalette; 188 QPalette mPrimaryPalette;
185 QPalette mNonPrimaryPalette; 189 QPalette mNonPrimaryPalette;
186 void setMyPalette(); 190 void setMyPalette();
187 QPalette getPalette (); 191 QPalette getPalette ();
188 void keyPressEvent ( QKeyEvent * ) ; 192 void keyPressEvent ( QKeyEvent * ) ;
189 193
190}; 194};
191 195
192 196
193class KOMonthView: public KOEventView 197class KOMonthView: public KOEventView
194{ 198{
195 Q_OBJECT 199 Q_OBJECT
196 public: 200 public:
197 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 201 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
198 ~KOMonthView(); 202 ~KOMonthView();
199 203
200 /** Returns maximum number of days supported by the komonthview */ 204 /** Returns maximum number of days supported by the komonthview */
201 virtual int maxDatesHint(); 205 virtual int maxDatesHint();
202 206
203 /** Returns number of currently shown dates. */ 207 /** Returns number of currently shown dates. */
204 virtual int currentDateCount(); 208 virtual int currentDateCount();
205 209
206 /** returns the currently selected events */ 210 /** returns the currently selected events */
207 virtual QPtrList<Incidence> selectedIncidences(); 211 virtual QPtrList<Incidence> selectedIncidences();
208 212
209 /** returns dates of the currently selected events */ 213 /** returns dates of the currently selected events */
210 virtual DateList selectedDates(); 214 virtual DateList selectedDates();
211 215
212 virtual void printPreview(CalPrinter *calPrinter, 216 virtual void printPreview(CalPrinter *calPrinter,
213 const QDate &, const QDate &); 217 const QDate &, const QDate &);
214 bool isMonthView() { return true; } 218 bool isMonthView() { return true; }
219 bool isUpdatePossible() { return updatePossible; }
215 220
216 MonthViewCell * selectedCell(); 221 MonthViewCell * selectedCell();
217 public slots: 222 public slots:
218 virtual void updateView(); 223 virtual void updateView();
219 virtual void updateConfig(); 224 virtual void updateConfig();
220 virtual void showDates(const QDate &start, const QDate &end); 225 virtual void showDates(const QDate &start, const QDate &end);
221 virtual void showEvents(QPtrList<Event> eventList); 226 virtual void showEvents(QPtrList<Event> eventList);
222 227
223 void changeEventDisplay(Event *, int); 228 void changeEventDisplay(Event *, int);
224 229
225 void clearSelection(); 230 void clearSelection();
226 231
227 void showContextMenu( Incidence * ); 232 void showContextMenu( Incidence * );
228 233
229 void setSelectedCell( MonthViewCell * ); 234 void setSelectedCell( MonthViewCell * );
230 235
231 protected slots: 236 protected slots:
232 void processSelectionChange(); 237 void processSelectionChange();
233 signals: 238 signals:
234 void selectWeekNum ( int ); 239 void selectWeekNum ( int );
235 void showDaySignal( QDate ); 240 void showDaySignal( QDate );
236 protected: 241 protected:
237 void resizeEvent(QResizeEvent *); 242 void resizeEvent(QResizeEvent *);
238 void viewChanged(); 243 void viewChanged();
239 void updateDayLabels(); 244 void updateDayLabels();
240 245
241 private: 246 private:
247 bool updatePossible;
242 int mDaysPerWeek; 248 int mDaysPerWeek;
243 int mNumWeeks; 249 int mNumWeeks;
244 int mNumCells; 250 int mNumCells;
245 bool mWeekStartsMonday; 251 bool mWeekStartsMonday;
246 bool mShowSatSunComp; 252 bool mShowSatSunComp;
247 void computeLayout(); 253 void computeLayout();
248 254
249 QPtrVector<MonthViewCell> mCells; 255 QPtrVector<MonthViewCell> mCells;
250 QPtrVector<QLabel> mDayLabels; 256 QPtrVector<QLabel> mDayLabels;
251 QPtrVector<KOWeekButton> mWeekLabels; 257 QPtrVector<KOWeekButton> mWeekLabels;
252 258
253 bool mShortDayLabels; 259 bool mShortDayLabels;
254 int mWidthLongDayLabel; 260 int mWidthLongDayLabel;
255 261
256 QDate mStartDate; 262 QDate mStartDate;
257 263
258 MonthViewCell *mSelectedCell; 264 MonthViewCell *mSelectedCell;
259 265
260 KOEventPopupMenu *mContextMenu; 266 KOEventPopupMenu *mContextMenu;
261 void keyPressEvent ( QKeyEvent * ) ; 267 void keyPressEvent ( QKeyEvent * ) ;
262 268
263}; 269};
264 270
265#endif 271#endif
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index cf56fcf..00a5842 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -16,64 +16,65 @@
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <qwidgetstack.h> 26#include <qwidgetstack.h>
27 27
28#include <kconfig.h> 28#include <kconfig.h>
29#include <kglobal.h> 29#include <kglobal.h>
30#ifndef DESKTOP_VERSION 30#ifndef DESKTOP_VERSION
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
32#else 32#else
33#include <qapplication.h> 33#include <qapplication.h>
34#endif 34#endif
35#include <qdatetime.h> 35#include <qdatetime.h>
36#include "calendarview.h" 36#include "calendarview.h"
37#include "datenavigator.h" 37#include "datenavigator.h"
38#include "kotodoview.h" 38#include "kotodoview.h"
39#include "koagendaview.h" 39#include "koagendaview.h"
40#include "kodialogmanager.h" 40#include "kodialogmanager.h"
41#include "komonthview.h" 41#include "komonthview.h"
42#include "kolistview.h" 42#include "kolistview.h"
43#include "kowhatsnextview.h" 43#include "kowhatsnextview.h"
44#include "kojournalview.h" 44#include "kojournalview.h"
45#include "kotimespanview.h" 45#include "kotimespanview.h"
46#include "koprefs.h" 46#include "koprefs.h"
47#include "navigatorbar.h" 47#include "navigatorbar.h"
48#include "kdatenavigator.h"
48 49
49#include "koviewmanager.h" 50#include "koviewmanager.h"
50//extern bool externFlagMonthviewBlockPainting; 51//extern bool externFlagMonthviewBlockPainting;
51 52
52//bool globalFlagBlockPainting = false; 53//bool globalFlagBlockPainting = false;
53int globalFlagBlockAgenda = 0; 54int globalFlagBlockAgenda = 0;
54int globalFlagBlockLabel = 0; 55int globalFlagBlockLabel = 0;
55int globalFlagBlockAgendaItemPaint = 1; 56int globalFlagBlockAgendaItemPaint = 1;
56int globalFlagBlockAgendaItemUpdate = 1; 57int globalFlagBlockAgendaItemUpdate = 1;
57 58
58 59
59KOViewManager::KOViewManager( CalendarView *mainView ) : 60KOViewManager::KOViewManager( CalendarView *mainView ) :
60 QObject(), mMainView( mainView ) 61 QObject(), mMainView( mainView )
61{ 62{
62 mCurrentView = 0; 63 mCurrentView = 0;
63 64
64 mWhatsNextView = 0; 65 mWhatsNextView = 0;
65 mTodoView = 0; 66 mTodoView = 0;
66 mAgendaView = 0; 67 mAgendaView = 0;
67 mMonthView = 0; 68 mMonthView = 0;
68 mListView = 0; 69 mListView = 0;
69 mJournalView = 0; 70 mJournalView = 0;
70 mTimeSpanView = 0; 71 mTimeSpanView = 0;
71 mCurrentAgendaView = 0 ; 72 mCurrentAgendaView = 0 ;
72 mFlagShowNextxDays = false; 73 mFlagShowNextxDays = false;
73} 74}
74 75
75KOViewManager::~KOViewManager() 76KOViewManager::~KOViewManager()
76{ 77{
77} 78}
78 79
79 80
@@ -247,66 +248,69 @@ void KOViewManager::showWhatsNextView()
247 248
248} 249}
249 250
250void KOViewManager::showListView() 251void KOViewManager::showListView()
251{ 252{
252 if (!mListView) { 253 if (!mListView) {
253 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 254 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
254 addView(mListView); 255 addView(mListView);
255 256
256 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 257 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
257 mMainView, SLOT(showIncidence(Incidence *))); 258 mMainView, SLOT(showIncidence(Incidence *)));
258 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 259 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
259 mMainView, SLOT(editIncidence(Incidence *))); 260 mMainView, SLOT(editIncidence(Incidence *)));
260 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 261 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
261 mMainView, SLOT(deleteIncidence(Incidence *))); 262 mMainView, SLOT(deleteIncidence(Incidence *)));
262 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 263 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
263 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 264 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
264 connect( mListView, SIGNAL( signalNewEvent() ), 265 connect( mListView, SIGNAL( signalNewEvent() ),
265 mMainView, SLOT( newEvent() ) ); 266 mMainView, SLOT( newEvent() ) );
266 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 267 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
267 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 268 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
268 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 269 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
269 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 270 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
270 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 271 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
271 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 272 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
272 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 273 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
273 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 274 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
274 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 275 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
275 } 276 }
276 // bool temp = mFlagShowNextxDays; 277 // bool temp = mFlagShowNextxDays;
277 //globalFlagBlockPainting = true; 278 //globalFlagBlockPainting = true;
278 globalFlagBlockAgenda = 1; 279 globalFlagBlockAgenda = 1;
279 if ( KOPrefs::instance()->mListViewMonthTimespan ) 280 if ( KOPrefs::instance()->mListViewMonthTimespan ) {
281 mMainView->setBlockShowDates( true );
280 mMainView->dateNavigator()->selectMonth(); 282 mMainView->dateNavigator()->selectMonth();
283 mMainView->setBlockShowDates( false );
284 }
281 showView(mListView, KOPrefs::instance()->mFullViewTodo); 285 showView(mListView, KOPrefs::instance()->mFullViewTodo);
282 //mFlagShowNextxDays = temp; 286 //mFlagShowNextxDays = temp;
283} 287}
284 288
285void KOViewManager::showAgendaView( bool fullScreen ) 289void KOViewManager::showAgendaView( bool fullScreen )
286{ 290{
287 291
288 mMainView->dialogManager()->hideSearchDialog(); 292 mMainView->dialogManager()->hideSearchDialog();
289 // qDebug("KOViewManager::showAgendaView "); 293 // qDebug("KOViewManager::showAgendaView ");
290 bool full; 294 bool full;
291 full = fullScreen; 295 full = fullScreen;
292 if (!mAgendaView) { 296 if (!mAgendaView) {
293 full = false; 297 full = false;
294 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); 298 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
295 addView(mAgendaView); 299 addView(mAgendaView);
296#ifndef DESKTOP_VERSION 300#ifndef DESKTOP_VERSION
297 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); 301 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
298#endif 302#endif
299 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), 303 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )),
300 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); 304 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) ));
301 305
302 // SIGNALS/SLOTS FOR DAY/WEEK VIEW 306 // SIGNALS/SLOTS FOR DAY/WEEK VIEW
303 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), 307 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)),
304 mMainView, SLOT(newEvent(QDateTime))); 308 mMainView, SLOT(newEvent(QDateTime)));
305 // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), 309 // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)),
306 // mMainView, SLOT(newEvent(QDateTime,QDateTime))); 310 // mMainView, SLOT(newEvent(QDateTime,QDateTime)));
307 connect(mAgendaView,SIGNAL(newEventSignal(QDate)), 311 connect(mAgendaView,SIGNAL(newEventSignal(QDate)),
308 mMainView, SLOT(newEvent(QDate))); 312 mMainView, SLOT(newEvent(QDate)));
309 313
310 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), 314 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)),
311 mMainView, SLOT(editIncidence(Incidence *))); 315 mMainView, SLOT(editIncidence(Incidence *)));
312 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), 316 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)),