-rw-r--r-- | kalarmd/simplealarmdaemonimpl.cpp | 4 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 2 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 65 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 5 |
5 files changed, 75 insertions, 2 deletions
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp index ec7f730..e8ec033 100644 --- a/kalarmd/simplealarmdaemonimpl.cpp +++ b/kalarmd/simplealarmdaemonimpl.cpp | |||
@@ -469,213 +469,215 @@ void SimpleAlarmDaemonImpl::confTimer( int time ) | |||
469 | //qDebug("impleAlarmDaemonImpl::confTimer() %d ", time ); | 469 | //qDebug("impleAlarmDaemonImpl::confTimer() %d ", time ); |
470 | int minutes = time; | 470 | int minutes = time; |
471 | if ( minutes == 0 ) { | 471 | if ( minutes == 0 ) { |
472 | if ( ! mTimerTime ) | 472 | if ( ! mTimerTime ) |
473 | return; | 473 | return; |
474 | 474 | ||
475 | QDialog dia ( 0, ("Stop Timer" ), true ); | 475 | QDialog dia ( 0, ("Stop Timer" ), true ); |
476 | QLabel lab (("Really stop the timer?\n\n"+ mRunningTimerText+"\n"), &dia ); | 476 | QLabel lab (("Really stop the timer?\n\n"+ mRunningTimerText+"\n"), &dia ); |
477 | lab.setAlignment( AlignCenter ); | 477 | lab.setAlignment( AlignCenter ); |
478 | dia.setCaption(("KO/Pi Timer Stop" )); | 478 | dia.setCaption(("KO/Pi Timer Stop" )); |
479 | QVBoxLayout lay( &dia ); | 479 | QVBoxLayout lay( &dia ); |
480 | lay.addWidget( &lab); | 480 | lay.addWidget( &lab); |
481 | QPushButton ok ( "Stop timer!", &dia); | 481 | QPushButton ok ( "Stop timer!", &dia); |
482 | QFont fo = dia.font(); | 482 | QFont fo = dia.font(); |
483 | fo.setPointSize( 36 ); | 483 | fo.setPointSize( 36 ); |
484 | ok.setFont( fo ); | 484 | ok.setFont( fo ); |
485 | lay.addWidget( &ok); | 485 | lay.addWidget( &ok); |
486 | connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); | 486 | connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); |
487 | QPushButton con ( "Continue timer!", &dia); | 487 | QPushButton con ( "Continue timer!", &dia); |
488 | fo.setPointSize( 36 ); | 488 | fo.setPointSize( 36 ); |
489 | con.setFont( fo ); | 489 | con.setFont( fo ); |
490 | lay.addWidget( &con); | 490 | lay.addWidget( &con); |
491 | connect ( &con, SIGNAL (clicked()), &dia, SLOT ( reject() ) ); | 491 | connect ( &con, SIGNAL (clicked()), &dia, SLOT ( reject() ) ); |
492 | lay.setMargin(5); | 492 | lay.setMargin(5); |
493 | lay.setSpacing(5); | 493 | lay.setSpacing(5); |
494 | dia.resize(dia.sizeHint() ); | 494 | dia.resize(dia.sizeHint() ); |
495 | 495 | ||
496 | if ( !dia.exec() ) | 496 | if ( !dia.exec() ) |
497 | return; | 497 | return; |
498 | 498 | ||
499 | AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.latin1() ); | 499 | AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.latin1() ); |
500 | mTimerTime = 0; | 500 | mTimerTime = 0; |
501 | return; | 501 | return; |
502 | } | 502 | } |
503 | if ( mTimerTime ) | 503 | if ( mTimerTime ) |
504 | return; | 504 | return; |
505 | if ( minutes == 1 ) { | 505 | if ( minutes == 1 ) { |
506 | return; | 506 | return; |
507 | } | 507 | } |
508 | QString mess = "timer_alarm"; | 508 | QString mess = "timer_alarm"; |
509 | mess += ("Timer Alarm!\n"); | 509 | mess += ("Timer Alarm!\n"); |
510 | if ( minutes == 22 ) { | 510 | if ( minutes == 22 ) { |
511 | mess += ( "Pizza is ready"); | 511 | mess += ( "Pizza is ready"); |
512 | mRunningTimerText = "Pizza"; | 512 | mRunningTimerText = "Pizza"; |
513 | } | 513 | } |
514 | else if ( minutes == 45 ) { | 514 | else if ( minutes == 45 ) { |
515 | mess += ( "Please wake up!"); | 515 | mess += ( "Please wake up!"); |
516 | mRunningTimerText = "Nap"; | 516 | mRunningTimerText = "Nap"; |
517 | } | 517 | } |
518 | else if ( minutes == 5 ) { | 518 | else if ( minutes == 5 ) { |
519 | mess += ( "Tea is ready"); | 519 | mess += ( "Tea is ready"); |
520 | mRunningTimerText = "Tea"; | 520 | mRunningTimerText = "Tea"; |
521 | } | 521 | } |
522 | else if ( minutes == 3 ) { | 522 | else if ( minutes == 3 ) { |
523 | mess += mCustomText; | 523 | mess += mCustomText; |
524 | minutes = mCustomMinutes ; | 524 | minutes = mCustomMinutes ; |
525 | mRunningTimerText = mCustomText.stripWhiteSpace (); | 525 | mRunningTimerText = mCustomText.stripWhiteSpace (); |
526 | int in = mRunningTimerText.find( " " ); | 526 | int in = mRunningTimerText.find( " " ); |
527 | mRunningTimerText = mRunningTimerText.left ( in ); | 527 | mRunningTimerText = mRunningTimerText.left ( in ); |
528 | } | 528 | } |
529 | else { | 529 | else { |
530 | if ( minutes == 2 ) { | 530 | if ( minutes == 2 ) { |
531 | // ask time | 531 | // ask time |
532 | QDialog dia ( 0, ("Customize Timer" ), true ); | 532 | QDialog dia ( 0, ("Customize Timer" ), true ); |
533 | QLabel lab (("Message Text:"), &dia ); | 533 | QLabel lab (("Message Text:"), &dia ); |
534 | dia.setCaption(("KO/Pi Timer" )); | 534 | dia.setCaption(("KO/Pi Timer" )); |
535 | QVBoxLayout lay( &dia ); | 535 | QVBoxLayout lay( &dia ); |
536 | lay.setMargin(5); | 536 | lay.setMargin(5); |
537 | lay.setSpacing(5); | 537 | lay.setSpacing(5); |
538 | lay.addWidget( &lab); | 538 | lay.addWidget( &lab); |
539 | QLineEdit lEdit( mCustomText, &dia ); | 539 | QLineEdit lEdit( mCustomText, &dia ); |
540 | lay.addWidget( &lEdit); | 540 | lay.addWidget( &lEdit); |
541 | QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia ); | 541 | QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia ); |
542 | lay.addWidget( &lab2); | 542 | lay.addWidget( &lab2); |
543 | QHBox hbox1 ( &dia ); | 543 | QHBox hbox1 ( &dia ); |
544 | lay.addWidget( &hbox1); | 544 | lay.addWidget( &hbox1); |
545 | QLabel lab3 (("Hours"), &hbox1 ); | 545 | QLabel lab3 (("Hours"), &hbox1 ); |
546 | QLabel lab4 (("Minutes"), &hbox1 ); | 546 | QLabel lab4 (("Minutes"), &hbox1 ); |
547 | QHBox hbox ( &dia ); | 547 | QHBox hbox ( &dia ); |
548 | QSpinBox spinh( 0, 24, 1,& hbox ); | 548 | QSpinBox spinh( 0, 24, 1,& hbox ); |
549 | QFont fo = dia.font(); | 549 | QFont fo = dia.font(); |
550 | fo.setPointSize( 36 ); | 550 | fo.setPointSize( 36 ); |
551 | QSpinBox spinm( 0, 59, 1,&hbox ); | 551 | QSpinBox spinm( 0, 59, 1,&hbox ); |
552 | spinm.setFont( fo ); | 552 | spinm.setFont( fo ); |
553 | spinh.setFont( fo ); | 553 | spinh.setFont( fo ); |
554 | spinh.setButtonSymbols( QSpinBox::PlusMinus ); | 554 | spinh.setButtonSymbols( QSpinBox::PlusMinus ); |
555 | spinm.setButtonSymbols( QSpinBox::PlusMinus ); | 555 | spinm.setButtonSymbols( QSpinBox::PlusMinus ); |
556 | spinh.upButton ()->setFixedSize( QSize( 48, 30 )); | 556 | spinh.upButton ()->setFixedSize( QSize( 48, 30 )); |
557 | spinh.downButton ()->setFixedSize( QSize( 48, 30 )); | 557 | spinh.downButton ()->setFixedSize( QSize( 48, 30 )); |
558 | //spinh.editor ()->setFixedSize( QSize( 50, 100 )); | 558 | //spinh.editor ()->setFixedSize( QSize( 50, 100 )); |
559 | spinh.setFixedSize( 100,62 ); | 559 | spinh.setFixedSize( 100,62 ); |
560 | spinm.upButton ()->setFixedSize( QSize( 48, 30 )); | 560 | spinm.upButton ()->setFixedSize( QSize( 48, 30 )); |
561 | spinm.downButton ()->setFixedSize( QSize( 48, 30 )); | 561 | spinm.downButton ()->setFixedSize( QSize( 48, 30 )); |
562 | spinm.downButton ()->setGeometry( 50,50,50,50); | 562 | spinm.downButton ()->setGeometry( 50,50,50,50); |
563 | spinm.setSuffix( " m" ); | 563 | spinm.setSuffix( " m" ); |
564 | spinh.setSuffix( " h" ); | 564 | spinh.setSuffix( " h" ); |
565 | spinm.setWrapping ( true ); | 565 | spinm.setWrapping ( true ); |
566 | //spinm.editor ()->setFixedSize( QSize( 50, 100 )); | 566 | //spinm.editor ()->setFixedSize( QSize( 50, 100 )); |
567 | spinm.setLineStep( 1 ); | 567 | spinm.setLineStep( 1 ); |
568 | spinm.setFixedSize( 110,62 ); | 568 | spinm.setFixedSize( 110,62 ); |
569 | lay.addWidget( &hbox); | 569 | lay.addWidget( &hbox); |
570 | QLabel lab5 ("Timer fires at:", &dia ); | 570 | QLabel lab5 ("Timer fires at:", &dia ); |
571 | lab5.setAlignment( AlignCenter ); | 571 | lab5.setAlignment( AlignCenter ); |
572 | lay.addWidget( &lab5); | 572 | lay.addWidget( &lab5); |
573 | KODateLabel dl ( &dia ); | 573 | KODateLabel dl ( &dia ); |
574 | dl.setAlignment( AlignCenter ); | 574 | dl.setAlignment( AlignCenter ); |
575 | dl.setFont( fo ); | 575 | dl.setFont( fo ); |
576 | connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) ); | 576 | connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) ); |
577 | connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) ); | 577 | connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) ); |
578 | lay.addWidget( &dl); | 578 | lay.addWidget( &dl); |
579 | spinh.setValue( mCustomMinutes/60 ); | 579 | spinh.setValue( mCustomMinutes/60 ); |
580 | spinm.setValue( mCustomMinutes%60 ); | 580 | spinm.setValue( mCustomMinutes%60 ); |
581 | QPushButton ok ( "Start timer", &dia); | 581 | QPushButton ok ( "Start timer", &dia); |
582 | ok.setFont( fo ); | 582 | ok.setFont( fo ); |
583 | lay.addWidget( &ok); | 583 | lay.addWidget( &ok); |
584 | connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); | 584 | connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); |
585 | dia.resize( dia.sizeHint().width(), dia.sizeHint().height() ); | 585 | dia.resize( dia.sizeHint().width(), dia.sizeHint().height() ); |
586 | 586 | ||
587 | if ( !dia.exec() ) | 587 | if ( !dia.exec() ) |
588 | return; | 588 | return; |
589 | mCustomText = lEdit.text(); | 589 | mCustomText = lEdit.text(); |
590 | mCustomMinutes = spinh.value()*60+spinm.value(); | 590 | mCustomMinutes = spinh.value()*60+spinm.value(); |
591 | if ( mCustomMinutes == 0 ) | 591 | if ( mCustomMinutes == 0 ) |
592 | mCustomMinutes = 1; | 592 | mCustomMinutes = 1; |
593 | if ( mCustomMinutes > 1440 ) | 593 | if ( mCustomMinutes > 1440 ) |
594 | mCustomMinutes = 1440; | 594 | mCustomMinutes = 1440; |
595 | mess += mCustomText; | 595 | mess += mCustomText; |
596 | minutes = mCustomMinutes; | 596 | minutes = mCustomMinutes; |
597 | mRunningTimerText = mCustomText.stripWhiteSpace (); | 597 | mRunningTimerText = mCustomText.stripWhiteSpace (); |
598 | int in = mRunningTimerText.find( " " ); | 598 | int in = mRunningTimerText.find( " " ); |
599 | mRunningTimerText = mRunningTimerText.left ( in ); | 599 | mRunningTimerText = mRunningTimerText.left ( in ); |
600 | } | 600 | } |
601 | else { | 601 | else { |
602 | mess+= QString::number ( minutes ) + ( " minutes are past!"); | 602 | mess+= QString::number ( minutes ) + ( " minutes are past!"); |
603 | int min = minutes; | 603 | int min = minutes; |
604 | if ( min % 60 == 0 ) | 604 | if ( min % 60 == 0 ) |
605 | mRunningTimerText = QString::number ( min/60 ) + ( " hours"); | 605 | mRunningTimerText = QString::number ( min/60 ) + ( " hours"); |
606 | else | 606 | else |
607 | mRunningTimerText = QString::number ( minutes ) + ( " minutes"); | 607 | mRunningTimerText = QString::number ( minutes ) + ( " minutes"); |
608 | } | 608 | } |
609 | } | 609 | } |
610 | //minutes = 1; | 610 | //minutes = 1; |
611 | mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); | 611 | mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); |
612 | timerMesssage = mess; | 612 | timerMesssage = mess; |
613 | AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.latin1()); | 613 | AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.latin1()); |
614 | mTimerTime = 1; | 614 | mTimerTime = 1; |
615 | } | 615 | } |
616 | 616 | ||
617 | void SimpleAlarmDaemonImpl::writeFile() | 617 | void SimpleAlarmDaemonImpl::writeFile() |
618 | { | 618 | { |
619 | QCopEnvelope e("QPE/Application/kopi", "-writeFile"); | 619 | QCopEnvelope e("QPE/Application/kopi", "-writeFile"); |
620 | } | 620 | } |
621 | void SimpleAlarmDaemonImpl::showWN() | 621 | void SimpleAlarmDaemonImpl::showWN() |
622 | { | 622 | { |
623 | QCopEnvelope e("QPE/Application/kopi", "-showWN"); | 623 | QCopEnvelope e("QPE/Application/kopi", "-showWN"); |
624 | } | 624 | } |
625 | void SimpleAlarmDaemonImpl::newTodo() | 625 | void SimpleAlarmDaemonImpl::newTodo() |
626 | { | 626 | { |
627 | QCopEnvelope e("QPE/Application/kopi", "-newTodo"); | 627 | QCopEnvelope e("QPE/Application/kopi", "-newTodo"); |
628 | } | 628 | } |
629 | 629 | ||
630 | void SimpleAlarmDaemonImpl::newEvent() | 630 | void SimpleAlarmDaemonImpl::newEvent() |
631 | { | 631 | { |
632 | QCopEnvelope e("QPE/Application/kopi", "-newEvent"); | 632 | QCopEnvelope e("QPE/Application/kopi", "-newEvent"); |
633 | 633 | ||
634 | } | 634 | } |
635 | void SimpleAlarmDaemonImpl::newMail() | 635 | void SimpleAlarmDaemonImpl::newMail() |
636 | { | 636 | { |
637 | QCopEnvelope e("QPE/Application/ompi", "newMail()"); | 637 | QCopEnvelope e("QPE/Application/ompi", "newMail()"); |
638 | } | 638 | } |
639 | void SimpleAlarmDaemonImpl::showAdd() | 639 | void SimpleAlarmDaemonImpl::showAdd() |
640 | { | 640 | { |
641 | QCopEnvelope e("QPE/Application/kapi", "raise()"); | 641 | QCopEnvelope e("QPE/Application/kapi", "raise()"); |
642 | } | 642 | } |
643 | void SimpleAlarmDaemonImpl::ringSync() | 643 | void SimpleAlarmDaemonImpl::ringSync() |
644 | { | 644 | { |
645 | QCopEnvelope e("QPE/Application/kopi", "-ringSync"); | 645 | QCopEnvelope e("QPE/Application/kopi", "-ringSync"); |
646 | 646 | ||
647 | } | 647 | } |
648 | void SimpleAlarmDaemonImpl::newCountdown() | 648 | void SimpleAlarmDaemonImpl::newCountdown() |
649 | { | 649 | { |
650 | //recieve("cal_alarm", 10 ); | 650 | //recieve("cal_alarm", 10 ); |
651 | } | 651 | } |
652 | void SimpleAlarmDaemonImpl::simulate() | 652 | void SimpleAlarmDaemonImpl::simulate() |
653 | { | 653 | { |
654 | writeFile(); | 654 | writeFile(); |
655 | QString filename = getenv("QPEDIR") ; | 655 | QString filename = getenv("QPEDIR") ; |
656 | filename += "/pics/kdepim/korganizer/koalarm.wav"; | 656 | filename += "/pics/kdepim/korganizer/koalarm.wav"; |
657 | startAlarm("Alarm simulation", filename ); | 657 | startAlarm("Alarm simulation", filename ); |
658 | } | 658 | } |
659 | void SimpleAlarmDaemonImpl::showKO() | 659 | void SimpleAlarmDaemonImpl::showKO() |
660 | { | 660 | { |
661 | QCopEnvelope e("QPE/Application/kopi", "-showKO"); | 661 | QCopEnvelope e("QPE/Application/kopi", "-showKO"); |
662 | // testing only | ||
663 | //QCopEnvelope e("QPE/Application/kopi", "nextView()"); | ||
662 | 664 | ||
663 | } | 665 | } |
664 | void SimpleAlarmDaemonImpl::showTodo() | 666 | void SimpleAlarmDaemonImpl::showTodo() |
665 | { | 667 | { |
666 | QCopEnvelope e("QPE/Application/kopi", "-showTodo"); | 668 | QCopEnvelope e("QPE/Application/kopi", "-showTodo"); |
667 | 669 | ||
668 | } | 670 | } |
669 | void SimpleAlarmDaemonImpl::writeJournal() | 671 | void SimpleAlarmDaemonImpl::writeJournal() |
670 | { | 672 | { |
671 | QCopEnvelope e("QPE/Application/kopi", "-showJournal"); | 673 | QCopEnvelope e("QPE/Application/kopi", "-showJournal"); |
672 | 674 | ||
673 | } | 675 | } |
674 | 676 | ||
675 | void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * ) | 677 | void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * ) |
676 | { | 678 | { |
677 | 679 | ||
678 | mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() ))); | 680 | mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() ))); |
679 | 681 | ||
680 | } | 682 | } |
681 | 683 | ||
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index a32333c..fa6b951 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -573,384 +573,386 @@ KOAgendaView::~KOAgendaView() | |||
573 | delete mAgendaPopup; | 573 | delete mAgendaPopup; |
574 | delete mAllDayAgendaPopup; | 574 | delete mAllDayAgendaPopup; |
575 | delete KOAgendaItem::paintPix(); | 575 | delete KOAgendaItem::paintPix(); |
576 | delete KOAgendaItem::paintPixSel(); | 576 | delete KOAgendaItem::paintPixSel(); |
577 | } | 577 | } |
578 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 578 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
579 | { | 579 | { |
580 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 580 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
581 | bool uc = false; | 581 | bool uc = false; |
582 | int ow = e->oldSize().width(); | 582 | int ow = e->oldSize().width(); |
583 | int oh = e->oldSize().height(); | 583 | int oh = e->oldSize().height(); |
584 | int w = e->size().width(); | 584 | int w = e->size().width(); |
585 | int h = e->size().height(); | 585 | int h = e->size().height(); |
586 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 586 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
587 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 587 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
588 | uc = true; | 588 | uc = true; |
589 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 589 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
590 | } | 590 | } |
591 | mUpcomingWidth = e->size().width() ; | 591 | mUpcomingWidth = e->size().width() ; |
592 | if ( mBlockUpdating || uc ) { | 592 | if ( mBlockUpdating || uc ) { |
593 | mBlockUpdating = false; | 593 | mBlockUpdating = false; |
594 | //mAgenda->setMinimumSize(800 , 600 ); | 594 | //mAgenda->setMinimumSize(800 , 600 ); |
595 | //qDebug("mAgenda->resize+++++++++++++++ "); | 595 | //qDebug("mAgenda->resize+++++++++++++++ "); |
596 | updateConfig(); | 596 | updateConfig(); |
597 | //qDebug("KOAgendaView::Updating now possible "); | 597 | //qDebug("KOAgendaView::Updating now possible "); |
598 | } else | 598 | } else |
599 | createDayLabels(); | 599 | createDayLabels(); |
600 | //qDebug("resizeEvent end "); | 600 | //qDebug("resizeEvent end "); |
601 | 601 | ||
602 | } | 602 | } |
603 | void KOAgendaView::slotDaylabelClicked( int num ) | 603 | void KOAgendaView::slotDaylabelClicked( int num ) |
604 | { | 604 | { |
605 | 605 | ||
606 | QDate firstDate = mSelectedDates.first(); | 606 | QDate firstDate = mSelectedDates.first(); |
607 | if ( num == -1 ) | 607 | if ( num == -1 ) |
608 | emit showDateView( 6, firstDate ); | 608 | emit showDateView( 6, firstDate ); |
609 | else if (num >= 0 ) { | 609 | else if (num >= 0 ) { |
610 | if ( mSelectedDates.count() == 1) | 610 | if ( mSelectedDates.count() == 1) |
611 | emit showDateView( 9, firstDate.addDays( num ) ); | 611 | emit showDateView( 9, firstDate.addDays( num ) ); |
612 | else | 612 | else |
613 | emit showDateView( 3, firstDate.addDays( num ) ); | 613 | emit showDateView( 3, firstDate.addDays( num ) ); |
614 | } | 614 | } |
615 | else | 615 | else |
616 | showDateView( 10, firstDate.addDays(1) ); | 616 | showDateView( 10, firstDate.addDays(1) ); |
617 | } | 617 | } |
618 | 618 | ||
619 | KOAgendaButton* KOAgendaView::getNewDaylabel() | 619 | KOAgendaButton* KOAgendaView::getNewDaylabel() |
620 | { | 620 | { |
621 | 621 | ||
622 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); | 622 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); |
623 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); | 623 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); |
624 | mDayLabelsList.append( dayLabel ); | 624 | mDayLabelsList.append( dayLabel ); |
625 | mLayoutDayLabels->addWidget(dayLabel); | 625 | mLayoutDayLabels->addWidget(dayLabel); |
626 | return dayLabel ; | 626 | return dayLabel ; |
627 | } | 627 | } |
628 | 628 | ||
629 | void KOAgendaView::createDayLabels() | 629 | void KOAgendaView::createDayLabels() |
630 | { | 630 | { |
631 | 631 | ||
632 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { | 632 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { |
633 | // qDebug(" KOAgendaView::createDayLabels() blocked "); | 633 | // qDebug(" KOAgendaView::createDayLabels() blocked "); |
634 | return; | 634 | return; |
635 | 635 | ||
636 | } | 636 | } |
637 | int newHight; | 637 | int newHight; |
638 | 638 | ||
639 | // ### Before deleting and recreating we could check if mSelectedDates changed... | 639 | // ### Before deleting and recreating we could check if mSelectedDates changed... |
640 | // It would remove some flickering and gain speed (since this is called by | 640 | // It would remove some flickering and gain speed (since this is called by |
641 | // each updateView() call) | 641 | // each updateView() call) |
642 | 642 | ||
643 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; | 643 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; |
644 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); | 644 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); |
645 | if ( maxWid < 0 ) | 645 | if ( maxWid < 0 ) |
646 | maxWid = 20; | 646 | maxWid = 20; |
647 | 647 | ||
648 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; | 648 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; |
649 | QFontMetrics fm ( dlf ); | 649 | QFontMetrics fm ( dlf ); |
650 | int selCount = mSelectedDates.count(); | 650 | int selCount = mSelectedDates.count(); |
651 | QString dayTest = "Mon 20"; | 651 | QString dayTest = "Mon 20"; |
652 | //QString dayTest = "Mon 20"; | 652 | //QString dayTest = "Mon 20"; |
653 | int wid = fm.width( dayTest ); | 653 | int wid = fm.width( dayTest ); |
654 | //maxWid -= ( selCount * 3 ); //working for QLabels | 654 | //maxWid -= ( selCount * 3 ); //working for QLabels |
655 | maxWid -= ( selCount * 3 ); //working for QPushButton | 655 | maxWid -= ( selCount * 3 ); //working for QPushButton |
656 | if ( maxWid < 0 ) | 656 | if ( maxWid < 0 ) |
657 | maxWid = 20; | 657 | maxWid = 20; |
658 | int needWid = wid * selCount; | 658 | int needWid = wid * selCount; |
659 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); | 659 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); |
660 | //if ( needWid > maxWid ) | 660 | //if ( needWid > maxWid ) |
661 | // qDebug("DAYLABELS TOOOOOOO BIG "); | 661 | // qDebug("DAYLABELS TOOOOOOO BIG "); |
662 | while ( needWid > maxWid ) { | 662 | while ( needWid > maxWid ) { |
663 | dayTest = dayTest.left( dayTest.length() - 1 ); | 663 | dayTest = dayTest.left( dayTest.length() - 1 ); |
664 | wid = fm.width( dayTest ); | 664 | wid = fm.width( dayTest ); |
665 | needWid = wid * selCount; | 665 | needWid = wid * selCount; |
666 | } | 666 | } |
667 | int maxLen = dayTest.length(); | 667 | int maxLen = dayTest.length(); |
668 | int fontPoint = dlf.pointSize(); | 668 | int fontPoint = dlf.pointSize(); |
669 | if ( maxLen < 2 ) { | 669 | if ( maxLen < 2 ) { |
670 | int fontPoint = dlf.pointSize(); | 670 | int fontPoint = dlf.pointSize(); |
671 | while ( fontPoint > 4 ) { | 671 | while ( fontPoint > 4 ) { |
672 | --fontPoint; | 672 | --fontPoint; |
673 | dlf.setPointSize( fontPoint ); | 673 | dlf.setPointSize( fontPoint ); |
674 | QFontMetrics f( dlf ); | 674 | QFontMetrics f( dlf ); |
675 | wid = f.width( "30" ); | 675 | wid = f.width( "30" ); |
676 | needWid = wid * selCount; | 676 | needWid = wid * selCount; |
677 | if ( needWid < maxWid ) | 677 | if ( needWid < maxWid ) |
678 | break; | 678 | break; |
679 | } | 679 | } |
680 | maxLen = 2; | 680 | maxLen = 2; |
681 | } | 681 | } |
682 | //qDebug("Max len %d ", dayTest.length() ); | 682 | //qDebug("Max len %d ", dayTest.length() ); |
683 | 683 | ||
684 | QFontMetrics tempF( dlf ); | 684 | QFontMetrics tempF( dlf ); |
685 | newHight = tempF.height(); | 685 | newHight = tempF.height(); |
686 | mDayLabels->setFont( dlf ); | 686 | mDayLabels->setFont( dlf ); |
687 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; | 687 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; |
688 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); | 688 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); |
689 | //mLayoutDayLabels->addSpacing( 2 ); | 689 | //mLayoutDayLabels->addSpacing( 2 ); |
690 | // QFont lFont = dlf; | 690 | // QFont lFont = dlf; |
691 | bool appendLabels = false; | 691 | bool appendLabels = false; |
692 | KOAgendaButton *dayLabel; | 692 | KOAgendaButton *dayLabel; |
693 | dayLabel = mDayLabelsList.first(); | 693 | dayLabel = mDayLabelsList.first(); |
694 | if ( !dayLabel ) { | 694 | if ( !dayLabel ) { |
695 | appendLabels = true; | 695 | appendLabels = true; |
696 | dayLabel = getNewDaylabel(); | 696 | dayLabel = getNewDaylabel(); |
697 | } | 697 | } |
698 | dayLabel->setFixedWidth( mTimeLabels->width()+2 ); | 698 | dayLabel->setFixedWidth( mTimeLabels->width()+2 ); |
699 | dayLabel->setFont( dlf ); | 699 | dayLabel->setFont( dlf ); |
700 | dayLabel->setNum( -1 ); | 700 | dayLabel->setNum( -1 ); |
701 | //dayLabel->setAlignment(QLabel::AlignHCenter); | 701 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
702 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); | 702 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); |
703 | dayLabel->show(); | 703 | dayLabel->show(); |
704 | DateList::ConstIterator dit; | 704 | DateList::ConstIterator dit; |
705 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); | 705 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); |
706 | int counter = -1; | 706 | int counter = -1; |
707 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 707 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
708 | ++counter; | 708 | ++counter; |
709 | QDate date = *dit; | 709 | QDate date = *dit; |
710 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); | 710 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); |
711 | if ( ! appendLabels ) { | 711 | if ( ! appendLabels ) { |
712 | dayLabel = mDayLabelsList.next(); | 712 | dayLabel = mDayLabelsList.next(); |
713 | if ( !dayLabel ) | 713 | if ( !dayLabel ) |
714 | appendLabels = true; | 714 | appendLabels = true; |
715 | } | 715 | } |
716 | if ( appendLabels ) { | 716 | if ( appendLabels ) { |
717 | dayLabel = getNewDaylabel(); | 717 | dayLabel = getNewDaylabel(); |
718 | } | 718 | } |
719 | dayLabel->setMinimumWidth( 1 ); | 719 | dayLabel->setMinimumWidth( 1 ); |
720 | dayLabel->setMaximumWidth( 10240 ); | 720 | dayLabel->setMaximumWidth( 10240 ); |
721 | dayLabel->setFont( dlf ); | 721 | dayLabel->setFont( dlf ); |
722 | dayLabel->show(); | 722 | dayLabel->show(); |
723 | dayLabel->setNum( counter ); | 723 | dayLabel->setNum( counter ); |
724 | QString str; | 724 | QString str; |
725 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); | 725 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); |
726 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); | 726 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); |
727 | switch ( maxLen ) { | 727 | switch ( maxLen ) { |
728 | case 2: | 728 | case 2: |
729 | str = QString::number( date.day() ); | 729 | str = QString::number( date.day() ); |
730 | break; | 730 | break; |
731 | 731 | ||
732 | case 3: | 732 | case 3: |
733 | str = dayName.left( 1 ) +QString::number( date.day()); | 733 | str = dayName.left( 1 ) +QString::number( date.day()); |
734 | 734 | ||
735 | break; | 735 | break; |
736 | case 4: | 736 | case 4: |
737 | str = dayName.left( 1 ) + " " +QString::number( date.day()); | 737 | str = dayName.left( 1 ) + " " +QString::number( date.day()); |
738 | 738 | ||
739 | break; | 739 | break; |
740 | case 5: | 740 | case 5: |
741 | str = dayName.left( 2 ) + " " +QString::number( date.day()); | 741 | str = dayName.left( 2 ) + " " +QString::number( date.day()); |
742 | 742 | ||
743 | break; | 743 | break; |
744 | case 6: | 744 | case 6: |
745 | str = dayName.left( 3 ) + " " +QString::number( date.day()); | 745 | str = dayName.left( 3 ) + " " +QString::number( date.day()); |
746 | break; | 746 | break; |
747 | 747 | ||
748 | default: | 748 | default: |
749 | break; | 749 | break; |
750 | } | 750 | } |
751 | if ( oneday ) { | 751 | if ( oneday ) { |
752 | QString addString; | 752 | QString addString; |
753 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) | 753 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) |
754 | addString = i18n("Today"); | 754 | addString = i18n("Today"); |
755 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) | 755 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) |
756 | addString = i18n("Tomorrow"); | 756 | addString = i18n("Tomorrow"); |
757 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) | 757 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) |
758 | addString = i18n("Yesterday"); | 758 | addString = i18n("Yesterday"); |
759 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) | 759 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) |
760 | addString = i18n("Day before yesterday"); | 760 | addString = i18n("Day before yesterday"); |
761 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) | 761 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) |
762 | addString = i18n("Day after tomorrow"); | 762 | addString = i18n("Day after tomorrow"); |
763 | if ( !addString.isEmpty() ) { | 763 | if ( !addString.isEmpty() ) { |
764 | str = addString+", " + str; | 764 | str = addString+", " + str; |
765 | } else { | ||
766 | str = KGlobal::locale()->formatDate( date, KOPrefs::instance()->mShortDateInViewer); | ||
765 | } | 767 | } |
766 | } | 768 | } |
767 | dayLabel->setText(str); | 769 | dayLabel->setText(str); |
768 | //dayLabel->setAlignment(QLabel::AlignHCenter); | 770 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
769 | if (date == QDate::currentDate()) { | 771 | if (date == QDate::currentDate()) { |
770 | QFont bFont = dlf; | 772 | QFont bFont = dlf; |
771 | bFont.setBold( true ); | 773 | bFont.setBold( true ); |
772 | dayLabel->setFont(bFont); | 774 | dayLabel->setFont(bFont); |
773 | } | 775 | } |
774 | //dayLayout->addWidget(dayLabel); | 776 | //dayLayout->addWidget(dayLabel); |
775 | 777 | ||
776 | #ifndef KORG_NOPLUGINS | 778 | #ifndef KORG_NOPLUGINS |
777 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); | 779 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); |
778 | CalendarDecoration *it; | 780 | CalendarDecoration *it; |
779 | for(it = cds.first(); it; it = cds.next()) { | 781 | for(it = cds.first(); it; it = cds.next()) { |
780 | QString text = it->shortText( date ); | 782 | QString text = it->shortText( date ); |
781 | if ( !text.isEmpty() ) { | 783 | if ( !text.isEmpty() ) { |
782 | QLabel *label = new QLabel(text,mDayLabels); | 784 | QLabel *label = new QLabel(text,mDayLabels); |
783 | label->setAlignment(AlignCenter); | 785 | label->setAlignment(AlignCenter); |
784 | dayLayout->addWidget(label); | 786 | dayLayout->addWidget(label); |
785 | } | 787 | } |
786 | } | 788 | } |
787 | 789 | ||
788 | for(it = cds.first(); it; it = cds.next()) { | 790 | for(it = cds.first(); it; it = cds.next()) { |
789 | QWidget *wid = it->smallWidget(mDayLabels,date); | 791 | QWidget *wid = it->smallWidget(mDayLabels,date); |
790 | if ( wid ) { | 792 | if ( wid ) { |
791 | // wid->setHeight(20); | 793 | // wid->setHeight(20); |
792 | dayLayout->addWidget(wid); | 794 | dayLayout->addWidget(wid); |
793 | } | 795 | } |
794 | } | 796 | } |
795 | #endif | 797 | #endif |
796 | } | 798 | } |
797 | if ( ! appendLabels ) { | 799 | if ( ! appendLabels ) { |
798 | dayLabel = mDayLabelsList.next(); | 800 | dayLabel = mDayLabelsList.next(); |
799 | if ( !dayLabel ) | 801 | if ( !dayLabel ) |
800 | appendLabels = true; | 802 | appendLabels = true; |
801 | } | 803 | } |
802 | if ( appendLabels ) { | 804 | if ( appendLabels ) { |
803 | dayLabel = getNewDaylabel(); | 805 | dayLabel = getNewDaylabel(); |
804 | } | 806 | } |
805 | //dayLabel->hide();//test only | 807 | //dayLabel->hide();//test only |
806 | 808 | ||
807 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; | 809 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; |
808 | if ( offset < 0 ) offset = 0; | 810 | if ( offset < 0 ) offset = 0; |
809 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); | 811 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); |
810 | dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); | 812 | dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); |
811 | dayLabel->setFont( dlf ); | 813 | dayLabel->setFont( dlf ); |
812 | dayLabel->show(); | 814 | dayLabel->show(); |
813 | dayLabel->setNum( -2 ); | 815 | dayLabel->setNum( -2 ); |
814 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); | 816 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); |
815 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); | 817 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); |
816 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); | 818 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); |
817 | if ( !appendLabels ) { | 819 | if ( !appendLabels ) { |
818 | dayLabel = mDayLabelsList.next(); | 820 | dayLabel = mDayLabelsList.next(); |
819 | while ( dayLabel ) { | 821 | while ( dayLabel ) { |
820 | //qDebug("!dayLabel %d",dayLabel ); | 822 | //qDebug("!dayLabel %d",dayLabel ); |
821 | dayLabel->hide(); | 823 | dayLabel->hide(); |
822 | dayLabel = mDayLabelsList.next(); | 824 | dayLabel = mDayLabelsList.next(); |
823 | } | 825 | } |
824 | } | 826 | } |
825 | //mDayLabelsFrame->show(); | 827 | //mDayLabelsFrame->show(); |
826 | //mDayLabels->show(); | 828 | //mDayLabels->show(); |
827 | //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); | 829 | //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); |
828 | //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); | 830 | //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); |
829 | mDayLabelsFrame->setFixedHeight( newHight ); | 831 | mDayLabelsFrame->setFixedHeight( newHight ); |
830 | } | 832 | } |
831 | 833 | ||
832 | int KOAgendaView::maxDatesHint() | 834 | int KOAgendaView::maxDatesHint() |
833 | { | 835 | { |
834 | // Not sure about the max number of events, so return 0 for now. | 836 | // Not sure about the max number of events, so return 0 for now. |
835 | return 0; | 837 | return 0; |
836 | } | 838 | } |
837 | 839 | ||
838 | int KOAgendaView::currentDateCount() | 840 | int KOAgendaView::currentDateCount() |
839 | { | 841 | { |
840 | return mSelectedDates.count(); | 842 | return mSelectedDates.count(); |
841 | } | 843 | } |
842 | 844 | ||
843 | QPtrList<Incidence> KOAgendaView::selectedIncidences() | 845 | QPtrList<Incidence> KOAgendaView::selectedIncidences() |
844 | { | 846 | { |
845 | QPtrList<Incidence> selected; | 847 | QPtrList<Incidence> selected; |
846 | Incidence *incidence; | 848 | Incidence *incidence; |
847 | 849 | ||
848 | incidence = mAgenda->selectedIncidence(); | 850 | incidence = mAgenda->selectedIncidence(); |
849 | if (incidence) selected.append(incidence); | 851 | if (incidence) selected.append(incidence); |
850 | 852 | ||
851 | incidence = mAllDayAgenda->selectedIncidence(); | 853 | incidence = mAllDayAgenda->selectedIncidence(); |
852 | if (incidence) selected.append(incidence); | 854 | if (incidence) selected.append(incidence); |
853 | 855 | ||
854 | return selected; | 856 | return selected; |
855 | } | 857 | } |
856 | 858 | ||
857 | DateList KOAgendaView::selectedDates() | 859 | DateList KOAgendaView::selectedDates() |
858 | { | 860 | { |
859 | DateList selected; | 861 | DateList selected; |
860 | QDate qd; | 862 | QDate qd; |
861 | 863 | ||
862 | qd = mAgenda->selectedIncidenceDate(); | 864 | qd = mAgenda->selectedIncidenceDate(); |
863 | if (qd.isValid()) selected.append(qd); | 865 | if (qd.isValid()) selected.append(qd); |
864 | 866 | ||
865 | qd = mAllDayAgenda->selectedIncidenceDate(); | 867 | qd = mAllDayAgenda->selectedIncidenceDate(); |
866 | if (qd.isValid()) selected.append(qd); | 868 | if (qd.isValid()) selected.append(qd); |
867 | 869 | ||
868 | return selected; | 870 | return selected; |
869 | } | 871 | } |
870 | 872 | ||
871 | 873 | ||
872 | void KOAgendaView::updateView() | 874 | void KOAgendaView::updateView() |
873 | { | 875 | { |
874 | if ( mBlockUpdating ) | 876 | if ( mBlockUpdating ) |
875 | return; | 877 | return; |
876 | // kdDebug() << "KOAgendaView::updateView()" << endl; | 878 | // kdDebug() << "KOAgendaView::updateView()" << endl; |
877 | fillAgenda(); | 879 | fillAgenda(); |
878 | 880 | ||
879 | } | 881 | } |
880 | 882 | ||
881 | 883 | ||
882 | /* | 884 | /* |
883 | Update configuration settings for the agenda view. This method is not | 885 | Update configuration settings for the agenda view. This method is not |
884 | complete. | 886 | complete. |
885 | */ | 887 | */ |
886 | void KOAgendaView::updateConfig() | 888 | void KOAgendaView::updateConfig() |
887 | { | 889 | { |
888 | if ( mBlockUpdating ) | 890 | if ( mBlockUpdating ) |
889 | return; | 891 | return; |
890 | 892 | ||
891 | // update config for children | 893 | // update config for children |
892 | mTimeLabels->updateConfig(); | 894 | mTimeLabels->updateConfig(); |
893 | mAgenda->storePosition(); | 895 | mAgenda->storePosition(); |
894 | mAgenda->updateConfig(); | 896 | mAgenda->updateConfig(); |
895 | mAllDayAgenda->updateConfig(); | 897 | mAllDayAgenda->updateConfig(); |
896 | // widget synchronization | 898 | // widget synchronization |
897 | //TODO: find a better way, maybe signal/slot | 899 | //TODO: find a better way, maybe signal/slot |
898 | mTimeLabels->positionChanged(); | 900 | mTimeLabels->positionChanged(); |
899 | 901 | ||
900 | // for some reason, this needs to be called explicitly | 902 | // for some reason, this needs to be called explicitly |
901 | mTimeLabels->repaint(); | 903 | mTimeLabels->repaint(); |
902 | 904 | ||
903 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 905 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
904 | 906 | ||
905 | // ToolTips displaying summary of events | 907 | // ToolTips displaying summary of events |
906 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() | 908 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() |
907 | ->mEnableToolTips); | 909 | ->mEnableToolTips); |
908 | 910 | ||
909 | //setHolidayMasks(); | 911 | //setHolidayMasks(); |
910 | 912 | ||
911 | //createDayLabels(); called by via updateView(); | 913 | //createDayLabels(); called by via updateView(); |
912 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); | 914 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); |
913 | updateView(); | 915 | updateView(); |
914 | mAgenda->restorePosition(); | 916 | mAgenda->restorePosition(); |
915 | } | 917 | } |
916 | 918 | ||
917 | 919 | ||
918 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | 920 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) |
919 | { | 921 | { |
920 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; | 922 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; |
921 | //qDebug("KOAgendaView::updateEventDates "); | 923 | //qDebug("KOAgendaView::updateEventDates "); |
922 | QDateTime startDt,endDt; | 924 | QDateTime startDt,endDt; |
923 | QDate startDate; | 925 | QDate startDate; |
924 | int lenInSecs; | 926 | int lenInSecs; |
925 | // if ( type == KOAgenda::RESIZETOP ) | 927 | // if ( type == KOAgenda::RESIZETOP ) |
926 | // qDebug("RESIZETOP "); | 928 | // qDebug("RESIZETOP "); |
927 | // if ( type == KOAgenda::RESIZEBOTTOM ) | 929 | // if ( type == KOAgenda::RESIZEBOTTOM ) |
928 | // qDebug("RESIZEBOTTOM "); | 930 | // qDebug("RESIZEBOTTOM "); |
929 | // if ( type == KOAgenda::MOVE ) | 931 | // if ( type == KOAgenda::MOVE ) |
930 | // qDebug("MOVE "); | 932 | // qDebug("MOVE "); |
931 | if ( item->incidence()->type() == "Event" ) { | 933 | if ( item->incidence()->type() == "Event" ) { |
932 | startDt =item->incidence()->dtStart(); | 934 | startDt =item->incidence()->dtStart(); |
933 | endDt = item->incidence()->dtEnd(); | 935 | endDt = item->incidence()->dtEnd(); |
934 | lenInSecs = startDt.secsTo( endDt ); | 936 | lenInSecs = startDt.secsTo( endDt ); |
935 | } | 937 | } |
936 | 938 | ||
937 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); | 939 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); |
938 | 940 | ||
939 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { | 941 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { |
940 | startDate = mSelectedDates[item->mLastMoveXPos]; | 942 | startDate = mSelectedDates[item->mLastMoveXPos]; |
941 | } else { | 943 | } else { |
942 | if (item->cellX() < 0) { | 944 | if (item->cellX() < 0) { |
943 | startDate = (mSelectedDates.first()).addDays(item->cellX()); | 945 | startDate = (mSelectedDates.first()).addDays(item->cellX()); |
944 | } else { | 946 | } else { |
945 | startDate = mSelectedDates[item->cellX()]; | 947 | startDate = mSelectedDates[item->cellX()]; |
946 | } | 948 | } |
947 | } | 949 | } |
948 | startDt.setDate(startDate); | 950 | startDt.setDate(startDate); |
949 | 951 | ||
950 | if (item->incidence()->doesFloat()) { | 952 | if (item->incidence()->doesFloat()) { |
951 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); | 953 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); |
952 | } else { | 954 | } else { |
953 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) | 955 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) |
954 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); | 956 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); |
955 | if ( item->incidence()->type() == "Event" ) { | 957 | if ( item->incidence()->type() == "Event" ) { |
956 | if ( type == KOAgenda::MOVE ) { | 958 | if ( type == KOAgenda::MOVE ) { |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 31ee5e2..b5de4a1 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -9,385 +9,450 @@ | |||
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
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 | #include "kdatenavigator.h" |
49 | 49 | ||
50 | #include "koviewmanager.h" | 50 | #include "koviewmanager.h" |
51 | //extern bool externFlagMonthviewBlockPainting; | 51 | //extern bool externFlagMonthviewBlockPainting; |
52 | 52 | ||
53 | //bool globalFlagBlockPainting = false; | 53 | //bool globalFlagBlockPainting = false; |
54 | int globalFlagBlockAgenda = 0; | 54 | int globalFlagBlockAgenda = 0; |
55 | int globalFlagBlockLabel = 0; | 55 | int globalFlagBlockLabel = 0; |
56 | int globalFlagBlockAgendaItemPaint = 1; | 56 | int globalFlagBlockAgendaItemPaint = 1; |
57 | int globalFlagBlockAgendaItemUpdate = 1; | 57 | int globalFlagBlockAgendaItemUpdate = 1; |
58 | 58 | ||
59 | 59 | ||
60 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 60 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
61 | QObject(), mMainView( mainView ) | 61 | QObject(), mMainView( mainView ) |
62 | { | 62 | { |
63 | mCurrentView = 0; | 63 | mCurrentView = 0; |
64 | 64 | ||
65 | mWhatsNextView = 0; | 65 | mWhatsNextView = 0; |
66 | mTodoView = 0; | 66 | mTodoView = 0; |
67 | mAgendaView = 0; | 67 | mAgendaView = 0; |
68 | mMonthView = 0; | 68 | mMonthView = 0; |
69 | mListView = 0; | 69 | mListView = 0; |
70 | mJournalView = 0; | 70 | mJournalView = 0; |
71 | mTimeSpanView = 0; | 71 | mTimeSpanView = 0; |
72 | mCurrentAgendaView = 0 ; | 72 | mCurrentAgendaView = 0 ; |
73 | mFlagShowNextxDays = false; | 73 | mFlagShowNextxDays = false; |
74 | } | 74 | } |
75 | 75 | ||
76 | KOViewManager::~KOViewManager() | 76 | KOViewManager::~KOViewManager() |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | KOrg::BaseView *KOViewManager::currentView() | 81 | KOrg::BaseView *KOViewManager::currentView() |
82 | { | 82 | { |
83 | return mCurrentView; | 83 | return mCurrentView; |
84 | } | 84 | } |
85 | 85 | ||
86 | void KOViewManager::readSettings(KConfig *config) | 86 | void KOViewManager::readSettings(KConfig *config) |
87 | { | 87 | { |
88 | config->setGroup("General"); | 88 | config->setGroup("General"); |
89 | QString view = config->readEntry("Current View"); | 89 | QString view = config->readEntry("Current View"); |
90 | if (view == "WhatsNext") showWhatsNextView(); | 90 | if (view == "WhatsNext") showWhatsNextView(); |
91 | else if (view == "Month") { | 91 | else if (view == "Month") { |
92 | if ( !KOPrefs::instance()->mMonthViewWeek ) | 92 | if ( !KOPrefs::instance()->mMonthViewWeek ) |
93 | showMonthView(); | 93 | showMonthView(); |
94 | else | 94 | else |
95 | showMonthViewWeek(); | 95 | showMonthViewWeek(); |
96 | } | 96 | } |
97 | else if (view == "List") showListView(); | 97 | else if (view == "List") showListView(); |
98 | else if (view == "Journal") showJournalView(); | 98 | else if (view == "Journal") showJournalView(); |
99 | else if (view == "TimeSpan") showTimeSpanView(); | 99 | else if (view == "TimeSpan") showTimeSpanView(); |
100 | else if (view == "Todo") showTodoView(); | 100 | else if (view == "Todo") showTodoView(); |
101 | else { | 101 | else { |
102 | config->setGroup( "Views" ); | 102 | config->setGroup( "Views" ); |
103 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 103 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
104 | mCurrentAgendaView = dateCount; | 104 | mCurrentAgendaView = dateCount; |
105 | showAgendaView(); | 105 | showAgendaView(); |
106 | mCurrentAgendaView = dateCount; | 106 | mCurrentAgendaView = dateCount; |
107 | #ifdef DESKTOP_VERSION | 107 | #ifdef DESKTOP_VERSION |
108 | QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); | 108 | QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); |
109 | #endif | 109 | #endif |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | void KOViewManager::showDateView( int view, QDate date) | 113 | void KOViewManager::showDateView( int view, QDate date) |
114 | { | 114 | { |
115 | static int lastMode = 0; | 115 | static int lastMode = 0; |
116 | static int lastCount = 0; | 116 | static int lastCount = 0; |
117 | static bool lastNDMode = false; | 117 | static bool lastNDMode = false; |
118 | static QDate lastDate; | 118 | static QDate lastDate; |
119 | //qDebug("date %d %s", view, date.toString().latin1()); | 119 | //qDebug("date %d %s", view, date.toString().latin1()); |
120 | 120 | ||
121 | if (view != 9) | 121 | if (view != 9) |
122 | lastMode = 0; | 122 | lastMode = 0; |
123 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); | 123 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); |
124 | bool savemFlagShowNextxDays = mFlagShowNextxDays; | 124 | bool savemFlagShowNextxDays = mFlagShowNextxDays; |
125 | mFlagShowNextxDays = false; | 125 | mFlagShowNextxDays = false; |
126 | if ( view == 3 ) { | 126 | if ( view == 3 ) { |
127 | //mCurrentAgendaView = 1 ; | 127 | //mCurrentAgendaView = 1 ; |
128 | lastDate = mMainView->dateNavigator()->selectedDates().first(); | 128 | lastDate = mMainView->dateNavigator()->selectedDates().first(); |
129 | lastCount = mMainView->dateNavigator()->selectedDates().count(); | 129 | lastCount = mMainView->dateNavigator()->selectedDates().count(); |
130 | lastNDMode = savemFlagShowNextxDays; | 130 | lastNDMode = savemFlagShowNextxDays; |
131 | mMainView->dateNavigator()->selectDate( date ); | 131 | mMainView->dateNavigator()->selectDate( date ); |
132 | lastMode = 1; | 132 | lastMode = 1; |
133 | mCurrentAgendaView = 1 ; | 133 | mCurrentAgendaView = 1 ; |
134 | } else if (view == 4 ) { | 134 | } else if (view == 4 ) { |
135 | mCurrentAgendaView = 7 ; | 135 | mCurrentAgendaView = 7 ; |
136 | mMainView->dateNavigator()->selectDates( date, 7 ); | 136 | mMainView->dateNavigator()->selectDates( date, 7 ); |
137 | } else if (view == 5 ) { | 137 | } else if (view == 5 ) { |
138 | mCurrentAgendaView = 14 ; | 138 | mCurrentAgendaView = 14 ; |
139 | mMainView->dateNavigator()->selectDates( date, 14); | 139 | mMainView->dateNavigator()->selectDates( date, 14); |
140 | } else if (view == 6 ) { | 140 | } else if (view == 6 ) { |
141 | //mMainView->dateNavigator()->selectDates( date, 7 ); | 141 | //mMainView->dateNavigator()->selectDates( date, 7 ); |
142 | showMonthView(); | 142 | showMonthView(); |
143 | } else if (view == 7 ) { | 143 | } else if (view == 7 ) { |
144 | mMainView->dateNavigator()->selectDate( date ); | 144 | mMainView->dateNavigator()->selectDate( date ); |
145 | showJournalView(); | 145 | showJournalView(); |
146 | } else if (view == 8 ) { | 146 | } else if (view == 8 ) { |
147 | globalFlagBlockAgenda = 1; | 147 | globalFlagBlockAgenda = 1; |
148 | if ( mCurrentAgendaView != 3 ) | 148 | if ( mCurrentAgendaView != 3 ) |
149 | mCurrentAgendaView = -1; | 149 | mCurrentAgendaView = -1; |
150 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 150 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
151 | globalFlagBlockAgenda = 2; | 151 | globalFlagBlockAgenda = 2; |
152 | mMainView->dateNavigator()->selectDates( date , | 152 | mMainView->dateNavigator()->selectDates( date , |
153 | KOPrefs::instance()->mNextXDays ); | 153 | KOPrefs::instance()->mNextXDays ); |
154 | mFlagShowNextxDays = true; | 154 | mFlagShowNextxDays = true; |
155 | mCurrentAgendaView = 3 ; | 155 | mCurrentAgendaView = 3 ; |
156 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) | 156 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) |
157 | if ( lastMode ) { | 157 | if ( lastMode ) { |
158 | mCurrentAgendaView = lastCount ; | 158 | mCurrentAgendaView = lastCount ; |
159 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); | 159 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); |
160 | mFlagShowNextxDays = lastNDMode; | 160 | mFlagShowNextxDays = lastNDMode; |
161 | if ( mFlagShowNextxDays ) { | 161 | if ( mFlagShowNextxDays ) { |
162 | mCurrentAgendaView = 3 ; | 162 | mCurrentAgendaView = 3 ; |
163 | } | 163 | } |
164 | } else | 164 | } else |
165 | showWeekView(); | 165 | showWeekView(); |
166 | } else if (view == 10) { | 166 | } else if (view == 10) { |
167 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); | 167 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); |
168 | } | 168 | } |
169 | } | 169 | } |
170 | 170 | ||
171 | 171 | ||
172 | 172 | ||
173 | void KOViewManager::writeSettings(KConfig *config) | 173 | void KOViewManager::writeSettings(KConfig *config) |
174 | { | 174 | { |
175 | config->setGroup("General"); | 175 | config->setGroup("General"); |
176 | 176 | ||
177 | QString view; | 177 | QString view; |
178 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 178 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
179 | else if (mCurrentView == mMonthView) view = "Month"; | 179 | else if (mCurrentView == mMonthView) view = "Month"; |
180 | else if (mCurrentView == mListView) view = "List"; | 180 | else if (mCurrentView == mListView) view = "List"; |
181 | else if (mCurrentView == mJournalView) view = "Journal"; | 181 | else if (mCurrentView == mJournalView) view = "Journal"; |
182 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 182 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
183 | else if (mCurrentView == mTodoView) view = "Todo"; | 183 | else if (mCurrentView == mTodoView) view = "Todo"; |
184 | else view = "Agenda"; | 184 | else view = "Agenda"; |
185 | 185 | ||
186 | config->writeEntry("Current View",view); | 186 | config->writeEntry("Current View",view); |
187 | 187 | ||
188 | if (mAgendaView) { | 188 | if (mAgendaView) { |
189 | mAgendaView->writeSettings(config); | 189 | mAgendaView->writeSettings(config); |
190 | } | 190 | } |
191 | if (mTimeSpanView) { | 191 | if (mTimeSpanView) { |
192 | mTimeSpanView->writeSettings(config); | 192 | mTimeSpanView->writeSettings(config); |
193 | } | 193 | } |
194 | if (mListView) { | 194 | if (mListView) { |
195 | mListView->writeSettings(config); | 195 | mListView->writeSettings(config); |
196 | } | 196 | } |
197 | if (mTodoView) { | 197 | if (mTodoView) { |
198 | mTodoView->saveLayout(config,"Todo View"); | 198 | mTodoView->saveLayout(config,"Todo View"); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | void KOViewManager::showNextView() | ||
202 | { | ||
203 | if (mCurrentView == mWhatsNextView) goto NEXT_X; | ||
204 | |||
205 | if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto LIST; | ||
206 | |||
207 | if (mCurrentView == mListView ) goto DAY_1; | ||
208 | |||
209 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; | ||
210 | |||
211 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; | ||
212 | |||
213 | if (mCurrentView == mAgendaView ) goto DAY_6; | ||
214 | |||
215 | if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; | ||
216 | |||
217 | if (mCurrentView == mMonthView ) goto TODO; | ||
218 | |||
219 | if (mCurrentView == mTodoView ) goto JOURNAL; | ||
220 | |||
221 | NEXT: | ||
222 | if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;} | ||
223 | NEXT_X: | ||
224 | if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;} | ||
225 | LIST: | ||
226 | if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;} | ||
227 | DAY_1: | ||
228 | if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;} | ||
229 | DAY_5: | ||
230 | if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;} | ||
231 | DAY_7: | ||
232 | if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;} | ||
233 | DAY_6: | ||
234 | if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;} | ||
235 | MONTH: | ||
236 | if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;} | ||
237 | TODO: | ||
238 | if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;} | ||
239 | JOURNAL: | ||
240 | if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;} | ||
241 | |||
242 | |||
243 | |||
244 | if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;} | ||
245 | |||
246 | if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;} | ||
247 | |||
248 | if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;} | ||
249 | |||
250 | if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;} | ||
201 | 251 | ||
252 | if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;} | ||
253 | |||
254 | if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;} | ||
255 | |||
256 | if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;} | ||
257 | |||
258 | if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;} | ||
259 | |||
260 | if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;} | ||
261 | |||
262 | if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;} | ||
263 | |||
264 | |||
265 | |||
266 | } | ||
202 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 267 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
203 | { | 268 | { |
204 | 269 | ||
205 | //mFlagShowNextxDays = false; | 270 | //mFlagShowNextxDays = false; |
206 | //if(view == mCurrentView) return; | 271 | //if(view == mCurrentView) return; |
207 | if ( view == 0 ) { | 272 | if ( view == 0 ) { |
208 | view = mCurrentView; | 273 | view = mCurrentView; |
209 | if ( view == 0 ) | 274 | if ( view == 0 ) |
210 | return; | 275 | return; |
211 | } | 276 | } |
212 | bool callupdate = !(view == mCurrentView); | 277 | bool callupdate = !(view == mCurrentView); |
213 | bool full = fullScreen; | 278 | bool full = fullScreen; |
214 | if(view == mCurrentView && view != mWhatsNextView ) { | 279 | if(view == mCurrentView && view != mWhatsNextView ) { |
215 | if ( mCurrentAgendaView < 0 ) | 280 | if ( mCurrentAgendaView < 0 ) |
216 | return; | 281 | return; |
217 | if ( view != mMonthView ) | 282 | if ( view != mMonthView ) |
218 | full = mMainView->leftFrame()->isVisible(); | 283 | full = mMainView->leftFrame()->isVisible(); |
219 | } else { | 284 | } else { |
220 | if ( view == mMonthView && mMonthView) | 285 | if ( view == mMonthView && mMonthView) |
221 | ;//mMonthView->skipResize = true ; | 286 | ;//mMonthView->skipResize = true ; |
222 | mCurrentView = view; | 287 | mCurrentView = view; |
223 | // bool full = fullScreen; | 288 | // bool full = fullScreen; |
224 | bool isFull = !mMainView->leftFrame()->isVisible(); | 289 | bool isFull = !mMainView->leftFrame()->isVisible(); |
225 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 290 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
226 | full = true; | 291 | full = true; |
227 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 292 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
228 | full = false; | 293 | full = false; |
229 | } | 294 | } |
230 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 295 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
231 | //raiseCurrentView( full ); | 296 | //raiseCurrentView( full ); |
232 | mMainView->processIncidenceSelection( 0 ); | 297 | mMainView->processIncidenceSelection( 0 ); |
233 | //mMainView->updateView(); | 298 | //mMainView->updateView(); |
234 | raiseCurrentView( full, callupdate ); | 299 | raiseCurrentView( full, callupdate ); |
235 | mMainView->adaptNavigationUnits(); | 300 | mMainView->adaptNavigationUnits(); |
236 | } | 301 | } |
237 | 302 | ||
238 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | 303 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
239 | { | 304 | { |
240 | mCurrentAgendaView = 0; | 305 | mCurrentAgendaView = 0; |
241 | if ( fullScreen ) { | 306 | if ( fullScreen ) { |
242 | mMainView->leftFrame()->hide(); | 307 | mMainView->leftFrame()->hide(); |
243 | } else { | 308 | } else { |
244 | mMainView->leftFrame()->show(); | 309 | mMainView->leftFrame()->show(); |
245 | } | 310 | } |
246 | //if ( mCurrentView == mMonthView ) qApp->processEvents(); | 311 | //if ( mCurrentView == mMonthView ) qApp->processEvents(); |
247 | emit signalFullScreen( !fullScreen ); | 312 | emit signalFullScreen( !fullScreen ); |
248 | if ( callUpdateView ) | 313 | if ( callUpdateView ) |
249 | mMainView->updateView(); | 314 | mMainView->updateView(); |
250 | 315 | ||
251 | if ( globalFlagBlockAgenda == 5 ) { | 316 | if ( globalFlagBlockAgenda == 5 ) { |
252 | globalFlagBlockAgenda = 4; | 317 | globalFlagBlockAgenda = 4; |
253 | globalFlagBlockAgendaItemPaint = 1; | 318 | globalFlagBlockAgendaItemPaint = 1; |
254 | } | 319 | } |
255 | mMainView->viewStack()->raiseWidget(mCurrentView); | 320 | mMainView->viewStack()->raiseWidget(mCurrentView); |
256 | if ( globalFlagBlockAgenda == 4 ) { | 321 | if ( globalFlagBlockAgenda == 4 ) { |
257 | if ( mCurrentView == mAgendaView ) { | 322 | if ( mCurrentView == mAgendaView ) { |
258 | //globalFlagBlockAgenda =1 ; | 323 | //globalFlagBlockAgenda =1 ; |
259 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 324 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
260 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 325 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
261 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 326 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
262 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 327 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
263 | qApp->processEvents(); | 328 | qApp->processEvents(); |
264 | //qDebug("qApp->processEvents() "); | 329 | //qDebug("qApp->processEvents() "); |
265 | globalFlagBlockAgenda = 0; | 330 | globalFlagBlockAgenda = 0; |
266 | mAgendaView->repaintAgenda(); | 331 | mAgendaView->repaintAgenda(); |
267 | 332 | ||
268 | } | 333 | } |
269 | globalFlagBlockAgenda = 0; | 334 | globalFlagBlockAgenda = 0; |
270 | } | 335 | } |
271 | emit signalAgendaView( mCurrentView == mAgendaView ); | 336 | emit signalAgendaView( mCurrentView == mAgendaView ); |
272 | //qDebug("raiseCurrentView ende "); | 337 | //qDebug("raiseCurrentView ende "); |
273 | 338 | ||
274 | } | 339 | } |
275 | 340 | ||
276 | void KOViewManager::updateView() | 341 | void KOViewManager::updateView() |
277 | { | 342 | { |
278 | // qDebug("KOViewManager::updateView() "); | 343 | // qDebug("KOViewManager::updateView() "); |
279 | // if we are updating mTodoView, we get endless recursion | 344 | // if we are updating mTodoView, we get endless recursion |
280 | if ( mTodoView == mCurrentView ) | 345 | if ( mTodoView == mCurrentView ) |
281 | return; | 346 | return; |
282 | if ( mCurrentView ) mCurrentView->updateView(); | 347 | if ( mCurrentView ) mCurrentView->updateView(); |
283 | 348 | ||
284 | } | 349 | } |
285 | 350 | ||
286 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 351 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
287 | { | 352 | { |
288 | // kdDebug() << "KOViewManager::updateView()" << endl; | 353 | // kdDebug() << "KOViewManager::updateView()" << endl; |
289 | 354 | ||
290 | if (mCurrentView) mCurrentView->showDates(start, end); | 355 | if (mCurrentView) mCurrentView->showDates(start, end); |
291 | 356 | ||
292 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); | 357 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); |
293 | } | 358 | } |
294 | 359 | ||
295 | 360 | ||
296 | void KOViewManager::updateWNview() | 361 | void KOViewManager::updateWNview() |
297 | { | 362 | { |
298 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 363 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
299 | mWhatsNextView->updateView(); | 364 | mWhatsNextView->updateView(); |
300 | 365 | ||
301 | } | 366 | } |
302 | void KOViewManager::showWhatsNextView() | 367 | void KOViewManager::showWhatsNextView() |
303 | { | 368 | { |
304 | if (!mWhatsNextView) { | 369 | if (!mWhatsNextView) { |
305 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 370 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
306 | "KOViewManager::WhatsNextView"); | 371 | "KOViewManager::WhatsNextView"); |
307 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 372 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
308 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 373 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
309 | addView(mWhatsNextView); | 374 | addView(mWhatsNextView); |
310 | connect(this, SIGNAL( printWNV() ), | 375 | connect(this, SIGNAL( printWNV() ), |
311 | mWhatsNextView, SLOT( printMe() ) ); | 376 | mWhatsNextView, SLOT( printMe() ) ); |
312 | } | 377 | } |
313 | globalFlagBlockAgenda = 1; | 378 | globalFlagBlockAgenda = 1; |
314 | showView(mWhatsNextView, true ); | 379 | showView(mWhatsNextView, true ); |
315 | //mWhatsNextView->updateView(); | 380 | //mWhatsNextView->updateView(); |
316 | 381 | ||
317 | } | 382 | } |
318 | 383 | ||
319 | void KOViewManager::showListView() | 384 | void KOViewManager::showListView() |
320 | { | 385 | { |
321 | if (!mListView) { | 386 | if (!mListView) { |
322 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 387 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
323 | addView(mListView); | 388 | addView(mListView); |
324 | 389 | ||
325 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 390 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
326 | mMainView, SLOT(showIncidence(Incidence *))); | 391 | mMainView, SLOT(showIncidence(Incidence *))); |
327 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 392 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
328 | mMainView, SLOT(editIncidence(Incidence *))); | 393 | mMainView, SLOT(editIncidence(Incidence *))); |
329 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 394 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
330 | mMainView, SLOT(deleteIncidence(Incidence *))); | 395 | mMainView, SLOT(deleteIncidence(Incidence *))); |
331 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 396 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
332 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 397 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
333 | connect( mListView, SIGNAL( signalNewEvent() ), | 398 | connect( mListView, SIGNAL( signalNewEvent() ), |
334 | mMainView, SLOT( newEvent() ) ); | 399 | mMainView, SLOT( newEvent() ) ); |
335 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 400 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
336 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 401 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
337 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 402 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
338 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 403 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
339 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 404 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
340 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 405 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
341 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 406 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
342 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 407 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
343 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 408 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
344 | } | 409 | } |
345 | // bool temp = mFlagShowNextxDays; | 410 | // bool temp = mFlagShowNextxDays; |
346 | //globalFlagBlockPainting = true; | 411 | //globalFlagBlockPainting = true; |
347 | globalFlagBlockAgenda = 1; | 412 | globalFlagBlockAgenda = 1; |
348 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { | 413 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { |
349 | mMainView->setBlockShowDates( true ); | 414 | mMainView->setBlockShowDates( true ); |
350 | mMainView->dateNavigator()->selectMonth(); | 415 | mMainView->dateNavigator()->selectMonth(); |
351 | mMainView->setBlockShowDates( false ); | 416 | mMainView->setBlockShowDates( false ); |
352 | } | 417 | } |
353 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 418 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
354 | //mFlagShowNextxDays = temp; | 419 | //mFlagShowNextxDays = temp; |
355 | } | 420 | } |
356 | 421 | ||
357 | void KOViewManager::showAgendaView( bool fullScreen ) | 422 | void KOViewManager::showAgendaView( bool fullScreen ) |
358 | { | 423 | { |
359 | 424 | ||
360 | mMainView->dialogManager()->hideSearchDialog(); | 425 | mMainView->dialogManager()->hideSearchDialog(); |
361 | // qDebug("KOViewManager::showAgendaView "); | 426 | // qDebug("KOViewManager::showAgendaView "); |
362 | bool full; | 427 | bool full; |
363 | full = fullScreen; | 428 | full = fullScreen; |
364 | if (!mAgendaView) { | 429 | if (!mAgendaView) { |
365 | full = false; | 430 | full = false; |
366 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 431 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
367 | addView(mAgendaView); | 432 | addView(mAgendaView); |
368 | #ifndef DESKTOP_VERSION | 433 | #ifndef DESKTOP_VERSION |
369 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 434 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
370 | #endif | 435 | #endif |
371 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 436 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
372 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 437 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
373 | 438 | ||
374 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 439 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
375 | 440 | ||
376 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); | 441 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); |
377 | 442 | ||
378 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), | 443 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), |
379 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); | 444 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); |
380 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 445 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
381 | mMainView, SLOT(newEvent(QDateTime))); | 446 | mMainView, SLOT(newEvent(QDateTime))); |
382 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 447 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
383 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 448 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
384 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 449 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
385 | mMainView, SLOT(newEvent(QDate))); | 450 | mMainView, SLOT(newEvent(QDate))); |
386 | 451 | ||
387 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 452 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
388 | mMainView, SLOT(editIncidence(Incidence *))); | 453 | mMainView, SLOT(editIncidence(Incidence *))); |
389 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 454 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
390 | mMainView, SLOT(showIncidence(Incidence *))); | 455 | mMainView, SLOT(showIncidence(Incidence *))); |
391 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 456 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
392 | mMainView, SLOT(deleteIncidence(Incidence *))); | 457 | mMainView, SLOT(deleteIncidence(Incidence *))); |
393 | 458 | ||
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index 6290227..d829f14 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h | |||
@@ -1,121 +1,122 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 | 3 | Copyright (c) 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef KOVIEWMANAGER_H | 24 | #ifndef KOVIEWMANAGER_H |
25 | #define KOVIEWMANAGER_H | 25 | #define KOVIEWMANAGER_H |
26 | 26 | ||
27 | #include <qobject.h> | 27 | #include <qobject.h> |
28 | 28 | ||
29 | #include <korganizer/baseview.h> | 29 | #include <korganizer/baseview.h> |
30 | 30 | ||
31 | class CalendarView; | 31 | class CalendarView; |
32 | 32 | ||
33 | class KOListView; | 33 | class KOListView; |
34 | class KOAgendaView; | 34 | class KOAgendaView; |
35 | class KOMonthView; | 35 | class KOMonthView; |
36 | class KOTimeSpanView; | 36 | class KOTimeSpanView; |
37 | class KOTodoView; | 37 | class KOTodoView; |
38 | class KOWhatsNextView; | 38 | class KOWhatsNextView; |
39 | class KOJournalView; | 39 | class KOJournalView; |
40 | 40 | ||
41 | using namespace KCal; | 41 | using namespace KCal; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | This class manages the views of the calendar. It owns the objects and handles | 44 | This class manages the views of the calendar. It owns the objects and handles |
45 | creation and selection. | 45 | creation and selection. |
46 | */ | 46 | */ |
47 | class KOViewManager : public QObject | 47 | class KOViewManager : public QObject |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | public: | 50 | public: |
51 | KOViewManager( CalendarView * ); | 51 | KOViewManager( CalendarView * ); |
52 | virtual ~KOViewManager(); | 52 | virtual ~KOViewManager(); |
53 | 53 | ||
54 | /** changes the view to be the currently selected view */ | 54 | /** changes the view to be the currently selected view */ |
55 | void showView(KOrg::BaseView *, bool fullScreen = false ); | 55 | void showView(KOrg::BaseView *, bool fullScreen = false ); |
56 | void updateWNview(); | 56 | void updateWNview(); |
57 | void readSettings(KConfig *config); | 57 | void readSettings(KConfig *config); |
58 | void writeSettings(KConfig *config); | 58 | void writeSettings(KConfig *config); |
59 | bool showsNextDays(); | 59 | bool showsNextDays(); |
60 | /** Read which view was shown last from config file */ | 60 | /** Read which view was shown last from config file */ |
61 | void readCurrentView(KConfig *); | 61 | void readCurrentView(KConfig *); |
62 | /** Write which view is currently shown to config file */ | 62 | /** Write which view is currently shown to config file */ |
63 | void writeCurrentView(KConfig *); | 63 | void writeCurrentView(KConfig *); |
64 | 64 | ||
65 | KOrg::BaseView *currentView(); | 65 | KOrg::BaseView *currentView(); |
66 | 66 | ||
67 | void setDocumentId( const QString & ); | 67 | void setDocumentId( const QString & ); |
68 | 68 | ||
69 | void updateView( const QDate &start, const QDate &end ); | 69 | void updateView( const QDate &start, const QDate &end ); |
70 | 70 | ||
71 | void raiseCurrentView( bool fullScreen = false , bool updateView = false); | 71 | void raiseCurrentView( bool fullScreen = false , bool updateView = false); |
72 | 72 | ||
73 | void addView(KOrg::BaseView *); | 73 | void addView(KOrg::BaseView *); |
74 | 74 | ||
75 | Incidence *currentSelection(); | 75 | Incidence *currentSelection(); |
76 | QDate currentSelectionDate(); | 76 | QDate currentSelectionDate(); |
77 | 77 | ||
78 | KOAgendaView *agendaView() const { return mAgendaView; } | 78 | KOAgendaView *agendaView() const { return mAgendaView; } |
79 | 79 | ||
80 | signals: | 80 | signals: |
81 | void printWNV(); | 81 | void printWNV(); |
82 | void signalFullScreen( bool ); | 82 | void signalFullScreen( bool ); |
83 | void signalAgendaView( bool ); | 83 | void signalAgendaView( bool ); |
84 | public slots: | 84 | public slots: |
85 | void showNextView(); | ||
85 | void showMonth( const QDate & ); | 86 | void showMonth( const QDate & ); |
86 | void showDateView( int, QDate ); | 87 | void showDateView( int, QDate ); |
87 | void updateView(); | 88 | void updateView(); |
88 | void showWhatsNextView(); | 89 | void showWhatsNextView(); |
89 | void showListView(); | 90 | void showListView(); |
90 | void showAgendaView( bool fullScreen = false ); | 91 | void showAgendaView( bool fullScreen = false ); |
91 | void showDayView(); | 92 | void showDayView(); |
92 | void showWorkWeekView(); | 93 | void showWorkWeekView(); |
93 | void showWeekView(); | 94 | void showWeekView(); |
94 | void showNextXView(); | 95 | void showNextXView(); |
95 | void showMonthView(); | 96 | void showMonthView(); |
96 | void showMonthViewWeek(); | 97 | void showMonthViewWeek(); |
97 | void showTodoView(); | 98 | void showTodoView(); |
98 | void showJournalView(); | 99 | void showJournalView(); |
99 | void showTimeSpanView(); | 100 | void showTimeSpanView(); |
100 | 101 | ||
101 | private: | 102 | private: |
102 | void createMonthView(); | 103 | void createMonthView(); |
103 | CalendarView *mMainView; | 104 | CalendarView *mMainView; |
104 | 105 | ||
105 | int mCurrentAgendaView; | 106 | int mCurrentAgendaView; |
106 | KOAgendaView *mAgendaView; | 107 | KOAgendaView *mAgendaView; |
107 | KOListView *mListView; | 108 | KOListView *mListView; |
108 | KOMonthView *mMonthView; | 109 | KOMonthView *mMonthView; |
109 | KOTodoView *mTodoView; | 110 | KOTodoView *mTodoView; |
110 | KOWhatsNextView *mWhatsNextView; | 111 | KOWhatsNextView *mWhatsNextView; |
111 | KOJournalView *mJournalView; | 112 | KOJournalView *mJournalView; |
112 | KOTimeSpanView *mTimeSpanView; | 113 | KOTimeSpanView *mTimeSpanView; |
113 | 114 | ||
114 | KOrg::BaseView *mCurrentView; // currently active event view | 115 | KOrg::BaseView *mCurrentView; // currently active event view |
115 | 116 | ||
116 | int mAgendaViewMode; | 117 | int mAgendaViewMode; |
117 | bool mFlagShowNextxDays; | 118 | bool mFlagShowNextxDays; |
118 | 119 | ||
119 | }; | 120 | }; |
120 | 121 | ||
121 | #endif | 122 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 7d5cf72..b947cac 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -295,387 +295,390 @@ MainWindow::~MainWindow() | |||
295 | delete mCalendar; | 295 | delete mCalendar; |
296 | delete mSyncManager; | 296 | delete mSyncManager; |
297 | #ifndef DESKTOP_VERSION | 297 | #ifndef DESKTOP_VERSION |
298 | if ( infrared ) | 298 | if ( infrared ) |
299 | delete infrared; | 299 | delete infrared; |
300 | #endif | 300 | #endif |
301 | 301 | ||
302 | 302 | ||
303 | } | 303 | } |
304 | 304 | ||
305 | void MainWindow::disableBR(bool b) | 305 | void MainWindow::disableBR(bool b) |
306 | { | 306 | { |
307 | #ifndef DESKTOP_VERSION | 307 | #ifndef DESKTOP_VERSION |
308 | if ( b ) { | 308 | if ( b ) { |
309 | if ( infrared ) { | 309 | if ( infrared ) { |
310 | toggleBeamReceive(); | 310 | toggleBeamReceive(); |
311 | mBRdisabled = true; | 311 | mBRdisabled = true; |
312 | } | 312 | } |
313 | mBRdisabled = true; | 313 | mBRdisabled = true; |
314 | } else { | 314 | } else { |
315 | if ( mBRdisabled ) { | 315 | if ( mBRdisabled ) { |
316 | mBRdisabled = false; | 316 | mBRdisabled = false; |
317 | //makes no sense,because other cal ap is probably running | 317 | //makes no sense,because other cal ap is probably running |
318 | // toggleBeamReceive(); | 318 | // toggleBeamReceive(); |
319 | } | 319 | } |
320 | } | 320 | } |
321 | #endif | 321 | #endif |
322 | 322 | ||
323 | } | 323 | } |
324 | bool MainWindow::beamReceiveEnabled() | 324 | bool MainWindow::beamReceiveEnabled() |
325 | { | 325 | { |
326 | #ifndef DESKTOP_VERSION | 326 | #ifndef DESKTOP_VERSION |
327 | return ( infrared != 0 ); | 327 | return ( infrared != 0 ); |
328 | #endif | 328 | #endif |
329 | return false; | 329 | return false; |
330 | } | 330 | } |
331 | 331 | ||
332 | void MainWindow::toggleBeamReceive() | 332 | void MainWindow::toggleBeamReceive() |
333 | { | 333 | { |
334 | if ( mBRdisabled ) | 334 | if ( mBRdisabled ) |
335 | return; | 335 | return; |
336 | #ifndef DESKTOP_VERSION | 336 | #ifndef DESKTOP_VERSION |
337 | if ( infrared ) { | 337 | if ( infrared ) { |
338 | qDebug("disable BeamReceive "); | 338 | qDebug("disable BeamReceive "); |
339 | delete infrared; | 339 | delete infrared; |
340 | infrared = 0; | 340 | infrared = 0; |
341 | brAction->setOn(false); | 341 | brAction->setOn(false); |
342 | return; | 342 | return; |
343 | } | 343 | } |
344 | qDebug("enable BeamReceive "); | 344 | qDebug("enable BeamReceive "); |
345 | brAction->setOn(true); | 345 | brAction->setOn(true); |
346 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 346 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
347 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 347 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
348 | #endif | 348 | #endif |
349 | } | 349 | } |
350 | void MainWindow::showMaximized () | 350 | void MainWindow::showMaximized () |
351 | { | 351 | { |
352 | #ifndef DESKTOP_VERSION | 352 | #ifndef DESKTOP_VERSION |
353 | if ( ! globalFlagBlockStartup ) | 353 | if ( ! globalFlagBlockStartup ) |
354 | if ( mClosed ) | 354 | if ( mClosed ) |
355 | mView->goToday(); | 355 | mView->goToday(); |
356 | #endif | 356 | #endif |
357 | QWidget::showMaximized () ; | 357 | QWidget::showMaximized () ; |
358 | mClosed = false; | 358 | mClosed = false; |
359 | } | 359 | } |
360 | void MainWindow::closeEvent( QCloseEvent* ce ) | 360 | void MainWindow::closeEvent( QCloseEvent* ce ) |
361 | { | 361 | { |
362 | 362 | ||
363 | 363 | ||
364 | 364 | ||
365 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 365 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
366 | saveOnClose(); | 366 | saveOnClose(); |
367 | mClosed = true; | 367 | mClosed = true; |
368 | ce->accept(); | 368 | ce->accept(); |
369 | return; | 369 | return; |
370 | 370 | ||
371 | } | 371 | } |
372 | 372 | ||
373 | switch( QMessageBox::information( this, "KO/Pi", | 373 | switch( QMessageBox::information( this, "KO/Pi", |
374 | i18n("Do you really want\nto close KO/Pi?"), | 374 | i18n("Do you really want\nto close KO/Pi?"), |
375 | i18n("Close"), i18n("No"), | 375 | i18n("Close"), i18n("No"), |
376 | 0, 0 ) ) { | 376 | 0, 0 ) ) { |
377 | case 0: | 377 | case 0: |
378 | saveOnClose(); | 378 | saveOnClose(); |
379 | mClosed = true; | 379 | mClosed = true; |
380 | ce->accept(); | 380 | ce->accept(); |
381 | break; | 381 | break; |
382 | case 1: | 382 | case 1: |
383 | ce->ignore(); | 383 | ce->ignore(); |
384 | break; | 384 | break; |
385 | case 2: | 385 | case 2: |
386 | 386 | ||
387 | default: | 387 | default: |
388 | break; | 388 | break; |
389 | } | 389 | } |
390 | 390 | ||
391 | 391 | ||
392 | } | 392 | } |
393 | 393 | ||
394 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 394 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
395 | { | 395 | { |
396 | QDataStream stream( data, IO_ReadOnly ); | 396 | QDataStream stream( data, IO_ReadOnly ); |
397 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 397 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
398 | //QString datamess; | 398 | //QString datamess; |
399 | //qDebug("message "); | 399 | //qDebug("message "); |
400 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 400 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
401 | 401 | ||
402 | if ( cmsg == "setDocument(QString)" ) { | 402 | if ( cmsg == "setDocument(QString)" ) { |
403 | QDataStream stream( data, IO_ReadOnly ); | 403 | QDataStream stream( data, IO_ReadOnly ); |
404 | QString fileName; | 404 | QString fileName; |
405 | stream >> fileName; | 405 | stream >> fileName; |
406 | //qDebug("filename %s ", fileName.latin1()); | 406 | //qDebug("filename %s ", fileName.latin1()); |
407 | showMaximized(); | 407 | showMaximized(); |
408 | raise(); | 408 | raise(); |
409 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 409 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
410 | mSyncManager->slotSyncMenu( 1002 ); | 410 | mSyncManager->slotSyncMenu( 1002 ); |
411 | return; | 411 | return; |
412 | } | 412 | } |
413 | 413 | ||
414 | if ( cmsg == "-writeFile" ) { | 414 | if ( cmsg == "-writeFile" ) { |
415 | // I made from the "-writeFile" an "-writeAlarm" | 415 | // I made from the "-writeFile" an "-writeAlarm" |
416 | mView->viewManager()->showWhatsNextView(); | 416 | mView->viewManager()->showWhatsNextView(); |
417 | mCalendar->checkAlarmForIncidence( 0, true); | 417 | mCalendar->checkAlarmForIncidence( 0, true); |
418 | showMaximized(); | 418 | showMaximized(); |
419 | raise(); | 419 | raise(); |
420 | return; | 420 | return; |
421 | 421 | ||
422 | } | 422 | } |
423 | if ( cmsg == "-writeFileSilent" ) { | 423 | if ( cmsg == "-writeFileSilent" ) { |
424 | // I made from the "-writeFile" an "-writeAlarm" | 424 | // I made from the "-writeFile" an "-writeAlarm" |
425 | // mView->viewManager()->showWhatsNextView(); | 425 | // mView->viewManager()->showWhatsNextView(); |
426 | mCalendar->checkAlarmForIncidence( 0, true); | 426 | mCalendar->checkAlarmForIncidence( 0, true); |
427 | //showMaximized(); | 427 | //showMaximized(); |
428 | //raise(); | 428 | //raise(); |
429 | hide(); | 429 | hide(); |
430 | return; | 430 | return; |
431 | } | 431 | } |
432 | if ( cmsg == "-newCountdown" ) { | 432 | if ( cmsg == "-newCountdown" ) { |
433 | qDebug("newCountdown "); | 433 | qDebug("newCountdown "); |
434 | 434 | ||
435 | } | 435 | } |
436 | QString msg ; | 436 | QString msg ; |
437 | QString allmsg = cmsg; | 437 | QString allmsg = cmsg; |
438 | while ( allmsg.length() > 0 ) { | 438 | while ( allmsg.length() > 0 ) { |
439 | int nextC = allmsg.find( "-", 1 ); | 439 | int nextC = allmsg.find( "-", 1 ); |
440 | if ( nextC == -1 ) { | 440 | if ( nextC == -1 ) { |
441 | msg = allmsg; | 441 | msg = allmsg; |
442 | allmsg = ""; | 442 | allmsg = ""; |
443 | } else{ | 443 | } else{ |
444 | msg = allmsg.left( nextC ); | 444 | msg = allmsg.left( nextC ); |
445 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 445 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
446 | } | 446 | } |
447 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 447 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
448 | if ( msg == "-newEvent" ) { | 448 | if ( msg == "-newEvent" ) { |
449 | mView->newEvent(); | 449 | mView->newEvent(); |
450 | } | 450 | } |
451 | if ( msg == "-newTodo" ) { | 451 | if ( msg == "-newTodo" ) { |
452 | mView->newTodo(); | 452 | mView->newTodo(); |
453 | 453 | ||
454 | } | 454 | } |
455 | if ( msg == "-showWN" ) { | 455 | if ( msg == "-showWN" ) { |
456 | mView->viewManager()->showWhatsNextView(); | 456 | mView->viewManager()->showWhatsNextView(); |
457 | } | 457 | } |
458 | if ( msg == "-showTodo" ) { | 458 | if ( msg == "-showTodo" ) { |
459 | mView->viewManager()->showTodoView(); | 459 | mView->viewManager()->showTodoView(); |
460 | } | 460 | } |
461 | if ( msg == "-showList" ) { | 461 | if ( msg == "-showList" ) { |
462 | mView->viewManager()->showListView(); | 462 | mView->viewManager()->showListView(); |
463 | } | 463 | } |
464 | else if ( msg == "-showDay" ) { | 464 | else if ( msg == "-showDay" ) { |
465 | mView->viewManager()->showDayView(); | 465 | mView->viewManager()->showDayView(); |
466 | } | 466 | } |
467 | else if ( msg == "-showWWeek" ) { | 467 | else if ( msg == "-showWWeek" ) { |
468 | mView->viewManager()->showWorkWeekView(); | 468 | mView->viewManager()->showWorkWeekView(); |
469 | } | 469 | } |
470 | else if ( msg == "-ringSync" ) { | 470 | else if ( msg == "-ringSync" ) { |
471 | mSyncManager->multiSync( false ); | 471 | mSyncManager->multiSync( false ); |
472 | } | 472 | } |
473 | else if ( msg == "-showWeek" ) { | 473 | else if ( msg == "-showWeek" ) { |
474 | mView->viewManager()->showWeekView(); | 474 | mView->viewManager()->showWeekView(); |
475 | } | 475 | } |
476 | else if ( msg == "-showTodo" ) { | 476 | else if ( msg == "-showTodo" ) { |
477 | mView->viewManager()->showTodoView(); | 477 | mView->viewManager()->showTodoView(); |
478 | } | 478 | } |
479 | else if ( msg == "-showJournal" ) { | 479 | else if ( msg == "-showJournal" ) { |
480 | mView->dateNavigator()->selectDates( 1 ); | 480 | mView->dateNavigator()->selectDates( 1 ); |
481 | mView->dateNavigator()->selectToday(); | 481 | mView->dateNavigator()->selectToday(); |
482 | mView->viewManager()->showJournalView(); | 482 | mView->viewManager()->showJournalView(); |
483 | } | 483 | } |
484 | else if ( msg == "-showKO" ) { | 484 | else if ( msg == "-showKO" ) { |
485 | mView->viewManager()->showNextXView(); | 485 | mView->viewManager()->showNextXView(); |
486 | } | 486 | } |
487 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 487 | else if ( msg == "-showWNext" ) { |
488 | mView->viewManager()->showWhatsNextView(); | 488 | mView->viewManager()->showWhatsNextView(); |
489 | } | 489 | } |
490 | else if ( msg == "nextView()" ) { | ||
491 | mView->viewManager()->showNextView(); | ||
492 | } | ||
490 | else if ( msg == "-showNextXView" ) { | 493 | else if ( msg == "-showNextXView" ) { |
491 | mView->viewManager()->showNextXView(); | 494 | mView->viewManager()->showNextXView(); |
492 | } | 495 | } |
493 | 496 | ||
494 | 497 | ||
495 | } | 498 | } |
496 | 499 | ||
497 | showMaximized(); | 500 | showMaximized(); |
498 | raise(); | 501 | raise(); |
499 | } | 502 | } |
500 | 503 | ||
501 | QPixmap MainWindow::loadPixmap( QString name ) | 504 | QPixmap MainWindow::loadPixmap( QString name ) |
502 | { | 505 | { |
503 | return SmallIcon( name ); | 506 | return SmallIcon( name ); |
504 | 507 | ||
505 | } | 508 | } |
506 | void MainWindow::initActions() | 509 | void MainWindow::initActions() |
507 | { | 510 | { |
508 | //KOPrefs::instance()->mShowFullMenu | 511 | //KOPrefs::instance()->mShowFullMenu |
509 | iconToolBar->clear(); | 512 | iconToolBar->clear(); |
510 | KOPrefs *p = KOPrefs::instance(); | 513 | KOPrefs *p = KOPrefs::instance(); |
511 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 514 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
512 | 515 | ||
513 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 516 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
514 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 517 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
515 | QPopupMenu *importMenu = new QPopupMenu( this ); | 518 | QPopupMenu *importMenu = new QPopupMenu( this ); |
516 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 519 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
517 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 520 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
518 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 521 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
519 | selectFilterMenu = new QPopupMenu( this ); | 522 | selectFilterMenu = new QPopupMenu( this ); |
520 | selectFilterMenu->setCheckable( true ); | 523 | selectFilterMenu->setCheckable( true ); |
521 | syncMenu = new QPopupMenu( this ); | 524 | syncMenu = new QPopupMenu( this ); |
522 | configureAgendaMenu = new QPopupMenu( this ); | 525 | configureAgendaMenu = new QPopupMenu( this ); |
523 | configureToolBarMenu = new QPopupMenu( this ); | 526 | configureToolBarMenu = new QPopupMenu( this ); |
524 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 527 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
525 | QIconSet icon; | 528 | QIconSet icon; |
526 | int pixWid = 22, pixHei = 22; | 529 | int pixWid = 22, pixHei = 22; |
527 | QString pathString = ""; | 530 | QString pathString = ""; |
528 | if ( !p->mToolBarMiniIcons ) { | 531 | if ( !p->mToolBarMiniIcons ) { |
529 | if ( QApplication::desktop()->width() < 480 ) { | 532 | if ( QApplication::desktop()->width() < 480 ) { |
530 | pathString += "icons16/"; | 533 | pathString += "icons16/"; |
531 | pixWid = 18; pixHei = 16; | 534 | pixWid = 18; pixHei = 16; |
532 | } | 535 | } |
533 | } else { | 536 | } else { |
534 | pathString += "iconsmini/"; | 537 | pathString += "iconsmini/"; |
535 | pixWid = 18; pixHei = 16; | 538 | pixWid = 18; pixHei = 16; |
536 | } | 539 | } |
537 | if ( KOPrefs::instance()->mShowFullMenu ) { | 540 | if ( KOPrefs::instance()->mShowFullMenu ) { |
538 | QMenuBar *menuBar1; | 541 | QMenuBar *menuBar1; |
539 | menuBar1 = menuBar(); | 542 | menuBar1 = menuBar(); |
540 | menuBar1->insertItem( i18n("File"), importMenu ); | 543 | menuBar1->insertItem( i18n("File"), importMenu ); |
541 | menuBar1->insertItem( i18n("View"), viewMenu ); | 544 | menuBar1->insertItem( i18n("View"), viewMenu ); |
542 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 545 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
543 | #ifdef DESKTOP_VERSION | 546 | #ifdef DESKTOP_VERSION |
544 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 547 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
545 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 548 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
546 | #else | 549 | #else |
547 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 550 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
548 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 551 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
549 | #endif | 552 | #endif |
550 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 553 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
551 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 554 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
552 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 555 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
553 | } else { | 556 | } else { |
554 | QPEMenuBar *menuBar1; | 557 | QPEMenuBar *menuBar1; |
555 | menuBar1 = new QPEMenuBar( iconToolBar ); | 558 | menuBar1 = new QPEMenuBar( iconToolBar ); |
556 | QPopupMenu *menuBar = new QPopupMenu( this ); | 559 | QPopupMenu *menuBar = new QPopupMenu( this ); |
557 | icon = loadPixmap( pathString + "z_menu" ); | 560 | icon = loadPixmap( pathString + "z_menu" ); |
558 | menuBar1->insertItem( icon.pixmap(), menuBar); | 561 | menuBar1->insertItem( icon.pixmap(), menuBar); |
559 | //menuBar1->insertItem( i18n("ME"), menuBar); | 562 | //menuBar1->insertItem( i18n("ME"), menuBar); |
560 | menuBar->insertItem( i18n("File"), importMenu ); | 563 | menuBar->insertItem( i18n("File"), importMenu ); |
561 | menuBar->insertItem( i18n("View"), viewMenu ); | 564 | menuBar->insertItem( i18n("View"), viewMenu ); |
562 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 565 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
563 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 566 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
564 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 567 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
565 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 568 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
566 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 569 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
567 | menuBar->insertItem( i18n("Help"), helpMenu ); | 570 | menuBar->insertItem( i18n("Help"), helpMenu ); |
568 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 571 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
569 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 572 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
570 | } | 573 | } |
571 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 574 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
572 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 575 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
573 | mWeekBgColor = iconToolBar->backgroundColor(); | 576 | mWeekBgColor = iconToolBar->backgroundColor(); |
574 | mWeekPixmap.resize( pixWid , pixHei ); | 577 | mWeekPixmap.resize( pixWid , pixHei ); |
575 | mWeekPixmap.fill( mWeekBgColor ); | 578 | mWeekPixmap.fill( mWeekBgColor ); |
576 | icon = mWeekPixmap; | 579 | icon = mWeekPixmap; |
577 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 580 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
578 | if ( p-> mShowIconWeekNum ) | 581 | if ( p-> mShowIconWeekNum ) |
579 | mWeekAction->addTo( iconToolBar ); | 582 | mWeekAction->addTo( iconToolBar ); |
580 | mWeekFont = font(); | 583 | mWeekFont = font(); |
581 | 584 | ||
582 | int fontPoint = mWeekFont.pointSize(); | 585 | int fontPoint = mWeekFont.pointSize(); |
583 | QFontMetrics f( mWeekFont ); | 586 | QFontMetrics f( mWeekFont ); |
584 | int fontWid = f.width( "30" ); | 587 | int fontWid = f.width( "30" ); |
585 | while ( fontWid > pixWid ) { | 588 | while ( fontWid > pixWid ) { |
586 | --fontPoint; | 589 | --fontPoint; |
587 | mWeekFont.setPointSize( fontPoint ); | 590 | mWeekFont.setPointSize( fontPoint ); |
588 | QFontMetrics f( mWeekFont ); | 591 | QFontMetrics f( mWeekFont ); |
589 | fontWid = f.width( "30" ); | 592 | fontWid = f.width( "30" ); |
590 | qDebug("dec-- "); | 593 | qDebug("dec-- "); |
591 | } | 594 | } |
592 | 595 | ||
593 | connect( mWeekAction, SIGNAL( activated() ), | 596 | connect( mWeekAction, SIGNAL( activated() ), |
594 | this, SLOT( weekAction() ) ); | 597 | this, SLOT( weekAction() ) ); |
595 | 598 | ||
596 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 599 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
597 | 600 | ||
598 | //#endif | 601 | //#endif |
599 | // ****************** | 602 | // ****************** |
600 | QAction *action; | 603 | QAction *action; |
601 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 604 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
602 | configureToolBarMenu->setCheckable( true ); | 605 | configureToolBarMenu->setCheckable( true ); |
603 | 606 | ||
604 | 607 | ||
605 | configureAgendaMenu->setCheckable( true ); | 608 | configureAgendaMenu->setCheckable( true ); |
606 | int iii ; | 609 | int iii ; |
607 | for ( iii = 1;iii<= 10 ;++iii ){ | 610 | for ( iii = 1;iii<= 10 ;++iii ){ |
608 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 611 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
609 | } | 612 | } |
610 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 613 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
611 | 614 | ||
612 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 615 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
613 | this, SLOT( showConfigureAgenda( ) ) ); | 616 | this, SLOT( showConfigureAgenda( ) ) ); |
614 | 617 | ||
615 | icon = loadPixmap( pathString + "configure" ); | 618 | icon = loadPixmap( pathString + "configure" ); |
616 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 619 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
617 | action->addTo( actionMenu ); | 620 | action->addTo( actionMenu ); |
618 | connect( action, SIGNAL( activated() ), | 621 | connect( action, SIGNAL( activated() ), |
619 | mView, SLOT( edit_options() ) ); | 622 | mView, SLOT( edit_options() ) ); |
620 | actionMenu->insertSeparator(); | 623 | actionMenu->insertSeparator(); |
621 | 624 | ||
622 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 625 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
623 | action->addTo( actionMenu ); | 626 | action->addTo( actionMenu ); |
624 | connect( action, SIGNAL( activated() ), | 627 | connect( action, SIGNAL( activated() ), |
625 | mView, SLOT( undo_delete() ) ); | 628 | mView, SLOT( undo_delete() ) ); |
626 | actionMenu->insertSeparator(); | 629 | actionMenu->insertSeparator(); |
627 | 630 | ||
628 | icon = loadPixmap( pathString + "newevent" ); | 631 | icon = loadPixmap( pathString + "newevent" ); |
629 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 632 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
630 | configureToolBarMenu->insertSeparator(); | 633 | configureToolBarMenu->insertSeparator(); |
631 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 634 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
632 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 635 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
633 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 636 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
634 | ne_action->addTo( actionMenu ); | 637 | ne_action->addTo( actionMenu ); |
635 | connect( ne_action, SIGNAL( activated() ), | 638 | connect( ne_action, SIGNAL( activated() ), |
636 | mView, SLOT( newEvent() ) ); | 639 | mView, SLOT( newEvent() ) ); |
637 | icon = loadPixmap( pathString + "newtodo" ); | 640 | icon = loadPixmap( pathString + "newtodo" ); |
638 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 641 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
639 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 642 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
640 | nt_action->addTo( actionMenu ); | 643 | nt_action->addTo( actionMenu ); |
641 | connect( nt_action, SIGNAL( activated() ), | 644 | connect( nt_action, SIGNAL( activated() ), |
642 | mView, SLOT( newTodo() ) ); | 645 | mView, SLOT( newTodo() ) ); |
643 | 646 | ||
644 | icon = loadPixmap( pathString + "today" ); | 647 | icon = loadPixmap( pathString + "today" ); |
645 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 648 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
646 | today_action->addTo( viewMenu ); | 649 | today_action->addTo( viewMenu ); |
647 | connect( today_action, SIGNAL( activated() ), | 650 | connect( today_action, SIGNAL( activated() ), |
648 | mView, SLOT( goToday() ) ); | 651 | mView, SLOT( goToday() ) ); |
649 | viewMenu->insertSeparator(); | 652 | viewMenu->insertSeparator(); |
650 | 653 | ||
651 | icon = loadPixmap( pathString + "navi" ); | 654 | icon = loadPixmap( pathString + "navi" ); |
652 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 655 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
653 | action->addTo( viewMenu ); | 656 | action->addTo( viewMenu ); |
654 | connect( action, SIGNAL( activated() ), | 657 | connect( action, SIGNAL( activated() ), |
655 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 658 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
656 | mToggleNav = action ; | 659 | mToggleNav = action ; |
657 | icon = loadPixmap( pathString + "filter" ); | 660 | icon = loadPixmap( pathString + "filter" ); |
658 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 661 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
659 | action->addTo( viewMenu ); | 662 | action->addTo( viewMenu ); |
660 | connect( action, SIGNAL( activated() ), | 663 | connect( action, SIGNAL( activated() ), |
661 | mView, SLOT( toggleFilter() ) ); | 664 | mView, SLOT( toggleFilter() ) ); |
662 | mToggleFilter = action; | 665 | mToggleFilter = action; |
663 | icon = loadPixmap( pathString + "allday" ); | 666 | icon = loadPixmap( pathString + "allday" ); |
664 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 667 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
665 | action->addTo( viewMenu ); | 668 | action->addTo( viewMenu ); |
666 | connect( action, SIGNAL( activated() ), | 669 | connect( action, SIGNAL( activated() ), |
667 | mView, SLOT( toggleAllDaySize() ) ); | 670 | mView, SLOT( toggleAllDaySize() ) ); |
668 | mToggleAllday = action; | 671 | mToggleAllday = action; |
669 | 672 | ||
670 | 673 | ||
671 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 674 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
672 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 675 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
673 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 676 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
674 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 677 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
675 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 678 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
676 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 679 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
677 | 680 | ||
678 | viewMenu->insertSeparator(); | 681 | viewMenu->insertSeparator(); |
679 | icon = loadPixmap( pathString + "picker" ); | 682 | icon = loadPixmap( pathString + "picker" ); |
680 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 683 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
681 | action->addTo( viewMenu ); | 684 | action->addTo( viewMenu ); |