-rw-r--r-- | kaddressbook/kabcore.cpp | 34 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 11 |
2 files changed, 16 insertions, 29 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index fa9f130..9c40142 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -538,237 +538,217 @@ void KABCore::restoreSettings() | |||
538 | if ( true /*splitterSize.count() == 0*/ ) { | 538 | if ( true /*splitterSize.count() == 0*/ ) { |
539 | splitterSize.append( wid / 2 ); | 539 | splitterSize.append( wid / 2 ); |
540 | splitterSize.append( wid / 2 ); | 540 | splitterSize.append( wid / 2 ); |
541 | } | 541 | } |
542 | mMiniSplitter->setSizes( splitterSize ); | 542 | mMiniSplitter->setSizes( splitterSize ); |
543 | if ( mExtensionBarSplitter ) { | 543 | if ( mExtensionBarSplitter ) { |
544 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 544 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
545 | if ( true /*splitterSize.count() == 0*/ ) { | 545 | if ( true /*splitterSize.count() == 0*/ ) { |
546 | splitterSize.append( wid / 2 ); | 546 | splitterSize.append( wid / 2 ); |
547 | splitterSize.append( wid / 2 ); | 547 | splitterSize.append( wid / 2 ); |
548 | } | 548 | } |
549 | mExtensionBarSplitter->setSizes( splitterSize ); | 549 | mExtensionBarSplitter->setSizes( splitterSize ); |
550 | 550 | ||
551 | } | 551 | } |
552 | 552 | ||
553 | 553 | ||
554 | } | 554 | } |
555 | 555 | ||
556 | void KABCore::saveSettings() | 556 | void KABCore::saveSettings() |
557 | { | 557 | { |
558 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 558 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
559 | if ( mExtensionBarSplitter ) | 559 | if ( mExtensionBarSplitter ) |
560 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 560 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
561 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 561 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
562 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 562 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
563 | #ifndef KAB_EMBEDDED | 563 | #ifndef KAB_EMBEDDED |
564 | 564 | ||
565 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 565 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
566 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 566 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
567 | #endif //KAB_EMBEDDED | 567 | #endif //KAB_EMBEDDED |
568 | mExtensionManager->saveSettings(); | 568 | mExtensionManager->saveSettings(); |
569 | mViewManager->saveSettings(); | 569 | mViewManager->saveSettings(); |
570 | 570 | ||
571 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 571 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
572 | KABPrefs::instance()->writeConfig(); | 572 | KABPrefs::instance()->writeConfig(); |
573 | qDebug("KA: KABCore::saveSettings() "); | 573 | qDebug("KA: KABCore::saveSettings() "); |
574 | } | 574 | } |
575 | 575 | ||
576 | KABC::AddressBook *KABCore::addressBook() const | 576 | KABC::AddressBook *KABCore::addressBook() const |
577 | { | 577 | { |
578 | return mAddressBook; | 578 | return mAddressBook; |
579 | } | 579 | } |
580 | 580 | ||
581 | KConfig *KABCore::config() | 581 | KConfig *KABCore::config() |
582 | { | 582 | { |
583 | #ifndef KAB_EMBEDDED | 583 | #ifndef KAB_EMBEDDED |
584 | return KABPrefs::instance()->config(); | 584 | return KABPrefs::instance()->config(); |
585 | #else //KAB_EMBEDDED | 585 | #else //KAB_EMBEDDED |
586 | return KABPrefs::instance()->getConfig(); | 586 | return KABPrefs::instance()->getConfig(); |
587 | #endif //KAB_EMBEDDED | 587 | #endif //KAB_EMBEDDED |
588 | } | 588 | } |
589 | 589 | ||
590 | KActionCollection *KABCore::actionCollection() const | 590 | KActionCollection *KABCore::actionCollection() const |
591 | { | 591 | { |
592 | return mGUIClient->actionCollection(); | 592 | return mGUIClient->actionCollection(); |
593 | } | 593 | } |
594 | 594 | ||
595 | KABC::Field *KABCore::currentSearchField() const | 595 | KABC::Field *KABCore::currentSearchField() const |
596 | { | 596 | { |
597 | if (mIncSearchWidget) | 597 | if (mIncSearchWidget) |
598 | return mIncSearchWidget->currentField(); | 598 | return mIncSearchWidget->currentField(); |
599 | else | 599 | else |
600 | return 0; | 600 | return 0; |
601 | } | 601 | } |
602 | 602 | ||
603 | QStringList KABCore::selectedUIDs() const | 603 | QStringList KABCore::selectedUIDs() const |
604 | { | 604 | { |
605 | return mViewManager->selectedUids(); | 605 | return mViewManager->selectedUids(); |
606 | } | 606 | } |
607 | 607 | ||
608 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 608 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
609 | { | 609 | { |
610 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 610 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
611 | 611 | ||
612 | QPtrList<KRES::Resource> kresResources; | 612 | QPtrList<KRES::Resource> kresResources; |
613 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 613 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
614 | KABC::Resource *resource; | 614 | KABC::Resource *resource; |
615 | while ( ( resource = resIt.current() ) != 0 ) { | 615 | while ( ( resource = resIt.current() ) != 0 ) { |
616 | ++resIt; | 616 | ++resIt; |
617 | if ( !resource->readOnly() ) { | 617 | if ( !resource->readOnly() ) { |
618 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 618 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
619 | if ( res ) | 619 | if ( res ) |
620 | kresResources.append( res ); | 620 | kresResources.append( res ); |
621 | } | 621 | } |
622 | } | 622 | } |
623 | 623 | ||
624 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 624 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
625 | return static_cast<KABC::Resource*>( res ); | 625 | return static_cast<KABC::Resource*>( res ); |
626 | } | 626 | } |
627 | 627 | ||
628 | #ifndef KAB_EMBEDDED | 628 | #ifndef KAB_EMBEDDED |
629 | KAboutData *KABCore::createAboutData() | 629 | KAboutData *KABCore::createAboutData() |
630 | #else //KAB_EMBEDDED | 630 | #else //KAB_EMBEDDED |
631 | void KABCore::createAboutData() | 631 | void KABCore::createAboutData() |
632 | #endif //KAB_EMBEDDED | 632 | #endif //KAB_EMBEDDED |
633 | { | 633 | { |
634 | #ifndef KAB_EMBEDDED | 634 | |
635 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | ||
636 | "3.1", I18N_NOOP( "The KDE Address Book" ), | ||
637 | KAboutData::License_GPL_V2, | ||
638 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | ||
639 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | ||
640 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | ||
641 | about->addAuthor( "Cornelius Schumacher", | ||
642 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), | ||
643 | "schumacher@kde.org" ); | ||
644 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), | ||
645 | "mpilone@slac.com" ); | ||
646 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); | ||
647 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); | ||
648 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), | ||
649 | "michel@klaralvdalens-datakonsult.se" ); | ||
650 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), | ||
651 | "hansen@kde.org" ); | ||
652 | |||
653 | return about; | ||
654 | #endif //KAB_EMBEDDED | ||
655 | 635 | ||
656 | QString version; | 636 | QString version; |
657 | #include <../version> | 637 | #include <../version> |
658 | QMessageBox::about( this, "About KAddressbook/Pi", | 638 | QMessageBox::about( this, "About KAddressbook/Pi", |
659 | "KAddressbook/Platform-independent\n" | 639 | "KAddressbook/Platform-independent\n" |
660 | "(KA/Pi) " +version + " - " + | 640 | "(KA/Pi) " +version + " - " + |
661 | #ifdef DESKTOP_VERSION | 641 | #ifdef DESKTOP_VERSION |
662 | "Desktop Edition\n" | 642 | "Desktop Edition\n" |
663 | #else | 643 | #else |
664 | "PDA-Edition\n" | 644 | "PDA-Edition\n" |
665 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 645 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
666 | #endif | 646 | #endif |
667 | 647 | ||
668 | "(c) 2004 Ulf Schenk\n" | 648 | "(c) 2004 Ulf Schenk\n" |
669 | "(c) 2004 Lutz Rogowski\n" | 649 | "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n" |
670 | "(c) 1997-2003, The KDE PIM Team\n" | 650 | "(c) 1997-2003, The KDE PIM Team\n" |
671 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" | 651 | "Tobias Koenig Maintainer\n" |
672 | "Don Sanders Original author\n" | 652 | "Don Sanders Original author\n" |
673 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" | 653 | "Cornelius Schumacher Co-maintainer\n" |
674 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" | 654 | "Mike Pilone GUI and framework redesign\n" |
675 | "Greg Stern DCOP interface\n" | 655 | "Greg Stern DCOP interface\n" |
676 | "Mark Westcot Contact pinning\n" | 656 | "Mark Westcot Contact pinning\n" |
677 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" | 657 | "Michel Boyer de la Giroday LDAP Lookup\n" |
678 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" | 658 | "Steffen Hansen LDAP Lookup" |
679 | #ifdef _WIN32_ | 659 | #ifdef _WIN32_ |
680 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" | 660 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" |
681 | #endif | 661 | #endif |
682 | ); | 662 | ); |
683 | } | 663 | } |
684 | 664 | ||
685 | void KABCore::setContactSelected( const QString &uid ) | 665 | void KABCore::setContactSelected( const QString &uid ) |
686 | { | 666 | { |
687 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 667 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
688 | if ( !mDetails->isHidden() ) | 668 | if ( !mDetails->isHidden() ) |
689 | mDetails->setAddressee( addr ); | 669 | mDetails->setAddressee( addr ); |
690 | 670 | ||
691 | if ( !addr.isEmpty() ) { | 671 | if ( !addr.isEmpty() ) { |
692 | emit contactSelected( addr.formattedName() ); | 672 | emit contactSelected( addr.formattedName() ); |
693 | KABC::Picture pic = addr.photo(); | 673 | KABC::Picture pic = addr.photo(); |
694 | if ( pic.isIntern() ) { | 674 | if ( pic.isIntern() ) { |
695 | //US emit contactSelected( pic.data() ); | 675 | //US emit contactSelected( pic.data() ); |
696 | //US instead use: | 676 | //US instead use: |
697 | QPixmap px; | 677 | QPixmap px; |
698 | if (pic.data().isNull() != true) | 678 | if (pic.data().isNull() != true) |
699 | { | 679 | { |
700 | px.convertFromImage(pic.data()); | 680 | px.convertFromImage(pic.data()); |
701 | } | 681 | } |
702 | 682 | ||
703 | emit contactSelected( px ); | 683 | emit contactSelected( px ); |
704 | } | 684 | } |
705 | } | 685 | } |
706 | 686 | ||
707 | 687 | ||
708 | mExtensionManager->setSelectionChanged(); | 688 | mExtensionManager->setSelectionChanged(); |
709 | 689 | ||
710 | // update the actions | 690 | // update the actions |
711 | bool selected = !uid.isEmpty(); | 691 | bool selected = !uid.isEmpty(); |
712 | 692 | ||
713 | if ( mReadWrite ) { | 693 | if ( mReadWrite ) { |
714 | mActionCut->setEnabled( selected ); | 694 | mActionCut->setEnabled( selected ); |
715 | mActionPaste->setEnabled( selected ); | 695 | mActionPaste->setEnabled( selected ); |
716 | } | 696 | } |
717 | 697 | ||
718 | mActionCopy->setEnabled( selected ); | 698 | mActionCopy->setEnabled( selected ); |
719 | mActionDelete->setEnabled( selected ); | 699 | mActionDelete->setEnabled( selected ); |
720 | mActionEditAddressee->setEnabled( selected ); | 700 | mActionEditAddressee->setEnabled( selected ); |
721 | mActionMail->setEnabled( selected ); | 701 | mActionMail->setEnabled( selected ); |
722 | mActionMailVCard->setEnabled( selected ); | 702 | mActionMailVCard->setEnabled( selected ); |
723 | //if (mActionBeam) | 703 | //if (mActionBeam) |
724 | //mActionBeam->setEnabled( selected ); | 704 | //mActionBeam->setEnabled( selected ); |
725 | mActionWhoAmI->setEnabled( selected ); | 705 | mActionWhoAmI->setEnabled( selected ); |
726 | } | 706 | } |
727 | 707 | ||
728 | void KABCore::sendMail() | 708 | void KABCore::sendMail() |
729 | { | 709 | { |
730 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 710 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
731 | } | 711 | } |
732 | 712 | ||
733 | void KABCore::sendMail( const QString& emaillist ) | 713 | void KABCore::sendMail( const QString& emaillist ) |
734 | { | 714 | { |
735 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 715 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
736 | if (emaillist.contains(",") > 0) | 716 | if (emaillist.contains(",") > 0) |
737 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 717 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
738 | else | 718 | else |
739 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 719 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
740 | } | 720 | } |
741 | 721 | ||
742 | 722 | ||
743 | 723 | ||
744 | void KABCore::mailVCard() | 724 | void KABCore::mailVCard() |
745 | { | 725 | { |
746 | QStringList uids = mViewManager->selectedUids(); | 726 | QStringList uids = mViewManager->selectedUids(); |
747 | if ( !uids.isEmpty() ) | 727 | if ( !uids.isEmpty() ) |
748 | mailVCard( uids ); | 728 | mailVCard( uids ); |
749 | } | 729 | } |
750 | 730 | ||
751 | void KABCore::mailVCard( const QStringList& uids ) | 731 | void KABCore::mailVCard( const QStringList& uids ) |
752 | { | 732 | { |
753 | QStringList urls; | 733 | QStringList urls; |
754 | 734 | ||
755 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 735 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
756 | 736 | ||
757 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); | 737 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); |
758 | 738 | ||
759 | 739 | ||
760 | 740 | ||
761 | QDir().mkdir( dirName, true ); | 741 | QDir().mkdir( dirName, true ); |
762 | 742 | ||
763 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 743 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
764 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 744 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
765 | 745 | ||
766 | if ( a.isEmpty() ) | 746 | if ( a.isEmpty() ) |
767 | continue; | 747 | continue; |
768 | 748 | ||
769 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 749 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
770 | 750 | ||
771 | QString fileName = dirName + "/" + name; | 751 | QString fileName = dirName + "/" + name; |
772 | 752 | ||
773 | QFile outFile(fileName); | 753 | QFile outFile(fileName); |
774 | 754 | ||
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 20a5b74..76d5c4b 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -859,194 +859,201 @@ void KOAgendaView::createDayLabels() | |||
859 | } | 859 | } |
860 | 860 | ||
861 | int KOAgendaView::maxDatesHint() | 861 | int KOAgendaView::maxDatesHint() |
862 | { | 862 | { |
863 | // Not sure about the max number of events, so return 0 for now. | 863 | // Not sure about the max number of events, so return 0 for now. |
864 | return 0; | 864 | return 0; |
865 | } | 865 | } |
866 | 866 | ||
867 | int KOAgendaView::currentDateCount() | 867 | int KOAgendaView::currentDateCount() |
868 | { | 868 | { |
869 | return mSelectedDates.count(); | 869 | return mSelectedDates.count(); |
870 | } | 870 | } |
871 | 871 | ||
872 | QPtrList<Incidence> KOAgendaView::selectedIncidences() | 872 | QPtrList<Incidence> KOAgendaView::selectedIncidences() |
873 | { | 873 | { |
874 | QPtrList<Incidence> selected; | 874 | QPtrList<Incidence> selected; |
875 | Incidence *incidence; | 875 | Incidence *incidence; |
876 | 876 | ||
877 | incidence = mAgenda->selectedIncidence(); | 877 | incidence = mAgenda->selectedIncidence(); |
878 | if (incidence) selected.append(incidence); | 878 | if (incidence) selected.append(incidence); |
879 | 879 | ||
880 | incidence = mAllDayAgenda->selectedIncidence(); | 880 | incidence = mAllDayAgenda->selectedIncidence(); |
881 | if (incidence) selected.append(incidence); | 881 | if (incidence) selected.append(incidence); |
882 | 882 | ||
883 | return selected; | 883 | return selected; |
884 | } | 884 | } |
885 | 885 | ||
886 | DateList KOAgendaView::selectedDates() | 886 | DateList KOAgendaView::selectedDates() |
887 | { | 887 | { |
888 | DateList selected; | 888 | DateList selected; |
889 | QDate qd; | 889 | QDate qd; |
890 | 890 | ||
891 | qd = mAgenda->selectedIncidenceDate(); | 891 | qd = mAgenda->selectedIncidenceDate(); |
892 | if (qd.isValid()) selected.append(qd); | 892 | if (qd.isValid()) selected.append(qd); |
893 | 893 | ||
894 | qd = mAllDayAgenda->selectedIncidenceDate(); | 894 | qd = mAllDayAgenda->selectedIncidenceDate(); |
895 | if (qd.isValid()) selected.append(qd); | 895 | if (qd.isValid()) selected.append(qd); |
896 | 896 | ||
897 | return selected; | 897 | return selected; |
898 | } | 898 | } |
899 | 899 | ||
900 | 900 | ||
901 | void KOAgendaView::updateView() | 901 | void KOAgendaView::updateView() |
902 | { | 902 | { |
903 | if ( mBlockUpdating ) | 903 | if ( mBlockUpdating ) |
904 | return; | 904 | return; |
905 | // kdDebug() << "KOAgendaView::updateView()" << endl; | 905 | // kdDebug() << "KOAgendaView::updateView()" << endl; |
906 | fillAgenda(); | 906 | fillAgenda(); |
907 | 907 | ||
908 | } | 908 | } |
909 | 909 | ||
910 | 910 | ||
911 | /* | 911 | /* |
912 | Update configuration settings for the agenda view. This method is not | 912 | Update configuration settings for the agenda view. This method is not |
913 | complete. | 913 | complete. |
914 | */ | 914 | */ |
915 | void KOAgendaView::updateConfig() | 915 | void KOAgendaView::updateConfig() |
916 | { | 916 | { |
917 | if ( mBlockUpdating ) | 917 | if ( mBlockUpdating ) |
918 | return; | 918 | return; |
919 | if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) { | 919 | if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) { |
920 | int old = KOPrefs::instance()->mHourSize; | 920 | int old = KOPrefs::instance()->mHourSize; |
921 | KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1; | 921 | KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1; |
922 | qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize ); | 922 | qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize ); |
923 | } | 923 | } |
924 | 924 | ||
925 | 925 | ||
926 | // update config for children | 926 | // update config for children |
927 | mTimeLabels->updateConfig(); | 927 | mTimeLabels->updateConfig(); |
928 | mAgenda->storePosition(); | 928 | mAgenda->storePosition(); |
929 | mAgenda->updateConfig(); | 929 | mAgenda->updateConfig(); |
930 | mAllDayAgenda->updateConfig(); | 930 | mAllDayAgenda->updateConfig(); |
931 | // widget synchronization | 931 | // widget synchronization |
932 | //TODO: find a better way, maybe signal/slot | 932 | //TODO: find a better way, maybe signal/slot |
933 | mTimeLabels->positionChanged(); | 933 | mTimeLabels->positionChanged(); |
934 | 934 | ||
935 | // for some reason, this needs to be called explicitly | 935 | // for some reason, this needs to be called explicitly |
936 | mTimeLabels->repaint(); | 936 | mTimeLabels->repaint(); |
937 | 937 | ||
938 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 938 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
939 | 939 | ||
940 | // ToolTips displaying summary of events | 940 | // ToolTips displaying summary of events |
941 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() | 941 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() |
942 | ->mEnableToolTips); | 942 | ->mEnableToolTips); |
943 | 943 | ||
944 | //setHolidayMasks(); | 944 | //setHolidayMasks(); |
945 | 945 | ||
946 | //createDayLabels(); called by via updateView(); | 946 | //createDayLabels(); called by via updateView(); |
947 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); | 947 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); |
948 | updateView(); | 948 | updateView(); |
949 | mAgenda->restorePosition(); | 949 | mAgenda->restorePosition(); |
950 | } | 950 | } |
951 | 951 | ||
952 | 952 | ||
953 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | 953 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) |
954 | { | 954 | { |
955 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; | 955 | |
956 | //qDebug("KOAgendaView::updateEventDates "); | 956 | |
957 | int xxx = item->cellX(); | ||
958 | //qDebug("KOAgendaView::updateEventDates %d %d %d %d %d", xxx, mMinY.at(xxx),mMaxY.at(xxx),item->cellYTop(),item->cellYBottom() ); | ||
959 | if ( mMinY.at(xxx) > item->cellYTop() ) | ||
960 | mMinY.at(xxx) = item->cellYTop(); | ||
961 | if ( mMaxY.at(xxx) < item->cellYBottom() ) | ||
962 | mMaxY.at(xxx) = item->cellYBottom(); | ||
963 | |||
957 | QDateTime startDt,endDt; | 964 | QDateTime startDt,endDt; |
958 | QDate startDate; | 965 | QDate startDate; |
959 | int lenInSecs; | 966 | int lenInSecs; |
960 | // if ( type == KOAgenda::RESIZETOP ) | 967 | // if ( type == KOAgenda::RESIZETOP ) |
961 | // qDebug("RESIZETOP "); | 968 | // qDebug("RESIZETOP "); |
962 | // if ( type == KOAgenda::RESIZEBOTTOM ) | 969 | // if ( type == KOAgenda::RESIZEBOTTOM ) |
963 | // qDebug("RESIZEBOTTOM "); | 970 | // qDebug("RESIZEBOTTOM "); |
964 | // if ( type == KOAgenda::MOVE ) | 971 | // if ( type == KOAgenda::MOVE ) |
965 | // qDebug("MOVE "); | 972 | // qDebug("MOVE "); |
966 | if ( item->incidence()->type() == "Event" ) { | 973 | if ( item->incidence()->type() == "Event" ) { |
967 | startDt =item->incidence()->dtStart(); | 974 | startDt =item->incidence()->dtStart(); |
968 | endDt = item->incidence()->dtEnd(); | 975 | endDt = item->incidence()->dtEnd(); |
969 | lenInSecs = startDt.secsTo( endDt ); | 976 | lenInSecs = startDt.secsTo( endDt ); |
970 | } | 977 | } |
971 | 978 | ||
972 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); | 979 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); |
973 | 980 | ||
974 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { | 981 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { |
975 | startDate = mSelectedDates[item->mLastMoveXPos]; | 982 | startDate = mSelectedDates[item->mLastMoveXPos]; |
976 | } else { | 983 | } else { |
977 | if (item->cellX() < 0) { | 984 | if (item->cellX() < 0) { |
978 | startDate = (mSelectedDates.first()).addDays(item->cellX()); | 985 | startDate = (mSelectedDates.first()).addDays(item->cellX()); |
979 | } else { | 986 | } else { |
980 | startDate = mSelectedDates[item->cellX()]; | 987 | startDate = mSelectedDates[item->cellX()]; |
981 | } | 988 | } |
982 | } | 989 | } |
983 | startDt.setDate(startDate); | 990 | startDt.setDate(startDate); |
984 | 991 | ||
985 | if (item->incidence()->doesFloat()) { | 992 | if (item->incidence()->doesFloat()) { |
986 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); | 993 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); |
987 | } else { | 994 | } else { |
988 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) | 995 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) |
989 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); | 996 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); |
990 | if ( item->incidence()->type() == "Event" ) { | 997 | if ( item->incidence()->type() == "Event" ) { |
991 | if ( type == KOAgenda::MOVE ) { | 998 | if ( type == KOAgenda::MOVE ) { |
992 | endDt = startDt.addSecs(lenInSecs); | 999 | endDt = startDt.addSecs(lenInSecs); |
993 | 1000 | ||
994 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { | 1001 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { |
995 | if (item->lastMultiItem()) { | 1002 | if (item->lastMultiItem()) { |
996 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 1003 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
997 | endDt.setDate(startDate. | 1004 | endDt.setDate(startDate. |
998 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 1005 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
999 | } else { | 1006 | } else { |
1000 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 1007 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
1001 | endDt.setDate(startDate); | 1008 | endDt.setDate(startDate); |
1002 | } | 1009 | } |
1003 | } | 1010 | } |
1004 | } else { | 1011 | } else { |
1005 | // todo | 1012 | // todo |
1006 | if (item->lastMultiItem()) { | 1013 | if (item->lastMultiItem()) { |
1007 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 1014 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
1008 | endDt.setDate(startDate. | 1015 | endDt.setDate(startDate. |
1009 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 1016 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
1010 | } else { | 1017 | } else { |
1011 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); | 1018 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); |
1012 | if ( item->cellYBottom() > 0 ) | 1019 | if ( item->cellYBottom() > 0 ) |
1013 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 1020 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
1014 | else | 1021 | else |
1015 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); | 1022 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); |
1016 | endDt.setDate(startDate); | 1023 | endDt.setDate(startDate); |
1017 | } | 1024 | } |
1018 | } | 1025 | } |
1019 | } | 1026 | } |
1020 | if ( item->incidence()->type() == "Event" ) { | 1027 | if ( item->incidence()->type() == "Event" ) { |
1021 | item->incidence()->setDtStart(startDt); | 1028 | item->incidence()->setDtStart(startDt); |
1022 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); | 1029 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); |
1023 | } else if ( item->incidence()->type() == "Todo" ) { | 1030 | } else if ( item->incidence()->type() == "Todo" ) { |
1024 | Todo* to = static_cast<Todo*>(item->incidence()); | 1031 | Todo* to = static_cast<Todo*>(item->incidence()); |
1025 | 1032 | ||
1026 | to->setDtDue(endDt); | 1033 | to->setDtDue(endDt); |
1027 | if ( to->hasStartDate() ) { | 1034 | if ( to->hasStartDate() ) { |
1028 | if (to->dtStart() >= to->dtDue() ) | 1035 | if (to->dtStart() >= to->dtDue() ) |
1029 | to->setDtStart(to->dtDue().addDays( -2 )); | 1036 | to->setDtStart(to->dtDue().addDays( -2 )); |
1030 | } | 1037 | } |
1031 | 1038 | ||
1032 | } | 1039 | } |
1033 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); | 1040 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); |
1034 | item->incidence()->setRevision(item->incidence()->revision()+1); | 1041 | item->incidence()->setRevision(item->incidence()->revision()+1); |
1035 | item->setItemDate(startDt.date()); | 1042 | item->setItemDate(startDt.date()); |
1036 | //item->updateItem(); | 1043 | //item->updateItem(); |
1037 | if ( item->incidence()->type() == "Todo" ) { | 1044 | if ( item->incidence()->type() == "Todo" ) { |
1038 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); | 1045 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); |
1039 | 1046 | ||
1040 | } | 1047 | } |
1041 | else | 1048 | else |
1042 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); | 1049 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); |
1043 | item->updateItem(); | 1050 | item->updateItem(); |
1044 | } | 1051 | } |
1045 | 1052 | ||
1046 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) | 1053 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) |
1047 | { | 1054 | { |
1048 | // kdDebug() << "KOAgendaView::selectDates" << endl; | 1055 | // kdDebug() << "KOAgendaView::selectDates" << endl; |
1049 | 1056 | ||
1050 | mSelectedDates.clear(); | 1057 | mSelectedDates.clear(); |
1051 | // qDebug("KOAgendaView::showDates "); | 1058 | // qDebug("KOAgendaView::showDates "); |
1052 | QDate d = start; | 1059 | QDate d = start; |