author | zautrix <zautrix> | 2005-06-17 10:27:21 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-17 10:27:21 (UTC) |
commit | ec691904e9c129fda7514179910c5be9bf0d908b (patch) (unidiff) | |
tree | 75984d135b97049af03ba22eab7f7db53a8a7922 | |
parent | 56f20e7a0a6b8ecf84d11ced19f870241a13c17d (diff) | |
download | kdepimpi-ec691904e9c129fda7514179910c5be9bf0d908b.zip kdepimpi-ec691904e9c129fda7514179910c5be9bf0d908b.tar.gz kdepimpi-ec691904e9c129fda7514179910c5be9bf0d908b.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/calendarview.cpp | 6 | ||||
-rw-r--r-- | korganizer/kofilterview.cpp | 6 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 18 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 19 | ||||
-rw-r--r-- | microkde/kglobal.cpp | 7 |
5 files changed, 26 insertions, 30 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index eac2f29..d25f632 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3645,769 +3645,773 @@ void CalendarView::schedule_refresh(Incidence *incidence) | |||
3645 | 3645 | ||
3646 | void CalendarView::schedule_cancel(Incidence *incidence) | 3646 | void CalendarView::schedule_cancel(Incidence *incidence) |
3647 | { | 3647 | { |
3648 | schedule(Scheduler::Cancel,incidence); | 3648 | schedule(Scheduler::Cancel,incidence); |
3649 | } | 3649 | } |
3650 | 3650 | ||
3651 | void CalendarView::schedule_add(Incidence *incidence) | 3651 | void CalendarView::schedule_add(Incidence *incidence) |
3652 | { | 3652 | { |
3653 | schedule(Scheduler::Add,incidence); | 3653 | schedule(Scheduler::Add,incidence); |
3654 | } | 3654 | } |
3655 | 3655 | ||
3656 | void CalendarView::schedule_reply(Incidence *incidence) | 3656 | void CalendarView::schedule_reply(Incidence *incidence) |
3657 | { | 3657 | { |
3658 | schedule(Scheduler::Reply,incidence); | 3658 | schedule(Scheduler::Reply,incidence); |
3659 | } | 3659 | } |
3660 | 3660 | ||
3661 | void CalendarView::schedule_counter(Incidence *incidence) | 3661 | void CalendarView::schedule_counter(Incidence *incidence) |
3662 | { | 3662 | { |
3663 | schedule(Scheduler::Counter,incidence); | 3663 | schedule(Scheduler::Counter,incidence); |
3664 | } | 3664 | } |
3665 | 3665 | ||
3666 | void CalendarView::schedule_declinecounter(Incidence *incidence) | 3666 | void CalendarView::schedule_declinecounter(Incidence *incidence) |
3667 | { | 3667 | { |
3668 | schedule(Scheduler::Declinecounter,incidence); | 3668 | schedule(Scheduler::Declinecounter,incidence); |
3669 | } | 3669 | } |
3670 | 3670 | ||
3671 | void CalendarView::schedule_publish_freebusy(int daysToPublish) | 3671 | void CalendarView::schedule_publish_freebusy(int daysToPublish) |
3672 | { | 3672 | { |
3673 | QDateTime start = QDateTime::currentDateTime(); | 3673 | QDateTime start = QDateTime::currentDateTime(); |
3674 | QDateTime end = start.addDays(daysToPublish); | 3674 | QDateTime end = start.addDays(daysToPublish); |
3675 | 3675 | ||
3676 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); | 3676 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); |
3677 | freebusy->setOrganizer(KOPrefs::instance()->email()); | 3677 | freebusy->setOrganizer(KOPrefs::instance()->email()); |
3678 | 3678 | ||
3679 | 3679 | ||
3680 | PublishDialog *publishdlg = new PublishDialog(); | 3680 | PublishDialog *publishdlg = new PublishDialog(); |
3681 | if ( publishdlg->exec() == QDialog::Accepted ) { | 3681 | if ( publishdlg->exec() == QDialog::Accepted ) { |
3682 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3682 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3683 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { | 3683 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { |
3684 | delete(freebusy); | 3684 | delete(freebusy); |
3685 | } | 3685 | } |
3686 | } | 3686 | } |
3687 | delete publishdlg; | 3687 | delete publishdlg; |
3688 | } | 3688 | } |
3689 | 3689 | ||
3690 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) | 3690 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) |
3691 | { | 3691 | { |
3692 | Event *event = 0; | 3692 | Event *event = 0; |
3693 | Todo *todo = 0; | 3693 | Todo *todo = 0; |
3694 | 3694 | ||
3695 | if (incidence == 0) { | 3695 | if (incidence == 0) { |
3696 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3696 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3697 | if (incidence == 0) { | 3697 | if (incidence == 0) { |
3698 | incidence = mTodoList->selectedIncidences().first(); | 3698 | incidence = mTodoList->selectedIncidences().first(); |
3699 | } | 3699 | } |
3700 | } | 3700 | } |
3701 | if ( incidence && incidence->typeID() == eventID ) { | 3701 | if ( incidence && incidence->typeID() == eventID ) { |
3702 | event = static_cast<Event *>(incidence); | 3702 | event = static_cast<Event *>(incidence); |
3703 | } | 3703 | } |
3704 | if ( incidence && incidence->typeID() == todoID ) { | 3704 | if ( incidence && incidence->typeID() == todoID ) { |
3705 | todo = static_cast<Todo *>(incidence); | 3705 | todo = static_cast<Todo *>(incidence); |
3706 | } | 3706 | } |
3707 | 3707 | ||
3708 | if (!event && !todo) { | 3708 | if (!event && !todo) { |
3709 | KMessageBox::sorry(this,i18n("No event selected.")); | 3709 | KMessageBox::sorry(this,i18n("No event selected.")); |
3710 | return; | 3710 | return; |
3711 | } | 3711 | } |
3712 | 3712 | ||
3713 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { | 3713 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { |
3714 | KMessageBox::sorry(this,i18n("The event has no attendees.")); | 3714 | KMessageBox::sorry(this,i18n("The event has no attendees.")); |
3715 | return; | 3715 | return; |
3716 | } | 3716 | } |
3717 | 3717 | ||
3718 | Event *ev = 0; | 3718 | Event *ev = 0; |
3719 | if (event) ev = new Event(*event); | 3719 | if (event) ev = new Event(*event); |
3720 | Todo *to = 0; | 3720 | Todo *to = 0; |
3721 | if (todo) to = new Todo(*todo); | 3721 | if (todo) to = new Todo(*todo); |
3722 | 3722 | ||
3723 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { | 3723 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { |
3724 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 3724 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
3725 | if (!me) { | 3725 | if (!me) { |
3726 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); | 3726 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); |
3727 | return; | 3727 | return; |
3728 | } | 3728 | } |
3729 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { | 3729 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { |
3730 | StatusDialog *statdlg = new StatusDialog(this); | 3730 | StatusDialog *statdlg = new StatusDialog(this); |
3731 | if (!statdlg->exec()==QDialog::Accepted) return; | 3731 | if (!statdlg->exec()==QDialog::Accepted) return; |
3732 | me->setStatus( statdlg->status() ); | 3732 | me->setStatus( statdlg->status() ); |
3733 | delete(statdlg); | 3733 | delete(statdlg); |
3734 | } | 3734 | } |
3735 | Attendee *menew = new Attendee(*me); | 3735 | Attendee *menew = new Attendee(*me); |
3736 | if (ev) { | 3736 | if (ev) { |
3737 | ev->clearAttendees(); | 3737 | ev->clearAttendees(); |
3738 | ev->addAttendee(menew,false); | 3738 | ev->addAttendee(menew,false); |
3739 | } else { | 3739 | } else { |
3740 | if (to) { | 3740 | if (to) { |
3741 | todo->clearAttendees(); | 3741 | todo->clearAttendees(); |
3742 | todo->addAttendee(menew,false); | 3742 | todo->addAttendee(menew,false); |
3743 | } | 3743 | } |
3744 | } | 3744 | } |
3745 | } | 3745 | } |
3746 | 3746 | ||
3747 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3747 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3748 | if (ev) { | 3748 | if (ev) { |
3749 | if ( !dlg->addMessage(ev,method) ) delete(ev); | 3749 | if ( !dlg->addMessage(ev,method) ) delete(ev); |
3750 | } else { | 3750 | } else { |
3751 | if (to) { | 3751 | if (to) { |
3752 | if ( !dlg->addMessage(to,method) ) delete(to); | 3752 | if ( !dlg->addMessage(to,method) ) delete(to); |
3753 | } | 3753 | } |
3754 | } | 3754 | } |
3755 | } | 3755 | } |
3756 | 3756 | ||
3757 | void CalendarView::openAddressbook() | 3757 | void CalendarView::openAddressbook() |
3758 | { | 3758 | { |
3759 | KRun::runCommand("kaddressbook"); | 3759 | KRun::runCommand("kaddressbook"); |
3760 | } | 3760 | } |
3761 | 3761 | ||
3762 | void CalendarView::setModified(bool modified) | 3762 | void CalendarView::setModified(bool modified) |
3763 | { | 3763 | { |
3764 | if ( modified ) | 3764 | if ( modified ) |
3765 | emit signalmodified(); | 3765 | emit signalmodified(); |
3766 | if (mModified != modified) { | 3766 | if (mModified != modified) { |
3767 | mModified = modified; | 3767 | mModified = modified; |
3768 | emit modifiedChanged(mModified); | 3768 | emit modifiedChanged(mModified); |
3769 | } | 3769 | } |
3770 | } | 3770 | } |
3771 | 3771 | ||
3772 | bool CalendarView::isReadOnly() | 3772 | bool CalendarView::isReadOnly() |
3773 | { | 3773 | { |
3774 | return mReadOnly; | 3774 | return mReadOnly; |
3775 | } | 3775 | } |
3776 | 3776 | ||
3777 | void CalendarView::setReadOnly(bool readOnly) | 3777 | void CalendarView::setReadOnly(bool readOnly) |
3778 | { | 3778 | { |
3779 | if (mReadOnly != readOnly) { | 3779 | if (mReadOnly != readOnly) { |
3780 | mReadOnly = readOnly; | 3780 | mReadOnly = readOnly; |
3781 | emit readOnlyChanged(mReadOnly); | 3781 | emit readOnlyChanged(mReadOnly); |
3782 | } | 3782 | } |
3783 | } | 3783 | } |
3784 | 3784 | ||
3785 | bool CalendarView::isModified() | 3785 | bool CalendarView::isModified() |
3786 | { | 3786 | { |
3787 | return mModified; | 3787 | return mModified; |
3788 | } | 3788 | } |
3789 | void CalendarView::slotprintSelInc() | 3789 | void CalendarView::slotprintSelInc() |
3790 | { | 3790 | { |
3791 | if ( currentSelection() == 0 ) { | 3791 | if ( currentSelection() == 0 ) { |
3792 | KMessageBox::sorry(this,i18n("There is nothing selected!")); | 3792 | KMessageBox::sorry(this,i18n("There is nothing selected!")); |
3793 | return; | 3793 | return; |
3794 | } | 3794 | } |
3795 | showIncidence(); | 3795 | showIncidence(); |
3796 | getEventViewerDialog()->print(); | 3796 | getEventViewerDialog()->print(); |
3797 | 3797 | ||
3798 | } | 3798 | } |
3799 | void CalendarView::printSetup() | 3799 | void CalendarView::printSetup() |
3800 | { | 3800 | { |
3801 | #ifndef KORG_NOPRINTER | 3801 | #ifndef KORG_NOPRINTER |
3802 | createPrinter(); | 3802 | createPrinter(); |
3803 | 3803 | ||
3804 | mCalPrinter->setupPrinter(); | 3804 | mCalPrinter->setupPrinter(); |
3805 | #endif | 3805 | #endif |
3806 | } | 3806 | } |
3807 | 3807 | ||
3808 | void CalendarView::print() | 3808 | void CalendarView::print() |
3809 | { | 3809 | { |
3810 | #ifndef KORG_NOPRINTER | 3810 | #ifndef KORG_NOPRINTER |
3811 | createPrinter(); | 3811 | createPrinter(); |
3812 | 3812 | ||
3813 | DateList tmpDateList = mNavigator->selectedDates(); | 3813 | DateList tmpDateList = mNavigator->selectedDates(); |
3814 | mCalPrinter->print(CalPrinter::Month, | 3814 | mCalPrinter->print(CalPrinter::Month, |
3815 | tmpDateList.first(), tmpDateList.last()); | 3815 | tmpDateList.first(), tmpDateList.last()); |
3816 | #endif | 3816 | #endif |
3817 | } | 3817 | } |
3818 | 3818 | ||
3819 | void CalendarView::printPreview() | 3819 | void CalendarView::printPreview() |
3820 | { | 3820 | { |
3821 | #ifndef KORG_NOPRINTER | 3821 | #ifndef KORG_NOPRINTER |
3822 | kdDebug() << "CalendarView::printPreview()" << endl; | 3822 | kdDebug() << "CalendarView::printPreview()" << endl; |
3823 | 3823 | ||
3824 | createPrinter(); | 3824 | createPrinter(); |
3825 | 3825 | ||
3826 | DateList tmpDateList = mNavigator->selectedDates(); | 3826 | DateList tmpDateList = mNavigator->selectedDates(); |
3827 | 3827 | ||
3828 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), | 3828 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), |
3829 | tmpDateList.last()); | 3829 | tmpDateList.last()); |
3830 | #endif | 3830 | #endif |
3831 | } | 3831 | } |
3832 | 3832 | ||
3833 | void CalendarView::exportICalendar() | 3833 | void CalendarView::exportICalendar() |
3834 | { | 3834 | { |
3835 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); | 3835 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); |
3836 | 3836 | ||
3837 | // Force correct extension | 3837 | // Force correct extension |
3838 | if (filename.right(4) != ".ics") filename += ".ics"; | 3838 | if (filename.right(4) != ".ics") filename += ".ics"; |
3839 | 3839 | ||
3840 | FileStorage storage( mCalendar, filename, new ICalFormat() ); | 3840 | FileStorage storage( mCalendar, filename, new ICalFormat() ); |
3841 | storage.save(); | 3841 | storage.save(); |
3842 | } | 3842 | } |
3843 | 3843 | ||
3844 | bool CalendarView::exportVCalendar( QString filename ) | 3844 | bool CalendarView::exportVCalendar( QString filename ) |
3845 | { | 3845 | { |
3846 | if (mCalendar->journals().count() > 0) { | 3846 | if (mCalendar->journals().count() > 0) { |
3847 | int result = KMessageBox::warningContinueCancel(this, | 3847 | int result = KMessageBox::warningContinueCancel(this, |
3848 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 3848 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
3849 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 3849 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
3850 | true); | 3850 | true); |
3851 | if (result != KMessageBox::Continue) return false; | 3851 | if (result != KMessageBox::Continue) return false; |
3852 | } | 3852 | } |
3853 | 3853 | ||
3854 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); | 3854 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); |
3855 | 3855 | ||
3856 | // Force correct extension | 3856 | // Force correct extension |
3857 | if (filename.right(4) != ".vcs") filename += ".vcs"; | 3857 | if (filename.right(4) != ".vcs") filename += ".vcs"; |
3858 | 3858 | ||
3859 | FileStorage storage( mCalendar, filename, new VCalFormat ); | 3859 | FileStorage storage( mCalendar, filename, new VCalFormat ); |
3860 | return storage.save(); | 3860 | return storage.save(); |
3861 | 3861 | ||
3862 | } | 3862 | } |
3863 | 3863 | ||
3864 | void CalendarView::eventUpdated(Incidence *) | 3864 | void CalendarView::eventUpdated(Incidence *) |
3865 | { | 3865 | { |
3866 | setModified(); | 3866 | setModified(); |
3867 | // Don't call updateView here. The code, which has caused the update of the | 3867 | // Don't call updateView here. The code, which has caused the update of the |
3868 | // event is responsible for updating the view. | 3868 | // event is responsible for updating the view. |
3869 | // updateView(); | 3869 | // updateView(); |
3870 | } | 3870 | } |
3871 | 3871 | ||
3872 | void CalendarView::adaptNavigationUnits() | 3872 | void CalendarView::adaptNavigationUnits() |
3873 | { | 3873 | { |
3874 | if (mViewManager->currentView()->isEventView()) { | 3874 | if (mViewManager->currentView()->isEventView()) { |
3875 | int days = mViewManager->currentView()->currentDateCount(); | 3875 | int days = mViewManager->currentView()->currentDateCount(); |
3876 | if (days == 1) { | 3876 | if (days == 1) { |
3877 | emit changeNavStringPrev(i18n("&Previous Day")); | 3877 | emit changeNavStringPrev(i18n("&Previous Day")); |
3878 | emit changeNavStringNext(i18n("&Next Day")); | 3878 | emit changeNavStringNext(i18n("&Next Day")); |
3879 | } else { | 3879 | } else { |
3880 | emit changeNavStringPrev(i18n("&Previous Week")); | 3880 | emit changeNavStringPrev(i18n("&Previous Week")); |
3881 | emit changeNavStringNext(i18n("&Next Week")); | 3881 | emit changeNavStringNext(i18n("&Next Week")); |
3882 | } | 3882 | } |
3883 | } | 3883 | } |
3884 | } | 3884 | } |
3885 | 3885 | ||
3886 | void CalendarView::processMainViewSelection( Incidence *incidence ) | 3886 | void CalendarView::processMainViewSelection( Incidence *incidence ) |
3887 | { | 3887 | { |
3888 | if ( incidence ) mTodoList->clearSelection(); | 3888 | if ( incidence ) mTodoList->clearSelection(); |
3889 | processIncidenceSelection( incidence ); | 3889 | processIncidenceSelection( incidence ); |
3890 | } | 3890 | } |
3891 | 3891 | ||
3892 | void CalendarView::processTodoListSelection( Incidence *incidence ) | 3892 | void CalendarView::processTodoListSelection( Incidence *incidence ) |
3893 | { | 3893 | { |
3894 | if ( incidence && mViewManager->currentView() ) { | 3894 | if ( incidence && mViewManager->currentView() ) { |
3895 | mViewManager->currentView()->clearSelection(); | 3895 | mViewManager->currentView()->clearSelection(); |
3896 | } | 3896 | } |
3897 | processIncidenceSelection( incidence ); | 3897 | processIncidenceSelection( incidence ); |
3898 | } | 3898 | } |
3899 | 3899 | ||
3900 | void CalendarView::processIncidenceSelection( Incidence *incidence ) | 3900 | void CalendarView::processIncidenceSelection( Incidence *incidence ) |
3901 | { | 3901 | { |
3902 | if ( incidence == mSelectedIncidence ) return; | 3902 | if ( incidence == mSelectedIncidence ) return; |
3903 | 3903 | ||
3904 | mSelectedIncidence = incidence; | 3904 | mSelectedIncidence = incidence; |
3905 | 3905 | ||
3906 | emit incidenceSelected( mSelectedIncidence ); | 3906 | emit incidenceSelected( mSelectedIncidence ); |
3907 | 3907 | ||
3908 | if ( incidence && incidence->typeID() == eventID ) { | 3908 | if ( incidence && incidence->typeID() == eventID ) { |
3909 | Event *event = static_cast<Event *>( incidence ); | 3909 | Event *event = static_cast<Event *>( incidence ); |
3910 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3910 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3911 | emit organizerEventsSelected( true ); | 3911 | emit organizerEventsSelected( true ); |
3912 | } else { | 3912 | } else { |
3913 | emit organizerEventsSelected(false); | 3913 | emit organizerEventsSelected(false); |
3914 | } | 3914 | } |
3915 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3915 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3916 | KOPrefs::instance()->email() ) ) { | 3916 | KOPrefs::instance()->email() ) ) { |
3917 | emit groupEventsSelected( true ); | 3917 | emit groupEventsSelected( true ); |
3918 | } else { | 3918 | } else { |
3919 | emit groupEventsSelected(false); | 3919 | emit groupEventsSelected(false); |
3920 | } | 3920 | } |
3921 | return; | 3921 | return; |
3922 | } else { | 3922 | } else { |
3923 | if ( incidence && incidence->typeID() == todoID ) { | 3923 | if ( incidence && incidence->typeID() == todoID ) { |
3924 | emit todoSelected( true ); | 3924 | emit todoSelected( true ); |
3925 | Todo *event = static_cast<Todo *>( incidence ); | 3925 | Todo *event = static_cast<Todo *>( incidence ); |
3926 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3926 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3927 | emit organizerEventsSelected( true ); | 3927 | emit organizerEventsSelected( true ); |
3928 | } else { | 3928 | } else { |
3929 | emit organizerEventsSelected(false); | 3929 | emit organizerEventsSelected(false); |
3930 | } | 3930 | } |
3931 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3931 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3932 | KOPrefs::instance()->email() ) ) { | 3932 | KOPrefs::instance()->email() ) ) { |
3933 | emit groupEventsSelected( true ); | 3933 | emit groupEventsSelected( true ); |
3934 | } else { | 3934 | } else { |
3935 | emit groupEventsSelected(false); | 3935 | emit groupEventsSelected(false); |
3936 | } | 3936 | } |
3937 | return; | 3937 | return; |
3938 | } else { | 3938 | } else { |
3939 | emit todoSelected( false ); | 3939 | emit todoSelected( false ); |
3940 | emit organizerEventsSelected(false); | 3940 | emit organizerEventsSelected(false); |
3941 | emit groupEventsSelected(false); | 3941 | emit groupEventsSelected(false); |
3942 | } | 3942 | } |
3943 | return; | 3943 | return; |
3944 | } | 3944 | } |
3945 | 3945 | ||
3946 | /* if ( incidence && incidence->typeID() == todoID ) { | 3946 | /* if ( incidence && incidence->typeID() == todoID ) { |
3947 | emit todoSelected( true ); | 3947 | emit todoSelected( true ); |
3948 | } else { | 3948 | } else { |
3949 | emit todoSelected( false ); | 3949 | emit todoSelected( false ); |
3950 | }*/ | 3950 | }*/ |
3951 | } | 3951 | } |
3952 | 3952 | ||
3953 | 3953 | ||
3954 | void CalendarView::checkClipboard() | 3954 | void CalendarView::checkClipboard() |
3955 | { | 3955 | { |
3956 | #ifndef KORG_NODND | 3956 | #ifndef KORG_NODND |
3957 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 3957 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
3958 | emit pasteEnabled(true); | 3958 | emit pasteEnabled(true); |
3959 | } else { | 3959 | } else { |
3960 | emit pasteEnabled(false); | 3960 | emit pasteEnabled(false); |
3961 | } | 3961 | } |
3962 | #endif | 3962 | #endif |
3963 | } | 3963 | } |
3964 | 3964 | ||
3965 | void CalendarView::showDates(const DateList &selectedDates) | 3965 | void CalendarView::showDates(const DateList &selectedDates) |
3966 | { | 3966 | { |
3967 | // kdDebug() << "CalendarView::selectDates()" << endl; | 3967 | // kdDebug() << "CalendarView::selectDates()" << endl; |
3968 | 3968 | ||
3969 | 3969 | ||
3970 | if ( !mBlockShowDates ) { | 3970 | if ( !mBlockShowDates ) { |
3971 | if ( mViewManager->currentView() ) { | 3971 | if ( mViewManager->currentView() ) { |
3972 | updateView( selectedDates.first(), selectedDates.last() ); | 3972 | updateView( selectedDates.first(), selectedDates.last() ); |
3973 | } else { | 3973 | } else { |
3974 | mViewManager->showAgendaView(); | 3974 | mViewManager->showAgendaView(); |
3975 | } | 3975 | } |
3976 | } | 3976 | } |
3977 | 3977 | ||
3978 | QDate date = selectedDates.first(); | 3978 | QDate date = selectedDates.first(); |
3979 | if ( ! date.isValid() ) { | 3979 | if ( ! date.isValid() ) { |
3980 | topLevelWidget()->setCaption(""); | 3980 | topLevelWidget()->setCaption(""); |
3981 | return; | 3981 | return; |
3982 | } | 3982 | } |
3983 | 3983 | ||
3984 | QString selDates; | 3984 | QString selDates; |
3985 | selDates = KGlobal::locale()->formatDate( date, true); | 3985 | selDates = KGlobal::locale()->formatDate( date, true); |
3986 | if (selectedDates.first() < selectedDates.last() ) | 3986 | if (selectedDates.first() < selectedDates.last() ) |
3987 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 3987 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
3988 | else { | 3988 | else { |
3989 | QString addString; | 3989 | QString addString; |
3990 | if ( date == QDateTime::currentDateTime().date() ) | 3990 | if ( date == QDateTime::currentDateTime().date() ) |
3991 | addString = i18n("Today"); | 3991 | addString = i18n("Today"); |
3992 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 3992 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
3993 | addString = i18n("Tomorrow"); | 3993 | addString = i18n("Tomorrow"); |
3994 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) | 3994 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) |
3995 | addString = i18n("Yesterday"); | 3995 | addString = i18n("Yesterday"); |
3996 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) | 3996 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) |
3997 | addString = i18n("Day before yesterday"); | 3997 | addString = i18n("Day before yesterday"); |
3998 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) | 3998 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) |
3999 | addString = i18n("Day after tomorrow"); | 3999 | addString = i18n("Day after tomorrow"); |
4000 | if ( !addString.isEmpty() ) { | 4000 | if ( !addString.isEmpty() ) { |
4001 | topLevelWidget()->setCaption( addString+", " + selDates ); | 4001 | topLevelWidget()->setCaption( addString+", " + selDates ); |
4002 | return; | 4002 | return; |
4003 | } | 4003 | } |
4004 | } | 4004 | } |
4005 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 4005 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
4006 | 4006 | ||
4007 | } | 4007 | } |
4008 | 4008 | ||
4009 | QPtrList<CalFilter> CalendarView::filters() | 4009 | QPtrList<CalFilter> CalendarView::filters() |
4010 | { | 4010 | { |
4011 | return mFilters; | 4011 | return mFilters; |
4012 | 4012 | ||
4013 | } | 4013 | } |
4014 | void CalendarView::editFilters() | 4014 | void CalendarView::editFilters() |
4015 | { | 4015 | { |
4016 | // kdDebug() << "CalendarView::editFilters()" << endl; | 4016 | // kdDebug() << "CalendarView::editFilters()" << endl; |
4017 | 4017 | ||
4018 | CalFilter *filter = mFilters.first(); | 4018 | CalFilter *filter = mFilters.first(); |
4019 | while(filter) { | 4019 | while(filter) { |
4020 | kdDebug() << " Filter: " << filter->name() << endl; | 4020 | kdDebug() << " Filter: " << filter->name() << endl; |
4021 | filter = mFilters.next(); | 4021 | filter = mFilters.next(); |
4022 | } | 4022 | } |
4023 | 4023 | ||
4024 | mDialogManager->showFilterEditDialog(&mFilters); | 4024 | mDialogManager->showFilterEditDialog(&mFilters); |
4025 | updateFilter(); | 4025 | updateFilter(); |
4026 | } | 4026 | } |
4027 | void CalendarView::toggleFilter() | 4027 | void CalendarView::toggleFilter() |
4028 | { | 4028 | { |
4029 | showFilter(! mCalEditView->isVisible()); | 4029 | if ( mLeftFrame->isHidden() ) { |
4030 | toggleExpand(); | ||
4031 | showFilter( true ); | ||
4032 | } else | ||
4033 | showFilter(! mCalEditView->isVisible()); | ||
4030 | } | 4034 | } |
4031 | 4035 | ||
4032 | KOFilterView *CalendarView::filterView() | 4036 | KOFilterView *CalendarView::filterView() |
4033 | { | 4037 | { |
4034 | return mFilterView; | 4038 | return mFilterView; |
4035 | } | 4039 | } |
4036 | void CalendarView::selectFilter( int fil ) | 4040 | void CalendarView::selectFilter( int fil ) |
4037 | { | 4041 | { |
4038 | mFilterView->setSelectedFilter( fil ); | 4042 | mFilterView->setSelectedFilter( fil ); |
4039 | } | 4043 | } |
4040 | void CalendarView::showFilter(bool visible) | 4044 | void CalendarView::showFilter(bool visible) |
4041 | { | 4045 | { |
4042 | #if 1 | 4046 | #if 1 |
4043 | if (visible) { | 4047 | if (visible) { |
4044 | mCalEditView->readConfig(); | 4048 | mCalEditView->readConfig(); |
4045 | mCalEditView->show(); | 4049 | mCalEditView->show(); |
4046 | QValueList<int> sizes; | 4050 | QValueList<int> sizes; |
4047 | sizes = mLeftFrame->sizes(); | 4051 | sizes = mLeftFrame->sizes(); |
4048 | if ( sizes.count() == 4 && sizes[3] < 20 ) { | 4052 | if ( sizes.count() == 4 && sizes[3] < 20 ) { |
4049 | sizes.clear(); | 4053 | sizes.clear(); |
4050 | sizes << 100; | 4054 | sizes << 100; |
4051 | sizes << 0; | 4055 | sizes << 0; |
4052 | sizes << 0; | 4056 | sizes << 0; |
4053 | sizes << 100; | 4057 | sizes << 100; |
4054 | mLeftFrame->setSizes(sizes); | 4058 | mLeftFrame->setSizes(sizes); |
4055 | } | 4059 | } |
4056 | #if 0 | 4060 | #if 0 |
4057 | sizes = mLeftFrame->sizes(); | 4061 | sizes = mLeftFrame->sizes(); |
4058 | int ccc = 0; | 4062 | int ccc = 0; |
4059 | while ( ccc < sizes.count()) { | 4063 | while ( ccc < sizes.count()) { |
4060 | qDebug("size %d %d ", ccc, sizes[ccc]); | 4064 | qDebug("size %d %d ", ccc, sizes[ccc]); |
4061 | ++ccc; | 4065 | ++ccc; |
4062 | } | 4066 | } |
4063 | #endif | 4067 | #endif |
4064 | 4068 | ||
4065 | } | 4069 | } |
4066 | else { | 4070 | else { |
4067 | mCalEditView->hide(); | 4071 | mCalEditView->hide(); |
4068 | } | 4072 | } |
4069 | #else | 4073 | #else |
4070 | if (visible) mFilterView->show(); | 4074 | if (visible) mFilterView->show(); |
4071 | else mFilterView->hide(); | 4075 | else mFilterView->hide(); |
4072 | #endif | 4076 | #endif |
4073 | } | 4077 | } |
4074 | void CalendarView::toggleFilerEnabled( ) | 4078 | void CalendarView::toggleFilerEnabled( ) |
4075 | { | 4079 | { |
4076 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 4080 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
4077 | if ( !mFilterView->filtersEnabled() ) | 4081 | if ( !mFilterView->filtersEnabled() ) |
4078 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 4082 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
4079 | 4083 | ||
4080 | } | 4084 | } |
4081 | void CalendarView::updateFilter() | 4085 | void CalendarView::updateFilter() |
4082 | { | 4086 | { |
4083 | CalFilter *filter = mFilterView->selectedFilter(); | 4087 | CalFilter *filter = mFilterView->selectedFilter(); |
4084 | if (filter) { | 4088 | if (filter) { |
4085 | QString mess; | 4089 | QString mess; |
4086 | if (mFilterView->filtersEnabled()) { | 4090 | if (mFilterView->filtersEnabled()) { |
4087 | mess = i18n("Filter selected: ")+filter->name(); | 4091 | mess = i18n("Filter selected: ")+filter->name(); |
4088 | filter->setEnabled(true); | 4092 | filter->setEnabled(true); |
4089 | } | 4093 | } |
4090 | else filter->setEnabled(false); | 4094 | else filter->setEnabled(false); |
4091 | mCalendar->setFilter(filter); | 4095 | mCalendar->setFilter(filter); |
4092 | updateView(); | 4096 | updateView(); |
4093 | if ( !mess.isEmpty() ) | 4097 | if ( !mess.isEmpty() ) |
4094 | topLevelWidget()->setCaption( mess ); | 4098 | topLevelWidget()->setCaption( mess ); |
4095 | 4099 | ||
4096 | } | 4100 | } |
4097 | emit filtersUpdated(); | 4101 | emit filtersUpdated(); |
4098 | } | 4102 | } |
4099 | 4103 | ||
4100 | void CalendarView::filterEdited() | 4104 | void CalendarView::filterEdited() |
4101 | { | 4105 | { |
4102 | mFilterView->updateFilters(); | 4106 | mFilterView->updateFilters(); |
4103 | updateFilter(); | 4107 | updateFilter(); |
4104 | writeSettings(); | 4108 | writeSettings(); |
4105 | } | 4109 | } |
4106 | 4110 | ||
4107 | 4111 | ||
4108 | void CalendarView::takeOverEvent() | 4112 | void CalendarView::takeOverEvent() |
4109 | { | 4113 | { |
4110 | Incidence *incidence = currentSelection(); | 4114 | Incidence *incidence = currentSelection(); |
4111 | 4115 | ||
4112 | if (!incidence) return; | 4116 | if (!incidence) return; |
4113 | 4117 | ||
4114 | incidence->setOrganizer(KOPrefs::instance()->email()); | 4118 | incidence->setOrganizer(KOPrefs::instance()->email()); |
4115 | incidence->recreate(); | 4119 | incidence->recreate(); |
4116 | incidence->setReadOnly(false); | 4120 | incidence->setReadOnly(false); |
4117 | 4121 | ||
4118 | updateView(); | 4122 | updateView(); |
4119 | } | 4123 | } |
4120 | 4124 | ||
4121 | void CalendarView::takeOverCalendar() | 4125 | void CalendarView::takeOverCalendar() |
4122 | { | 4126 | { |
4123 | // TODO: Create Calendar::allIncidences() function and use it here | 4127 | // TODO: Create Calendar::allIncidences() function and use it here |
4124 | 4128 | ||
4125 | clearAllViews(); | 4129 | clearAllViews(); |
4126 | QPtrList<Event> events = mCalendar->events(); | 4130 | QPtrList<Event> events = mCalendar->events(); |
4127 | for(uint i=0; i<events.count(); ++i) { | 4131 | for(uint i=0; i<events.count(); ++i) { |
4128 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); | 4132 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); |
4129 | events.at(i)->recreate(); | 4133 | events.at(i)->recreate(); |
4130 | events.at(i)->setReadOnly(false); | 4134 | events.at(i)->setReadOnly(false); |
4131 | } | 4135 | } |
4132 | 4136 | ||
4133 | QPtrList<Todo> todos = mCalendar->todos(); | 4137 | QPtrList<Todo> todos = mCalendar->todos(); |
4134 | for(uint i=0; i<todos.count(); ++i) { | 4138 | for(uint i=0; i<todos.count(); ++i) { |
4135 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); | 4139 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); |
4136 | todos.at(i)->recreate(); | 4140 | todos.at(i)->recreate(); |
4137 | todos.at(i)->setReadOnly(false); | 4141 | todos.at(i)->setReadOnly(false); |
4138 | } | 4142 | } |
4139 | 4143 | ||
4140 | QPtrList<Journal> journals = mCalendar->journals(); | 4144 | QPtrList<Journal> journals = mCalendar->journals(); |
4141 | for(uint i=0; i<journals.count(); ++i) { | 4145 | for(uint i=0; i<journals.count(); ++i) { |
4142 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); | 4146 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); |
4143 | journals.at(i)->recreate(); | 4147 | journals.at(i)->recreate(); |
4144 | journals.at(i)->setReadOnly(false); | 4148 | journals.at(i)->setReadOnly(false); |
4145 | } | 4149 | } |
4146 | 4150 | ||
4147 | updateView(); | 4151 | updateView(); |
4148 | } | 4152 | } |
4149 | 4153 | ||
4150 | void CalendarView::showIntro() | 4154 | void CalendarView::showIntro() |
4151 | { | 4155 | { |
4152 | kdDebug() << "To be implemented." << endl; | 4156 | kdDebug() << "To be implemented." << endl; |
4153 | } | 4157 | } |
4154 | 4158 | ||
4155 | QWidgetStack *CalendarView::viewStack() | 4159 | QWidgetStack *CalendarView::viewStack() |
4156 | { | 4160 | { |
4157 | return mRightFrame; | 4161 | return mRightFrame; |
4158 | } | 4162 | } |
4159 | 4163 | ||
4160 | QWidget *CalendarView::leftFrame() | 4164 | QWidget *CalendarView::leftFrame() |
4161 | { | 4165 | { |
4162 | return ( QWidget *)mLeftFrame; | 4166 | return ( QWidget *)mLeftFrame; |
4163 | } | 4167 | } |
4164 | 4168 | ||
4165 | DateNavigator *CalendarView::dateNavigator() | 4169 | DateNavigator *CalendarView::dateNavigator() |
4166 | { | 4170 | { |
4167 | return mNavigator; | 4171 | return mNavigator; |
4168 | } | 4172 | } |
4169 | 4173 | ||
4170 | KDateNavigator* CalendarView::dateNavigatorWidget() | 4174 | KDateNavigator* CalendarView::dateNavigatorWidget() |
4171 | { | 4175 | { |
4172 | return mDateNavigator->navigatorView(); | 4176 | return mDateNavigator->navigatorView(); |
4173 | } | 4177 | } |
4174 | void CalendarView::toggleDateNavigatorWidget() | 4178 | void CalendarView::toggleDateNavigatorWidget() |
4175 | { | 4179 | { |
4176 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; | 4180 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; |
4177 | 4181 | ||
4178 | if (!KOPrefs::instance()->mShowDateNavigator ) | 4182 | if (!KOPrefs::instance()->mShowDateNavigator ) |
4179 | mDateNavigator->hide(); | 4183 | mDateNavigator->hide(); |
4180 | else | 4184 | else |
4181 | mDateNavigator->show(); | 4185 | mDateNavigator->show(); |
4182 | } | 4186 | } |
4183 | void CalendarView::addView(KOrg::BaseView *view) | 4187 | void CalendarView::addView(KOrg::BaseView *view) |
4184 | { | 4188 | { |
4185 | mViewManager->addView(view); | 4189 | mViewManager->addView(view); |
4186 | } | 4190 | } |
4187 | 4191 | ||
4188 | void CalendarView::showView(KOrg::BaseView *view) | 4192 | void CalendarView::showView(KOrg::BaseView *view) |
4189 | { | 4193 | { |
4190 | mViewManager->showView(view, mLeftFrame->isVisible()); | 4194 | mViewManager->showView(view, mLeftFrame->isVisible()); |
4191 | } | 4195 | } |
4192 | 4196 | ||
4193 | Incidence *CalendarView::currentSelection() | 4197 | Incidence *CalendarView::currentSelection() |
4194 | { | 4198 | { |
4195 | return mViewManager->currentSelection(); | 4199 | return mViewManager->currentSelection(); |
4196 | } | 4200 | } |
4197 | void CalendarView::toggleAllDaySize() | 4201 | void CalendarView::toggleAllDaySize() |
4198 | { | 4202 | { |
4199 | /* | 4203 | /* |
4200 | if ( KOPrefs::instance()->mAllDaySize > 47 ) | 4204 | if ( KOPrefs::instance()->mAllDaySize > 47 ) |
4201 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; | 4205 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; |
4202 | else | 4206 | else |
4203 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; | 4207 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; |
4204 | */ | 4208 | */ |
4205 | viewManager()->agendaView()->toggleAllDay(); | 4209 | viewManager()->agendaView()->toggleAllDay(); |
4206 | } | 4210 | } |
4207 | void CalendarView::toggleExpand() | 4211 | void CalendarView::toggleExpand() |
4208 | { | 4212 | { |
4209 | // if ( mLeftFrame->isHidden() ) { | 4213 | // if ( mLeftFrame->isHidden() ) { |
4210 | // mLeftFrame->show(); | 4214 | // mLeftFrame->show(); |
4211 | // emit calendarViewExpanded( false ); | 4215 | // emit calendarViewExpanded( false ); |
4212 | // } else { | 4216 | // } else { |
4213 | // mLeftFrame->hide(); | 4217 | // mLeftFrame->hide(); |
4214 | // emit calendarViewExpanded( true ); | 4218 | // emit calendarViewExpanded( true ); |
4215 | // } | 4219 | // } |
4216 | //qDebug(" CalendarView::toggleExpand()"); | 4220 | //qDebug(" CalendarView::toggleExpand()"); |
4217 | globalFlagBlockAgenda = 1; | 4221 | globalFlagBlockAgenda = 1; |
4218 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); | 4222 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); |
4219 | globalFlagBlockAgenda = 5; | 4223 | globalFlagBlockAgenda = 5; |
4220 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); | 4224 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); |
4221 | //mViewManager->showView( 0, true ); | 4225 | //mViewManager->showView( 0, true ); |
4222 | } | 4226 | } |
4223 | 4227 | ||
4224 | void CalendarView::calendarModified( bool modified, Calendar * ) | 4228 | void CalendarView::calendarModified( bool modified, Calendar * ) |
4225 | { | 4229 | { |
4226 | setModified( modified ); | 4230 | setModified( modified ); |
4227 | } | 4231 | } |
4228 | 4232 | ||
4229 | Todo *CalendarView::selectedTodo() | 4233 | Todo *CalendarView::selectedTodo() |
4230 | { | 4234 | { |
4231 | Incidence *incidence = currentSelection(); | 4235 | Incidence *incidence = currentSelection(); |
4232 | if ( incidence && incidence->typeID() == todoID ) { | 4236 | if ( incidence && incidence->typeID() == todoID ) { |
4233 | return static_cast<Todo *>( incidence ); | 4237 | return static_cast<Todo *>( incidence ); |
4234 | } | 4238 | } |
4235 | 4239 | ||
4236 | incidence = mTodoList->selectedIncidences().first(); | 4240 | incidence = mTodoList->selectedIncidences().first(); |
4237 | if ( incidence && incidence->typeID() == todoID ) { | 4241 | if ( incidence && incidence->typeID() == todoID ) { |
4238 | return static_cast<Todo *>( incidence ); | 4242 | return static_cast<Todo *>( incidence ); |
4239 | } | 4243 | } |
4240 | 4244 | ||
4241 | return 0; | 4245 | return 0; |
4242 | } | 4246 | } |
4243 | 4247 | ||
4244 | void CalendarView::dialogClosing(Incidence *in) | 4248 | void CalendarView::dialogClosing(Incidence *in) |
4245 | { | 4249 | { |
4246 | // mDialogList.remove(in); | 4250 | // mDialogList.remove(in); |
4247 | } | 4251 | } |
4248 | 4252 | ||
4249 | void CalendarView::showIncidence() | 4253 | void CalendarView::showIncidence() |
4250 | { | 4254 | { |
4251 | mViewerCallerIsSearchDialog = false; | 4255 | mViewerCallerIsSearchDialog = false; |
4252 | Incidence *incidence = currentSelection(); | 4256 | Incidence *incidence = currentSelection(); |
4253 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 4257 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
4254 | if ( incidence ) { | 4258 | if ( incidence ) { |
4255 | ShowIncidenceVisitor v; | 4259 | ShowIncidenceVisitor v; |
4256 | v.act( incidence, this ); | 4260 | v.act( incidence, this ); |
4257 | } | 4261 | } |
4258 | } | 4262 | } |
4259 | void CalendarView::editIncidenceDescription() | 4263 | void CalendarView::editIncidenceDescription() |
4260 | { | 4264 | { |
4261 | mFlagEditDescription = true; | 4265 | mFlagEditDescription = true; |
4262 | editIncidence(); | 4266 | editIncidence(); |
4263 | mFlagEditDescription = false; | 4267 | mFlagEditDescription = false; |
4264 | } | 4268 | } |
4265 | void CalendarView::editIncidence() | 4269 | void CalendarView::editIncidence() |
4266 | { | 4270 | { |
4267 | // qDebug("editIncidence() "); | 4271 | // qDebug("editIncidence() "); |
4268 | Incidence *incidence = currentSelection(); | 4272 | Incidence *incidence = currentSelection(); |
4269 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 4273 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
4270 | if ( incidence ) { | 4274 | if ( incidence ) { |
4271 | EditIncidenceVisitor v; | 4275 | EditIncidenceVisitor v; |
4272 | v.act( incidence, this ); | 4276 | v.act( incidence, this ); |
4273 | } | 4277 | } |
4274 | } | 4278 | } |
4275 | 4279 | ||
4276 | void CalendarView::deleteIncidence() | 4280 | void CalendarView::deleteIncidence() |
4277 | { | 4281 | { |
4278 | Incidence *incidence = currentSelection(); | 4282 | Incidence *incidence = currentSelection(); |
4279 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 4283 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
4280 | if ( incidence ) { | 4284 | if ( incidence ) { |
4281 | deleteIncidence(incidence); | 4285 | deleteIncidence(incidence); |
4282 | } | 4286 | } |
4283 | } | 4287 | } |
4284 | void CalendarView::showIncidence(QString uid) | 4288 | void CalendarView::showIncidence(QString uid) |
4285 | { | 4289 | { |
4286 | Incidence *inc = mCalendar->incidence( uid ); | 4290 | Incidence *inc = mCalendar->incidence( uid ); |
4287 | if ( inc ) | 4291 | if ( inc ) |
4288 | showIncidence( inc ); | 4292 | showIncidence( inc ); |
4289 | } | 4293 | } |
4290 | void CalendarView::showIncidence(Incidence *incidence) | 4294 | void CalendarView::showIncidence(Incidence *incidence) |
4291 | { | 4295 | { |
4292 | mViewerCallerIsSearchDialog = false; | 4296 | mViewerCallerIsSearchDialog = false; |
4293 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); | 4297 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); |
4294 | if ( sender() && mDialogManager->getSearchDialog() ) { | 4298 | if ( sender() && mDialogManager->getSearchDialog() ) { |
4295 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { | 4299 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { |
4296 | mViewerCallerIsSearchDialog = true; | 4300 | mViewerCallerIsSearchDialog = true; |
4297 | } | 4301 | } |
4298 | } | 4302 | } |
4299 | if ( incidence ) { | 4303 | if ( incidence ) { |
4300 | ShowIncidenceVisitor v; | 4304 | ShowIncidenceVisitor v; |
4301 | v.act( incidence, this ); | 4305 | v.act( incidence, this ); |
4302 | } | 4306 | } |
4303 | } | 4307 | } |
4304 | 4308 | ||
4305 | void CalendarView::editIncidence(Incidence *incidence) | 4309 | void CalendarView::editIncidence(Incidence *incidence) |
4306 | { | 4310 | { |
4307 | if ( incidence ) { | 4311 | if ( incidence ) { |
4308 | 4312 | ||
4309 | EditIncidenceVisitor v; | 4313 | EditIncidenceVisitor v; |
4310 | v.act( incidence, this ); | 4314 | v.act( incidence, this ); |
4311 | 4315 | ||
4312 | } | 4316 | } |
4313 | } | 4317 | } |
4314 | 4318 | ||
4315 | void CalendarView::deleteIncidence(Incidence *incidence) | 4319 | void CalendarView::deleteIncidence(Incidence *incidence) |
4316 | { | 4320 | { |
4317 | //qDebug(" CalendarView::deleteIncidence "); | 4321 | //qDebug(" CalendarView::deleteIncidence "); |
4318 | if ( incidence ) { | 4322 | if ( incidence ) { |
4319 | DeleteIncidenceVisitor v; | 4323 | DeleteIncidenceVisitor v; |
4320 | v.act( incidence, this ); | 4324 | v.act( incidence, this ); |
4321 | } | 4325 | } |
4322 | } | 4326 | } |
4323 | 4327 | ||
4324 | 4328 | ||
4325 | void CalendarView::lookForOutgoingMessages() | 4329 | void CalendarView::lookForOutgoingMessages() |
4326 | { | 4330 | { |
4327 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 4331 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
4328 | ogd->loadMessages(); | 4332 | ogd->loadMessages(); |
4329 | } | 4333 | } |
4330 | 4334 | ||
4331 | void CalendarView::lookForIncomingMessages() | 4335 | void CalendarView::lookForIncomingMessages() |
4332 | { | 4336 | { |
4333 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 4337 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
4334 | icd->retrieve(); | 4338 | icd->retrieve(); |
4335 | } | 4339 | } |
4336 | 4340 | ||
4337 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 4341 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
4338 | { | 4342 | { |
4339 | bool deleteTodo = true; | 4343 | bool deleteTodo = true; |
4340 | QPtrList<Incidence> subTodos; | 4344 | QPtrList<Incidence> subTodos; |
4341 | Incidence *aTodo; | 4345 | Incidence *aTodo; |
4342 | subTodos = t->relations(); | 4346 | subTodos = t->relations(); |
4343 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 4347 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
4344 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 4348 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
4345 | deleteTodo = false; | 4349 | deleteTodo = false; |
4346 | } | 4350 | } |
4347 | if ( deleteTodo ) { | 4351 | if ( deleteTodo ) { |
4348 | if ( t->isCompleted() && !t->doesRecur()) { | 4352 | if ( t->isCompleted() && !t->doesRecur()) { |
4349 | checkExternalId( t ); | 4353 | checkExternalId( t ); |
4350 | mCalendar->deleteTodo( t ); | 4354 | mCalendar->deleteTodo( t ); |
4351 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 4355 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
4352 | } | 4356 | } |
4353 | else | 4357 | else |
4354 | deleteTodo = false; | 4358 | deleteTodo = false; |
4355 | } | 4359 | } |
4356 | return deleteTodo; | 4360 | return deleteTodo; |
4357 | 4361 | ||
4358 | } | 4362 | } |
4359 | void CalendarView::purgeCompleted() | 4363 | void CalendarView::purgeCompleted() |
4360 | { | 4364 | { |
4361 | int result = KMessageBox::warningContinueCancel(this, | 4365 | int result = KMessageBox::warningContinueCancel(this, |
4362 | i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); | 4366 | i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); |
4363 | 4367 | ||
4364 | if (result == KMessageBox::Continue) { | 4368 | if (result == KMessageBox::Continue) { |
4365 | 4369 | ||
4366 | QPtrList<Todo> todoCal; | 4370 | QPtrList<Todo> todoCal; |
4367 | QPtrList<Todo> rootTodos; | 4371 | QPtrList<Todo> rootTodos; |
4368 | //QPtrList<Incidence> rel; | 4372 | //QPtrList<Incidence> rel; |
4369 | Todo *aTodo;//, *rTodo; | 4373 | Todo *aTodo;//, *rTodo; |
4370 | Incidence *rIncidence; | 4374 | Incidence *rIncidence; |
4371 | bool childDelete = false; | 4375 | bool childDelete = false; |
4372 | bool deletedOne = true; | 4376 | bool deletedOne = true; |
4373 | todoCal = calendar()->todos(); | 4377 | todoCal = calendar()->todos(); |
4374 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 4378 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
4375 | if ( !aTodo->relatedTo() ) | 4379 | if ( !aTodo->relatedTo() ) |
4376 | rootTodos.append( aTodo ); | 4380 | rootTodos.append( aTodo ); |
4377 | } | 4381 | } |
4378 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 4382 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
4379 | removeCompletedSubTodos( aTodo ); | 4383 | removeCompletedSubTodos( aTodo ); |
4380 | } | 4384 | } |
4381 | 4385 | ||
4382 | updateView(); | 4386 | updateView(); |
4383 | } | 4387 | } |
4384 | } | 4388 | } |
4385 | 4389 | ||
4386 | void CalendarView::slotCalendarChanged() | 4390 | void CalendarView::slotCalendarChanged() |
4387 | { | 4391 | { |
4388 | ; | 4392 | ; |
4389 | } | 4393 | } |
4390 | 4394 | ||
4391 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 4395 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
4392 | { | 4396 | { |
4393 | //qDebug(" alendarView::keyPressEvent "); | 4397 | //qDebug(" alendarView::keyPressEvent "); |
4394 | e->ignore(); | 4398 | e->ignore(); |
4395 | } | 4399 | } |
4396 | 4400 | ||
4397 | 4401 | ||
4398 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 4402 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) |
4399 | { | 4403 | { |
4400 | // mSyncManager = manager; | 4404 | // mSyncManager = manager; |
4401 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 4405 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
4402 | qDebug("KO: SyncKDE request detected!"); | 4406 | qDebug("KO: SyncKDE request detected!"); |
4403 | } | 4407 | } |
4404 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 4408 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
4405 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 4409 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
4406 | return syncCalendar( filename, mode ); | 4410 | return syncCalendar( filename, mode ); |
4407 | } | 4411 | } |
4408 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 4412 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
4409 | { | 4413 | { |
4410 | //mSyncManager = manager; | 4414 | //mSyncManager = manager; |
4411 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 4415 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
4412 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 4416 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
4413 | if ( resource == "sharp" ) | 4417 | if ( resource == "sharp" ) |
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index e4dc751..bb88386 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp | |||
@@ -1,424 +1,424 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qcombobox.h> | 25 | #include <qcombobox.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qdialog.h> | 29 | #include <qdialog.h> |
30 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
31 | #include <qtextcodec.h> | 31 | #include <qtextcodec.h> |
32 | 32 | ||
33 | 33 | ||
34 | #include <libkcal/calfilter.h> | 34 | #include <libkcal/calfilter.h> |
35 | 35 | ||
36 | #include "kofilterview.h" | 36 | #include "kofilterview.h" |
37 | #include "koprefs.h" | 37 | #include "koprefs.h" |
38 | #include <kiconloader.h> | 38 | #include <kiconloader.h> |
39 | #include <kglobal.h> | 39 | #include <kglobal.h> |
40 | #include <kcolorbutton.h> | 40 | #include <kcolorbutton.h> |
41 | #include <kmessagebox.h> | 41 | #include <kmessagebox.h> |
42 | 42 | ||
43 | 43 | ||
44 | 44 | ||
45 | 45 | ||
46 | 46 | ||
47 | KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, | 47 | KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, |
48 | const char* name,WFlags fl ) | 48 | const char* name,WFlags fl ) |
49 | : KOFilterView_base(parent,name,fl) | 49 | : KOFilterView_base(parent,name,fl) |
50 | { | 50 | { |
51 | mFilters = filterList; | 51 | mFilters = filterList; |
52 | 52 | ||
53 | connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); | 53 | connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); |
54 | connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); | 54 | connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); |
55 | connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); | 55 | connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); |
56 | } | 56 | } |
57 | 57 | ||
58 | KOFilterView::~KOFilterView() | 58 | KOFilterView::~KOFilterView() |
59 | { | 59 | { |
60 | // no need to delete child widgets, Qt does it all for us | 60 | // no need to delete child widgets, Qt does it all for us |
61 | } | 61 | } |
62 | 62 | ||
63 | bool KOFilterView::filtersEnabled() | 63 | bool KOFilterView::filtersEnabled() |
64 | { | 64 | { |
65 | return mEnabledCheck->isChecked(); | 65 | return mEnabledCheck->isChecked(); |
66 | } | 66 | } |
67 | 67 | ||
68 | void KOFilterView::setFiltersEnabled(bool set) | 68 | void KOFilterView::setFiltersEnabled(bool set) |
69 | { | 69 | { |
70 | mEnabledCheck->setChecked(set); | 70 | mEnabledCheck->setChecked(set); |
71 | emit filterChanged(); | 71 | emit filterChanged(); |
72 | } | 72 | } |
73 | 73 | ||
74 | 74 | ||
75 | void KOFilterView::updateFilters() | 75 | void KOFilterView::updateFilters() |
76 | { | 76 | { |
77 | mSelectionCombo->clear(); | 77 | mSelectionCombo->clear(); |
78 | 78 | ||
79 | CalFilter *filter = mFilters->first(); | 79 | CalFilter *filter = mFilters->first(); |
80 | while(filter) { | 80 | while(filter) { |
81 | mSelectionCombo->insertItem(filter->name()); | 81 | mSelectionCombo->insertItem(filter->name()); |
82 | filter = mFilters->next(); | 82 | filter = mFilters->next(); |
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | CalFilter *KOFilterView::selectedFilter() | 86 | CalFilter *KOFilterView::selectedFilter() |
87 | { | 87 | { |
88 | CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); | 88 | CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); |
89 | return f; | 89 | return f; |
90 | } | 90 | } |
91 | 91 | ||
92 | void KOFilterView::setSelectedFilter(QString filterName) | 92 | void KOFilterView::setSelectedFilter(QString filterName) |
93 | { | 93 | { |
94 | int filter_num = mSelectionCombo->count(); | 94 | int filter_num = mSelectionCombo->count(); |
95 | int i; | 95 | int i; |
96 | for (i=0;i<filter_num;i++) { | 96 | for (i=0;i<filter_num;i++) { |
97 | if (mSelectionCombo->text(i)==filterName) | 97 | if (mSelectionCombo->text(i)==filterName) |
98 | mSelectionCombo->setCurrentItem(i); | 98 | mSelectionCombo->setCurrentItem(i); |
99 | } | 99 | } |
100 | emit filterChanged(); | 100 | emit filterChanged(); |
101 | } | 101 | } |
102 | void KOFilterView::setSelectedFilter( int fil ) | 102 | void KOFilterView::setSelectedFilter( int fil ) |
103 | { | 103 | { |
104 | if ( fil >= mSelectionCombo->count() ) | 104 | if ( fil >= mSelectionCombo->count() ) |
105 | return; | 105 | return; |
106 | mSelectionCombo->setCurrentItem( fil ); | 106 | mSelectionCombo->setCurrentItem( fil ); |
107 | emit filterChanged(); | 107 | emit filterChanged(); |
108 | } | 108 | } |
109 | 109 | ||
110 | 110 | ||
111 | 111 | ||
112 | KOCalEditView::KOCalEditView(QWidget* parent, | 112 | KOCalEditView::KOCalEditView(QWidget* parent, |
113 | const char* name ) | 113 | const char* name ) |
114 | : QScrollView(parent,name) | 114 | : QScrollView(parent,name) |
115 | { | 115 | { |
116 | mw = 0; | 116 | mw = 0; |
117 | setResizePolicy( AutoOneFit ); | 117 | setResizePolicy( AutoOneFit ); |
118 | setFrameStyle ( QFrame::Panel | QFrame::Plain ); | 118 | setFrameStyle ( QFrame::Panel | QFrame::Plain ); |
119 | setLineWidth ( 1 ); | 119 | setLineWidth ( 1 ); |
120 | setMidLineWidth ( 1 ); | 120 | setMidLineWidth ( 1 ); |
121 | setFocusPolicy(NoFocus); | 121 | setFocusPolicy(NoFocus); |
122 | } | 122 | } |
123 | 123 | ||
124 | KOCalEditView::~KOCalEditView() | 124 | KOCalEditView::~KOCalEditView() |
125 | { | 125 | { |
126 | // no need to delete child widgets, Qt does it all for us | 126 | // no need to delete child widgets, Qt does it all for us |
127 | } | 127 | } |
128 | void KOCalEditView::selectCal(int id ,bool b) | 128 | void KOCalEditView::selectCal(int id ,bool b) |
129 | { | 129 | { |
130 | KOPrefs::instance()->getCalendar( id )->isEnabled = b; | 130 | KOPrefs::instance()->getCalendar( id )->isEnabled = b; |
131 | emit calendarEnabled ( id, b ); | 131 | emit calendarEnabled ( id, b ); |
132 | emit needsUpdate(); | 132 | emit needsUpdate(); |
133 | 133 | ||
134 | } | 134 | } |
135 | void KOCalEditView::selectStdCal( int id, bool b ) | 135 | void KOCalEditView::selectStdCal( int id, bool b ) |
136 | { | 136 | { |
137 | 137 | ||
138 | if ( !b ) { | 138 | if ( !b ) { |
139 | KOCalCheckButton* it = (KOCalCheckButton*) sender(); | 139 | KOCalCheckButton* it = (KOCalCheckButton*) sender(); |
140 | if ( it ) { | 140 | if ( it ) { |
141 | it->blockSignals( true ); | 141 | it->blockSignals( true ); |
142 | it->setChecked( true ); | 142 | it->setChecked( true ); |
143 | it->blockSignals( false ); | 143 | it->blockSignals( false ); |
144 | return; | 144 | return; |
145 | } | 145 | } |
146 | return; | 146 | return; |
147 | } | 147 | } |
148 | KOCalCheckButton* sen = (KOCalCheckButton*) sender(); | 148 | KOCalCheckButton* sen = (KOCalCheckButton*) sender(); |
149 | KOCalCheckButton* it = mStdandardB.first(); | 149 | KOCalCheckButton* it = mStdandardB.first(); |
150 | while ( it ) { | 150 | while ( it ) { |
151 | if ( it->isChecked() ) { | 151 | if ( it->isChecked() ) { |
152 | if ( it != sen ) { | 152 | if ( it != sen ) { |
153 | it->blockSignals( true ); | 153 | it->blockSignals( true ); |
154 | it->setChecked( false ); | 154 | it->setChecked( false ); |
155 | it->blockSignals( false ); | 155 | it->blockSignals( false ); |
156 | break; | 156 | break; |
157 | } | 157 | } |
158 | } | 158 | } |
159 | it = mStdandardB.next(); | 159 | it = mStdandardB.next(); |
160 | } | 160 | } |
161 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 161 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
162 | while ( kkf ) { | 162 | while ( kkf ) { |
163 | kkf->isStandard = false; | 163 | kkf->isStandard = false; |
164 | kkf = KOPrefs::instance()->mCalendars.next(); | 164 | kkf = KOPrefs::instance()->mCalendars.next(); |
165 | } | 165 | } |
166 | KOPrefs::instance()->getCalendar( id )->isStandard = true; | 166 | KOPrefs::instance()->getCalendar( id )->isStandard = true; |
167 | emit setCalendarDefault ( id ); | 167 | emit setCalendarDefault ( id ); |
168 | } | 168 | } |
169 | 169 | ||
170 | void KOCalEditView::selectCalAlarm(int id ,bool b ) | 170 | void KOCalEditView::selectCalAlarm(int id ,bool b ) |
171 | { | 171 | { |
172 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; | 172 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; |
173 | emit alarmEnabled ( id , b ); | 173 | emit alarmEnabled ( id , b ); |
174 | emit needsUpdate(); | 174 | emit needsUpdate(); |
175 | } | 175 | } |
176 | void KOCalEditView::selectReadOnly(int id ,bool b ) | 176 | void KOCalEditView::selectReadOnly(int id ,bool b ) |
177 | { | 177 | { |
178 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; | 178 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; |
179 | emit calendarReadonly ( id , b ); | 179 | emit calendarReadonly ( id , b ); |
180 | if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) { | 180 | if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) { |
181 | KOPrefs::instance()->getCalendar( id )->isStandard = false; | 181 | KOPrefs::instance()->getCalendar( id )->isStandard = false; |
182 | KOPrefs::instance()->getCalendar( 1 )->isStandard = true; | 182 | KOPrefs::instance()->getCalendar( 1 )->isStandard = true; |
183 | emit setCalendarDefault ( 1 ); | 183 | emit setCalendarDefault ( 1 ); |
184 | } | 184 | } |
185 | emit needsUpdate(); | 185 | emit needsUpdate(); |
186 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 186 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
187 | 187 | ||
188 | } | 188 | } |
189 | void KOCalEditView::setColor( const QColor& c, int id ) | 189 | void KOCalEditView::setColor( const QColor& c, int id ) |
190 | { | 190 | { |
191 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; | 191 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; |
192 | emit needsUpdate(); | 192 | emit needsUpdate(); |
193 | } | 193 | } |
194 | void KOCalEditView::deleteCal( int id ) | 194 | void KOCalEditView::deleteCal( int id ) |
195 | { | 195 | { |
196 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); | 196 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); |
197 | QString name = kkf->mName; | 197 | QString name = kkf->mName; |
198 | QString file = kkf->mFileName; | 198 | QString file = KGlobal::formatMessage ( kkf->mFileName ,0 ); |
199 | if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; | 199 | if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; |
200 | if ( kkf->isStandard ) | 200 | if ( kkf->isStandard ) |
201 | selectStdCal( 1, true ); | 201 | selectStdCal( 1, true ); |
202 | emit removeCalendar ( id ); | 202 | emit removeCalendar ( id ); |
203 | KOPrefs::instance()->mCalendars.remove ( kkf ); | 203 | KOPrefs::instance()->mCalendars.remove ( kkf ); |
204 | emit needsUpdate(); | 204 | emit needsUpdate(); |
205 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 205 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
206 | } | 206 | } |
207 | void KOCalEditView::infoCal( int id ) | 207 | void KOCalEditView::infoCal( int id ) |
208 | { | 208 | { |
209 | QString name = KOPrefs::instance()->getCalendar( id )->mName; | 209 | QString name = KOPrefs::instance()->getCalendar( id )->mName; |
210 | QString file = KOPrefs::instance()->getCalendar( id )->mFileName; | 210 | QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 ); |
211 | if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { | 211 | if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { |
212 | if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { | 212 | if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { |
213 | emit calendarAdded( id ); | 213 | emit calendarAdded( id ); |
214 | emit needsUpdate(); | 214 | emit needsUpdate(); |
215 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 215 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | else | 218 | else |
219 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); | 219 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); |
220 | } | 220 | } |
221 | void KOCalEditView::readConfig() | 221 | void KOCalEditView::readConfig() |
222 | { | 222 | { |
223 | 223 | ||
224 | mStdandardB.clear(); | 224 | mStdandardB.clear(); |
225 | mEnabledB.clear(); | 225 | mEnabledB.clear(); |
226 | mAlarmB.clear(); | 226 | mAlarmB.clear(); |
227 | mROB.clear(); | 227 | mROB.clear(); |
228 | 228 | ||
229 | if ( mw ) delete mw; | 229 | if ( mw ) delete mw; |
230 | mw = new QWidget ( viewport() ); | 230 | mw = new QWidget ( viewport() ); |
231 | addChild(mw); | 231 | addChild(mw); |
232 | 232 | ||
233 | mainLayout = new QGridLayout ( mw , 2, 8 ); | 233 | mainLayout = new QGridLayout ( mw , 2, 8 ); |
234 | mainLayout->setMargin( 3); | 234 | mainLayout->setMargin( 3); |
235 | mainLayout->setSpacing( 2); | 235 | mainLayout->setSpacing( 2); |
236 | QPushButton * addBut = new QPushButton ( mw ); | 236 | QPushButton * addBut = new QPushButton ( mw ); |
237 | addBut->setFocusPolicy(NoFocus); | 237 | addBut->setFocusPolicy(NoFocus); |
238 | mainLayout->addWidget( addBut,0,0 ); | 238 | mainLayout->addWidget( addBut,0,0 ); |
239 | addBut->setPixmap ( SmallIcon("plus")); | 239 | addBut->setPixmap ( SmallIcon("plus")); |
240 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); | 240 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); |
241 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 241 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
242 | 242 | ||
243 | addBut = new QPushButton ( mw ); | 243 | addBut = new QPushButton ( mw ); |
244 | addBut->setFocusPolicy(NoFocus); | 244 | addBut->setFocusPolicy(NoFocus); |
245 | mainLayout->addWidget( addBut,0,1 ); | 245 | mainLayout->addWidget( addBut,0,1 ); |
246 | addBut->setPixmap ( SmallIcon("eye")); | 246 | addBut->setPixmap ( SmallIcon("eye")); |
247 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); | 247 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); |
248 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 248 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
249 | 249 | ||
250 | QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); | 250 | QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); |
251 | mainLayout->addWidget( lab,0,2 ); | 251 | mainLayout->addWidget( lab,0,2 ); |
252 | lab = new QLabel ( i18n(" "), mw ); | 252 | lab = new QLabel ( i18n(" "), mw ); |
253 | mainLayout->addWidget( lab,0,3 ); | 253 | mainLayout->addWidget( lab,0,3 ); |
254 | lab->setFixedWidth( 6 ); | 254 | lab->setFixedWidth( 6 ); |
255 | addBut = new QPushButton ( mw ); | 255 | addBut = new QPushButton ( mw ); |
256 | addBut->setFocusPolicy(NoFocus); | 256 | addBut->setFocusPolicy(NoFocus); |
257 | mainLayout->addWidget( addBut,0,4 ); | 257 | mainLayout->addWidget( addBut,0,4 ); |
258 | addBut->setPixmap ( SmallIcon("bell")); | 258 | addBut->setPixmap ( SmallIcon("bell")); |
259 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); | 259 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); |
260 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 260 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
261 | 261 | ||
262 | addBut = new QPushButton ( mw ); | 262 | addBut = new QPushButton ( mw ); |
263 | addBut->setFocusPolicy(NoFocus); | 263 | addBut->setFocusPolicy(NoFocus); |
264 | mainLayout->addWidget( addBut,0,5 ); | 264 | mainLayout->addWidget( addBut,0,5 ); |
265 | addBut->setPixmap ( SmallIcon("pencil")); | 265 | addBut->setPixmap ( SmallIcon("pencil")); |
266 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); | 266 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); |
267 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 267 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
268 | 268 | ||
269 | lab = new QLabel ( i18n(" Color "), mw ); | 269 | lab = new QLabel ( i18n(" Color "), mw ); |
270 | mainLayout->addWidget( lab,0,6 ); | 270 | mainLayout->addWidget( lab,0,6 ); |
271 | #if 0 | 271 | #if 0 |
272 | addBut = new QPushButton ( mw ); | 272 | addBut = new QPushButton ( mw ); |
273 | mainLayout->addWidget( addBut,0,6 ); | 273 | mainLayout->addWidget( addBut,0,6 ); |
274 | addBut->setPixmap ( SmallIcon("minus")); | 274 | addBut->setPixmap ( SmallIcon("minus")); |
275 | connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); | 275 | connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); |
276 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 276 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
277 | #endif | 277 | #endif |
278 | 278 | ||
279 | 279 | ||
280 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 280 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
281 | int row = 1; | 281 | int row = 1; |
282 | while ( kkf ) { | 282 | while ( kkf ) { |
283 | int iii = 0; | 283 | int iii = 0; |
284 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); | 284 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); |
285 | mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); | 285 | mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); |
286 | cb->setChecked( kkf->isStandard ); | 286 | cb->setChecked( kkf->isStandard ); |
287 | cb->setNum( kkf->mCalNumber ); | 287 | cb->setNum( kkf->mCalNumber ); |
288 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); | 288 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); |
289 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) | 289 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) |
290 | cb->setEnabled( false ); | 290 | cb->setEnabled( false ); |
291 | cb = new KOCalCheckButton( mw ); | 291 | cb = new KOCalCheckButton( mw ); |
292 | mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); | 292 | mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); |
293 | cb->setChecked( kkf->isEnabled ); | 293 | cb->setChecked( kkf->isEnabled ); |
294 | cb->setNum( kkf->mCalNumber ); | 294 | cb->setNum( kkf->mCalNumber ); |
295 | if ( kkf->mErrorOnLoad ) | 295 | if ( kkf->mErrorOnLoad ) |
296 | cb->setEnabled( false ); | 296 | cb->setEnabled( false ); |
297 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); | 297 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); |
298 | KOCalButton* name = new KOCalButton( mw ); | 298 | KOCalButton* name = new KOCalButton( mw ); |
299 | name->setNum( kkf->mCalNumber ); | 299 | name->setNum( kkf->mCalNumber ); |
300 | name->setText( kkf->mName ); | 300 | name->setText( kkf->mName ); |
301 | mainLayout->addWidget( name,row,++iii ); | 301 | mainLayout->addWidget( name,row,++iii ); |
302 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); | 302 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); |
303 | lab = new QLabel ( i18n(" "), mw ); | 303 | lab = new QLabel ( i18n(" "), mw ); |
304 | mainLayout->addWidget( lab,row,++iii ); | 304 | mainLayout->addWidget( lab,row,++iii ); |
305 | cb = new KOCalCheckButton( mw ); | 305 | cb = new KOCalCheckButton( mw ); |
306 | mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); | 306 | mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); |
307 | cb->setChecked( kkf->isAlarmEnabled ); | 307 | cb->setChecked( kkf->isAlarmEnabled ); |
308 | cb->setNum( kkf->mCalNumber ); | 308 | cb->setNum( kkf->mCalNumber ); |
309 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); | 309 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); |
310 | if ( kkf->mErrorOnLoad ) | 310 | if ( kkf->mErrorOnLoad ) |
311 | cb->setEnabled( false ); | 311 | cb->setEnabled( false ); |
312 | cb = new KOCalCheckButton( mw ); | 312 | cb = new KOCalCheckButton( mw ); |
313 | mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); | 313 | mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); |
314 | cb->setChecked( kkf->isReadOnly ); | 314 | cb->setChecked( kkf->isReadOnly ); |
315 | cb->setNum( kkf->mCalNumber ); | 315 | cb->setNum( kkf->mCalNumber ); |
316 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); | 316 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); |
317 | if ( kkf->mErrorOnLoad ) | 317 | if ( kkf->mErrorOnLoad ) |
318 | cb->setEnabled( false ); | 318 | cb->setEnabled( false ); |
319 | if ( row > 1) { | 319 | if ( row > 1) { |
320 | KColorButton *colb = new KColorButton( mw ); | 320 | KColorButton *colb = new KColorButton( mw ); |
321 | mainLayout->addWidget( colb,row,++iii ); | 321 | mainLayout->addWidget( colb,row,++iii ); |
322 | colb->setID( kkf->mCalNumber ); | 322 | colb->setID( kkf->mCalNumber ); |
323 | colb->setColor( kkf->mDefaultColor ); | 323 | colb->setColor( kkf->mDefaultColor ); |
324 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); | 324 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); |
325 | KOCalButton* calb = new KOCalButton( mw ); | 325 | KOCalButton* calb = new KOCalButton( mw ); |
326 | mainLayout->addWidget( calb,row,++iii ); | 326 | mainLayout->addWidget( calb,row,++iii ); |
327 | calb->setNum( kkf->mCalNumber ); | 327 | calb->setNum( kkf->mCalNumber ); |
328 | calb->setPixmap ( SmallIcon("minus")); | 328 | calb->setPixmap ( SmallIcon("minus")); |
329 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); | 329 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); |
330 | int hei = calb->sizeHint().height(); | 330 | int hei = calb->sizeHint().height(); |
331 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); | 331 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); |
332 | } | 332 | } |
333 | ++row; | 333 | ++row; |
334 | kkf = KOPrefs::instance()->mCalendars.next(); | 334 | kkf = KOPrefs::instance()->mCalendars.next(); |
335 | } | 335 | } |
336 | lab = new QLabel ( "", mw ); | 336 | lab = new QLabel ( "", mw ); |
337 | mainLayout->addWidget( lab,row,0 ); | 337 | mainLayout->addWidget( lab,row,0 ); |
338 | mw->show(); | 338 | mw->show(); |
339 | 339 | ||
340 | } | 340 | } |
341 | void KOCalEditView::addCal() | 341 | void KOCalEditView::addCal() |
342 | { | 342 | { |
343 | bool tryagain = true; | 343 | bool tryagain = true; |
344 | QString name, file; | 344 | QString name, file; |
345 | while ( tryagain ) { | 345 | while ( tryagain ) { |
346 | KONewCalPrefs prefs ( this ); | 346 | KONewCalPrefs prefs ( this ); |
347 | prefs.nameE->setText( name ); | 347 | prefs.nameE->setText( name ); |
348 | prefs.url->setURL( file ); | 348 | prefs.url->setURL( file ); |
349 | if ( ! prefs.exec() ) | 349 | if ( ! prefs.exec() ) |
350 | return; | 350 | return; |
351 | name = prefs.calName(); | 351 | name = prefs.calName(); |
352 | file = prefs.calFileName(); | 352 | file = prefs.calFileName(); |
353 | tryagain = false; | 353 | tryagain = false; |
354 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 354 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
355 | while ( kkf ) { | 355 | while ( kkf ) { |
356 | if ( kkf->mName == name ) { | 356 | if ( kkf->mName == name ) { |
357 | KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); | 357 | KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); |
358 | name = ""; | 358 | name = ""; |
359 | tryagain = true; | 359 | tryagain = true; |
360 | break; | 360 | break; |
361 | } | 361 | } |
362 | if ( kkf->mFileName == file ) { | 362 | if ( kkf->mFileName == file ) { |
363 | KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( file) ); | 363 | KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) ); |
364 | tryagain = true; | 364 | tryagain = true; |
365 | file = ""; | 365 | file = ""; |
366 | break; | 366 | break; |
367 | } | 367 | } |
368 | kkf = KOPrefs::instance()->mCalendars.next(); | 368 | kkf = KOPrefs::instance()->mCalendars.next(); |
369 | } | 369 | } |
370 | } | 370 | } |
371 | QFileInfo fi ( file ); | 371 | QFileInfo fi ( file ); |
372 | if (!fi.exists() ) { | 372 | if (!fi.exists() ) { |
373 | if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No ) | 373 | if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No ) |
374 | return; | 374 | return; |
375 | QFile fileIn( file ); | 375 | QFile fileIn( file ); |
376 | if (!fileIn.open( IO_WriteOnly ) ) { | 376 | if (!fileIn.open( IO_WriteOnly ) ) { |
377 | KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); | 377 | KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); |
378 | return; | 378 | return; |
379 | } | 379 | } |
380 | QTextStream tsIn( &fileIn ); | 380 | QTextStream tsIn( &fileIn ); |
381 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 381 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
382 | tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; | 382 | tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; |
383 | fileIn.close(); | 383 | fileIn.close(); |
384 | } | 384 | } |
385 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); | 385 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); |
386 | kkf->mName = name; | 386 | kkf->mName = name; |
387 | kkf->mFileName = file; | 387 | kkf->mFileName = file; |
388 | emit calendarAdded( kkf->mCalNumber ); | 388 | emit calendarAdded( kkf->mCalNumber ); |
389 | emit needsUpdate(); | 389 | emit needsUpdate(); |
390 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 390 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
391 | } | 391 | } |
392 | void KOCalEditView::enableAll() | 392 | void KOCalEditView::enableAll() |
393 | { | 393 | { |
394 | toggleList( mEnabledB ); | 394 | toggleList( mEnabledB ); |
395 | } | 395 | } |
396 | void KOCalEditView::enableAlarm() | 396 | void KOCalEditView::enableAlarm() |
397 | { | 397 | { |
398 | toggleList( mAlarmB ); | 398 | toggleList( mAlarmB ); |
399 | } | 399 | } |
400 | void KOCalEditView::disableRO() | 400 | void KOCalEditView::disableRO() |
401 | { | 401 | { |
402 | toggleList( mROB ); | 402 | toggleList( mROB ); |
403 | } | 403 | } |
404 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) | 404 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) |
405 | { | 405 | { |
406 | bool dis = false; | 406 | bool dis = false; |
407 | KOCalCheckButton* it = list.first(); | 407 | KOCalCheckButton* it = list.first(); |
408 | while ( it ) { | 408 | while ( it ) { |
409 | if ( !it->isChecked() ) { | 409 | if ( !it->isChecked() ) { |
410 | dis = true; | 410 | dis = true; |
411 | break; | 411 | break; |
412 | } | 412 | } |
413 | it = list.next(); | 413 | it = list.next(); |
414 | } | 414 | } |
415 | it = list.first(); | 415 | it = list.first(); |
416 | while ( it ) { | 416 | while ( it ) { |
417 | it->setChecked(dis); | 417 | it->setChecked(dis); |
418 | it = list.next(); | 418 | it = list.next(); |
419 | } | 419 | } |
420 | } | 420 | } |
421 | void KOCalEditView::deleteAll() | 421 | void KOCalEditView::deleteAll() |
422 | { | 422 | { |
423 | qDebug("delteAll"); | 423 | qDebug("delteAll"); |
424 | } | 424 | } |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 13e88ef..926a136 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -1,482 +1,483 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qheader.h> | 25 | #include <qheader.h> |
26 | #include <qcursor.h> | 26 | #include <qcursor.h> |
27 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
28 | #include <qdialog.h> | 28 | #include <qdialog.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | 31 | ||
32 | #include <qinputdialog.h> | 32 | #include <qinputdialog.h> |
33 | 33 | ||
34 | #include <qvbox.h> | 34 | #include <qvbox.h> |
35 | #include <kdebug.h> | 35 | #include <kdebug.h> |
36 | #include "koprefs.h" | 36 | #include "koprefs.h" |
37 | #include <klocale.h> | 37 | #include <klocale.h> |
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kdateedit.h> | 39 | #include <kdateedit.h> |
40 | #include "ktimeedit.h" | 40 | #include "ktimeedit.h" |
41 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
42 | #include <kmessagebox.h> | 42 | #include <kmessagebox.h> |
43 | 43 | ||
44 | #include <libkcal/icaldrag.h> | 44 | #include <libkcal/icaldrag.h> |
45 | #include <libkcal/vcaldrag.h> | 45 | #include <libkcal/vcaldrag.h> |
46 | #include <libkcal/calfilter.h> | 46 | #include <libkcal/calfilter.h> |
47 | #include <libkcal/dndfactory.h> | 47 | #include <libkcal/dndfactory.h> |
48 | #include <libkcal/calendarresources.h> | 48 | #include <libkcal/calendarresources.h> |
49 | #include <libkcal/resourcecalendar.h> | 49 | #include <libkcal/resourcecalendar.h> |
50 | #include <kresources/resourceselectdialog.h> | 50 | #include <kresources/resourceselectdialog.h> |
51 | #include <libkcal/kincidenceformatter.h> | 51 | #include <libkcal/kincidenceformatter.h> |
52 | #ifndef DESKTOP_VERSION | 52 | #ifndef DESKTOP_VERSION |
53 | #include <qpe/qpeapplication.h> | 53 | #include <qpe/qpeapplication.h> |
54 | #else | 54 | #else |
55 | #include <qapplication.h> | 55 | #include <qapplication.h> |
56 | #endif | 56 | #endif |
57 | #ifndef KORG_NOPRINTER | 57 | #ifndef KORG_NOPRINTER |
58 | #include "calprinter.h" | 58 | #include "calprinter.h" |
59 | #endif | 59 | #endif |
60 | #include "docprefs.h" | 60 | #include "docprefs.h" |
61 | 61 | ||
62 | #include "kotodoview.h" | 62 | #include "kotodoview.h" |
63 | using namespace KOrg; | 63 | using namespace KOrg; |
64 | 64 | ||
65 | 65 | ||
66 | KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : | 66 | KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : |
67 | QDialog( parent, name, true ) | 67 | QDialog( parent, name, true ) |
68 | { | 68 | { |
69 | mTodo = todo; | 69 | mTodo = todo; |
70 | setCaption( i18n("Stop todo") ); | 70 | setCaption( i18n("Stop todo") ); |
71 | QVBoxLayout* lay = new QVBoxLayout( this ); | 71 | QVBoxLayout* lay = new QVBoxLayout( this ); |
72 | lay->setSpacing( 3 ); | 72 | lay->setSpacing( 3 ); |
73 | lay->setMargin( 3 ); | 73 | lay->setMargin( 3 ); |
74 | QLabel * lab = new QLabel( i18n("%1\nis running!").arg( todo->summary() ), this ); | 74 | QLabel * lab = new QLabel( i18n("%1\nis running!").arg( todo->summary() ), this ); |
75 | lay->addWidget( lab ); | 75 | lay->addWidget( lab ); |
76 | lab->setAlignment( AlignHCenter ); | 76 | lab->setAlignment( AlignHCenter ); |
77 | lab = new QLabel( i18n("Additional Comment:"), this ); | 77 | lab = new QLabel( i18n("Additional Comment:"), this ); |
78 | lay->addWidget( lab ); | 78 | lay->addWidget( lab ); |
79 | mComment = new QLineEdit( this ); | 79 | mComment = new QLineEdit( this ); |
80 | lay->addWidget( mComment ); | 80 | lay->addWidget( mComment ); |
81 | QHBox * start = new QHBox ( this ); | 81 | QHBox * start = new QHBox ( this ); |
82 | lay->addWidget( start ); | 82 | lay->addWidget( start ); |
83 | lab = new QLabel( i18n("Start:"), start ); | 83 | lab = new QLabel( i18n("Start:"), start ); |
84 | QHBox * end = new QHBox ( this ); | 84 | QHBox * end = new QHBox ( this ); |
85 | lay->addWidget( end ); | 85 | lay->addWidget( end ); |
86 | lab = new QLabel( i18n("End:"), end ); | 86 | lab = new QLabel( i18n("End:"), end ); |
87 | sde = new KDateEdit( start ); | 87 | sde = new KDateEdit( start ); |
88 | ste = new KOTimeEdit( start ); | 88 | ste = new KOTimeEdit( start ); |
89 | connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); | 89 | connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); |
90 | ede = new KDateEdit( end ); | 90 | ede = new KDateEdit( end ); |
91 | ete = new KOTimeEdit(end ); | 91 | ete = new KOTimeEdit(end ); |
92 | connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); | 92 | connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); |
93 | sde->setDate( mTodo->runStart().date() ); | 93 | sde->setDate( mTodo->runStart().date() ); |
94 | ste->setTime( mTodo->runStart().time() ); | 94 | ste->setTime( mTodo->runStart().time() ); |
95 | ede->setDate( QDate::currentDate()); | 95 | ede->setDate( QDate::currentDate()); |
96 | ete->setTime( QTime::currentTime() ); | 96 | ete->setTime( QTime::currentTime() ); |
97 | QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); | 97 | QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); |
98 | lay->addWidget( ok ); | 98 | lay->addWidget( ok ); |
99 | ok->setDefault( true ); | ||
99 | QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); | 100 | QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); |
100 | lay->addWidget( cancel ); | 101 | lay->addWidget( cancel ); |
101 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 102 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
102 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 103 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
103 | ok = new QPushButton( i18n("Stop - do not save"), this ); | 104 | ok = new QPushButton( i18n("Stop - do not save"), this ); |
104 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); | 105 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); |
105 | lay->addWidget( ok ); | 106 | lay->addWidget( ok ); |
106 | if (QApplication::desktop()->width() < 320 ) | 107 | if (QApplication::desktop()->width() < 320 ) |
107 | resize( 240, 200 ); | 108 | resize( 240, 200 ); |
108 | else | 109 | else |
109 | resize( 320, 200 ); | 110 | resize( 320, 200 ); |
110 | 111 | ||
111 | } | 112 | } |
112 | 113 | ||
113 | void KOStopTodoPrefs::accept() | 114 | void KOStopTodoPrefs::accept() |
114 | { | 115 | { |
115 | QDateTime start = QDateTime( sde->date(), ste->getTime() ); | 116 | QDateTime start = QDateTime( sde->date(), ste->getTime() ); |
116 | QDateTime stop = QDateTime( ede->date(), ete->getTime() ); | 117 | QDateTime stop = QDateTime( ede->date(), ete->getTime() ); |
117 | if ( start > stop ) { | 118 | if ( start > stop ) { |
118 | KMessageBox::sorry(this, | 119 | KMessageBox::sorry(this, |
119 | i18n("The start time is\nafter the end time!"), | 120 | i18n("The start time is\nafter the end time!"), |
120 | i18n("Time mismatch!")); | 121 | i18n("Time mismatch!")); |
121 | return; | 122 | return; |
122 | } | 123 | } |
123 | mTodo->saveRunningInfo( mComment->text(), start, stop ); | 124 | mTodo->saveRunningInfo( mComment->text(), start, stop ); |
124 | QDialog::accept(); | 125 | QDialog::accept(); |
125 | } | 126 | } |
126 | void KOStopTodoPrefs::doNotSave() | 127 | void KOStopTodoPrefs::doNotSave() |
127 | { | 128 | { |
128 | int result = KMessageBox::warningContinueCancel(this, | 129 | int result = KMessageBox::warningContinueCancel(this, |
129 | i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary() ); | 130 | i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary() ); |
130 | if (result != KMessageBox::Continue) return; | 131 | if (result != KMessageBox::Continue) return; |
131 | mTodo->stopRunning(); | 132 | mTodo->stopRunning(); |
132 | QDialog::accept(); | 133 | QDialog::accept(); |
133 | } | 134 | } |
134 | 135 | ||
135 | 136 | ||
136 | class KOTodoViewWhatsThis :public QWhatsThis | 137 | class KOTodoViewWhatsThis :public QWhatsThis |
137 | { | 138 | { |
138 | public: | 139 | public: |
139 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 140 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; |
140 | 141 | ||
141 | protected: | 142 | protected: |
142 | virtual QString text( const QPoint& p) | 143 | virtual QString text( const QPoint& p) |
143 | { | 144 | { |
144 | return _view->getWhatsThisText(p) ; | 145 | return _view->getWhatsThisText(p) ; |
145 | } | 146 | } |
146 | private: | 147 | private: |
147 | QWidget* _wid; | 148 | QWidget* _wid; |
148 | KOTodoView * _view; | 149 | KOTodoView * _view; |
149 | }; | 150 | }; |
150 | 151 | ||
151 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, | 152 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, |
152 | const char *name) : | 153 | const char *name) : |
153 | KListView(parent,name) | 154 | KListView(parent,name) |
154 | { | 155 | { |
155 | mName = QString ( name ); | 156 | mName = QString ( name ); |
156 | mCalendar = calendar; | 157 | mCalendar = calendar; |
157 | #ifndef DESKTOP_VERSION | 158 | #ifndef DESKTOP_VERSION |
158 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 159 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
159 | #endif | 160 | #endif |
160 | mOldCurrent = 0; | 161 | mOldCurrent = 0; |
161 | mMousePressed = false; | 162 | mMousePressed = false; |
162 | 163 | ||
163 | setAcceptDrops(true); | 164 | setAcceptDrops(true); |
164 | viewport()->setAcceptDrops(true); | 165 | viewport()->setAcceptDrops(true); |
165 | int size = 16; | 166 | int size = 16; |
166 | if (qApp->desktop()->width() < 300 ) | 167 | if (qApp->desktop()->width() < 300 ) |
167 | size = 12; | 168 | size = 12; |
168 | setTreeStepSize( size + 6 ); | 169 | setTreeStepSize( size + 6 ); |
169 | 170 | ||
170 | } | 171 | } |
171 | 172 | ||
172 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) | 173 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) |
173 | { | 174 | { |
174 | #ifndef KORG_NODND | 175 | #ifndef KORG_NODND |
175 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; | 176 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; |
176 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 177 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
177 | !QTextDrag::canDecode( e ) ) { | 178 | !QTextDrag::canDecode( e ) ) { |
178 | e->ignore(); | 179 | e->ignore(); |
179 | return; | 180 | return; |
180 | } | 181 | } |
181 | 182 | ||
182 | mOldCurrent = currentItem(); | 183 | mOldCurrent = currentItem(); |
183 | #endif | 184 | #endif |
184 | } | 185 | } |
185 | 186 | ||
186 | 187 | ||
187 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) | 188 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) |
188 | { | 189 | { |
189 | #ifndef KORG_NODND | 190 | #ifndef KORG_NODND |
190 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; | 191 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; |
191 | 192 | ||
192 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 193 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
193 | !QTextDrag::canDecode( e ) ) { | 194 | !QTextDrag::canDecode( e ) ) { |
194 | e->ignore(); | 195 | e->ignore(); |
195 | return; | 196 | return; |
196 | } | 197 | } |
197 | 198 | ||
198 | e->accept(); | 199 | e->accept(); |
199 | #endif | 200 | #endif |
200 | } | 201 | } |
201 | 202 | ||
202 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) | 203 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) |
203 | { | 204 | { |
204 | #ifndef KORG_NODND | 205 | #ifndef KORG_NODND |
205 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; | 206 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; |
206 | 207 | ||
207 | setCurrentItem(mOldCurrent); | 208 | setCurrentItem(mOldCurrent); |
208 | setSelected(mOldCurrent,true); | 209 | setSelected(mOldCurrent,true); |
209 | #endif | 210 | #endif |
210 | } | 211 | } |
211 | 212 | ||
212 | void KOTodoListView::contentsDropEvent(QDropEvent *e) | 213 | void KOTodoListView::contentsDropEvent(QDropEvent *e) |
213 | { | 214 | { |
214 | #ifndef KORG_NODND | 215 | #ifndef KORG_NODND |
215 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; | 216 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; |
216 | 217 | ||
217 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 218 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
218 | !QTextDrag::canDecode( e ) ) { | 219 | !QTextDrag::canDecode( e ) ) { |
219 | e->ignore(); | 220 | e->ignore(); |
220 | return; | 221 | return; |
221 | } | 222 | } |
222 | 223 | ||
223 | DndFactory factory( mCalendar ); | 224 | DndFactory factory( mCalendar ); |
224 | Todo *todo = factory.createDropTodo(e); | 225 | Todo *todo = factory.createDropTodo(e); |
225 | 226 | ||
226 | if (todo) { | 227 | if (todo) { |
227 | e->acceptAction(); | 228 | e->acceptAction(); |
228 | 229 | ||
229 | KOTodoViewItem *destination = | 230 | KOTodoViewItem *destination = |
230 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); | 231 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); |
231 | Todo *destinationEvent = 0; | 232 | Todo *destinationEvent = 0; |
232 | if (destination) destinationEvent = destination->todo(); | 233 | if (destination) destinationEvent = destination->todo(); |
233 | 234 | ||
234 | Todo *existingTodo = mCalendar->todo(todo->uid()); | 235 | Todo *existingTodo = mCalendar->todo(todo->uid()); |
235 | 236 | ||
236 | if(existingTodo) { | 237 | if(existingTodo) { |
237 | Incidence *to = destinationEvent; | 238 | Incidence *to = destinationEvent; |
238 | while(to) { | 239 | while(to) { |
239 | if (to->uid() == todo->uid()) { | 240 | if (to->uid() == todo->uid()) { |
240 | KMessageBox::sorry(this, | 241 | KMessageBox::sorry(this, |
241 | i18n("Cannot move Todo to itself\nor a child of itself"), | 242 | i18n("Cannot move Todo to itself\nor a child of itself"), |
242 | i18n("Drop Todo")); | 243 | i18n("Drop Todo")); |
243 | delete todo; | 244 | delete todo; |
244 | return; | 245 | return; |
245 | } | 246 | } |
246 | to = to->relatedTo(); | 247 | to = to->relatedTo(); |
247 | } | 248 | } |
248 | internalDrop = true; | 249 | internalDrop = true; |
249 | if ( destinationEvent ) | 250 | if ( destinationEvent ) |
250 | reparentTodoSignal( destinationEvent, existingTodo ); | 251 | reparentTodoSignal( destinationEvent, existingTodo ); |
251 | else | 252 | else |
252 | unparentTodoSignal(existingTodo); | 253 | unparentTodoSignal(existingTodo); |
253 | delete todo; | 254 | delete todo; |
254 | } else { | 255 | } else { |
255 | mCalendar->addTodo(todo); | 256 | mCalendar->addTodo(todo); |
256 | emit todoDropped(todo, KOGlobals::EVENTADDED); | 257 | emit todoDropped(todo, KOGlobals::EVENTADDED); |
257 | if ( destinationEvent ) | 258 | if ( destinationEvent ) |
258 | reparentTodoSignal( destinationEvent, todo ); | 259 | reparentTodoSignal( destinationEvent, todo ); |
259 | } | 260 | } |
260 | } | 261 | } |
261 | else { | 262 | else { |
262 | QString text; | 263 | QString text; |
263 | if (QTextDrag::decode(e,text)) { | 264 | if (QTextDrag::decode(e,text)) { |
264 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); | 265 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); |
265 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); | 266 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); |
266 | qDebug("Dropped : " + text); | 267 | qDebug("Dropped : " + text); |
267 | QStringList emails = QStringList::split(",",text); | 268 | QStringList emails = QStringList::split(",",text); |
268 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 269 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
269 | int pos = (*it).find("<"); | 270 | int pos = (*it).find("<"); |
270 | QString name = (*it).left(pos); | 271 | QString name = (*it).left(pos); |
271 | QString email = (*it).mid(pos); | 272 | QString email = (*it).mid(pos); |
272 | if (!email.isEmpty() && todoi) { | 273 | if (!email.isEmpty() && todoi) { |
273 | todoi->todo()->addAttendee(new Attendee(name,email)); | 274 | todoi->todo()->addAttendee(new Attendee(name,email)); |
274 | } | 275 | } |
275 | } | 276 | } |
276 | } | 277 | } |
277 | else { | 278 | else { |
278 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); | 279 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); |
279 | e->ignore(); | 280 | e->ignore(); |
280 | } | 281 | } |
281 | } | 282 | } |
282 | #endif | 283 | #endif |
283 | } | 284 | } |
284 | void KOTodoListView::wheelEvent (QWheelEvent *e) | 285 | void KOTodoListView::wheelEvent (QWheelEvent *e) |
285 | { | 286 | { |
286 | QListView::wheelEvent (e); | 287 | QListView::wheelEvent (e); |
287 | } | 288 | } |
288 | 289 | ||
289 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | 290 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) |
290 | { | 291 | { |
291 | 292 | ||
292 | QPoint p(contentsToViewport(e->pos())); | 293 | QPoint p(contentsToViewport(e->pos())); |
293 | QListViewItem *i = itemAt(p); | 294 | QListViewItem *i = itemAt(p); |
294 | bool rootClicked = true; | 295 | bool rootClicked = true; |
295 | if (i) { | 296 | if (i) { |
296 | // if the user clicked into the root decoration of the item, don't | 297 | // if the user clicked into the root decoration of the item, don't |
297 | // try to start a drag! | 298 | // try to start a drag! |
298 | int X = p.x(); | 299 | int X = p.x(); |
299 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); | 300 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); |
300 | if (X > header()->sectionPos(0) + | 301 | if (X > header()->sectionPos(0) + |
301 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | 302 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + |
302 | itemMargin() +i->height()|| | 303 | itemMargin() +i->height()|| |
303 | X < header()->sectionPos(0)) { | 304 | X < header()->sectionPos(0)) { |
304 | rootClicked = false; | 305 | rootClicked = false; |
305 | } | 306 | } |
306 | } else { | 307 | } else { |
307 | rootClicked = false; | 308 | rootClicked = false; |
308 | } | 309 | } |
309 | #ifndef KORG_NODND | 310 | #ifndef KORG_NODND |
310 | mMousePressed = false; | 311 | mMousePressed = false; |
311 | if (! rootClicked && !( e->button() == RightButton) ) { | 312 | if (! rootClicked && !( e->button() == RightButton) ) { |
312 | mPressPos = e->pos(); | 313 | mPressPos = e->pos(); |
313 | mMousePressed = true; | 314 | mMousePressed = true; |
314 | } else { | 315 | } else { |
315 | mMousePressed = false; | 316 | mMousePressed = false; |
316 | } | 317 | } |
317 | #endif | 318 | #endif |
318 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); | 319 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); |
319 | #ifndef DESKTOP_VERSION | 320 | #ifndef DESKTOP_VERSION |
320 | if (!( e->button() == RightButton && rootClicked) ) | 321 | if (!( e->button() == RightButton && rootClicked) ) |
321 | QListView::contentsMousePressEvent(e); | 322 | QListView::contentsMousePressEvent(e); |
322 | #else | 323 | #else |
323 | QListView::contentsMousePressEvent(e); | 324 | QListView::contentsMousePressEvent(e); |
324 | #endif | 325 | #endif |
325 | } | 326 | } |
326 | void KOTodoListView::paintEvent(QPaintEvent* e) | 327 | void KOTodoListView::paintEvent(QPaintEvent* e) |
327 | { | 328 | { |
328 | emit paintNeeded(); | 329 | emit paintNeeded(); |
329 | QListView::paintEvent( e); | 330 | QListView::paintEvent( e); |
330 | } | 331 | } |
331 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 332 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
332 | { | 333 | { |
333 | 334 | ||
334 | #ifndef KORG_NODND | 335 | #ifndef KORG_NODND |
335 | //QListView::contentsMouseMoveEvent(e); | 336 | //QListView::contentsMouseMoveEvent(e); |
336 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > | 337 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > |
337 | QApplication::startDragDistance()*3) { | 338 | QApplication::startDragDistance()*3) { |
338 | mMousePressed = false; | 339 | mMousePressed = false; |
339 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); | 340 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); |
340 | if (item) { | 341 | if (item) { |
341 | DndFactory factory( mCalendar ); | 342 | DndFactory factory( mCalendar ); |
342 | ICalDrag *vd = factory.createDrag( | 343 | ICalDrag *vd = factory.createDrag( |
343 | ((KOTodoViewItem *)item)->todo(),viewport()); | 344 | ((KOTodoViewItem *)item)->todo(),viewport()); |
344 | internalDrop = false; | 345 | internalDrop = false; |
345 | // we cannot do any senseful here, because the DnD is still broken in Qt | 346 | // we cannot do any senseful here, because the DnD is still broken in Qt |
346 | if (vd->drag()) { | 347 | if (vd->drag()) { |
347 | if ( !internalDrop ) { | 348 | if ( !internalDrop ) { |
348 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); | 349 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); |
349 | qDebug("Dnd: External move: Delete drag source "); | 350 | qDebug("Dnd: External move: Delete drag source "); |
350 | } else | 351 | } else |
351 | qDebug("Dnd: Internal move "); | 352 | qDebug("Dnd: Internal move "); |
352 | 353 | ||
353 | } else { | 354 | } else { |
354 | if ( !internalDrop ) { | 355 | if ( !internalDrop ) { |
355 | qDebug("Dnd: External Copy"); | 356 | qDebug("Dnd: External Copy"); |
356 | } else | 357 | } else |
357 | qDebug("DnD: Internal copy: Copy pending"); | 358 | qDebug("DnD: Internal copy: Copy pending"); |
358 | } | 359 | } |
359 | } | 360 | } |
360 | } | 361 | } |
361 | #endif | 362 | #endif |
362 | } | 363 | } |
363 | void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) | 364 | void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) |
364 | { | 365 | { |
365 | if ( !e->isAutoRepeat() ) { | 366 | if ( !e->isAutoRepeat() ) { |
366 | mFlagKeyPressed = false; | 367 | mFlagKeyPressed = false; |
367 | } | 368 | } |
368 | } | 369 | } |
369 | 370 | ||
370 | 371 | ||
371 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 372 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
372 | { | 373 | { |
373 | qApp->processEvents(); | 374 | qApp->processEvents(); |
374 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 375 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
375 | e->ignore(); | 376 | e->ignore(); |
376 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 377 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
377 | return; | 378 | return; |
378 | } | 379 | } |
379 | if (! e->isAutoRepeat() ) | 380 | if (! e->isAutoRepeat() ) |
380 | mFlagKeyPressed = true; | 381 | mFlagKeyPressed = true; |
381 | QListViewItem* cn; | 382 | QListViewItem* cn; |
382 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { | 383 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { |
383 | cn = currentItem(); | 384 | cn = currentItem(); |
384 | if ( cn ) { | 385 | if ( cn ) { |
385 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 386 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
386 | if ( ci ){ | 387 | if ( ci ){ |
387 | if ( e->state() == ShiftButton ) | 388 | if ( e->state() == ShiftButton ) |
388 | ci->setOn( false ); | 389 | ci->setOn( false ); |
389 | else | 390 | else |
390 | ci->setOn( true ); | 391 | ci->setOn( true ); |
391 | cn = cn->itemBelow(); | 392 | cn = cn->itemBelow(); |
392 | if ( cn ) { | 393 | if ( cn ) { |
393 | setCurrentItem ( cn ); | 394 | setCurrentItem ( cn ); |
394 | ensureItemVisible ( cn ); | 395 | ensureItemVisible ( cn ); |
395 | } | 396 | } |
396 | 397 | ||
397 | } | 398 | } |
398 | } | 399 | } |
399 | 400 | ||
400 | return; | 401 | return; |
401 | } | 402 | } |
402 | 403 | ||
403 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 404 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
404 | switch ( e->key() ) { | 405 | switch ( e->key() ) { |
405 | case Qt::Key_Down: | 406 | case Qt::Key_Down: |
406 | case Qt::Key_Up: | 407 | case Qt::Key_Up: |
407 | QListView::keyPressEvent ( e ); | 408 | QListView::keyPressEvent ( e ); |
408 | break; | 409 | break; |
409 | case Qt::Key_Left: | 410 | case Qt::Key_Left: |
410 | case Qt::Key_Right: | 411 | case Qt::Key_Right: |
411 | QListView::keyPressEvent ( e ); | 412 | QListView::keyPressEvent ( e ); |
412 | e->accept(); | 413 | e->accept(); |
413 | return; | 414 | return; |
414 | break; | 415 | break; |
415 | default: | 416 | default: |
416 | e->ignore(); | 417 | e->ignore(); |
417 | break; | 418 | break; |
418 | } | 419 | } |
419 | return; | 420 | return; |
420 | } | 421 | } |
421 | e->ignore(); | 422 | e->ignore(); |
422 | } | 423 | } |
423 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 424 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
424 | { | 425 | { |
425 | QListView::contentsMouseReleaseEvent(e); | 426 | QListView::contentsMouseReleaseEvent(e); |
426 | mMousePressed = false; | 427 | mMousePressed = false; |
427 | } | 428 | } |
428 | 429 | ||
429 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 430 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
430 | { | 431 | { |
431 | if (!e) return; | 432 | if (!e) return; |
432 | 433 | ||
433 | QPoint vp = contentsToViewport(e->pos()); | 434 | QPoint vp = contentsToViewport(e->pos()); |
434 | 435 | ||
435 | QListViewItem *item = itemAt(vp); | 436 | QListViewItem *item = itemAt(vp); |
436 | 437 | ||
437 | emit double_Clicked(item); | 438 | emit double_Clicked(item); |
438 | if (!item) return; | 439 | if (!item) return; |
439 | 440 | ||
440 | emit doubleClicked(item,vp,0); | 441 | emit doubleClicked(item,vp,0); |
441 | } | 442 | } |
442 | 443 | ||
443 | ///////////////////////////////////////////////////////////////////////////// | 444 | ///////////////////////////////////////////////////////////////////////////// |
444 | 445 | ||
445 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 446 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
446 | QLineEdit(parent) | 447 | QLineEdit(parent) |
447 | { | 448 | { |
448 | setText(i18n("Click to add a new Todo")); | 449 | setText(i18n("Click to add a new Todo")); |
449 | } | 450 | } |
450 | 451 | ||
451 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 452 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
452 | { | 453 | { |
453 | if ( text()==i18n("Click to add a new Todo") ) | 454 | if ( text()==i18n("Click to add a new Todo") ) |
454 | setText(""); | 455 | setText(""); |
455 | QLineEdit::focusInEvent(ev); | 456 | QLineEdit::focusInEvent(ev); |
456 | } | 457 | } |
457 | 458 | ||
458 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 459 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
459 | { | 460 | { |
460 | setText(i18n("Click to add a new Todo")); | 461 | setText(i18n("Click to add a new Todo")); |
461 | QLineEdit::focusOutEvent(ev); | 462 | QLineEdit::focusOutEvent(ev); |
462 | } | 463 | } |
463 | 464 | ||
464 | ///////////////////////////////////////////////////////////////////////////// | 465 | ///////////////////////////////////////////////////////////////////////////// |
465 | 466 | ||
466 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 467 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
467 | KOrg::BaseView(calendar,parent,name) | 468 | KOrg::BaseView(calendar,parent,name) |
468 | { | 469 | { |
469 | mPendingUpdateBeforeRepaint = false; | 470 | mPendingUpdateBeforeRepaint = false; |
470 | isFlatDisplay = false; | 471 | isFlatDisplay = false; |
471 | mNavigator = 0; | 472 | mNavigator = 0; |
472 | QBoxLayout *topLayout = new QVBoxLayout(this); | 473 | QBoxLayout *topLayout = new QVBoxLayout(this); |
473 | mName = QString ( name ); | 474 | mName = QString ( name ); |
474 | mBlockUpdate = false; | 475 | mBlockUpdate = false; |
475 | mQuickAdd = new KOQuickTodo(this); | 476 | mQuickAdd = new KOQuickTodo(this); |
476 | topLayout->addWidget(mQuickAdd); | 477 | topLayout->addWidget(mQuickAdd); |
477 | 478 | ||
478 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 479 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
479 | 480 | ||
480 | mTodoListView = new KOTodoListView(calendar,this, name ); | 481 | mTodoListView = new KOTodoListView(calendar,this, name ); |
481 | topLayout->addWidget(mTodoListView); | 482 | topLayout->addWidget(mTodoListView); |
482 | //mTodoListView->header()->setMaximumHeight(30); | 483 | //mTodoListView->header()->setMaximumHeight(30); |
@@ -821,722 +822,705 @@ void KOTodoView::storeCurrentItem() | |||
821 | mCurItemRootParent = mCurItem; | 822 | mCurItemRootParent = mCurItem; |
822 | mCurItemParent = mCurItemRootParent->relatedTo(); | 823 | mCurItemParent = mCurItemRootParent->relatedTo(); |
823 | while ( mCurItemRootParent->relatedTo() != 0 ) | 824 | while ( mCurItemRootParent->relatedTo() != 0 ) |
824 | mCurItemRootParent = mCurItemRootParent->relatedTo(); | 825 | mCurItemRootParent = mCurItemRootParent->relatedTo(); |
825 | } | 826 | } |
826 | mActiveItem = 0; | 827 | mActiveItem = 0; |
827 | } | 828 | } |
828 | 829 | ||
829 | void KOTodoView::resetCurrentItem() | 830 | void KOTodoView::resetCurrentItem() |
830 | { | 831 | { |
831 | mTodoListView->setFocus(); | 832 | mTodoListView->setFocus(); |
832 | KOTodoViewItem* foundItem = 0; | 833 | KOTodoViewItem* foundItem = 0; |
833 | KOTodoViewItem* foundItemRoot = 0; | 834 | KOTodoViewItem* foundItemRoot = 0; |
834 | KOTodoViewItem* foundItemParent = 0; | 835 | KOTodoViewItem* foundItemParent = 0; |
835 | KOTodoViewItem* foundItemAbove = 0; | 836 | KOTodoViewItem* foundItemAbove = 0; |
836 | if ( mTodoListView->firstChild () ) { | 837 | if ( mTodoListView->firstChild () ) { |
837 | if ( mCurItem ) { | 838 | if ( mCurItem ) { |
838 | KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); | 839 | KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); |
839 | while ( item ) { | 840 | while ( item ) { |
840 | if ( item->todo() == mCurItem ) { | 841 | if ( item->todo() == mCurItem ) { |
841 | foundItem = item; | 842 | foundItem = item; |
842 | break; | 843 | break; |
843 | } else if ( item->todo() == mCurItemAbove ) { | 844 | } else if ( item->todo() == mCurItemAbove ) { |
844 | foundItemAbove = item; | 845 | foundItemAbove = item; |
845 | 846 | ||
846 | } | 847 | } |
847 | if ( item->todo() == mCurItemRootParent ) { | 848 | if ( item->todo() == mCurItemRootParent ) { |
848 | foundItemRoot = item; | 849 | foundItemRoot = item; |
849 | } | 850 | } |
850 | if ( item->todo() == mCurItemParent ) { | 851 | if ( item->todo() == mCurItemParent ) { |
851 | foundItemParent = item; | 852 | foundItemParent = item; |
852 | } | 853 | } |
853 | item = (KOTodoViewItem*)item->itemBelow(); | 854 | item = (KOTodoViewItem*)item->itemBelow(); |
854 | } | 855 | } |
855 | if ( ! foundItem ) { | 856 | if ( ! foundItem ) { |
856 | if ( foundItemParent ) { | 857 | if ( foundItemParent ) { |
857 | foundItem = foundItemParent; | 858 | foundItem = foundItemParent; |
858 | } else { | 859 | } else { |
859 | if ( foundItemRoot ) | 860 | if ( foundItemRoot ) |
860 | foundItem = foundItemRoot; | 861 | foundItem = foundItemRoot; |
861 | else | 862 | else |
862 | foundItem = foundItemAbove; | 863 | foundItem = foundItemAbove; |
863 | } | 864 | } |
864 | } | 865 | } |
865 | } | 866 | } |
866 | if ( foundItem ) { | 867 | if ( foundItem ) { |
867 | mTodoListView->setCurrentItem( foundItem ); | 868 | mTodoListView->setCurrentItem( foundItem ); |
868 | mTodoListView->ensureItemVisible( foundItem ); | 869 | mTodoListView->ensureItemVisible( foundItem ); |
869 | } else { | 870 | } else { |
870 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); | 871 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); |
871 | } | 872 | } |
872 | } | 873 | } |
873 | mTodoListView->setFocus(); | 874 | mTodoListView->setFocus(); |
874 | } | 875 | } |
875 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; | 876 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; |
876 | bool KOTodoView::checkTodo( Todo * todo ) | 877 | bool KOTodoView::checkTodo( Todo * todo ) |
877 | { | 878 | { |
878 | 879 | ||
879 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) | 880 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) |
880 | return false; | 881 | return false; |
881 | if ( !todo->isCompleted() ) { | 882 | if ( !todo->isCompleted() ) { |
882 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) | 883 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) |
883 | return true; | 884 | return true; |
884 | } | 885 | } |
885 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { | 886 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { |
886 | if ( todo->hasStartDate() ) | 887 | if ( todo->hasStartDate() ) |
887 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) | 888 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) |
888 | return false; | 889 | return false; |
889 | if ( todo->hasDueDate() ) | 890 | if ( todo->hasDueDate() ) |
890 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) | 891 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) |
891 | return false; | 892 | return false; |
892 | } | 893 | } |
893 | return true; | 894 | return true; |
894 | } | 895 | } |
895 | 896 | ||
896 | void KOTodoView::restoreItemState( QListViewItem *item ) | 897 | void KOTodoView::restoreItemState( QListViewItem *item ) |
897 | { | 898 | { |
898 | pendingSubtodo = 0; | 899 | pendingSubtodo = 0; |
899 | while( item ) { | 900 | while( item ) { |
900 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 901 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
901 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 902 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
902 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 903 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
903 | item = item->nextSibling(); | 904 | item = item->nextSibling(); |
904 | } | 905 | } |
905 | } | 906 | } |
906 | 907 | ||
907 | 908 | ||
908 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 909 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
909 | KOTodoView::insertTodoItem(Todo *todo) | 910 | KOTodoView::insertTodoItem(Todo *todo) |
910 | { | 911 | { |
911 | 912 | ||
912 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 913 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
913 | // TODO: Check, if dynmaic cast is necessary | 914 | // TODO: Check, if dynmaic cast is necessary |
914 | 915 | ||
915 | pendingSubtodo = 0; | 916 | pendingSubtodo = 0; |
916 | Incidence *incidence = todo->relatedTo(); | 917 | Incidence *incidence = todo->relatedTo(); |
917 | while ( incidence && !incidence->calEnabled() ) | 918 | while ( incidence && !incidence->calEnabled() ) |
918 | incidence = incidence->relatedTo(); | 919 | incidence = incidence->relatedTo(); |
919 | if (incidence && incidence->typeID() == todoID ) { | 920 | if (incidence && incidence->typeID() == todoID ) { |
920 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 921 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
921 | 922 | ||
922 | // kdDebug() << " has Related" << endl; | 923 | // kdDebug() << " has Related" << endl; |
923 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 924 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
924 | itemIterator = mTodoMap.find(relatedTodo); | 925 | itemIterator = mTodoMap.find(relatedTodo); |
925 | if (itemIterator == mTodoMap.end()) { | 926 | if (itemIterator == mTodoMap.end()) { |
926 | // kdDebug() << " related not yet in list" << endl; | 927 | // kdDebug() << " related not yet in list" << endl; |
927 | itemIterator = insertTodoItem (relatedTodo); | 928 | itemIterator = insertTodoItem (relatedTodo); |
928 | } | 929 | } |
929 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | 930 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem |
930 | // and one into the map. Sure finding is more easy but why? -zecke | 931 | // and one into the map. Sure finding is more easy but why? -zecke |
931 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | 932 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); |
932 | return mTodoMap.insert(todo,todoItem); | 933 | return mTodoMap.insert(todo,todoItem); |
933 | } else { | 934 | } else { |
934 | // kdDebug() << " no Related" << endl; | 935 | // kdDebug() << " no Related" << endl; |
935 | // see above -zecke | 936 | // see above -zecke |
936 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 937 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
937 | return mTodoMap.insert(todo,todoItem); | 938 | return mTodoMap.insert(todo,todoItem); |
938 | } | 939 | } |
939 | } | 940 | } |
940 | 941 | ||
941 | 942 | ||
942 | void KOTodoView::updateConfig() | 943 | void KOTodoView::updateConfig() |
943 | { | 944 | { |
944 | updateView(); | 945 | updateView(); |
945 | mTodoListView->repaintContents(); | 946 | mTodoListView->repaintContents(); |
946 | } | 947 | } |
947 | 948 | ||
948 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 949 | QPtrList<Incidence> KOTodoView::selectedIncidences() |
949 | { | 950 | { |
950 | QPtrList<Incidence> selected; | 951 | QPtrList<Incidence> selected; |
951 | 952 | ||
952 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 953 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
953 | // if (!item) item = mActiveItem; | 954 | // if (!item) item = mActiveItem; |
954 | if (item) selected.append(item->todo()); | 955 | if (item) selected.append(item->todo()); |
955 | 956 | ||
956 | return selected; | 957 | return selected; |
957 | } | 958 | } |
958 | 959 | ||
959 | QPtrList<Todo> KOTodoView::selectedTodos() | 960 | QPtrList<Todo> KOTodoView::selectedTodos() |
960 | { | 961 | { |
961 | QPtrList<Todo> selected; | 962 | QPtrList<Todo> selected; |
962 | 963 | ||
963 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 964 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
964 | // if (!item) item = mActiveItem; | 965 | // if (!item) item = mActiveItem; |
965 | if (item) selected.append(item->todo()); | 966 | if (item) selected.append(item->todo()); |
966 | 967 | ||
967 | return selected; | 968 | return selected; |
968 | } | 969 | } |
969 | 970 | ||
970 | void KOTodoView::changeEventDisplay(Event *, int) | 971 | void KOTodoView::changeEventDisplay(Event *, int) |
971 | { | 972 | { |
972 | updateView(); | 973 | updateView(); |
973 | } | 974 | } |
974 | 975 | ||
975 | void KOTodoView::showDates(const QDate &, const QDate &) | 976 | void KOTodoView::showDates(const QDate &, const QDate &) |
976 | { | 977 | { |
977 | } | 978 | } |
978 | 979 | ||
979 | void KOTodoView::showEvents(QPtrList<Event>) | 980 | void KOTodoView::showEvents(QPtrList<Event>) |
980 | { | 981 | { |
981 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; | 982 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; |
982 | } | 983 | } |
983 | 984 | ||
984 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 985 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
985 | const QDate &td) | 986 | const QDate &td) |
986 | { | 987 | { |
987 | #ifndef KORG_NOPRINTER | 988 | #ifndef KORG_NOPRINTER |
988 | calPrinter->preview(CalPrinter::Todolist, fd, td); | 989 | calPrinter->preview(CalPrinter::Todolist, fd, td); |
989 | #endif | 990 | #endif |
990 | } | 991 | } |
991 | 992 | ||
992 | void KOTodoView::editItem(QListViewItem *item ) | 993 | void KOTodoView::editItem(QListViewItem *item ) |
993 | { | 994 | { |
994 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); | 995 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); |
995 | } | 996 | } |
996 | 997 | ||
997 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 998 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) |
998 | { | 999 | { |
999 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); | 1000 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); |
1000 | } | 1001 | } |
1001 | 1002 | ||
1002 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) | 1003 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) |
1003 | { | 1004 | { |
1004 | pendingSubtodo = 0; | 1005 | pendingSubtodo = 0; |
1005 | mActiveItem = (KOTodoViewItem *)item; | 1006 | mActiveItem = (KOTodoViewItem *)item; |
1006 | if (item) { | 1007 | if (item) { |
1007 | switch (column){ | 1008 | switch (column){ |
1008 | case 1: | 1009 | case 1: |
1009 | mPriorityPopupMenu->popup(QCursor::pos ()); break; | 1010 | mPriorityPopupMenu->popup(QCursor::pos ()); break; |
1010 | case 2: | 1011 | case 2: |
1011 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; | 1012 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; |
1012 | case 3: | 1013 | case 3: |
1013 | moveTodo(); | 1014 | moveTodo(); |
1014 | break; | 1015 | break; |
1015 | case 8: | 1016 | case 8: |
1016 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; | 1017 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; |
1017 | default: | 1018 | default: |
1018 | mItemPopupMenu->popup(QCursor::pos()); | 1019 | mItemPopupMenu->popup(QCursor::pos()); |
1019 | } | 1020 | } |
1020 | } else mPopupMenu->popup(QCursor::pos()); | 1021 | } else mPopupMenu->popup(QCursor::pos()); |
1021 | } | 1022 | } |
1022 | void KOTodoView::newTodo() | 1023 | void KOTodoView::newTodo() |
1023 | { | 1024 | { |
1024 | emit newTodoSignal(); | 1025 | emit newTodoSignal(); |
1025 | } | 1026 | } |
1026 | 1027 | ||
1027 | void KOTodoView::newSubTodo() | 1028 | void KOTodoView::newSubTodo() |
1028 | { | 1029 | { |
1029 | if (mActiveItem) { | 1030 | if (mActiveItem) { |
1030 | emit newSubTodoSignal(mActiveItem->todo()); | 1031 | emit newSubTodoSignal(mActiveItem->todo()); |
1031 | } | 1032 | } |
1032 | } | 1033 | } |
1033 | void KOTodoView::unparentTodo() | 1034 | void KOTodoView::unparentTodo() |
1034 | { | 1035 | { |
1035 | if (mActiveItem) { | 1036 | if (mActiveItem) { |
1036 | emit unparentTodoSignal(mActiveItem->todo()); | 1037 | emit unparentTodoSignal(mActiveItem->todo()); |
1037 | } | 1038 | } |
1038 | } | 1039 | } |
1039 | 1040 | ||
1040 | void KOTodoView::reparentTodo() | 1041 | void KOTodoView::reparentTodo() |
1041 | { | 1042 | { |
1042 | if (mActiveItem) { | 1043 | if (mActiveItem) { |
1043 | topLevelWidget()->setCaption(i18n("Click on new parent item")); | 1044 | topLevelWidget()->setCaption(i18n("Click on new parent item")); |
1044 | pendingSubtodo = mActiveItem; | 1045 | pendingSubtodo = mActiveItem; |
1045 | } | 1046 | } |
1046 | } | 1047 | } |
1047 | void KOTodoView::editTodo() | 1048 | void KOTodoView::editTodo() |
1048 | { | 1049 | { |
1049 | if (mActiveItem) { | 1050 | if (mActiveItem) { |
1050 | emit editTodoSignal(mActiveItem->todo()); | 1051 | emit editTodoSignal(mActiveItem->todo()); |
1051 | } | 1052 | } |
1052 | } | 1053 | } |
1053 | void KOTodoView::cloneTodo() | 1054 | void KOTodoView::cloneTodo() |
1054 | { | 1055 | { |
1055 | if (mActiveItem) { | 1056 | if (mActiveItem) { |
1056 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 1057 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
1057 | } | 1058 | } |
1058 | } | 1059 | } |
1059 | void KOTodoView::cancelTodo() | 1060 | void KOTodoView::cancelTodo() |
1060 | { | 1061 | { |
1061 | if (mActiveItem) { | 1062 | if (mActiveItem) { |
1062 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 1063 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
1063 | } | 1064 | } |
1064 | } | 1065 | } |
1065 | void KOTodoView::moveTodo() | 1066 | void KOTodoView::moveTodo() |
1066 | { | 1067 | { |
1067 | if (mActiveItem) { | 1068 | if (mActiveItem) { |
1068 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); | 1069 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); |
1069 | } | 1070 | } |
1070 | } | 1071 | } |
1071 | void KOTodoView::beamTodo() | 1072 | void KOTodoView::beamTodo() |
1072 | { | 1073 | { |
1073 | if (mActiveItem) { | 1074 | if (mActiveItem) { |
1074 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); | 1075 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); |
1075 | } | 1076 | } |
1076 | } | 1077 | } |
1077 | 1078 | ||
1078 | 1079 | ||
1079 | void KOTodoView::showTodo() | 1080 | void KOTodoView::showTodo() |
1080 | { | 1081 | { |
1081 | if (mActiveItem) { | 1082 | if (mActiveItem) { |
1082 | emit showTodoSignal(mActiveItem->todo()); | 1083 | emit showTodoSignal(mActiveItem->todo()); |
1083 | } | 1084 | } |
1084 | } | 1085 | } |
1085 | 1086 | ||
1086 | void KOTodoView::deleteTodo() | 1087 | void KOTodoView::deleteTodo() |
1087 | { | 1088 | { |
1088 | if (mActiveItem) { | 1089 | if (mActiveItem) { |
1089 | emit deleteTodoSignal(mActiveItem->todo()); | 1090 | emit deleteTodoSignal(mActiveItem->todo()); |
1090 | } | 1091 | } |
1091 | } | 1092 | } |
1092 | 1093 | ||
1093 | void KOTodoView::setNewPriority(int index) | 1094 | void KOTodoView::setNewPriority(int index) |
1094 | { | 1095 | { |
1095 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1096 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1096 | mActiveItem->todo()->setPriority(mPriority[index]); | 1097 | mActiveItem->todo()->setPriority(mPriority[index]); |
1097 | mActiveItem->construct(); | 1098 | mActiveItem->construct(); |
1098 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); | 1099 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); |
1099 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1100 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1100 | } | 1101 | } |
1101 | } | 1102 | } |
1102 | 1103 | ||
1103 | void KOTodoView::setNewPercentage(int index) | 1104 | void KOTodoView::setNewPercentage(int index) |
1104 | { | 1105 | { |
1105 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1106 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1106 | 1107 | ||
1107 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { | 1108 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { |
1108 | mActiveItem->setOn( true ); | 1109 | mActiveItem->setOn( true ); |
1109 | return; | 1110 | return; |
1110 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { | 1111 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { |
1111 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); | 1112 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); |
1112 | if ( par && par->isOn() ) | 1113 | if ( par && par->isOn() ) |
1113 | par->setOn( false ); | 1114 | par->setOn( false ); |
1114 | } | 1115 | } |
1115 | if (mPercentage[index] == 100) { | 1116 | if (mPercentage[index] == 100) { |
1116 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1117 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
1117 | } else { | 1118 | } else { |
1118 | mActiveItem->todo()->setCompleted(false); | 1119 | mActiveItem->todo()->setCompleted(false); |
1119 | } | 1120 | } |
1120 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 1121 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
1121 | mActiveItem->construct(); | 1122 | mActiveItem->construct(); |
1122 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 1123 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
1123 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1124 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1124 | } | 1125 | } |
1125 | } | 1126 | } |
1126 | 1127 | ||
1127 | 1128 | ||
1128 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | 1129 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) |
1129 | { | 1130 | { |
1130 | QPopupMenu* tempMenu = new QPopupMenu (this); | 1131 | QPopupMenu* tempMenu = new QPopupMenu (this); |
1131 | QStringList checkedCategories = todoItem->todo()->categories (); | 1132 | QStringList checkedCategories = todoItem->todo()->categories (); |
1132 | 1133 | ||
1133 | tempMenu->setCheckable (true); | 1134 | tempMenu->setCheckable (true); |
1134 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 1135 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
1135 | it != KOPrefs::instance()->mCustomCategories.end (); | 1136 | it != KOPrefs::instance()->mCustomCategories.end (); |
1136 | ++it) { | 1137 | ++it) { |
1137 | int index = tempMenu->insertItem (*it); | 1138 | int index = tempMenu->insertItem (*it); |
1138 | mCategory[index] = *it; | 1139 | mCategory[index] = *it; |
1139 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); | 1140 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); |
1140 | } | 1141 | } |
1141 | 1142 | ||
1142 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 1143 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
1143 | return tempMenu; | 1144 | return tempMenu; |
1144 | 1145 | ||
1145 | 1146 | ||
1146 | } | 1147 | } |
1147 | void KOTodoView::changedCategories(int index) | 1148 | void KOTodoView::changedCategories(int index) |
1148 | { | 1149 | { |
1149 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1150 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1150 | QStringList categories = mActiveItem->todo()->categories (); | 1151 | QStringList categories = mActiveItem->todo()->categories (); |
1151 | QString colcat = categories.first(); | 1152 | QString colcat = categories.first(); |
1152 | if (categories.find (mCategory[index]) != categories.end ()) | 1153 | if (categories.find (mCategory[index]) != categories.end ()) |
1153 | categories.remove (mCategory[index]); | 1154 | categories.remove (mCategory[index]); |
1154 | else | 1155 | else |
1155 | categories.insert (categories.end(), mCategory[index]); | 1156 | categories.insert (categories.end(), mCategory[index]); |
1156 | categories.sort (); | 1157 | categories.sort (); |
1157 | if ( !colcat.isEmpty() ) { | 1158 | if ( !colcat.isEmpty() ) { |
1158 | if ( categories.find ( colcat ) != categories.end () ) { | 1159 | if ( categories.find ( colcat ) != categories.end () ) { |
1159 | categories.remove( colcat ); | 1160 | categories.remove( colcat ); |
1160 | categories.prepend( colcat ); | 1161 | categories.prepend( colcat ); |
1161 | } | 1162 | } |
1162 | } | 1163 | } |
1163 | mActiveItem->todo()->setCategories (categories); | 1164 | mActiveItem->todo()->setCategories (categories); |
1164 | mActiveItem->construct(); | 1165 | mActiveItem->construct(); |
1165 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1166 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1166 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); | 1167 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); |
1167 | } | 1168 | } |
1168 | } | 1169 | } |
1169 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 1170 | void KOTodoView::itemDoubleClicked(QListViewItem *item) |
1170 | { | 1171 | { |
1171 | if ( pendingSubtodo != 0 ) { | 1172 | if ( pendingSubtodo != 0 ) { |
1172 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1173 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1173 | } | 1174 | } |
1174 | pendingSubtodo = 0; | 1175 | pendingSubtodo = 0; |
1175 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); | 1176 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); |
1176 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); | 1177 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); |
1177 | //qDebug("ROW %d ", row); | 1178 | //qDebug("ROW %d ", row); |
1178 | if (!item) { | 1179 | if (!item) { |
1179 | newTodo(); | 1180 | newTodo(); |
1180 | return; | 1181 | return; |
1181 | } else { | 1182 | } else { |
1182 | if ( row == 2 || row == 1 ) { | 1183 | if ( row == 2 || row == 1 ) { |
1183 | mActiveItem = (KOTodoViewItem *) item; | 1184 | mActiveItem = (KOTodoViewItem *) item; |
1184 | newSubTodo(); | 1185 | newSubTodo(); |
1185 | return; | 1186 | return; |
1186 | } | 1187 | } |
1187 | if ( row == 5 || row == 6 ) { | 1188 | if ( row == 5 || row == 6 ) { |
1188 | mActiveItem = (KOTodoViewItem *) item; | 1189 | mActiveItem = (KOTodoViewItem *) item; |
1189 | toggleRunningItem(); | 1190 | toggleRunningItem(); |
1190 | return; | 1191 | return; |
1191 | } | 1192 | } |
1192 | } | 1193 | } |
1193 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 1194 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
1194 | editItem( item ); | 1195 | editItem( item ); |
1195 | else | 1196 | else |
1196 | showItem( item , QPoint(), 0 ); | 1197 | showItem( item , QPoint(), 0 ); |
1197 | } | 1198 | } |
1198 | void KOTodoView::toggleRunningItem() | 1199 | void KOTodoView::toggleRunningItem() |
1199 | { | 1200 | { |
1200 | // qDebug("KOTodoView::toggleRunning() "); | 1201 | // qDebug("KOTodoView::toggleRunning() "); |
1201 | if ( ! mActiveItem ) | 1202 | if ( ! mActiveItem ) |
1202 | return; | 1203 | return; |
1203 | Todo * t = mActiveItem->todo(); | 1204 | Todo * t = mActiveItem->todo(); |
1204 | if ( t->isRunning() ) { | 1205 | if ( t->isRunning() ) { |
1205 | |||
1206 | |||
1207 | KOStopTodoPrefs tp ( t, this ); | 1206 | KOStopTodoPrefs tp ( t, this ); |
1208 | tp.exec(); | 1207 | tp.exec(); |
1209 | |||
1210 | |||
1211 | #if 0 | ||
1212 | int result = KMessageBox::warningYesNoCancel(this, | ||
1213 | i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop"),i18n("Stop+note")); | ||
1214 | if (result == KMessageBox::Cancel) return; | ||
1215 | if ( result == KMessageBox::No ) { | ||
1216 | QString comment = QInputDialog::getText(mActiveItem->text(0).left( 25 ),i18n("Comment for todo:") ); | ||
1217 | t->setRunningFalse( comment ); | ||
1218 | } else { | ||
1219 | t->setRunning( false ); | ||
1220 | } | ||
1221 | mActiveItem->construct(); | 1208 | mActiveItem->construct(); |
1222 | |||
1223 | |||
1224 | #endif | ||
1225 | } else { | 1209 | } else { |
1226 | int result = KMessageBox::warningContinueCancel(this, | 1210 | int result = KMessageBox::warningContinueCancel(this, |
1227 | i18n("<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>").arg(mActiveItem->text(0).left( 25 ) ),i18n("Start todo"),i18n("Start todo"),i18n("Cancel"), true); | 1211 | i18n("<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>").arg(mActiveItem->text(0).left( 25 ) ),i18n("Start todo"),i18n("Start todo"),i18n("Cancel"), true); |
1228 | if (result != KMessageBox::Continue) return; | 1212 | if (result != KMessageBox::Continue) return; |
1229 | t->setRunning( true ); | 1213 | t->setRunning( true ); |
1230 | mActiveItem->construct(); | 1214 | mActiveItem->construct(); |
1231 | } | 1215 | } |
1232 | } | 1216 | } |
1233 | 1217 | ||
1234 | void KOTodoView::itemClicked(QListViewItem *item) | 1218 | void KOTodoView::itemClicked(QListViewItem *item) |
1235 | { | 1219 | { |
1236 | //qDebug("KOTodoView::itemClicked %d", item); | 1220 | //qDebug("KOTodoView::itemClicked %d", item); |
1237 | if (!item) { | 1221 | if (!item) { |
1238 | if ( pendingSubtodo != 0 ) { | 1222 | if ( pendingSubtodo != 0 ) { |
1239 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1223 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1240 | } | 1224 | } |
1241 | pendingSubtodo = 0; | 1225 | pendingSubtodo = 0; |
1242 | return; | 1226 | return; |
1243 | } | 1227 | } |
1244 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1228 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1245 | if ( pendingSubtodo != 0 ) { | 1229 | if ( pendingSubtodo != 0 ) { |
1246 | bool allowReparent = true; | 1230 | bool allowReparent = true; |
1247 | QListViewItem *par = item; | 1231 | QListViewItem *par = item; |
1248 | while ( par ) { | 1232 | while ( par ) { |
1249 | if ( par == pendingSubtodo ) { | 1233 | if ( par == pendingSubtodo ) { |
1250 | allowReparent = false; | 1234 | allowReparent = false; |
1251 | break; | 1235 | break; |
1252 | } | 1236 | } |
1253 | par = par->parent(); | 1237 | par = par->parent(); |
1254 | } | 1238 | } |
1255 | if ( !allowReparent ) { | 1239 | if ( !allowReparent ) { |
1256 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); | 1240 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); |
1257 | pendingSubtodo = 0; | 1241 | pendingSubtodo = 0; |
1258 | } else { | 1242 | } else { |
1259 | Todo* newParent = todoItem->todo(); | 1243 | Todo* newParent = todoItem->todo(); |
1260 | Todo* newSub = pendingSubtodo->todo(); | 1244 | Todo* newSub = pendingSubtodo->todo(); |
1261 | pendingSubtodo = 0; | 1245 | pendingSubtodo = 0; |
1262 | emit reparentTodoSignal( newParent,newSub ); | 1246 | emit reparentTodoSignal( newParent,newSub ); |
1263 | return; | 1247 | return; |
1264 | } | 1248 | } |
1265 | } | 1249 | } |
1266 | 1250 | ||
1267 | } | 1251 | } |
1268 | 1252 | ||
1269 | void KOTodoView::setDocumentId( const QString &id ) | 1253 | void KOTodoView::setDocumentId( const QString &id ) |
1270 | { | 1254 | { |
1271 | 1255 | ||
1272 | mDocPrefs->setDoc( id ); | 1256 | mDocPrefs->setDoc( id ); |
1273 | } | 1257 | } |
1274 | 1258 | ||
1275 | void KOTodoView::itemStateChanged( QListViewItem *item ) | 1259 | void KOTodoView::itemStateChanged( QListViewItem *item ) |
1276 | { | 1260 | { |
1277 | if (!item) return; | 1261 | if (!item) return; |
1278 | 1262 | ||
1279 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1263 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1280 | 1264 | ||
1281 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; | 1265 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; |
1282 | 1266 | ||
1283 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); | 1267 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); |
1284 | } | 1268 | } |
1285 | 1269 | ||
1286 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const | 1270 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const |
1287 | { | 1271 | { |
1288 | mTodoListView->saveLayout(config,group); | 1272 | mTodoListView->saveLayout(config,group); |
1289 | } | 1273 | } |
1290 | 1274 | ||
1291 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) | 1275 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) |
1292 | { | 1276 | { |
1293 | mTodoListView->restoreLayout(config,group); | 1277 | mTodoListView->restoreLayout(config,group); |
1294 | } | 1278 | } |
1295 | 1279 | ||
1296 | void KOTodoView::processSelectionChange() | 1280 | void KOTodoView::processSelectionChange() |
1297 | { | 1281 | { |
1298 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; | 1282 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; |
1299 | 1283 | ||
1300 | KOTodoViewItem *item = | 1284 | KOTodoViewItem *item = |
1301 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); | 1285 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); |
1302 | 1286 | ||
1303 | if ( !item ) { | 1287 | if ( !item ) { |
1304 | emit incidenceSelected( 0 ); | 1288 | emit incidenceSelected( 0 ); |
1305 | } else { | 1289 | } else { |
1306 | emit incidenceSelected( item->todo() ); | 1290 | emit incidenceSelected( item->todo() ); |
1307 | } | 1291 | } |
1308 | } | 1292 | } |
1309 | 1293 | ||
1310 | void KOTodoView::modified(bool b) | 1294 | void KOTodoView::modified(bool b) |
1311 | { | 1295 | { |
1312 | emit isModified(b); | 1296 | emit isModified(b); |
1313 | } | 1297 | } |
1314 | void KOTodoView::setTodoModified( Todo* todo ) | 1298 | void KOTodoView::setTodoModified( Todo* todo ) |
1315 | { | 1299 | { |
1316 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); | 1300 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); |
1317 | } | 1301 | } |
1318 | void KOTodoView::clearSelection() | 1302 | void KOTodoView::clearSelection() |
1319 | { | 1303 | { |
1320 | mTodoListView->selectAll( false ); | 1304 | mTodoListView->selectAll( false ); |
1321 | } | 1305 | } |
1322 | void KOTodoView::setAllOpen() | 1306 | void KOTodoView::setAllOpen() |
1323 | { | 1307 | { |
1324 | if ( isFlatDisplay ) { | 1308 | if ( isFlatDisplay ) { |
1325 | isFlatDisplay = false; | 1309 | isFlatDisplay = false; |
1326 | mPopupMenu->setItemChecked( 8,false ); | 1310 | mPopupMenu->setItemChecked( 8,false ); |
1327 | updateView(); | 1311 | updateView(); |
1328 | } else { | 1312 | } else { |
1329 | storeCurrentItem(); | 1313 | storeCurrentItem(); |
1330 | } | 1314 | } |
1331 | setOpen(mTodoListView->firstChild(), true); | 1315 | setOpen(mTodoListView->firstChild(), true); |
1332 | resetCurrentItem(); | 1316 | resetCurrentItem(); |
1333 | } | 1317 | } |
1334 | void KOTodoView::setAllClose() | 1318 | void KOTodoView::setAllClose() |
1335 | { | 1319 | { |
1336 | if ( isFlatDisplay ) { | 1320 | if ( isFlatDisplay ) { |
1337 | isFlatDisplay = false; | 1321 | isFlatDisplay = false; |
1338 | mPopupMenu->setItemChecked( 8,false ); | 1322 | mPopupMenu->setItemChecked( 8,false ); |
1339 | updateView(); | 1323 | updateView(); |
1340 | } else { | 1324 | } else { |
1341 | storeCurrentItem(); | 1325 | storeCurrentItem(); |
1342 | } | 1326 | } |
1343 | setOpen(mTodoListView->firstChild(), false); | 1327 | setOpen(mTodoListView->firstChild(), false); |
1344 | resetCurrentItem(); | 1328 | resetCurrentItem(); |
1345 | } | 1329 | } |
1346 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) | 1330 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) |
1347 | { | 1331 | { |
1348 | 1332 | ||
1349 | while ( item ) { | 1333 | while ( item ) { |
1350 | setOpen( item->firstChild(), setOpenI ); | 1334 | setOpen( item->firstChild(), setOpenI ); |
1351 | item->setOpen( setOpenI ); | 1335 | item->setOpen( setOpenI ); |
1352 | item = item->nextSibling(); | 1336 | item = item->nextSibling(); |
1353 | } | 1337 | } |
1354 | } | 1338 | } |
1355 | 1339 | ||
1356 | void KOTodoView::displayAllFlat() | 1340 | void KOTodoView::displayAllFlat() |
1357 | { | 1341 | { |
1358 | pendingSubtodo = 0; | 1342 | pendingSubtodo = 0; |
1359 | if ( mBlockUpdate ) { | 1343 | if ( mBlockUpdate ) { |
1360 | return; | 1344 | return; |
1361 | } | 1345 | } |
1362 | mPopupMenu->setItemChecked( 8,true ); | 1346 | mPopupMenu->setItemChecked( 8,true ); |
1363 | isFlatDisplay = true; | 1347 | isFlatDisplay = true; |
1364 | QPtrList<Todo> todoList = calendar()->todos(); | 1348 | QPtrList<Todo> todoList = calendar()->todos(); |
1365 | mTodoMap.clear(); | 1349 | mTodoMap.clear(); |
1366 | mTodoListView->clear(); | 1350 | mTodoListView->clear(); |
1367 | Todo *todo; | 1351 | Todo *todo; |
1368 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 1352 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
1369 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1353 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1370 | mTodoMap.insert(todo,todoItem); | 1354 | mTodoMap.insert(todo,todoItem); |
1371 | } | 1355 | } |
1372 | mTodoListView->setFocus(); | 1356 | mTodoListView->setFocus(); |
1373 | processSelectionChange(); | 1357 | processSelectionChange(); |
1374 | } | 1358 | } |
1375 | 1359 | ||
1376 | void KOTodoView::setAllFlat() | 1360 | void KOTodoView::setAllFlat() |
1377 | { | 1361 | { |
1378 | if ( isFlatDisplay ) { | 1362 | if ( isFlatDisplay ) { |
1379 | isFlatDisplay = false; | 1363 | isFlatDisplay = false; |
1380 | mPopupMenu->setItemChecked( 8,false ); | 1364 | mPopupMenu->setItemChecked( 8,false ); |
1381 | updateView(); | 1365 | updateView(); |
1382 | return; | 1366 | return; |
1383 | } | 1367 | } |
1384 | storeCurrentItem(); | 1368 | storeCurrentItem(); |
1385 | displayAllFlat(); | 1369 | displayAllFlat(); |
1386 | resetCurrentItem(); | 1370 | resetCurrentItem(); |
1387 | } | 1371 | } |
1388 | 1372 | ||
1389 | void KOTodoView::purgeCompleted() | 1373 | void KOTodoView::purgeCompleted() |
1390 | { | 1374 | { |
1391 | emit purgeCompletedSignal(); | 1375 | emit purgeCompletedSignal(); |
1392 | 1376 | ||
1393 | } | 1377 | } |
1394 | void KOTodoView::toggleQuickTodo() | 1378 | void KOTodoView::toggleQuickTodo() |
1395 | { | 1379 | { |
1396 | if ( mQuickAdd->isVisible() ) { | 1380 | if ( mQuickAdd->isVisible() ) { |
1397 | mQuickAdd->hide(); | 1381 | mQuickAdd->hide(); |
1398 | KOPrefs::instance()->mEnableQuickTodo = false; | 1382 | KOPrefs::instance()->mEnableQuickTodo = false; |
1399 | } | 1383 | } |
1400 | else { | 1384 | else { |
1401 | mQuickAdd->show(); | 1385 | mQuickAdd->show(); |
1402 | KOPrefs::instance()->mEnableQuickTodo = true; | 1386 | KOPrefs::instance()->mEnableQuickTodo = true; |
1403 | } | 1387 | } |
1404 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 1388 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
1405 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 1389 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
1406 | } | 1390 | } |
1407 | 1391 | ||
1408 | void KOTodoView::toggleRunning() | 1392 | void KOTodoView::toggleRunning() |
1409 | { | 1393 | { |
1410 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; | 1394 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; |
1411 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 1395 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
1412 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 1396 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
1413 | updateView(); | 1397 | updateView(); |
1414 | } | 1398 | } |
1415 | 1399 | ||
1416 | void KOTodoView::toggleCompleted() | 1400 | void KOTodoView::toggleCompleted() |
1417 | { | 1401 | { |
1418 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; | 1402 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; |
1419 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 1403 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
1420 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 1404 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
1421 | updateView(); | 1405 | updateView(); |
1422 | } | 1406 | } |
1423 | 1407 | ||
1424 | void KOTodoView::addQuickTodo() | 1408 | void KOTodoView::addQuickTodo() |
1425 | { | 1409 | { |
1426 | Todo *todo = new Todo(); | 1410 | Todo *todo = new Todo(); |
1427 | todo->setSummary(mQuickAdd->text()); | 1411 | todo->setSummary(mQuickAdd->text()); |
1428 | todo->setOrganizer(KOPrefs::instance()->email()); | 1412 | todo->setOrganizer(KOPrefs::instance()->email()); |
1429 | CalFilter * cf = mCalendar->filter(); | 1413 | CalFilter * cf = mCalendar->filter(); |
1430 | if ( cf ) { | 1414 | if ( cf ) { |
1431 | if ( cf->isEnabled()&& cf->showCategories()) { | 1415 | if ( cf->isEnabled()&& cf->showCategories()) { |
1432 | todo->setCategories(cf->categoryList()); | 1416 | todo->setCategories(cf->categoryList()); |
1433 | } | 1417 | } |
1434 | if ( cf->isEnabled() ) | 1418 | if ( cf->isEnabled() ) |
1435 | todo->setSecrecy( cf->getSecrecy()); | 1419 | todo->setSecrecy( cf->getSecrecy()); |
1436 | } | 1420 | } |
1437 | mCalendar->addTodo(todo); | 1421 | mCalendar->addTodo(todo); |
1438 | mQuickAdd->setText(""); | 1422 | mQuickAdd->setText(""); |
1439 | todoModified (todo, KOGlobals::EVENTADDED ); | 1423 | todoModified (todo, KOGlobals::EVENTADDED ); |
1440 | updateView(); | 1424 | updateView(); |
1441 | } | 1425 | } |
1442 | 1426 | ||
1443 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) | 1427 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) |
1444 | { | 1428 | { |
1445 | // e->ignore(); | 1429 | // e->ignore(); |
1446 | //return; | 1430 | //return; |
1447 | //qDebug("KOTodoView::keyPressEvent "); | 1431 | //qDebug("KOTodoView::keyPressEvent "); |
1448 | switch ( e->key() ) { | 1432 | switch ( e->key() ) { |
1449 | case Qt::Key_Down: | 1433 | case Qt::Key_Down: |
1450 | case Qt::Key_Up: | 1434 | case Qt::Key_Up: |
1451 | QWidget::keyPressEvent ( e ); | 1435 | QWidget::keyPressEvent ( e ); |
1452 | break; | 1436 | break; |
1453 | 1437 | ||
1454 | case Qt::Key_Q: | 1438 | case Qt::Key_Q: |
1455 | toggleQuickTodo(); | 1439 | toggleQuickTodo(); |
1456 | break; | 1440 | break; |
1457 | case Qt::Key_U: | 1441 | case Qt::Key_U: |
1458 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1442 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1459 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1443 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1460 | unparentTodo(); | 1444 | unparentTodo(); |
1461 | e->accept(); | 1445 | e->accept(); |
1462 | } else | 1446 | } else |
1463 | e->ignore(); | 1447 | e->ignore(); |
1464 | break; | 1448 | break; |
1465 | case Qt::Key_S: | 1449 | case Qt::Key_S: |
1466 | if ( e->state() == Qt::ControlButton ) { | 1450 | if ( e->state() == Qt::ControlButton ) { |
1467 | e->ignore(); | 1451 | e->ignore(); |
1468 | break; | 1452 | break; |
1469 | } | 1453 | } |
1470 | if ( e->state() == Qt::ShiftButton ) { | 1454 | if ( e->state() == Qt::ShiftButton ) { |
1471 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1455 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1472 | reparentTodo(); | 1456 | reparentTodo(); |
1473 | e->accept(); | 1457 | e->accept(); |
1474 | } else | 1458 | } else |
1475 | e->ignore(); | 1459 | e->ignore(); |
1476 | break; | 1460 | break; |
1477 | case Qt::Key_P: | 1461 | case Qt::Key_P: |
1478 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1462 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1479 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1463 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1480 | if ( pendingSubtodo ) | 1464 | if ( pendingSubtodo ) |
1481 | itemClicked(mActiveItem); | 1465 | itemClicked(mActiveItem); |
1482 | e->accept(); | 1466 | e->accept(); |
1483 | } else | 1467 | } else |
1484 | e->ignore(); | 1468 | e->ignore(); |
1485 | break; | 1469 | break; |
1486 | case Qt::Key_Escape: | 1470 | case Qt::Key_Escape: |
1487 | if ( pendingSubtodo ) { | 1471 | if ( pendingSubtodo ) { |
1488 | itemClicked(0); | 1472 | itemClicked(0); |
1489 | e->accept(); | 1473 | e->accept(); |
1490 | } else | 1474 | } else |
1491 | e->ignore(); | 1475 | e->ignore(); |
1492 | break; | 1476 | break; |
1493 | default: | 1477 | default: |
1494 | e->ignore(); | 1478 | e->ignore(); |
1495 | } | 1479 | } |
1496 | 1480 | ||
1497 | if ( true ) { | 1481 | if ( true ) { |
1498 | if ( e->key() == Qt::Key_I ) { | 1482 | if ( e->key() == Qt::Key_I ) { |
1499 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); | 1483 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); |
1500 | if ( cn ) { | 1484 | if ( cn ) { |
1501 | mActiveItem = cn; | 1485 | mActiveItem = cn; |
1502 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 1486 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
1503 | if ( ci ){ | 1487 | if ( ci ){ |
1504 | showTodo(); | 1488 | showTodo(); |
1505 | cn = (KOTodoViewItem*)cn->itemBelow(); | 1489 | cn = (KOTodoViewItem*)cn->itemBelow(); |
1506 | if ( cn ) { | 1490 | if ( cn ) { |
1507 | mTodoListView->setCurrentItem ( cn ); | 1491 | mTodoListView->setCurrentItem ( cn ); |
1508 | mTodoListView->ensureItemVisible ( cn ); | 1492 | mTodoListView->ensureItemVisible ( cn ); |
1509 | } | 1493 | } |
1510 | 1494 | ||
1511 | } | 1495 | } |
1512 | } | 1496 | } |
1513 | e->accept(); | 1497 | e->accept(); |
1514 | 1498 | ||
1515 | } | 1499 | } |
1516 | 1500 | ||
1517 | } | 1501 | } |
1518 | 1502 | ||
1519 | } | 1503 | } |
1520 | void KOTodoView::updateTodo( Todo * t, int type ) | 1504 | void KOTodoView::updateTodo( Todo * t, int type ) |
1521 | { | 1505 | { |
1522 | if ( mBlockUpdate) | 1506 | if ( mBlockUpdate) |
1523 | return; | 1507 | return; |
1524 | 1508 | ||
1525 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 1509 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
1526 | itemIterator = mTodoMap.find(t); | 1510 | itemIterator = mTodoMap.find(t); |
1527 | if (itemIterator != mTodoMap.end()) { | 1511 | if (itemIterator != mTodoMap.end()) { |
1528 | (*itemIterator)->construct(); | 1512 | (*itemIterator)->construct(); |
1529 | } else { | 1513 | } else { |
1530 | if ( type == KOGlobals::EVENTADDED ) { | 1514 | if ( type == KOGlobals::EVENTADDED ) { |
1531 | insertTodoItem( t ); | 1515 | insertTodoItem( t ); |
1532 | } | 1516 | } |
1533 | } | 1517 | } |
1534 | 1518 | ||
1535 | } | 1519 | } |
1536 | 1520 | ||
1537 | void KOTodoView::todoModified(Todo * t , int p ) | 1521 | void KOTodoView::todoModified(Todo * t , int p ) |
1538 | { | 1522 | { |
1539 | mBlockUpdate = true; | 1523 | mBlockUpdate = true; |
1540 | emit todoModifiedSignal ( t, p ); | 1524 | emit todoModifiedSignal ( t, p ); |
1541 | mBlockUpdate = false; | 1525 | mBlockUpdate = false; |
1542 | } | 1526 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 13e186d..f945383 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -397,796 +397,797 @@ void MainWindow::disableBR(bool b) | |||
397 | #ifndef DESKTOP_VERSION | 397 | #ifndef DESKTOP_VERSION |
398 | if ( b ) { | 398 | if ( b ) { |
399 | if ( infrared ) { | 399 | if ( infrared ) { |
400 | toggleBeamReceive(); | 400 | toggleBeamReceive(); |
401 | mBRdisabled = true; | 401 | mBRdisabled = true; |
402 | } | 402 | } |
403 | mBRdisabled = true; | 403 | mBRdisabled = true; |
404 | } else { | 404 | } else { |
405 | if ( mBRdisabled ) { | 405 | if ( mBRdisabled ) { |
406 | mBRdisabled = false; | 406 | mBRdisabled = false; |
407 | //makes no sense,because other cal ap is probably running | 407 | //makes no sense,because other cal ap is probably running |
408 | // toggleBeamReceive(); | 408 | // toggleBeamReceive(); |
409 | } | 409 | } |
410 | } | 410 | } |
411 | #endif | 411 | #endif |
412 | 412 | ||
413 | } | 413 | } |
414 | bool MainWindow::beamReceiveEnabled() | 414 | bool MainWindow::beamReceiveEnabled() |
415 | { | 415 | { |
416 | #ifndef DESKTOP_VERSION | 416 | #ifndef DESKTOP_VERSION |
417 | return ( infrared != 0 ); | 417 | return ( infrared != 0 ); |
418 | #endif | 418 | #endif |
419 | return false; | 419 | return false; |
420 | } | 420 | } |
421 | 421 | ||
422 | void MainWindow::toggleBeamReceive() | 422 | void MainWindow::toggleBeamReceive() |
423 | { | 423 | { |
424 | if ( mBRdisabled ) | 424 | if ( mBRdisabled ) |
425 | return; | 425 | return; |
426 | #ifndef DESKTOP_VERSION | 426 | #ifndef DESKTOP_VERSION |
427 | if ( infrared ) { | 427 | if ( infrared ) { |
428 | qDebug("KO: Disable BeamReceive "); | 428 | qDebug("KO: Disable BeamReceive "); |
429 | delete infrared; | 429 | delete infrared; |
430 | infrared = 0; | 430 | infrared = 0; |
431 | brAction->setOn(false); | 431 | brAction->setOn(false); |
432 | return; | 432 | return; |
433 | } | 433 | } |
434 | qDebug("KO: Enable BeamReceive "); | 434 | qDebug("KO: Enable BeamReceive "); |
435 | brAction->setOn(true); | 435 | brAction->setOn(true); |
436 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 436 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
437 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 437 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
438 | #endif | 438 | #endif |
439 | } | 439 | } |
440 | void MainWindow::showMaximized () | 440 | void MainWindow::showMaximized () |
441 | { | 441 | { |
442 | #ifndef DESKTOP_VERSION | 442 | #ifndef DESKTOP_VERSION |
443 | if ( ! globalFlagBlockStartup ) | 443 | if ( ! globalFlagBlockStartup ) |
444 | if ( mClosed ) | 444 | if ( mClosed ) |
445 | mView->goToday(); | 445 | mView->goToday(); |
446 | #endif | 446 | #endif |
447 | QWidget::showMaximized () ; | 447 | QWidget::showMaximized () ; |
448 | mClosed = false; | 448 | mClosed = false; |
449 | } | 449 | } |
450 | void MainWindow::closeEvent( QCloseEvent* ce ) | 450 | void MainWindow::closeEvent( QCloseEvent* ce ) |
451 | { | 451 | { |
452 | 452 | ||
453 | 453 | ||
454 | 454 | ||
455 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 455 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
456 | saveOnClose(); | 456 | saveOnClose(); |
457 | mClosed = true; | 457 | mClosed = true; |
458 | ce->accept(); | 458 | ce->accept(); |
459 | return; | 459 | return; |
460 | 460 | ||
461 | } | 461 | } |
462 | 462 | ||
463 | switch( QMessageBox::information( this, "KO/Pi", | 463 | switch( QMessageBox::information( this, "KO/Pi", |
464 | i18n("Do you really want\nto close KO/Pi?"), | 464 | i18n("Do you really want\nto close KO/Pi?"), |
465 | i18n("Close"), i18n("No"), | 465 | i18n("Close"), i18n("No"), |
466 | 0, 0 ) ) { | 466 | 0, 0 ) ) { |
467 | case 0: | 467 | case 0: |
468 | saveOnClose(); | 468 | saveOnClose(); |
469 | mClosed = true; | 469 | mClosed = true; |
470 | ce->accept(); | 470 | ce->accept(); |
471 | break; | 471 | break; |
472 | case 1: | 472 | case 1: |
473 | ce->ignore(); | 473 | ce->ignore(); |
474 | break; | 474 | break; |
475 | case 2: | 475 | case 2: |
476 | 476 | ||
477 | default: | 477 | default: |
478 | break; | 478 | break; |
479 | } | 479 | } |
480 | 480 | ||
481 | 481 | ||
482 | } | 482 | } |
483 | 483 | ||
484 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 484 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
485 | { | 485 | { |
486 | QDataStream stream( data, IO_ReadOnly ); | 486 | QDataStream stream( data, IO_ReadOnly ); |
487 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 487 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
488 | //QString datamess; | 488 | //QString datamess; |
489 | //qDebug("message "); | 489 | //qDebug("message "); |
490 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 490 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
491 | 491 | ||
492 | if ( cmsg == "setDocument(QString)" ) { | 492 | if ( cmsg == "setDocument(QString)" ) { |
493 | QDataStream stream( data, IO_ReadOnly ); | 493 | QDataStream stream( data, IO_ReadOnly ); |
494 | QString fileName; | 494 | QString fileName; |
495 | stream >> fileName; | 495 | stream >> fileName; |
496 | //qDebug("filename %s ", fileName.latin1()); | 496 | //qDebug("filename %s ", fileName.latin1()); |
497 | showMaximized(); | 497 | showMaximized(); |
498 | raise(); | 498 | raise(); |
499 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 499 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
500 | mSyncManager->slotSyncMenu( 1002 ); | 500 | mSyncManager->slotSyncMenu( 1002 ); |
501 | return; | 501 | return; |
502 | } | 502 | } |
503 | 503 | ||
504 | if ( cmsg == "-writeFile" ) { | 504 | if ( cmsg == "-writeFile" ) { |
505 | // I made from the "-writeFile" an "-writeAlarm" | 505 | // I made from the "-writeFile" an "-writeAlarm" |
506 | mView->viewManager()->showWhatsNextView(); | 506 | mView->viewManager()->showWhatsNextView(); |
507 | mCalendar->checkAlarmForIncidence( 0, true); | 507 | mCalendar->checkAlarmForIncidence( 0, true); |
508 | showMaximized(); | 508 | showMaximized(); |
509 | raise(); | 509 | raise(); |
510 | return; | 510 | return; |
511 | 511 | ||
512 | } | 512 | } |
513 | if ( cmsg == "-writeFileSilent" ) { | 513 | if ( cmsg == "-writeFileSilent" ) { |
514 | // I made from the "-writeFile" an "-writeAlarm" | 514 | // I made from the "-writeFile" an "-writeAlarm" |
515 | // mView->viewManager()->showWhatsNextView(); | 515 | // mView->viewManager()->showWhatsNextView(); |
516 | mCalendar->checkAlarmForIncidence( 0, true); | 516 | mCalendar->checkAlarmForIncidence( 0, true); |
517 | //showMaximized(); | 517 | //showMaximized(); |
518 | //raise(); | 518 | //raise(); |
519 | hide(); | 519 | hide(); |
520 | return; | 520 | return; |
521 | } | 521 | } |
522 | if ( cmsg == "-newCountdown" ) { | 522 | if ( cmsg == "-newCountdown" ) { |
523 | qDebug("newCountdown "); | 523 | qDebug("newCountdown "); |
524 | 524 | ||
525 | } | 525 | } |
526 | QString msg ; | 526 | QString msg ; |
527 | QString allmsg = cmsg; | 527 | QString allmsg = cmsg; |
528 | while ( allmsg.length() > 0 ) { | 528 | while ( allmsg.length() > 0 ) { |
529 | int nextC = allmsg.find( "-", 1 ); | 529 | int nextC = allmsg.find( "-", 1 ); |
530 | if ( nextC == -1 ) { | 530 | if ( nextC == -1 ) { |
531 | msg = allmsg; | 531 | msg = allmsg; |
532 | allmsg = ""; | 532 | allmsg = ""; |
533 | } else{ | 533 | } else{ |
534 | msg = allmsg.left( nextC ); | 534 | msg = allmsg.left( nextC ); |
535 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 535 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
536 | } | 536 | } |
537 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 537 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
538 | if ( msg == "-newEvent" ) { | 538 | if ( msg == "-newEvent" ) { |
539 | mView->newEvent(); | 539 | mView->newEvent(); |
540 | } | 540 | } |
541 | if ( msg == "-newTodo" ) { | 541 | if ( msg == "-newTodo" ) { |
542 | mView->newTodo(); | 542 | mView->newTodo(); |
543 | 543 | ||
544 | } | 544 | } |
545 | if ( msg == "-showWN" ) { | 545 | if ( msg == "-showWN" ) { |
546 | mView->viewManager()->showWhatsNextView(); | 546 | mView->viewManager()->showWhatsNextView(); |
547 | } | 547 | } |
548 | if ( msg == "-showTodo" ) { | 548 | if ( msg == "-showTodo" ) { |
549 | mView->viewManager()->showTodoView(); | 549 | mView->viewManager()->showTodoView(); |
550 | } | 550 | } |
551 | if ( msg == "-showList" ) { | 551 | if ( msg == "-showList" ) { |
552 | mView->viewManager()->showListView(); | 552 | mView->viewManager()->showListView(); |
553 | } | 553 | } |
554 | else if ( msg == "-showDay" ) { | 554 | else if ( msg == "-showDay" ) { |
555 | mView->viewManager()->showDayView(); | 555 | mView->viewManager()->showDayView(); |
556 | } | 556 | } |
557 | else if ( msg == "-showWWeek" ) { | 557 | else if ( msg == "-showWWeek" ) { |
558 | mView->viewManager()->showWorkWeekView(); | 558 | mView->viewManager()->showWorkWeekView(); |
559 | } | 559 | } |
560 | else if ( msg == "-ringSync" ) { | 560 | else if ( msg == "-ringSync" ) { |
561 | mSyncManager->multiSync( false ); | 561 | mSyncManager->multiSync( false ); |
562 | } | 562 | } |
563 | else if ( msg == "-showWeek" ) { | 563 | else if ( msg == "-showWeek" ) { |
564 | mView->viewManager()->showWeekView(); | 564 | mView->viewManager()->showWeekView(); |
565 | } | 565 | } |
566 | else if ( msg == "-showTodo" ) { | 566 | else if ( msg == "-showTodo" ) { |
567 | mView->viewManager()->showTodoView(); | 567 | mView->viewManager()->showTodoView(); |
568 | } | 568 | } |
569 | else if ( msg == "-showJournal" ) { | 569 | else if ( msg == "-showJournal" ) { |
570 | mView->dateNavigator()->selectDates( 1 ); | 570 | mView->dateNavigator()->selectDates( 1 ); |
571 | mView->dateNavigator()->selectToday(); | 571 | mView->dateNavigator()->selectToday(); |
572 | mView->viewManager()->showJournalView(); | 572 | mView->viewManager()->showJournalView(); |
573 | } | 573 | } |
574 | else if ( msg == "-showKO" ) { | 574 | else if ( msg == "-showKO" ) { |
575 | mView->viewManager()->showNextXView(); | 575 | mView->viewManager()->showNextXView(); |
576 | } | 576 | } |
577 | else if ( msg == "-showWNext" ) { | 577 | else if ( msg == "-showWNext" ) { |
578 | mView->viewManager()->showWhatsNextView(); | 578 | mView->viewManager()->showWhatsNextView(); |
579 | } | 579 | } |
580 | else if ( msg == "nextView()" ) { | 580 | else if ( msg == "nextView()" ) { |
581 | mView->viewManager()->showNextView(); | 581 | mView->viewManager()->showNextView(); |
582 | } | 582 | } |
583 | else if ( msg == "-showNextXView" ) { | 583 | else if ( msg == "-showNextXView" ) { |
584 | mView->viewManager()->showNextXView(); | 584 | mView->viewManager()->showNextXView(); |
585 | } | 585 | } |
586 | 586 | ||
587 | 587 | ||
588 | } | 588 | } |
589 | 589 | ||
590 | showMaximized(); | 590 | showMaximized(); |
591 | raise(); | 591 | raise(); |
592 | } | 592 | } |
593 | 593 | ||
594 | QPixmap MainWindow::loadPixmap( QString name ) | 594 | QPixmap MainWindow::loadPixmap( QString name ) |
595 | { | 595 | { |
596 | return SmallIcon( name ); | 596 | return SmallIcon( name ); |
597 | 597 | ||
598 | } | 598 | } |
599 | void MainWindow::setUsesBigPixmaps ( bool b ) | 599 | void MainWindow::setUsesBigPixmaps ( bool b ) |
600 | { | 600 | { |
601 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); | 601 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); |
602 | if ( b ) | 602 | if ( b ) |
603 | qDebug("KO: BigPixmaps are not supported "); | 603 | qDebug("KO: BigPixmaps are not supported "); |
604 | } | 604 | } |
605 | void MainWindow::initActions() | 605 | void MainWindow::initActions() |
606 | { | 606 | { |
607 | //KOPrefs::instance()->mShowFullMenu | 607 | //KOPrefs::instance()->mShowFullMenu |
608 | iconToolBar->clear(); | 608 | iconToolBar->clear(); |
609 | KOPrefs *p = KOPrefs::instance(); | 609 | KOPrefs *p = KOPrefs::instance(); |
610 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 610 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
611 | 611 | ||
612 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 612 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
613 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 613 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
614 | QPopupMenu *importMenu = new QPopupMenu( this ); | 614 | QPopupMenu *importMenu = new QPopupMenu( this ); |
615 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 615 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
616 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 616 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
617 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 617 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
618 | selectFilterMenu = new QPopupMenu( this ); | 618 | selectFilterMenu = new QPopupMenu( this ); |
619 | selectFilterMenu->setCheckable( true ); | 619 | selectFilterMenu->setCheckable( true ); |
620 | syncMenu = new QPopupMenu( this ); | 620 | syncMenu = new QPopupMenu( this ); |
621 | configureAgendaMenu = new QPopupMenu( this ); | 621 | configureAgendaMenu = new QPopupMenu( this ); |
622 | configureToolBarMenu = new QPopupMenu( this ); | 622 | configureToolBarMenu = new QPopupMenu( this ); |
623 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 623 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
624 | QIconSet icon; | 624 | QIconSet icon; |
625 | int pixWid = 22, pixHei = 22; | 625 | int pixWid = 22, pixHei = 22; |
626 | QString pathString = ""; | 626 | QString pathString = ""; |
627 | if ( !p->mToolBarMiniIcons ) { | 627 | if ( !p->mToolBarMiniIcons ) { |
628 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { | 628 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { |
629 | pathString += "icons16/"; | 629 | pathString += "icons16/"; |
630 | pixWid = 18; pixHei = 16; | 630 | pixWid = 18; pixHei = 16; |
631 | } | 631 | } |
632 | } else { | 632 | } else { |
633 | pathString += "iconsmini/"; | 633 | pathString += "iconsmini/"; |
634 | pixWid = 18; pixHei = 16; | 634 | pixWid = 18; pixHei = 16; |
635 | } | 635 | } |
636 | if ( KOPrefs::instance()->mShowFullMenu ) { | 636 | if ( KOPrefs::instance()->mShowFullMenu ) { |
637 | QMenuBar *menuBar1; | 637 | QMenuBar *menuBar1; |
638 | menuBar1 = menuBar(); | 638 | menuBar1 = menuBar(); |
639 | menuBar1->insertItem( i18n("File"), importMenu ); | 639 | menuBar1->insertItem( i18n("File"), importMenu ); |
640 | menuBar1->insertItem( i18n("View"), viewMenu ); | 640 | menuBar1->insertItem( i18n("View"), viewMenu ); |
641 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 641 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
642 | #ifdef DESKTOP_VERSION | 642 | #ifdef DESKTOP_VERSION |
643 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 643 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
644 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 644 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
645 | #else | 645 | #else |
646 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 646 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
647 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 647 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
648 | #endif | 648 | #endif |
649 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 649 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
650 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 650 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
651 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 651 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
652 | } else { | 652 | } else { |
653 | QPEMenuBar *menuBar1; | 653 | QPEMenuBar *menuBar1; |
654 | menuBar1 = new QPEMenuBar( iconToolBar ); | 654 | menuBar1 = new QPEMenuBar( iconToolBar ); |
655 | QPopupMenu *menuBar = new QPopupMenu( this ); | 655 | QPopupMenu *menuBar = new QPopupMenu( this ); |
656 | icon = loadPixmap( pathString + "z_menu" ); | 656 | icon = loadPixmap( pathString + "z_menu" ); |
657 | menuBar1->insertItem( icon.pixmap(), menuBar); | 657 | menuBar1->insertItem( icon.pixmap(), menuBar); |
658 | //menuBar1->insertItem( i18n("ME"), menuBar); | 658 | //menuBar1->insertItem( i18n("ME"), menuBar); |
659 | menuBar->insertItem( i18n("File"), importMenu ); | 659 | menuBar->insertItem( i18n("File"), importMenu ); |
660 | menuBar->insertItem( i18n("View"), viewMenu ); | 660 | menuBar->insertItem( i18n("View"), viewMenu ); |
661 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 661 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
662 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 662 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
663 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 663 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
664 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 664 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
665 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 665 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
666 | menuBar->insertItem( i18n("Help"), helpMenu ); | 666 | menuBar->insertItem( i18n("Help"), helpMenu ); |
667 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 667 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
668 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 668 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
669 | } | 669 | } |
670 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 670 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
671 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 671 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
672 | 672 | ||
673 | 673 | ||
674 | mWeekBgColor = iconToolBar->backgroundColor(); | 674 | mWeekBgColor = iconToolBar->backgroundColor(); |
675 | mWeekPixmap.resize( pixWid , pixHei ); | 675 | mWeekPixmap.resize( pixWid , pixHei ); |
676 | mWeekPixmap.fill( mWeekBgColor ); | 676 | mWeekPixmap.fill( mWeekBgColor ); |
677 | icon = mWeekPixmap; | 677 | icon = mWeekPixmap; |
678 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 678 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
679 | if ( p-> mShowIconWeekNum ) | 679 | if ( p-> mShowIconWeekNum ) |
680 | mWeekAction->addTo( iconToolBar ); | 680 | mWeekAction->addTo( iconToolBar ); |
681 | mWeekFont = font(); | 681 | mWeekFont = font(); |
682 | 682 | ||
683 | int fontPoint = mWeekFont.pointSize(); | 683 | int fontPoint = mWeekFont.pointSize(); |
684 | QFontMetrics f( mWeekFont ); | 684 | QFontMetrics f( mWeekFont ); |
685 | int fontWid = f.width( "30" ); | 685 | int fontWid = f.width( "30" ); |
686 | while ( fontWid > pixWid ) { | 686 | while ( fontWid > pixWid ) { |
687 | --fontPoint; | 687 | --fontPoint; |
688 | mWeekFont.setPointSize( fontPoint ); | 688 | mWeekFont.setPointSize( fontPoint ); |
689 | QFontMetrics f( mWeekFont ); | 689 | QFontMetrics f( mWeekFont ); |
690 | fontWid = f.width( "30" ); | 690 | fontWid = f.width( "30" ); |
691 | //qDebug("dec-- "); | 691 | //qDebug("dec-- "); |
692 | } | 692 | } |
693 | 693 | ||
694 | connect( mWeekAction, SIGNAL( activated() ), | 694 | connect( mWeekAction, SIGNAL( activated() ), |
695 | this, SLOT( weekAction() ) ); | 695 | this, SLOT( weekAction() ) ); |
696 | 696 | ||
697 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 697 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
698 | if ( p->mShowIconFilterview ) { | 698 | if ( p->mShowIconFilterview ) { |
699 | icon = loadPixmap( pathString + "filter" ); | 699 | icon = loadPixmap( pathString + "filter" ); |
700 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); | 700 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); |
701 | connect( actionFilterMenuTB, SIGNAL( activated() ), | 701 | connect( actionFilterMenuTB, SIGNAL( activated() ), |
702 | this, SLOT( fillFilterMenuTB() ) ); | 702 | this, SLOT( fillFilterMenuTB() ) ); |
703 | actionFilterMenuTB->addTo( iconToolBar ); | 703 | actionFilterMenuTB->addTo( iconToolBar ); |
704 | selectFilterMenuTB = new QPopupMenu( this ); | 704 | selectFilterMenuTB = new QPopupMenu( this ); |
705 | selectFilterMenuTB->setCheckable( true ); | 705 | selectFilterMenuTB->setCheckable( true ); |
706 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 706 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
707 | } | 707 | } |
708 | 708 | ||
709 | //#endif | 709 | //#endif |
710 | // ****************** | 710 | // ****************** |
711 | QAction *action; | 711 | QAction *action; |
712 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 712 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
713 | configureToolBarMenu->setCheckable( true ); | 713 | configureToolBarMenu->setCheckable( true ); |
714 | 714 | ||
715 | 715 | ||
716 | configureAgendaMenu->setCheckable( true ); | 716 | configureAgendaMenu->setCheckable( true ); |
717 | int iii ; | 717 | int iii ; |
718 | for ( iii = 1;iii<= 10 ;++iii ){ | 718 | for ( iii = 1;iii<= 10 ;++iii ){ |
719 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 719 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
720 | } | 720 | } |
721 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 721 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
722 | 722 | ||
723 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 723 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
724 | this, SLOT( showConfigureAgenda( ) ) ); | 724 | this, SLOT( showConfigureAgenda( ) ) ); |
725 | 725 | ||
726 | icon = loadPixmap( pathString + "configure" ); | 726 | icon = loadPixmap( pathString + "configure" ); |
727 | action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); | 727 | action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); |
728 | action->addTo( actionMenu ); | 728 | action->addTo( actionMenu ); |
729 | connect( action, SIGNAL( activated() ), | 729 | connect( action, SIGNAL( activated() ), |
730 | mView, SLOT( edit_options() ) ); | 730 | mView, SLOT( edit_options() ) ); |
731 | icon = loadPixmap( pathString + "configure" ); | 731 | icon = loadPixmap( pathString + "configure" ); |
732 | action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); | 732 | action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); |
733 | action->addTo( actionMenu ); | 733 | action->addTo( actionMenu ); |
734 | connect( action, SIGNAL( activated() ), | 734 | connect( action, SIGNAL( activated() ), |
735 | mView, SLOT( edit_global_options() ) ); | 735 | mView, SLOT( edit_global_options() ) ); |
736 | actionMenu->insertSeparator(); | 736 | actionMenu->insertSeparator(); |
737 | 737 | ||
738 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 738 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
739 | action->addTo( actionMenu ); | 739 | action->addTo( actionMenu ); |
740 | connect( action, SIGNAL( activated() ), | 740 | connect( action, SIGNAL( activated() ), |
741 | mView, SLOT( undo_delete() ) ); | 741 | mView, SLOT( undo_delete() ) ); |
742 | actionMenu->insertSeparator(); | 742 | actionMenu->insertSeparator(); |
743 | 743 | ||
744 | icon = loadPixmap( pathString + "newevent" ); | 744 | icon = loadPixmap( pathString + "newevent" ); |
745 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 745 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
746 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); | 746 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); |
747 | configureToolBarMenu->insertSeparator(); | 747 | configureToolBarMenu->insertSeparator(); |
748 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); | 748 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); |
749 | configureToolBarMenu->insertSeparator(); | 749 | configureToolBarMenu->insertSeparator(); |
750 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 750 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
751 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 751 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
752 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 752 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
753 | ne_action->addTo( actionMenu ); | 753 | ne_action->addTo( actionMenu ); |
754 | connect( ne_action, SIGNAL( activated() ), | 754 | connect( ne_action, SIGNAL( activated() ), |
755 | mView, SLOT( newEvent() ) ); | 755 | mView, SLOT( newEvent() ) ); |
756 | icon = loadPixmap( pathString + "newtodo" ); | 756 | icon = loadPixmap( pathString + "newtodo" ); |
757 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 757 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
758 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 758 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
759 | nt_action->addTo( actionMenu ); | 759 | nt_action->addTo( actionMenu ); |
760 | connect( nt_action, SIGNAL( activated() ), | 760 | connect( nt_action, SIGNAL( activated() ), |
761 | mView, SLOT( newTodo() ) ); | 761 | mView, SLOT( newTodo() ) ); |
762 | 762 | ||
763 | icon = loadPixmap( pathString + "today" ); | 763 | icon = loadPixmap( pathString + "today" ); |
764 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 764 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
765 | today_action->addTo( viewMenu ); | 765 | today_action->addTo( viewMenu ); |
766 | connect( today_action, SIGNAL( activated() ), | 766 | connect( today_action, SIGNAL( activated() ), |
767 | mView, SLOT( goToday() ) ); | 767 | mView, SLOT( goToday() ) ); |
768 | viewMenu->insertSeparator(); | 768 | viewMenu->insertSeparator(); |
769 | 769 | ||
770 | // *********************** | 770 | // *********************** |
771 | if ( KOPrefs::instance()->mVerticalScreen ) { | 771 | if ( KOPrefs::instance()->mVerticalScreen ) { |
772 | icon = SmallIcon( "1updownarrow" ); | 772 | icon = SmallIcon( "1updownarrow" ); |
773 | } else { | 773 | } else { |
774 | icon = SmallIcon("1leftrightarrow" ); | 774 | icon = SmallIcon("1leftrightarrow" ); |
775 | } | 775 | } |
776 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); | 776 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); |
777 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); | 777 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); |
778 | FSaction->addTo( viewMenu ); | 778 | FSaction->addTo( viewMenu ); |
779 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); | 779 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); |
780 | 780 | ||
781 | icon = loadPixmap( pathString + "navi" ); | 781 | |
782 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); | ||
783 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | ||
784 | action->addTo( viewMenu ); | ||
785 | connect( action, SIGNAL( activated() ), | ||
786 | mView, SLOT( toggleDateNavigatorWidget() ) ); | ||
787 | mToggleNav = action ; | ||
788 | icon = loadPixmap( pathString + "filter" ); | 782 | icon = loadPixmap( pathString + "filter" ); |
789 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); | 783 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); |
790 | icon = loadPixmap( pathString + "configure" ); | 784 | icon = loadPixmap( pathString + "configure" ); |
791 | action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); | 785 | action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); |
792 | action->addTo( viewMenu ); | 786 | action->addTo( viewMenu ); |
793 | connect( action, SIGNAL( activated() ), | 787 | connect( action, SIGNAL( activated() ), |
794 | mView, SLOT( toggleFilter() ) ); | 788 | mView, SLOT( toggleFilter() ) ); |
795 | mToggleFilter = action; | 789 | mToggleFilter = action; |
790 | icon = loadPixmap( pathString + "navi" ); | ||
791 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); | ||
792 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | ||
793 | action->addTo( viewMenu ); | ||
794 | connect( action, SIGNAL( activated() ), | ||
795 | mView, SLOT( toggleDateNavigatorWidget() ) ); | ||
796 | mToggleNav = action ; | ||
796 | icon = loadPixmap( pathString + "allday" ); | 797 | icon = loadPixmap( pathString + "allday" ); |
797 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); | 798 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); |
798 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 799 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
799 | action->addTo( viewMenu ); | 800 | action->addTo( viewMenu ); |
800 | connect( action, SIGNAL( activated() ), | 801 | connect( action, SIGNAL( activated() ), |
801 | mView, SLOT( toggleAllDaySize() ) ); | 802 | mView, SLOT( toggleAllDaySize() ) ); |
802 | mToggleAllday = action; | 803 | mToggleAllday = action; |
803 | 804 | ||
804 | 805 | ||
805 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 806 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
806 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 807 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
807 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 808 | //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
808 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 809 | // mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
809 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 810 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
810 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 811 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
811 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 812 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
812 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); | 813 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); |
813 | 814 | ||
814 | viewMenu->insertSeparator(); | 815 | viewMenu->insertSeparator(); |
815 | icon = loadPixmap( pathString + "picker" ); | 816 | icon = loadPixmap( pathString + "picker" ); |
816 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 817 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
817 | action->addTo( viewMenu ); | 818 | action->addTo( viewMenu ); |
818 | connect( action, SIGNAL( activated() ), | 819 | connect( action, SIGNAL( activated() ), |
819 | mView, SLOT( showDatePicker() ) ); | 820 | mView, SLOT( showDatePicker() ) ); |
820 | action->addTo( iconToolBar ); | 821 | action->addTo( iconToolBar ); |
821 | viewMenu->insertSeparator(); | 822 | viewMenu->insertSeparator(); |
822 | 823 | ||
823 | if ( p-> mShowIconToggleFull ) | 824 | if ( p-> mShowIconToggleFull ) |
824 | FSaction->addTo( iconToolBar ); | 825 | FSaction->addTo( iconToolBar ); |
825 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); | 826 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); |
826 | 827 | ||
827 | //******************** | 828 | //******************** |
828 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); | 829 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); |
829 | 830 | ||
830 | 831 | ||
831 | icon = loadPixmap( pathString + "whatsnext" ); | 832 | icon = loadPixmap( pathString + "whatsnext" ); |
832 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); | 833 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); |
833 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 834 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
834 | whatsnext_action->addTo( viewMenu ); | 835 | whatsnext_action->addTo( viewMenu ); |
835 | connect( whatsnext_action, SIGNAL( activated() ), | 836 | connect( whatsnext_action, SIGNAL( activated() ), |
836 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 837 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
837 | 838 | ||
838 | icon = loadPixmap( pathString + "xdays" ); | 839 | icon = loadPixmap( pathString + "xdays" ); |
839 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); | 840 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); |
840 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 841 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
841 | xdays_action->addTo( viewMenu ); | 842 | xdays_action->addTo( viewMenu ); |
842 | connect( xdays_action, SIGNAL( activated() ), | 843 | connect( xdays_action, SIGNAL( activated() ), |
843 | mView->viewManager(), SLOT( showNextXView() ) ); | 844 | mView->viewManager(), SLOT( showNextXView() ) ); |
844 | 845 | ||
845 | 846 | ||
846 | icon = loadPixmap( pathString + "journal" ); | 847 | icon = loadPixmap( pathString + "journal" ); |
847 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 848 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
848 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 849 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
849 | viewjournal_action->addTo( viewMenu ); | 850 | viewjournal_action->addTo( viewMenu ); |
850 | connect( viewjournal_action, SIGNAL( activated() ), | 851 | connect( viewjournal_action, SIGNAL( activated() ), |
851 | mView->viewManager(), SLOT( showJournalView() ) ); | 852 | mView->viewManager(), SLOT( showJournalView() ) ); |
852 | 853 | ||
853 | 854 | ||
854 | icon = loadPixmap( pathString + "day" ); | 855 | icon = loadPixmap( pathString + "day" ); |
855 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 856 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
856 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 857 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
857 | day1_action->addTo( viewMenu ); | 858 | day1_action->addTo( viewMenu ); |
858 | // action->addTo( toolBar ); | 859 | // action->addTo( toolBar ); |
859 | connect( day1_action, SIGNAL( activated() ), | 860 | connect( day1_action, SIGNAL( activated() ), |
860 | mView->viewManager(), SLOT( showDayView() ) ); | 861 | mView->viewManager(), SLOT( showDayView() ) ); |
861 | 862 | ||
862 | icon = loadPixmap( pathString + "workweek" ); | 863 | icon = loadPixmap( pathString + "workweek" ); |
863 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 864 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
864 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 865 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
865 | day5_action->addTo( viewMenu ); | 866 | day5_action->addTo( viewMenu ); |
866 | connect( day5_action, SIGNAL( activated() ), | 867 | connect( day5_action, SIGNAL( activated() ), |
867 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 868 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
868 | 869 | ||
869 | icon = loadPixmap( pathString + "week" ); | 870 | icon = loadPixmap( pathString + "week" ); |
870 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 871 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
871 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 872 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
872 | day7_action->addTo( viewMenu ); | 873 | day7_action->addTo( viewMenu ); |
873 | connect( day7_action, SIGNAL( activated() ), | 874 | connect( day7_action, SIGNAL( activated() ), |
874 | mView->viewManager(), SLOT( showWeekView() ) ); | 875 | mView->viewManager(), SLOT( showWeekView() ) ); |
875 | 876 | ||
876 | icon = loadPixmap( pathString + "workweek2" ); | 877 | icon = loadPixmap( pathString + "workweek2" ); |
877 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); | 878 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); |
878 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); | 879 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); |
879 | day6_action->addTo( viewMenu ); | 880 | day6_action->addTo( viewMenu ); |
880 | connect( day6_action, SIGNAL( activated() ), | 881 | connect( day6_action, SIGNAL( activated() ), |
881 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); | 882 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); |
882 | 883 | ||
883 | icon = loadPixmap( pathString + "month" ); | 884 | icon = loadPixmap( pathString + "month" ); |
884 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 885 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
885 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 886 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
886 | month_action->addTo( viewMenu ); | 887 | month_action->addTo( viewMenu ); |
887 | connect( month_action, SIGNAL( activated() ), | 888 | connect( month_action, SIGNAL( activated() ), |
888 | mView->viewManager(), SLOT( showMonthView() ) ); | 889 | mView->viewManager(), SLOT( showMonthView() ) ); |
889 | 890 | ||
890 | icon = loadPixmap( pathString + "list" ); | 891 | icon = loadPixmap( pathString + "list" ); |
891 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 892 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
892 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 893 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
893 | showlist_action->addTo( viewMenu ); | 894 | showlist_action->addTo( viewMenu ); |
894 | connect( showlist_action, SIGNAL( activated() ), | 895 | connect( showlist_action, SIGNAL( activated() ), |
895 | mView->viewManager(), SLOT( showListView() ) ); | 896 | mView->viewManager(), SLOT( showListView() ) ); |
896 | 897 | ||
897 | icon = loadPixmap( pathString + "todo" ); | 898 | icon = loadPixmap( pathString + "todo" ); |
898 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 899 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
899 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 900 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
900 | todoview_action->addTo( viewMenu ); | 901 | todoview_action->addTo( viewMenu ); |
901 | connect( todoview_action, SIGNAL( activated() ), | 902 | connect( todoview_action, SIGNAL( activated() ), |
902 | mView->viewManager(), SLOT( showTodoView() ) ); | 903 | mView->viewManager(), SLOT( showTodoView() ) ); |
903 | 904 | ||
904 | 905 | ||
905 | 906 | ||
906 | #if 0 | 907 | #if 0 |
907 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 908 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
908 | action->addTo( viewMenu ); | 909 | action->addTo( viewMenu ); |
909 | connect( action, SIGNAL( activated() ), | 910 | connect( action, SIGNAL( activated() ), |
910 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 911 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
911 | #endif | 912 | #endif |
912 | 913 | ||
913 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 914 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
914 | this ); | 915 | this ); |
915 | mNewSubTodoAction->addTo( actionMenu ); | 916 | mNewSubTodoAction->addTo( actionMenu ); |
916 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 917 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
917 | mView, SLOT( newSubTodo() ) ); | 918 | mView, SLOT( newSubTodo() ) ); |
918 | 919 | ||
919 | actionMenu->insertSeparator(); | 920 | actionMenu->insertSeparator(); |
920 | 921 | ||
921 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 922 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
922 | mShowAction->addTo( actionMenu ); | 923 | mShowAction->addTo( actionMenu ); |
923 | connect( mShowAction, SIGNAL( activated() ), | 924 | connect( mShowAction, SIGNAL( activated() ), |
924 | mView, SLOT( showIncidence() ) ); | 925 | mView, SLOT( showIncidence() ) ); |
925 | 926 | ||
926 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 927 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
927 | mEditAction->addTo( actionMenu ); | 928 | mEditAction->addTo( actionMenu ); |
928 | connect( mEditAction, SIGNAL( activated() ), | 929 | connect( mEditAction, SIGNAL( activated() ), |
929 | mView, SLOT( editIncidence() ) ); | 930 | mView, SLOT( editIncidence() ) ); |
930 | 931 | ||
931 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 932 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
932 | mDeleteAction->addTo( actionMenu ); | 933 | mDeleteAction->addTo( actionMenu ); |
933 | connect( mDeleteAction, SIGNAL( activated() ), | 934 | connect( mDeleteAction, SIGNAL( activated() ), |
934 | mView, SLOT( deleteIncidence() ) ); | 935 | mView, SLOT( deleteIncidence() ) ); |
935 | 936 | ||
936 | 937 | ||
937 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 938 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
938 | mCloneAction->addTo( actionMenu ); | 939 | mCloneAction->addTo( actionMenu ); |
939 | connect( mCloneAction, SIGNAL( activated() ), | 940 | connect( mCloneAction, SIGNAL( activated() ), |
940 | mView, SLOT( cloneIncidence() ) ); | 941 | mView, SLOT( cloneIncidence() ) ); |
941 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 942 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
942 | mMoveAction->addTo( actionMenu ); | 943 | mMoveAction->addTo( actionMenu ); |
943 | connect( mMoveAction, SIGNAL( activated() ), | 944 | connect( mMoveAction, SIGNAL( activated() ), |
944 | mView, SLOT( moveIncidence() ) ); | 945 | mView, SLOT( moveIncidence() ) ); |
945 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 946 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
946 | mBeamAction->addTo( actionMenu ); | 947 | mBeamAction->addTo( actionMenu ); |
947 | connect( mBeamAction, SIGNAL( activated() ), | 948 | connect( mBeamAction, SIGNAL( activated() ), |
948 | mView, SLOT( beamIncidence() ) ); | 949 | mView, SLOT( beamIncidence() ) ); |
949 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 950 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
950 | mCancelAction->addTo( actionMenu ); | 951 | mCancelAction->addTo( actionMenu ); |
951 | connect( mCancelAction, SIGNAL( activated() ), | 952 | connect( mCancelAction, SIGNAL( activated() ), |
952 | mView, SLOT( toggleCancelIncidence() ) ); | 953 | mView, SLOT( toggleCancelIncidence() ) ); |
953 | 954 | ||
954 | actionMenu->insertSeparator(); | 955 | actionMenu->insertSeparator(); |
955 | 956 | ||
956 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 957 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
957 | this ); | 958 | this ); |
958 | action->addTo( actionMenu ); | 959 | action->addTo( actionMenu ); |
959 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 960 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
960 | 961 | ||
961 | icon = loadPixmap( pathString + "search" ); | 962 | icon = loadPixmap( pathString + "search" ); |
962 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 963 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
963 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); | 964 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); |
964 | search_action->addTo( actionMenu ); | 965 | search_action->addTo( actionMenu ); |
965 | connect( search_action, SIGNAL( activated() ), | 966 | connect( search_action, SIGNAL( activated() ), |
966 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 967 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
967 | 968 | ||
968 | 969 | ||
969 | 970 | ||
970 | if ( KOPrefs::instance()->mShowFullMenu ) { | 971 | if ( KOPrefs::instance()->mShowFullMenu ) { |
971 | actionMenu->insertSeparator(); | 972 | actionMenu->insertSeparator(); |
972 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 973 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
973 | 974 | ||
974 | } | 975 | } |
975 | // actionMenu->insertSeparator(); | 976 | // actionMenu->insertSeparator(); |
976 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 977 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
977 | this ); | 978 | this ); |
978 | action->addTo( importMenu_X ); | 979 | action->addTo( importMenu_X ); |
979 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 980 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
980 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 981 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
981 | this ); | 982 | this ); |
982 | action->addTo( importMenu_X ); | 983 | action->addTo( importMenu_X ); |
983 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 984 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
984 | importMenu_X->insertSeparator(); | 985 | importMenu_X->insertSeparator(); |
985 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 986 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
986 | this ); | 987 | this ); |
987 | action->addTo( importMenu_X ); | 988 | action->addTo( importMenu_X ); |
988 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 989 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
989 | //#ifndef DESKTOP_VERSION | 990 | //#ifndef DESKTOP_VERSION |
990 | importMenu_X->insertSeparator(); | 991 | importMenu_X->insertSeparator(); |
991 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 992 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
992 | this ); | 993 | this ); |
993 | action->addTo( importMenu_X ); | 994 | action->addTo( importMenu_X ); |
994 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 995 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
995 | //#else | 996 | //#else |
996 | #ifdef _OL_IMPORT_ | 997 | #ifdef _OL_IMPORT_ |
997 | importMenu_X->insertSeparator(); | 998 | importMenu_X->insertSeparator(); |
998 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 999 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
999 | this ); | 1000 | this ); |
1000 | action->addTo( importMenu_X ); | 1001 | action->addTo( importMenu_X ); |
1001 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 1002 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
1002 | #endif | 1003 | #endif |
1003 | //#endif | 1004 | //#endif |
1004 | 1005 | ||
1005 | //importMenu->insertSeparator(); | 1006 | //importMenu->insertSeparator(); |
1006 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 1007 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
1007 | this ); | 1008 | this ); |
1008 | action->addTo( importMenu ); | 1009 | action->addTo( importMenu ); |
1009 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 1010 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
1010 | 1011 | ||
1011 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 1012 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
1012 | this ); | 1013 | this ); |
1013 | action->addTo( importMenu ); | 1014 | action->addTo( importMenu ); |
1014 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 1015 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
1015 | importMenu->insertSeparator(); | 1016 | importMenu->insertSeparator(); |
1016 | importMenu->insertItem( i18n("Import"), importMenu_X ); | 1017 | importMenu->insertItem( i18n("Import"), importMenu_X ); |
1017 | //importMenu->insertSeparator(); | 1018 | //importMenu->insertSeparator(); |
1018 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 1019 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
1019 | this ); | 1020 | this ); |
1020 | action->addTo( exportMenu_X ); | 1021 | action->addTo( exportMenu_X ); |
1021 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 1022 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
1022 | 1023 | ||
1023 | 1024 | ||
1024 | //LR | 1025 | //LR |
1025 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 1026 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
1026 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1027 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1027 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1028 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1028 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 1029 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
1029 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); | 1030 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); |
1030 | 1031 | ||
1031 | importMenu->insertItem( i18n("Export"), exportMenu_X ); | 1032 | importMenu->insertItem( i18n("Export"), exportMenu_X ); |
1032 | #ifndef DESKTOP_VERSION | 1033 | #ifndef DESKTOP_VERSION |
1033 | //importMenu->insertSeparator(); | 1034 | //importMenu->insertSeparator(); |
1034 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 1035 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
1035 | this ); | 1036 | this ); |
1036 | brAction->addTo( beamMenu_X ); | 1037 | brAction->addTo( beamMenu_X ); |
1037 | brAction->setToggleAction (true ) ; | 1038 | brAction->setToggleAction (true ) ; |
1038 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 1039 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
1039 | 1040 | ||
1040 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 1041 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
1041 | this ); | 1042 | this ); |
1042 | action->addTo( beamMenu_X ); | 1043 | action->addTo( beamMenu_X ); |
1043 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 1044 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
1044 | 1045 | ||
1045 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 1046 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
1046 | this ); | 1047 | this ); |
1047 | action->addTo( beamMenu_X ); | 1048 | action->addTo( beamMenu_X ); |
1048 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 1049 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
1049 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); | 1050 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); |
1050 | #else | 1051 | #else |
1051 | //importMenu->insertSeparator(); | 1052 | //importMenu->insertSeparator(); |
1052 | icon = loadPixmap( pathString + "print" ); | 1053 | icon = loadPixmap( pathString + "print" ); |
1053 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 1054 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
1054 | action->addTo( beamMenu_X ); | 1055 | action->addTo( beamMenu_X ); |
1055 | connect( action, SIGNAL( activated() ), | 1056 | connect( action, SIGNAL( activated() ), |
1056 | this, SLOT( printCal() ) ); | 1057 | this, SLOT( printCal() ) ); |
1057 | 1058 | ||
1058 | icon = loadPixmap( pathString + "print" ); | 1059 | icon = loadPixmap( pathString + "print" ); |
1059 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 1060 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
1060 | action->addTo( beamMenu_X ); | 1061 | action->addTo( beamMenu_X ); |
1061 | connect( action, SIGNAL( activated() ), | 1062 | connect( action, SIGNAL( activated() ), |
1062 | this, SLOT( printSel() ) ); | 1063 | this, SLOT( printSel() ) ); |
1063 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 1064 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
1064 | action->addTo( beamMenu_X ); | 1065 | action->addTo( beamMenu_X ); |
1065 | connect( action, SIGNAL( activated() ), | 1066 | connect( action, SIGNAL( activated() ), |
1066 | mView->viewManager(), SLOT( slotprintWNV() ) ); | 1067 | mView->viewManager(), SLOT( slotprintWNV() ) ); |
1067 | 1068 | ||
1068 | 1069 | ||
1069 | icon = loadPixmap( pathString + "print" ); | 1070 | icon = loadPixmap( pathString + "print" ); |
1070 | action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); | 1071 | action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); |
1071 | action->addTo( beamMenu_X ); | 1072 | action->addTo( beamMenu_X ); |
1072 | connect( action, SIGNAL( activated() ), | 1073 | connect( action, SIGNAL( activated() ), |
1073 | this, SLOT( printListView() ) ); | 1074 | this, SLOT( printListView() ) ); |
1074 | 1075 | ||
1075 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); | 1076 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); |
1076 | action->addTo( beamMenu_X ); | 1077 | action->addTo( beamMenu_X ); |
1077 | connect( action, SIGNAL( activated() ), | 1078 | connect( action, SIGNAL( activated() ), |
1078 | mView, SLOT( slotprintSelInc() ) ); | 1079 | mView, SLOT( slotprintSelInc() ) ); |
1079 | 1080 | ||
1080 | importMenu->insertItem( i18n("Print"), beamMenu_X ); | 1081 | importMenu->insertItem( i18n("Print"), beamMenu_X ); |
1081 | #endif | 1082 | #endif |
1082 | importMenu->insertSeparator(); | 1083 | importMenu->insertSeparator(); |
1083 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 1084 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
1084 | this ); | 1085 | this ); |
1085 | action->addTo( importMenu ); | 1086 | action->addTo( importMenu ); |
1086 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 1087 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
1087 | importMenu->insertSeparator(); | 1088 | importMenu->insertSeparator(); |
1088 | action = new QAction( "beam all", i18n("Save"), 0, | 1089 | action = new QAction( "beam all", i18n("Save"), 0, |
1089 | this ); | 1090 | this ); |
1090 | action->addTo( importMenu ); | 1091 | action->addTo( importMenu ); |
1091 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 1092 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
1092 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 1093 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
1093 | this ); | 1094 | this ); |
1094 | action->addTo( importMenu ); | 1095 | action->addTo( importMenu ); |
1095 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 1096 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
1096 | 1097 | ||
1097 | //menuBar->insertItem( "Configure",configureMenu ); | 1098 | //menuBar->insertItem( "Configure",configureMenu ); |
1098 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 1099 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
1099 | icon = loadPixmap( "korganizer/korganizer" ); | 1100 | icon = loadPixmap( "korganizer/korganizer" ); |
1100 | 1101 | ||
1101 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 1102 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
1102 | action->addTo( helpMenu ); | 1103 | action->addTo( helpMenu ); |
1103 | connect( action, SIGNAL( activated() ), | 1104 | connect( action, SIGNAL( activated() ), |
1104 | SLOT( whatsNew() ) ); | 1105 | SLOT( whatsNew() ) ); |
1105 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 1106 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
1106 | action->addTo( helpMenu ); | 1107 | action->addTo( helpMenu ); |
1107 | connect( action, SIGNAL( activated() ), | 1108 | connect( action, SIGNAL( activated() ), |
1108 | SLOT( features() ) ); | 1109 | SLOT( features() ) ); |
1109 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 1110 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
1110 | action->addTo( helpMenu ); | 1111 | action->addTo( helpMenu ); |
1111 | connect( action, SIGNAL( activated() ), | 1112 | connect( action, SIGNAL( activated() ), |
1112 | SLOT( keyBindings() ) ); | 1113 | SLOT( keyBindings() ) ); |
1113 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); | 1114 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); |
1114 | action->addTo( helpMenu ); | 1115 | action->addTo( helpMenu ); |
1115 | connect( action, SIGNAL( activated() ), | 1116 | connect( action, SIGNAL( activated() ), |
1116 | SLOT( storagehowto() ) ); | 1117 | SLOT( storagehowto() ) ); |
1117 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); | 1118 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); |
1118 | action->addTo( helpMenu ); | 1119 | action->addTo( helpMenu ); |
1119 | connect( action, SIGNAL( activated() ), | 1120 | connect( action, SIGNAL( activated() ), |
1120 | SLOT( timetrackinghowto() ) ); | 1121 | SLOT( timetrackinghowto() ) ); |
1121 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 1122 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
1122 | action->addTo( helpMenu ); | 1123 | action->addTo( helpMenu ); |
1123 | connect( action, SIGNAL( activated() ), | 1124 | connect( action, SIGNAL( activated() ), |
1124 | SLOT( synchowto() ) ); | 1125 | SLOT( synchowto() ) ); |
1125 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 1126 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
1126 | action->addTo( helpMenu ); | 1127 | action->addTo( helpMenu ); |
1127 | connect( action, SIGNAL( activated() ), | 1128 | connect( action, SIGNAL( activated() ), |
1128 | SLOT( kdesynchowto() ) ); | 1129 | SLOT( kdesynchowto() ) ); |
1129 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 1130 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
1130 | action->addTo( helpMenu ); | 1131 | action->addTo( helpMenu ); |
1131 | connect( action, SIGNAL( activated() ), | 1132 | connect( action, SIGNAL( activated() ), |
1132 | SLOT( multisynchowto() ) ); | 1133 | SLOT( multisynchowto() ) ); |
1133 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 1134 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
1134 | action->addTo( helpMenu ); | 1135 | action->addTo( helpMenu ); |
1135 | connect( action, SIGNAL( activated() ), | 1136 | connect( action, SIGNAL( activated() ), |
1136 | SLOT( aboutAutoSaving() ) ); | 1137 | SLOT( aboutAutoSaving() ) ); |
1137 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 1138 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
1138 | action->addTo( helpMenu ); | 1139 | action->addTo( helpMenu ); |
1139 | connect( action, SIGNAL( activated() ), | 1140 | connect( action, SIGNAL( activated() ), |
1140 | SLOT( aboutKnownBugs() ) ); | 1141 | SLOT( aboutKnownBugs() ) ); |
1141 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 1142 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
1142 | action->addTo( helpMenu ); | 1143 | action->addTo( helpMenu ); |
1143 | connect( action, SIGNAL( activated() ), | 1144 | connect( action, SIGNAL( activated() ), |
1144 | SLOT( usertrans() ) ); | 1145 | SLOT( usertrans() ) ); |
1145 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 1146 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
1146 | action->addTo( helpMenu ); | 1147 | action->addTo( helpMenu ); |
1147 | connect( action, SIGNAL( activated() ), | 1148 | connect( action, SIGNAL( activated() ), |
1148 | SLOT( faq() ) ); | 1149 | SLOT( faq() ) ); |
1149 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 1150 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
1150 | action->addTo( helpMenu ); | 1151 | action->addTo( helpMenu ); |
1151 | connect( action, SIGNAL( activated() ), | 1152 | connect( action, SIGNAL( activated() ), |
1152 | SLOT( licence() ) ); | 1153 | SLOT( licence() ) ); |
1153 | action = new QAction( "about", i18n("About..."), 0, this ); | 1154 | action = new QAction( "about", i18n("About..."), 0, this ); |
1154 | action->addTo( helpMenu ); | 1155 | action->addTo( helpMenu ); |
1155 | connect( action, SIGNAL( activated() ), | 1156 | connect( action, SIGNAL( activated() ), |
1156 | SLOT( about() ) ); | 1157 | SLOT( about() ) ); |
1157 | //menuBar->insertSeparator(); | 1158 | //menuBar->insertSeparator(); |
1158 | 1159 | ||
1159 | // ****************************************************** | 1160 | // ****************************************************** |
1160 | // menubar icons | 1161 | // menubar icons |
1161 | 1162 | ||
1162 | 1163 | ||
1163 | 1164 | ||
1164 | //menuBar->insertItem( iconToolBar ); | 1165 | //menuBar->insertItem( iconToolBar ); |
1165 | //xdays_action | 1166 | //xdays_action |
1166 | if (p-> mShowIconNewEvent) | 1167 | if (p-> mShowIconNewEvent) |
1167 | ne_action->addTo( iconToolBar ); | 1168 | ne_action->addTo( iconToolBar ); |
1168 | if (p->mShowIconNewTodo ) | 1169 | if (p->mShowIconNewTodo ) |
1169 | nt_action->addTo( iconToolBar ); | 1170 | nt_action->addTo( iconToolBar ); |
1170 | if (p-> mShowIconSearch) | 1171 | if (p-> mShowIconSearch) |
1171 | search_action->addTo( iconToolBar ); | 1172 | search_action->addTo( iconToolBar ); |
1172 | if (p-> mShowIconWhatsThis) | 1173 | if (p-> mShowIconWhatsThis) |
1173 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1174 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1174 | if (p-> mShowIconNext) | 1175 | if (p-> mShowIconNext) |
1175 | whatsnext_action->addTo( viewToolBar ); | 1176 | whatsnext_action->addTo( viewToolBar ); |
1176 | if (p-> mShowIconNextDays) | 1177 | if (p-> mShowIconNextDays) |
1177 | xdays_action->addTo( viewToolBar ); | 1178 | xdays_action->addTo( viewToolBar ); |
1178 | if (p-> mShowIconJournal) | 1179 | if (p-> mShowIconJournal) |
1179 | viewjournal_action->addTo( viewToolBar ); | 1180 | viewjournal_action->addTo( viewToolBar ); |
1180 | if (p-> mShowIconDay1) | 1181 | if (p-> mShowIconDay1) |
1181 | day1_action->addTo( viewToolBar ); | 1182 | day1_action->addTo( viewToolBar ); |
1182 | if (p-> mShowIconDay5) | 1183 | if (p-> mShowIconDay5) |
1183 | day5_action->addTo( viewToolBar ); | 1184 | day5_action->addTo( viewToolBar ); |
1184 | if (p-> mShowIconDay7) | 1185 | if (p-> mShowIconDay7) |
1185 | day7_action->addTo( viewToolBar ); | 1186 | day7_action->addTo( viewToolBar ); |
1186 | if (p-> mShowIconDay6) | 1187 | if (p-> mShowIconDay6) |
1187 | day6_action->addTo( viewToolBar ); | 1188 | day6_action->addTo( viewToolBar ); |
1188 | if (p-> mShowIconMonth) | 1189 | if (p-> mShowIconMonth) |
1189 | month_action->addTo( viewToolBar ); | 1190 | month_action->addTo( viewToolBar ); |
1190 | if (p-> mShowIconList) | 1191 | if (p-> mShowIconList) |
1191 | showlist_action->addTo( viewToolBar ); | 1192 | showlist_action->addTo( viewToolBar ); |
1192 | if (p-> mShowIconTodoview) | 1193 | if (p-> mShowIconTodoview) |
diff --git a/microkde/kglobal.cpp b/microkde/kglobal.cpp index bf7e238..53edd08 100644 --- a/microkde/kglobal.cpp +++ b/microkde/kglobal.cpp | |||
@@ -1,168 +1,175 @@ | |||
1 | #include "kglobal.h" | 1 | #include "kglobal.h" |
2 | #include "kstandarddirs.h" | 2 | #include "kstandarddirs.h" |
3 | #include <qkeycode.h> | 3 | #include <qkeycode.h> |
4 | #include <qapplication.h> | 4 | #include <qapplication.h> |
5 | 5 | ||
6 | KLocale *KGlobal::mLocale = 0; | 6 | KLocale *KGlobal::mLocale = 0; |
7 | KConfig *KGlobal::mConfig = 0; | 7 | KConfig *KGlobal::mConfig = 0; |
8 | KIconLoader *KGlobal::mIconLoader = 0; | 8 | KIconLoader *KGlobal::mIconLoader = 0; |
9 | KStandardDirs *KGlobal::mDirs = 0; | 9 | KStandardDirs *KGlobal::mDirs = 0; |
10 | 10 | ||
11 | QString KGlobal::mAppName = "godot"; | 11 | QString KGlobal::mAppName = "godot"; |
12 | 12 | ||
13 | KLocale *KGlobal::locale() | 13 | KLocale *KGlobal::locale() |
14 | { | 14 | { |
15 | if ( !mLocale ) { | 15 | if ( !mLocale ) { |
16 | ASSERT(mAppName); | 16 | ASSERT(mAppName); |
17 | 17 | ||
18 | mLocale = new KLocale();//mAppName); | 18 | mLocale = new KLocale();//mAppName); |
19 | } | 19 | } |
20 | 20 | ||
21 | return mLocale; | 21 | return mLocale; |
22 | } | 22 | } |
23 | 23 | ||
24 | //US | 24 | //US |
25 | void KGlobal::setLocale(KLocale *kg) | 25 | void KGlobal::setLocale(KLocale *kg) |
26 | { | 26 | { |
27 | mLocale = kg; | 27 | mLocale = kg; |
28 | } | 28 | } |
29 | 29 | ||
30 | KConfig *KGlobal::config() | 30 | KConfig *KGlobal::config() |
31 | { | 31 | { |
32 | //mConfig is set inside setAppName. Though it has to be the first function you call. | 32 | //mConfig is set inside setAppName. Though it has to be the first function you call. |
33 | return mConfig; | 33 | return mConfig; |
34 | } | 34 | } |
35 | 35 | ||
36 | KGlobal::Size KGlobal::getDesktopSize() | 36 | KGlobal::Size KGlobal::getDesktopSize() |
37 | { | 37 | { |
38 | #ifdef DESKTOP_VERSION | 38 | #ifdef DESKTOP_VERSION |
39 | return KGlobal::Desktop; | 39 | return KGlobal::Desktop; |
40 | #else | 40 | #else |
41 | if ( QApplication::desktop()->width() <= 320 ) | 41 | if ( QApplication::desktop()->width() <= 320 ) |
42 | return KGlobal::Small; | 42 | return KGlobal::Small; |
43 | else if ( QApplication::desktop()->width() > 480) | 43 | else if ( QApplication::desktop()->width() > 480) |
44 | return KGlobal::Desktop; | 44 | return KGlobal::Desktop; |
45 | else | 45 | else |
46 | return KGlobal::Medium; | 46 | return KGlobal::Medium; |
47 | #endif | 47 | #endif |
48 | } | 48 | } |
49 | 49 | ||
50 | KGlobal::Orientation KGlobal::getOrientation() | 50 | KGlobal::Orientation KGlobal::getOrientation() |
51 | { | 51 | { |
52 | if (QApplication::desktop()->width() > QApplication::desktop()->height()) | 52 | if (QApplication::desktop()->width() > QApplication::desktop()->height()) |
53 | return KGlobal::Landscape; | 53 | return KGlobal::Landscape; |
54 | else | 54 | else |
55 | return KGlobal::Portrait; | 55 | return KGlobal::Portrait; |
56 | } | 56 | } |
57 | 57 | ||
58 | int KGlobal::getDesktopWidth() | 58 | int KGlobal::getDesktopWidth() |
59 | { | 59 | { |
60 | return QApplication::desktop()->width(); | 60 | return QApplication::desktop()->width(); |
61 | } | 61 | } |
62 | 62 | ||
63 | int KGlobal::getDesktopHeight() | 63 | int KGlobal::getDesktopHeight() |
64 | { | 64 | { |
65 | return QApplication::desktop()->height(); | 65 | return QApplication::desktop()->height(); |
66 | } | 66 | } |
67 | 67 | ||
68 | 68 | ||
69 | KIconLoader *KGlobal::iconLoader() | 69 | KIconLoader *KGlobal::iconLoader() |
70 | { | 70 | { |
71 | if ( !mIconLoader ) { | 71 | if ( !mIconLoader ) { |
72 | mIconLoader = new KIconLoader(); | 72 | mIconLoader = new KIconLoader(); |
73 | } | 73 | } |
74 | 74 | ||
75 | return mIconLoader; | 75 | return mIconLoader; |
76 | } | 76 | } |
77 | 77 | ||
78 | KStandardDirs *KGlobal::dirs() | 78 | KStandardDirs *KGlobal::dirs() |
79 | { | 79 | { |
80 | if ( !mDirs ) { | 80 | if ( !mDirs ) { |
81 | mDirs = new KStandardDirs(); | 81 | mDirs = new KStandardDirs(); |
82 | } | 82 | } |
83 | 83 | ||
84 | return mDirs; | 84 | return mDirs; |
85 | } | 85 | } |
86 | 86 | ||
87 | void KGlobal::setAppName( const QString &appName ) | 87 | void KGlobal::setAppName( const QString &appName ) |
88 | { | 88 | { |
89 | mAppName = appName; | 89 | mAppName = appName; |
90 | 90 | ||
91 | mConfig = new KConfig( locateLocal("config", mAppName + "rc" ) ); | 91 | mConfig = new KConfig( locateLocal("config", mAppName + "rc" ) ); |
92 | } | 92 | } |
93 | 93 | ||
94 | //US | 94 | //US |
95 | QString KGlobal::getAppName() | 95 | QString KGlobal::getAppName() |
96 | { | 96 | { |
97 | return mAppName; | 97 | return mAppName; |
98 | } | 98 | } |
99 | QString KGlobal::formatMessage ( QString mess, int maxlen ) | 99 | QString KGlobal::formatMessage ( QString mess, int maxlen ) |
100 | { | 100 | { |
101 | //int maxlen = 80; | 101 | //int maxlen = 80; |
102 | if ( maxlen == 0 ) { | ||
103 | maxlen = QApplication::desktop()->width()/10; | ||
104 | if ( maxlen > 32 ) | ||
105 | maxlen = (maxlen * 3) / 4; | ||
106 | if ( maxlen > 100 ) | ||
107 | maxlen = 100; | ||
108 | } | ||
102 | int start = 0; | 109 | int start = 0; |
103 | int end = mess.length(); | 110 | int end = mess.length(); |
104 | QString retVal = ""; | 111 | QString retVal = ""; |
105 | int nl, space; | 112 | int nl, space; |
106 | while ( (end - start) > maxlen ) { | 113 | while ( (end - start) > maxlen ) { |
107 | nl = mess.find( "\n", start ); | 114 | nl = mess.find( "\n", start ); |
108 | if ( nl > 0 && nl < start + maxlen ) { | 115 | if ( nl > 0 && nl < start + maxlen ) { |
109 | nl += 1; | 116 | nl += 1; |
110 | retVal += mess.mid( start, nl - start); | 117 | retVal += mess.mid( start, nl - start); |
111 | start = nl; | 118 | start = nl; |
112 | } else { | 119 | } else { |
113 | space = mess.findRev( " ", start + maxlen ); | 120 | space = mess.findRev( " ", start + maxlen ); |
114 | if ( space < start ) { | 121 | if ( space < start ) { |
115 | retVal += mess.mid( start, maxlen) +"\n"; | 122 | retVal += mess.mid( start, maxlen) +"\n"; |
116 | start += maxlen ; | 123 | start += maxlen ; |
117 | } else { | 124 | } else { |
118 | retVal += mess.mid( start, space - start ) +"\n"; | 125 | retVal += mess.mid( start, space - start ) +"\n"; |
119 | start = space+ 1; | 126 | start = space+ 1; |
120 | } | 127 | } |
121 | } | 128 | } |
122 | } | 129 | } |
123 | retVal += mess.mid( start, end - start ); | 130 | retVal += mess.mid( start, end - start ); |
124 | return retVal; | 131 | return retVal; |
125 | } | 132 | } |
126 | int KGlobal::knumkeykonv( int k ) | 133 | int KGlobal::knumkeykonv( int k ) |
127 | { | 134 | { |
128 | int key; | 135 | int key; |
129 | switch( k ) { | 136 | switch( k ) { |
130 | case Qt::Key_Q : | 137 | case Qt::Key_Q : |
131 | key = Qt::Key_1; | 138 | key = Qt::Key_1; |
132 | break; | 139 | break; |
133 | case Qt::Key_W : | 140 | case Qt::Key_W : |
134 | key = Qt::Key_2; | 141 | key = Qt::Key_2; |
135 | break; | 142 | break; |
136 | case Qt::Key_E : | 143 | case Qt::Key_E : |
137 | key = Qt::Key_3; | 144 | key = Qt::Key_3; |
138 | break; | 145 | break; |
139 | case Qt::Key_R : | 146 | case Qt::Key_R : |
140 | key = Qt::Key_4; | 147 | key = Qt::Key_4; |
141 | break; | 148 | break; |
142 | case Qt::Key_T : | 149 | case Qt::Key_T : |
143 | key = Qt::Key_5; | 150 | key = Qt::Key_5; |
144 | break; | 151 | break; |
145 | case Qt::Key_Z : | 152 | case Qt::Key_Z : |
146 | key = Qt::Key_6; | 153 | key = Qt::Key_6; |
147 | break; | 154 | break; |
148 | case Qt::Key_Y : | 155 | case Qt::Key_Y : |
149 | key = Qt::Key_6; | 156 | key = Qt::Key_6; |
150 | break; | 157 | break; |
151 | case Qt::Key_U : | 158 | case Qt::Key_U : |
152 | key = Qt::Key_7; | 159 | key = Qt::Key_7; |
153 | break; | 160 | break; |
154 | case Qt::Key_I : | 161 | case Qt::Key_I : |
155 | key = Qt::Key_8; | 162 | key = Qt::Key_8; |
156 | break; | 163 | break; |
157 | case Qt::Key_O : | 164 | case Qt::Key_O : |
158 | key = Qt::Key_9; | 165 | key = Qt::Key_9; |
159 | break; | 166 | break; |
160 | case Qt::Key_P : | 167 | case Qt::Key_P : |
161 | key = Qt::Key_0; | 168 | key = Qt::Key_0; |
162 | break; | 169 | break; |
163 | default: | 170 | default: |
164 | key = k; | 171 | key = k; |
165 | break; | 172 | break; |
166 | } // switch | 173 | } // switch |
167 | return key; | 174 | return key; |
168 | } | 175 | } |