author | zautrix <zautrix> | 2005-02-02 20:10:54 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-02 20:10:54 (UTC) |
commit | f79d089ec5c44a27f9005da76e452b4574eae27f (patch) (unidiff) | |
tree | bba6aa76939a7bd736230329088b812cabfa3204 | |
parent | 20191b4c5acf30282436a7f7215719f7b2ec8b01 (diff) | |
download | kdepimpi-f79d089ec5c44a27f9005da76e452b4574eae27f.zip kdepimpi-f79d089ec5c44a27f9005da76e452b4574eae27f.tar.gz kdepimpi-f79d089ec5c44a27f9005da76e452b4574eae27f.tar.bz2 |
fix
-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 | |||
@@ -387,97 +387,96 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
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")), |
@@ -546,97 +545,97 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
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 |