-rw-r--r-- | korganizer/koagendaview.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index f8301f8..918931a 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -339,352 +339,351 @@ void EventIndicator::changeColumns(int columns) | |||
339 | 339 | ||
340 | void EventIndicator::enableColumn(int column, bool enable) | 340 | void EventIndicator::enableColumn(int column, bool enable) |
341 | { | 341 | { |
342 | mEnabled[column] = enable; | 342 | mEnabled[column] = enable; |
343 | } | 343 | } |
344 | 344 | ||
345 | 345 | ||
346 | //////////////////////////////////////////////////////////////////////////// | 346 | //////////////////////////////////////////////////////////////////////////// |
347 | //////////////////////////////////////////////////////////////////////////// | 347 | //////////////////////////////////////////////////////////////////////////// |
348 | //////////////////////////////////////////////////////////////////////////// | 348 | //////////////////////////////////////////////////////////////////////////// |
349 | 349 | ||
350 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | 350 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : |
351 | KOEventView (cal,parent,name) | 351 | KOEventView (cal,parent,name) |
352 | { | 352 | { |
353 | mBlockUpdating = true; | 353 | mBlockUpdating = true; |
354 | mStartHour = 8; | 354 | mStartHour = 8; |
355 | mSelectedDates.append(QDate::currentDate()); | 355 | mSelectedDates.append(QDate::currentDate()); |
356 | 356 | ||
357 | mLayoutDayLabels = 0; | 357 | mLayoutDayLabels = 0; |
358 | mDayLabelsFrame = 0; | 358 | mDayLabelsFrame = 0; |
359 | mDayLabels = 0; | 359 | mDayLabels = 0; |
360 | bool isRTL = KOGlobals::self()->reverseLayout(); | 360 | bool isRTL = KOGlobals::self()->reverseLayout(); |
361 | 361 | ||
362 | if ( KOPrefs::instance()->mVerticalScreen ) { | 362 | if ( KOPrefs::instance()->mVerticalScreen ) { |
363 | mExpandedPixmap = SmallIcon( "1downarrow" ); | 363 | mExpandedPixmap = SmallIcon( "1downarrow" ); |
364 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); | 364 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); |
365 | } else { | 365 | } else { |
366 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); | 366 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); |
367 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); | 367 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); |
368 | } | 368 | } |
369 | 369 | ||
370 | QBoxLayout *topLayout = new QVBoxLayout(this); | 370 | QBoxLayout *topLayout = new QVBoxLayout(this); |
371 | 371 | ||
372 | // Create day name labels for agenda columns | 372 | // Create day name labels for agenda columns |
373 | mDayLabelsFrame = new QHBox(this); | 373 | mDayLabelsFrame = new QHBox(this); |
374 | topLayout->addWidget(mDayLabelsFrame); | 374 | topLayout->addWidget(mDayLabelsFrame); |
375 | mDayLabels = new QFrame (mDayLabelsFrame); | 375 | mDayLabels = new QFrame (mDayLabelsFrame); |
376 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 376 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
377 | // Create agenda splitter | 377 | // Create agenda splitter |
378 | #ifndef KORG_NOSPLITTER | 378 | #ifndef KORG_NOSPLITTER |
379 | mSplitterAgenda = new QSplitter(Vertical,this); | 379 | mSplitterAgenda = new QSplitter(Vertical,this); |
380 | topLayout->addWidget(mSplitterAgenda); | 380 | topLayout->addWidget(mSplitterAgenda); |
381 | mSplitterAgenda->setOpaqueResize(); | 381 | mSplitterAgenda->setOpaqueResize(); |
382 | 382 | ||
383 | mAllDayFrame = new QHBox(mSplitterAgenda); | 383 | mAllDayFrame = new QHBox(mSplitterAgenda); |
384 | 384 | ||
385 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 385 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
386 | #else | 386 | #else |
387 | #if 0 | 387 | #if 0 |
388 | QWidget *mainBox = new QWidget( this ); | 388 | QWidget *mainBox = new QWidget( this ); |
389 | topLayout->addWidget( mainBox ); | 389 | topLayout->addWidget( mainBox ); |
390 | QBoxLayout *mainLayout = new QVBoxLayout(mainBox); | 390 | QBoxLayout *mainLayout = new QVBoxLayout(mainBox); |
391 | mAllDayFrame = new QHBox(mainBox); | 391 | mAllDayFrame = new QHBox(mainBox); |
392 | mainLayout->addWidget(mAllDayFrame); | 392 | mainLayout->addWidget(mAllDayFrame); |
393 | mainLayout->setStretchFactor( mAllDayFrame, 0 ); | 393 | mainLayout->setStretchFactor( mAllDayFrame, 0 ); |
394 | mAllDayFrame->setFocusPolicy(NoFocus); | 394 | mAllDayFrame->setFocusPolicy(NoFocus); |
395 | QWidget *agendaFrame = new QWidget(mainBox); | 395 | QWidget *agendaFrame = new QWidget(mainBox); |
396 | mainLayout->addWidget(agendaFrame); | 396 | mainLayout->addWidget(agendaFrame); |
397 | mainLayout->setStretchFactor( agendaFrame, 10 ); | 397 | mainLayout->setStretchFactor( agendaFrame, 10 ); |
398 | 398 | ||
399 | agendaFrame->setFocusPolicy(NoFocus); | 399 | agendaFrame->setFocusPolicy(NoFocus); |
400 | #endif | 400 | #endif |
401 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 401 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
402 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 402 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
403 | topLayout->addWidget( mSplitterAgenda ); | 403 | topLayout->addWidget( mSplitterAgenda ); |
404 | mAllDayFrame = new QHBox(mSplitterAgenda); | 404 | mAllDayFrame = new QHBox(mSplitterAgenda); |
405 | mAllDayFrame->setFocusPolicy(NoFocus); | 405 | mAllDayFrame->setFocusPolicy(NoFocus); |
406 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 406 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
407 | agendaFrame->setFocusPolicy(NoFocus); | 407 | agendaFrame->setFocusPolicy(NoFocus); |
408 | 408 | ||
409 | #endif | 409 | #endif |
410 | 410 | ||
411 | // Create all-day agenda widget | 411 | // Create all-day agenda widget |
412 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 412 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
413 | 413 | ||
414 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 414 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
415 | mExpandButton->setPixmap( mNotExpandedPixmap ); | 415 | mExpandButton->setPixmap( mNotExpandedPixmap ); |
416 | int widebut = mExpandButton->sizeHint().width(); | 416 | int widebut = mExpandButton->sizeHint().width(); |
417 | if ( QApplication::desktop()->width() < 480 ) | 417 | if ( QApplication::desktop()->width() < 480 ) |
418 | widebut = widebut*2; | 418 | widebut = widebut*2; |
419 | else | 419 | else |
420 | widebut = (widebut*3) / 2; | 420 | widebut = (widebut*3) / 2; |
421 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 421 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
422 | // QSizePolicy::Fixed ) ); | 422 | // QSizePolicy::Fixed ) ); |
423 | mExpandButton->setFixedSize( widebut, widebut); | 423 | mExpandButton->setFixedSize( widebut, widebut); |
424 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 424 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
425 | mExpandButton->setFocusPolicy(NoFocus); | 425 | mExpandButton->setFocusPolicy(NoFocus); |
426 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 426 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
427 | mAllDayAgenda->setFocusPolicy(NoFocus); | 427 | mAllDayAgenda->setFocusPolicy(NoFocus); |
428 | QVBox *dummyAllDayRight = new QVBox(mAllDayFrame); | 428 | QVBox *dummyAllDayRight = new QVBox(mAllDayFrame); |
429 | 429 | ||
430 | QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight); | 430 | QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight); |
431 | mDummyAllDayRightL = new QLabel ( dummyAllDayRight ); | 431 | mDummyAllDayRightL = new QLabel ( dummyAllDayRight ); |
432 | 432 | ||
433 | dummyAllDayRightB->setFlat( true ); | 433 | dummyAllDayRightB->setFlat( true ); |
434 | dummyAllDayRightB->setFocusPolicy(NoFocus); | 434 | dummyAllDayRightB->setFocusPolicy(NoFocus); |
435 | // dummyAllDayRightB->setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); | ||
436 | dummyAllDayRightB->setFixedHeight( (dummyAllDayRightB->sizeHint().height()/4)*3 ); | 435 | dummyAllDayRightB->setFixedHeight( (dummyAllDayRightB->sizeHint().height()/4)*3 ); |
437 | QPopupMenu * wpo = new QPopupMenu (this); | 436 | QPopupMenu * wpo = new QPopupMenu (this); |
438 | wpo->insertItem( i18n("W#"), 0 ); | 437 | wpo->insertItem( i18n("W#"), 0 ); |
439 | int i; | 438 | int i; |
440 | for ( i = 1; i < 53; i++ ) | 439 | for ( i = 1; i < 53; i++ ) |
441 | wpo->insertItem( QString::number( i ),i ); | 440 | wpo->insertItem( QString::number( i ),i ); |
442 | //Qt bug - we must add some empty fields... | 441 | //Qt bug - we must add some empty fields... |
443 | for ( i = 53; i < 54; ++i ) { | 442 | for ( i = 53; i < 54; ++i ) { |
444 | wpo->insertItem( "", 52 ); | 443 | wpo->insertItem( "", 52 ); |
445 | } | 444 | } |
446 | dummyAllDayRightB->setPopup( wpo ); | 445 | dummyAllDayRightB->setPopup( wpo ); |
447 | 446 | ||
448 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); | 447 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); |
449 | 448 | ||
450 | // Create event context menu for all day agenda | 449 | // Create event context menu for all day agenda |
451 | mAllDayAgendaPopup = eventPopup(); | 450 | mAllDayAgendaPopup = eventPopup(); |
452 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 451 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
453 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 452 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
454 | 453 | ||
455 | // Create agenda frame | 454 | // Create agenda frame |
456 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); | 455 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); |
457 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 456 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
458 | 457 | ||
459 | // create event indicator bars | 458 | // create event indicator bars |
460 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 459 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
461 | agendaLayout->addWidget(mEventIndicatorTop,0,1); | 460 | agendaLayout->addWidget(mEventIndicatorTop,0,1); |
462 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 461 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
463 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 462 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
464 | agendaFrame); | 463 | agendaFrame); |
465 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); | 464 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); |
466 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 465 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
467 | agendaLayout->addWidget(dummyAgendaRight,0,2); | 466 | agendaLayout->addWidget(dummyAgendaRight,0,2); |
468 | 467 | ||
469 | // Create time labels | 468 | // Create time labels |
470 | mTimeLabels = new TimeLabels(24,agendaFrame); | 469 | mTimeLabels = new TimeLabels(24,agendaFrame); |
471 | agendaLayout->addWidget(mTimeLabels,1,0); | 470 | agendaLayout->addWidget(mTimeLabels,1,0); |
472 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 471 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
473 | this,SLOT(updateConfig())); | 472 | this,SLOT(updateConfig())); |
474 | 473 | ||
475 | // Create agenda | 474 | // Create agenda |
476 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 475 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
477 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); | 476 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); |
478 | agendaLayout->setColStretch(1,1); | 477 | agendaLayout->setColStretch(1,1); |
479 | mAgenda->setFocusPolicy(NoFocus); | 478 | mAgenda->setFocusPolicy(NoFocus); |
480 | // Create event context menu for agenda | 479 | // Create event context menu for agenda |
481 | mAgendaPopup = eventPopup(); | 480 | mAgendaPopup = eventPopup(); |
482 | 481 | ||
483 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 482 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
484 | i18n("Toggle Alarm"),mAgenda, | 483 | i18n("Toggle Alarm"),mAgenda, |
485 | SLOT(popupAlarm()),true); | 484 | SLOT(popupAlarm()),true); |
486 | 485 | ||
487 | 486 | ||
488 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 487 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
489 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 488 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
490 | 489 | ||
491 | // make connections between dependent widgets | 490 | // make connections between dependent widgets |
492 | mTimeLabels->setAgenda(mAgenda); | 491 | mTimeLabels->setAgenda(mAgenda); |
493 | 492 | ||
494 | // Update widgets to reflect user preferences | 493 | // Update widgets to reflect user preferences |
495 | // updateConfig(); | 494 | // updateConfig(); |
496 | 495 | ||
497 | // createDayLabels(); | 496 | // createDayLabels(); |
498 | 497 | ||
499 | // these blank widgets make the All Day Event box line up with the agenda | 498 | // these blank widgets make the All Day Event box line up with the agenda |
500 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 499 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
501 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 500 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
502 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 501 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
503 | 502 | ||
504 | // Scrolling | 503 | // Scrolling |
505 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 504 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
506 | mTimeLabels, SLOT(positionChanged())); | 505 | mTimeLabels, SLOT(positionChanged())); |
507 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 506 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
508 | SLOT(setContentsPos(int))); | 507 | SLOT(setContentsPos(int))); |
509 | 508 | ||
510 | connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); | 509 | connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); |
511 | connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); | 510 | connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); |
512 | 511 | ||
513 | // Create/Show/Edit/Delete Event | 512 | // Create/Show/Edit/Delete Event |
514 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), | 513 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), |
515 | SLOT(newEvent(int,int))); | 514 | SLOT(newEvent(int,int))); |
516 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), | 515 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), |
517 | SLOT(newTodo(int,int))); | 516 | SLOT(newTodo(int,int))); |
518 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 517 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
519 | SLOT(newEvent(int,int,int,int))); | 518 | SLOT(newEvent(int,int,int,int))); |
520 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 519 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
521 | SLOT(newEventAllDay(int,int))); | 520 | SLOT(newEventAllDay(int,int))); |
522 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), | 521 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), |
523 | SLOT(newTodoAllDay(int,int))); | 522 | SLOT(newTodoAllDay(int,int))); |
524 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 523 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
525 | SLOT(newEventAllDay(int,int))); | 524 | SLOT(newEventAllDay(int,int))); |
526 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 525 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
527 | SLOT(newTimeSpanSelected(int,int,int,int))); | 526 | SLOT(newTimeSpanSelected(int,int,int,int))); |
528 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 527 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
529 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); | 528 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); |
530 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 529 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
531 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 530 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
532 | 531 | ||
533 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 532 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
534 | SIGNAL(editIncidenceSignal(Incidence *))); | 533 | SIGNAL(editIncidenceSignal(Incidence *))); |
535 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 534 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
536 | SIGNAL(editIncidenceSignal(Incidence *))); | 535 | SIGNAL(editIncidenceSignal(Incidence *))); |
537 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 536 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
538 | SIGNAL(showIncidenceSignal(Incidence *))); | 537 | SIGNAL(showIncidenceSignal(Incidence *))); |
539 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 538 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
540 | SIGNAL(showIncidenceSignal(Incidence *))); | 539 | SIGNAL(showIncidenceSignal(Incidence *))); |
541 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 540 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
542 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 541 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
543 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 542 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
544 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 543 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
545 | 544 | ||
546 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 545 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
547 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 546 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
548 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 547 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
549 | SLOT(updateEventDates(KOAgendaItem *, int))); | 548 | SLOT(updateEventDates(KOAgendaItem *, int))); |
550 | 549 | ||
551 | // event indicator update | 550 | // event indicator update |
552 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 551 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
553 | SLOT(updateEventIndicatorTop(int))); | 552 | SLOT(updateEventIndicatorTop(int))); |
554 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 553 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
555 | SLOT(updateEventIndicatorBottom(int))); | 554 | SLOT(updateEventIndicatorBottom(int))); |
556 | // drag signals | 555 | // drag signals |
557 | /* | 556 | /* |
558 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 557 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
559 | SLOT(startDrag(Event *))); | 558 | SLOT(startDrag(Event *))); |
560 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 559 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
561 | SLOT(startDrag(Event *))); | 560 | SLOT(startDrag(Event *))); |
562 | */ | 561 | */ |
563 | // synchronize selections | 562 | // synchronize selections |
564 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 563 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
565 | mAllDayAgenda, SLOT( deselectItem() ) ); | 564 | mAllDayAgenda, SLOT( deselectItem() ) ); |
566 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 565 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
567 | mAgenda, SLOT( deselectItem() ) ); | 566 | mAgenda, SLOT( deselectItem() ) ); |
568 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 567 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
569 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 568 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
570 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 569 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
571 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 570 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
572 | connect( mAgenda, SIGNAL( resizedSignal() ), | 571 | connect( mAgenda, SIGNAL( resizedSignal() ), |
573 | SLOT( updateConfig( ) ) ); | 572 | SLOT( updateConfig( ) ) ); |
574 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 573 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
575 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 574 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
576 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 575 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
577 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 576 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
578 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 577 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
579 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 578 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
580 | 579 | ||
581 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; | 580 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; |
582 | QFontMetrics fm ( dlf ); | 581 | QFontMetrics fm ( dlf ); |
583 | QString dayTest = "30"; | 582 | QString dayTest = "30"; |
584 | int wid = fm.width( dayTest ); | 583 | int wid = fm.width( dayTest ); |
585 | int maxWid = dummyAllDayRight->width(); | 584 | int maxWid = dummyAllDayRight->width(); |
586 | int fontPoint = dlf.pointSize(); | 585 | int fontPoint = dlf.pointSize(); |
587 | while ( wid > maxWid ) { | 586 | while ( wid > maxWid ) { |
588 | --fontPoint; | 587 | --fontPoint; |
589 | dlf.setPointSize( fontPoint ); | 588 | dlf.setPointSize( fontPoint ); |
590 | QFontMetrics f( dlf ); | 589 | QFontMetrics f( dlf ); |
591 | wid = f.width( dayTest ); | 590 | wid = f.width( dayTest ); |
592 | } | 591 | } |
593 | mDummyAllDayRightL->setFont( dlf ); | 592 | mDummyAllDayRightL->setFont( dlf ); |
594 | 593 | mDummyAllDayRightL->setAlignment( AlignHCenter ); | |
595 | } | 594 | } |
596 | 595 | ||
597 | void KOAgendaView::toggleAllDay() | 596 | void KOAgendaView::toggleAllDay() |
598 | { | 597 | { |
599 | if ( mSplitterAgenda->firstHandle() ) | 598 | if ( mSplitterAgenda->firstHandle() ) |
600 | mSplitterAgenda->firstHandle()->toggle(); | 599 | mSplitterAgenda->firstHandle()->toggle(); |
601 | } | 600 | } |
602 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 601 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
603 | { | 602 | { |
604 | calendar()->addIncidence( inc ); | 603 | calendar()->addIncidence( inc ); |
605 | 604 | ||
606 | if ( incOld ) { | 605 | if ( incOld ) { |
607 | if ( incOld->type() == "Todo" ) | 606 | if ( incOld->type() == "Todo" ) |
608 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 607 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
609 | else | 608 | else |
610 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 609 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
611 | } | 610 | } |
612 | 611 | ||
613 | } | 612 | } |
614 | 613 | ||
615 | KOAgendaView::~KOAgendaView() | 614 | KOAgendaView::~KOAgendaView() |
616 | { | 615 | { |
617 | delete mAgendaPopup; | 616 | delete mAgendaPopup; |
618 | delete mAllDayAgendaPopup; | 617 | delete mAllDayAgendaPopup; |
619 | delete KOAgendaItem::paintPix(); | 618 | delete KOAgendaItem::paintPix(); |
620 | delete KOAgendaItem::paintPixSel(); | 619 | delete KOAgendaItem::paintPixSel(); |
621 | } | 620 | } |
622 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 621 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
623 | { | 622 | { |
624 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 623 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
625 | bool uc = false; | 624 | bool uc = false; |
626 | int ow = e->oldSize().width(); | 625 | int ow = e->oldSize().width(); |
627 | int oh = e->oldSize().height(); | 626 | int oh = e->oldSize().height(); |
628 | int w = e->size().width(); | 627 | int w = e->size().width(); |
629 | int h = e->size().height(); | 628 | int h = e->size().height(); |
630 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 629 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
631 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 630 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
632 | uc = true; | 631 | uc = true; |
633 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 632 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
634 | } | 633 | } |
635 | mUpcomingWidth = e->size().width() ; | 634 | mUpcomingWidth = e->size().width() ; |
636 | if ( mBlockUpdating || uc ) { | 635 | if ( mBlockUpdating || uc ) { |
637 | mBlockUpdating = false; | 636 | mBlockUpdating = false; |
638 | //mAgenda->setMinimumSize(800 , 600 ); | 637 | //mAgenda->setMinimumSize(800 , 600 ); |
639 | //qDebug("mAgenda->resize+++++++++++++++ "); | 638 | //qDebug("mAgenda->resize+++++++++++++++ "); |
640 | updateConfig(); | 639 | updateConfig(); |
641 | //qDebug("KOAgendaView::Updating now possible "); | 640 | //qDebug("KOAgendaView::Updating now possible "); |
642 | } else | 641 | } else |
643 | createDayLabels(); | 642 | createDayLabels(); |
644 | //qDebug("resizeEvent end "); | 643 | //qDebug("resizeEvent end "); |
645 | 644 | ||
646 | } | 645 | } |
647 | void KOAgendaView::slotDaylabelClicked( int num ) | 646 | void KOAgendaView::slotDaylabelClicked( int num ) |
648 | { | 647 | { |
649 | 648 | ||
650 | QDate firstDate = mSelectedDates.first(); | 649 | QDate firstDate = mSelectedDates.first(); |
651 | if ( num == -1 ) | 650 | if ( num == -1 ) |
652 | emit showDateView( 6, firstDate ); | 651 | emit showDateView( 6, firstDate ); |
653 | else if (num >= 0 ) { | 652 | else if (num >= 0 ) { |
654 | if ( mSelectedDates.count() == 1) | 653 | if ( mSelectedDates.count() == 1) |
655 | emit showDateView( 9, firstDate.addDays( num ) ); | 654 | emit showDateView( 9, firstDate.addDays( num ) ); |
656 | else | 655 | else |
657 | emit showDateView( 3, firstDate.addDays( num ) ); | 656 | emit showDateView( 3, firstDate.addDays( num ) ); |
658 | } | 657 | } |
659 | else | 658 | else |
660 | showDateView( 10, firstDate.addDays(1) ); | 659 | showDateView( 10, firstDate.addDays(1) ); |
661 | } | 660 | } |
662 | 661 | ||
663 | KOAgendaButton* KOAgendaView::getNewDaylabel() | 662 | KOAgendaButton* KOAgendaView::getNewDaylabel() |
664 | { | 663 | { |
665 | 664 | ||
666 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); | 665 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); |
667 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); | 666 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); |
668 | mDayLabelsList.append( dayLabel ); | 667 | mDayLabelsList.append( dayLabel ); |
669 | mLayoutDayLabels->addWidget(dayLabel); | 668 | mLayoutDayLabels->addWidget(dayLabel); |
670 | return dayLabel ; | 669 | return dayLabel ; |
671 | } | 670 | } |
672 | 671 | ||
673 | void KOAgendaView::createDayLabels() | 672 | void KOAgendaView::createDayLabels() |
674 | { | 673 | { |
675 | 674 | ||
676 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { | 675 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { |
677 | // qDebug(" KOAgendaView::createDayLabels() blocked "); | 676 | // qDebug(" KOAgendaView::createDayLabels() blocked "); |
678 | return; | 677 | return; |
679 | 678 | ||
680 | } | 679 | } |
681 | int newHight; | 680 | int newHight; |
682 | 681 | ||
683 | // ### Before deleting and recreating we could check if mSelectedDates changed... | 682 | // ### Before deleting and recreating we could check if mSelectedDates changed... |
684 | // It would remove some flickering and gain speed (since this is called by | 683 | // It would remove some flickering and gain speed (since this is called by |
685 | // each updateView() call) | 684 | // each updateView() call) |
686 | 685 | ||
687 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; | 686 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; |
688 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); | 687 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); |
689 | if ( maxWid < 0 ) | 688 | if ( maxWid < 0 ) |
690 | maxWid = 20; | 689 | maxWid = 20; |