author | zautrix <zautrix> | 2005-07-06 11:17:00 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-06 11:17:00 (UTC) |
commit | 7e22293b1ec1ee190ca8db6c8ecd079bafdae520 (patch) (unidiff) | |
tree | aed67fbbd844480e3dc0a7b5587edca766b51a5f /korganizer | |
parent | 3b77a857e17e04e47d22ba6017dd723ed922e3fc (diff) | |
download | kdepimpi-7e22293b1ec1ee190ca8db6c8ecd079bafdae520.zip kdepimpi-7e22293b1ec1ee190ca8db6c8ecd079bafdae520.tar.gz kdepimpi-7e22293b1ec1ee190ca8db6c8ecd079bafdae520.tar.bz2 |
fixes
-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | korganizer/koagenda.cpp | 1 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 8 |
4 files changed, 10 insertions, 6 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 7566c6f..4b3f806 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3744,518 +3744,516 @@ void CalendarView::schedule_refresh(Incidence *incidence) | |||
3744 | void CalendarView::schedule_cancel(Incidence *incidence) | 3744 | void CalendarView::schedule_cancel(Incidence *incidence) |
3745 | { | 3745 | { |
3746 | schedule(Scheduler::Cancel,incidence); | 3746 | schedule(Scheduler::Cancel,incidence); |
3747 | } | 3747 | } |
3748 | 3748 | ||
3749 | void CalendarView::schedule_add(Incidence *incidence) | 3749 | void CalendarView::schedule_add(Incidence *incidence) |
3750 | { | 3750 | { |
3751 | schedule(Scheduler::Add,incidence); | 3751 | schedule(Scheduler::Add,incidence); |
3752 | } | 3752 | } |
3753 | 3753 | ||
3754 | void CalendarView::schedule_reply(Incidence *incidence) | 3754 | void CalendarView::schedule_reply(Incidence *incidence) |
3755 | { | 3755 | { |
3756 | schedule(Scheduler::Reply,incidence); | 3756 | schedule(Scheduler::Reply,incidence); |
3757 | } | 3757 | } |
3758 | 3758 | ||
3759 | void CalendarView::schedule_counter(Incidence *incidence) | 3759 | void CalendarView::schedule_counter(Incidence *incidence) |
3760 | { | 3760 | { |
3761 | schedule(Scheduler::Counter,incidence); | 3761 | schedule(Scheduler::Counter,incidence); |
3762 | } | 3762 | } |
3763 | 3763 | ||
3764 | void CalendarView::schedule_declinecounter(Incidence *incidence) | 3764 | void CalendarView::schedule_declinecounter(Incidence *incidence) |
3765 | { | 3765 | { |
3766 | schedule(Scheduler::Declinecounter,incidence); | 3766 | schedule(Scheduler::Declinecounter,incidence); |
3767 | } | 3767 | } |
3768 | 3768 | ||
3769 | void CalendarView::schedule_publish_freebusy(int daysToPublish) | 3769 | void CalendarView::schedule_publish_freebusy(int daysToPublish) |
3770 | { | 3770 | { |
3771 | QDateTime start = QDateTime::currentDateTime(); | 3771 | QDateTime start = QDateTime::currentDateTime(); |
3772 | QDateTime end = start.addDays(daysToPublish); | 3772 | QDateTime end = start.addDays(daysToPublish); |
3773 | 3773 | ||
3774 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); | 3774 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); |
3775 | freebusy->setOrganizer(KOPrefs::instance()->email()); | 3775 | freebusy->setOrganizer(KOPrefs::instance()->email()); |
3776 | 3776 | ||
3777 | 3777 | ||
3778 | PublishDialog *publishdlg = new PublishDialog(); | 3778 | PublishDialog *publishdlg = new PublishDialog(); |
3779 | if ( publishdlg->exec() == QDialog::Accepted ) { | 3779 | if ( publishdlg->exec() == QDialog::Accepted ) { |
3780 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3780 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3781 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { | 3781 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { |
3782 | delete(freebusy); | 3782 | delete(freebusy); |
3783 | } | 3783 | } |
3784 | } | 3784 | } |
3785 | delete publishdlg; | 3785 | delete publishdlg; |
3786 | } | 3786 | } |
3787 | 3787 | ||
3788 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) | 3788 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) |
3789 | { | 3789 | { |
3790 | Event *event = 0; | 3790 | Event *event = 0; |
3791 | Todo *todo = 0; | 3791 | Todo *todo = 0; |
3792 | 3792 | ||
3793 | if (incidence == 0) { | 3793 | if (incidence == 0) { |
3794 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3794 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3795 | if (incidence == 0) { | 3795 | if (incidence == 0) { |
3796 | incidence = mTodoList->selectedIncidences().first(); | 3796 | incidence = mTodoList->selectedIncidences().first(); |
3797 | } | 3797 | } |
3798 | } | 3798 | } |
3799 | if ( incidence && incidence->typeID() == eventID ) { | 3799 | if ( incidence && incidence->typeID() == eventID ) { |
3800 | event = static_cast<Event *>(incidence); | 3800 | event = static_cast<Event *>(incidence); |
3801 | } | 3801 | } |
3802 | if ( incidence && incidence->typeID() == todoID ) { | 3802 | if ( incidence && incidence->typeID() == todoID ) { |
3803 | todo = static_cast<Todo *>(incidence); | 3803 | todo = static_cast<Todo *>(incidence); |
3804 | } | 3804 | } |
3805 | 3805 | ||
3806 | if (!event && !todo) { | 3806 | if (!event && !todo) { |
3807 | KMessageBox::sorry(this,i18n("No event selected.")); | 3807 | KMessageBox::sorry(this,i18n("No event selected.")); |
3808 | return; | 3808 | return; |
3809 | } | 3809 | } |
3810 | 3810 | ||
3811 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { | 3811 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { |
3812 | KMessageBox::sorry(this,i18n("The event has no attendees.")); | 3812 | KMessageBox::sorry(this,i18n("The event has no attendees.")); |
3813 | return; | 3813 | return; |
3814 | } | 3814 | } |
3815 | 3815 | ||
3816 | Event *ev = 0; | 3816 | Event *ev = 0; |
3817 | if (event) ev = new Event(*event); | 3817 | if (event) ev = new Event(*event); |
3818 | Todo *to = 0; | 3818 | Todo *to = 0; |
3819 | if (todo) to = new Todo(*todo); | 3819 | if (todo) to = new Todo(*todo); |
3820 | 3820 | ||
3821 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { | 3821 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { |
3822 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 3822 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
3823 | if (!me) { | 3823 | if (!me) { |
3824 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); | 3824 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); |
3825 | return; | 3825 | return; |
3826 | } | 3826 | } |
3827 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { | 3827 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { |
3828 | StatusDialog *statdlg = new StatusDialog(this); | 3828 | StatusDialog *statdlg = new StatusDialog(this); |
3829 | if (!statdlg->exec()==QDialog::Accepted) return; | 3829 | if (!statdlg->exec()==QDialog::Accepted) return; |
3830 | me->setStatus( statdlg->status() ); | 3830 | me->setStatus( statdlg->status() ); |
3831 | delete(statdlg); | 3831 | delete(statdlg); |
3832 | } | 3832 | } |
3833 | Attendee *menew = new Attendee(*me); | 3833 | Attendee *menew = new Attendee(*me); |
3834 | if (ev) { | 3834 | if (ev) { |
3835 | ev->clearAttendees(); | 3835 | ev->clearAttendees(); |
3836 | ev->addAttendee(menew,false); | 3836 | ev->addAttendee(menew,false); |
3837 | } else { | 3837 | } else { |
3838 | if (to) { | 3838 | if (to) { |
3839 | todo->clearAttendees(); | 3839 | todo->clearAttendees(); |
3840 | todo->addAttendee(menew,false); | 3840 | todo->addAttendee(menew,false); |
3841 | } | 3841 | } |
3842 | } | 3842 | } |
3843 | } | 3843 | } |
3844 | 3844 | ||
3845 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3845 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3846 | if (ev) { | 3846 | if (ev) { |
3847 | if ( !dlg->addMessage(ev,method) ) delete(ev); | 3847 | if ( !dlg->addMessage(ev,method) ) delete(ev); |
3848 | } else { | 3848 | } else { |
3849 | if (to) { | 3849 | if (to) { |
3850 | if ( !dlg->addMessage(to,method) ) delete(to); | 3850 | if ( !dlg->addMessage(to,method) ) delete(to); |
3851 | } | 3851 | } |
3852 | } | 3852 | } |
3853 | } | 3853 | } |
3854 | 3854 | ||
3855 | void CalendarView::openAddressbook() | 3855 | void CalendarView::openAddressbook() |
3856 | { | 3856 | { |
3857 | KRun::runCommand("kaddressbook"); | 3857 | KRun::runCommand("kaddressbook"); |
3858 | } | 3858 | } |
3859 | 3859 | ||
3860 | void CalendarView::setModified(bool modified) | 3860 | void CalendarView::setModified(bool modified) |
3861 | { | 3861 | { |
3862 | if ( modified ) | 3862 | if ( modified ) |
3863 | emit signalmodified(); | 3863 | emit signalmodified(); |
3864 | if (mModified != modified) { | 3864 | if (mModified != modified) { |
3865 | mModified = modified; | 3865 | mModified = modified; |
3866 | emit modifiedChanged(mModified); | 3866 | emit modifiedChanged(mModified); |
3867 | } | 3867 | } |
3868 | } | 3868 | } |
3869 | 3869 | ||
3870 | bool CalendarView::isReadOnly() | 3870 | bool CalendarView::isReadOnly() |
3871 | { | 3871 | { |
3872 | return mReadOnly; | 3872 | return mReadOnly; |
3873 | } | 3873 | } |
3874 | 3874 | ||
3875 | void CalendarView::setReadOnly(bool readOnly) | 3875 | void CalendarView::setReadOnly(bool readOnly) |
3876 | { | 3876 | { |
3877 | if (mReadOnly != readOnly) { | 3877 | if (mReadOnly != readOnly) { |
3878 | mReadOnly = readOnly; | 3878 | mReadOnly = readOnly; |
3879 | emit readOnlyChanged(mReadOnly); | 3879 | emit readOnlyChanged(mReadOnly); |
3880 | } | 3880 | } |
3881 | } | 3881 | } |
3882 | 3882 | ||
3883 | bool CalendarView::isModified() | 3883 | bool CalendarView::isModified() |
3884 | { | 3884 | { |
3885 | return mModified; | 3885 | return mModified; |
3886 | } | 3886 | } |
3887 | void CalendarView::slotprintSelInc() | 3887 | void CalendarView::slotprintSelInc() |
3888 | { | 3888 | { |
3889 | if ( currentSelection() == 0 ) { | 3889 | if ( currentSelection() == 0 ) { |
3890 | KMessageBox::sorry(this,i18n("There is nothing selected!")); | 3890 | KMessageBox::sorry(this,i18n("There is nothing selected!")); |
3891 | return; | 3891 | return; |
3892 | } | 3892 | } |
3893 | showIncidence(); | 3893 | showIncidence(); |
3894 | getEventViewerDialog()->print(); | 3894 | getEventViewerDialog()->print(); |
3895 | 3895 | ||
3896 | } | 3896 | } |
3897 | void CalendarView::printSetup() | 3897 | void CalendarView::printSetup() |
3898 | { | 3898 | { |
3899 | #ifndef KORG_NOPRINTER | 3899 | #ifndef KORG_NOPRINTER |
3900 | createPrinter(); | 3900 | createPrinter(); |
3901 | 3901 | ||
3902 | mCalPrinter->setupPrinter(); | 3902 | mCalPrinter->setupPrinter(); |
3903 | #endif | 3903 | #endif |
3904 | } | 3904 | } |
3905 | 3905 | ||
3906 | void CalendarView::print() | 3906 | void CalendarView::print() |
3907 | { | 3907 | { |
3908 | #ifndef KORG_NOPRINTER | 3908 | #ifndef KORG_NOPRINTER |
3909 | createPrinter(); | 3909 | createPrinter(); |
3910 | 3910 | ||
3911 | DateList tmpDateList = mNavigator->selectedDates(); | 3911 | DateList tmpDateList = mNavigator->selectedDates(); |
3912 | mCalPrinter->print(CalPrinter::Month, | 3912 | mCalPrinter->print(CalPrinter::Month, |
3913 | tmpDateList.first(), tmpDateList.last()); | 3913 | tmpDateList.first(), tmpDateList.last()); |
3914 | #endif | 3914 | #endif |
3915 | } | 3915 | } |
3916 | 3916 | ||
3917 | void CalendarView::printPreview() | 3917 | void CalendarView::printPreview() |
3918 | { | 3918 | { |
3919 | #ifndef KORG_NOPRINTER | 3919 | #ifndef KORG_NOPRINTER |
3920 | kdDebug() << "CalendarView::printPreview()" << endl; | 3920 | kdDebug() << "CalendarView::printPreview()" << endl; |
3921 | 3921 | ||
3922 | createPrinter(); | 3922 | createPrinter(); |
3923 | 3923 | ||
3924 | DateList tmpDateList = mNavigator->selectedDates(); | 3924 | DateList tmpDateList = mNavigator->selectedDates(); |
3925 | 3925 | ||
3926 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), | 3926 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), |
3927 | tmpDateList.last()); | 3927 | tmpDateList.last()); |
3928 | #endif | 3928 | #endif |
3929 | } | 3929 | } |
3930 | 3930 | ||
3931 | void CalendarView::exportICalendar() | 3931 | void CalendarView::exportICalendar() |
3932 | { | 3932 | { |
3933 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); | 3933 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); |
3934 | 3934 | ||
3935 | // Force correct extension | 3935 | // Force correct extension |
3936 | if (filename.right(4) != ".ics") filename += ".ics"; | 3936 | if (filename.right(4) != ".ics") filename += ".ics"; |
3937 | 3937 | ||
3938 | FileStorage storage( mCalendar, filename, new ICalFormat() ); | 3938 | FileStorage storage( mCalendar, filename, new ICalFormat() ); |
3939 | storage.save(); | 3939 | storage.save(); |
3940 | } | 3940 | } |
3941 | 3941 | ||
3942 | bool CalendarView::exportVCalendar( QString filename ) | 3942 | bool CalendarView::exportVCalendar( QString filename ) |
3943 | { | 3943 | { |
3944 | if (mCalendar->journals().count() > 0) { | 3944 | if (mCalendar->journals().count() > 0) { |
3945 | int result = KMessageBox::warningContinueCancel(this, | 3945 | int result = KMessageBox::warningContinueCancel(this, |
3946 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 3946 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
3947 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 3947 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
3948 | true); | 3948 | true); |
3949 | if (result != KMessageBox::Continue) return false; | 3949 | if (result != KMessageBox::Continue) return false; |
3950 | } | 3950 | } |
3951 | 3951 | ||
3952 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); | 3952 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); |
3953 | 3953 | ||
3954 | // Force correct extension | 3954 | // Force correct extension |
3955 | if (filename.right(4) != ".vcs") filename += ".vcs"; | 3955 | if (filename.right(4) != ".vcs") filename += ".vcs"; |
3956 | 3956 | ||
3957 | FileStorage storage( mCalendar, filename, new VCalFormat ); | 3957 | FileStorage storage( mCalendar, filename, new VCalFormat ); |
3958 | return storage.save(); | 3958 | return storage.save(); |
3959 | 3959 | ||
3960 | } | 3960 | } |
3961 | 3961 | ||
3962 | void CalendarView::eventUpdated(Incidence *) | 3962 | void CalendarView::eventUpdated(Incidence *) |
3963 | { | 3963 | { |
3964 | setModified(); | 3964 | setModified(); |
3965 | // Don't call updateView here. The code, which has caused the update of the | 3965 | // Don't call updateView here. The code, which has caused the update of the |
3966 | // event is responsible for updating the view. | 3966 | // event is responsible for updating the view. |
3967 | // updateView(); | 3967 | // updateView(); |
3968 | } | 3968 | } |
3969 | 3969 | ||
3970 | void CalendarView::adaptNavigationUnits() | 3970 | void CalendarView::adaptNavigationUnits() |
3971 | { | 3971 | { |
3972 | if (mViewManager->currentView()->isEventView()) { | 3972 | if (mViewManager->currentView()->isEventView()) { |
3973 | int days = mViewManager->currentView()->currentDateCount(); | 3973 | int days = mViewManager->currentView()->currentDateCount(); |
3974 | if (days == 1) { | 3974 | if (days == 1) { |
3975 | emit changeNavStringPrev(i18n("&Previous Day")); | 3975 | emit changeNavStringPrev(i18n("&Previous Day")); |
3976 | emit changeNavStringNext(i18n("&Next Day")); | 3976 | emit changeNavStringNext(i18n("&Next Day")); |
3977 | } else { | 3977 | } else { |
3978 | emit changeNavStringPrev(i18n("&Previous Week")); | 3978 | emit changeNavStringPrev(i18n("&Previous Week")); |
3979 | emit changeNavStringNext(i18n("&Next Week")); | 3979 | emit changeNavStringNext(i18n("&Next Week")); |
3980 | } | 3980 | } |
3981 | } | 3981 | } |
3982 | } | 3982 | } |
3983 | 3983 | ||
3984 | void CalendarView::processMainViewSelection( Incidence *incidence ) | 3984 | void CalendarView::processMainViewSelection( Incidence *incidence ) |
3985 | { | 3985 | { |
3986 | if ( incidence ) mTodoList->clearSelection(); | 3986 | if ( incidence ) mTodoList->clearSelection(); |
3987 | processIncidenceSelection( incidence ); | 3987 | processIncidenceSelection( incidence ); |
3988 | } | 3988 | } |
3989 | 3989 | ||
3990 | void CalendarView::processTodoListSelection( Incidence *incidence ) | 3990 | void CalendarView::processTodoListSelection( Incidence *incidence ) |
3991 | { | 3991 | { |
3992 | if ( incidence && mViewManager->currentView() ) { | 3992 | if ( incidence && mViewManager->currentView() ) { |
3993 | mViewManager->currentView()->clearSelection(); | 3993 | mViewManager->currentView()->clearSelection(); |
3994 | } | 3994 | } |
3995 | processIncidenceSelection( incidence ); | 3995 | processIncidenceSelection( incidence ); |
3996 | } | 3996 | } |
3997 | 3997 | ||
3998 | void CalendarView::processIncidenceSelection( Incidence *incidence ) | 3998 | void CalendarView::processIncidenceSelection( Incidence *incidence ) |
3999 | { | 3999 | { |
4000 | emit incidenceSelected( incidence ); | ||
4000 | if ( incidence == mSelectedIncidence ) return; | 4001 | if ( incidence == mSelectedIncidence ) return; |
4001 | |||
4002 | mSelectedIncidence = incidence; | 4002 | mSelectedIncidence = incidence; |
4003 | 4003 | ||
4004 | emit incidenceSelected( mSelectedIncidence ); | ||
4005 | |||
4006 | if ( incidence && incidence->typeID() == eventID ) { | 4004 | if ( incidence && incidence->typeID() == eventID ) { |
4007 | Event *event = static_cast<Event *>( incidence ); | 4005 | Event *event = static_cast<Event *>( incidence ); |
4008 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 4006 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
4009 | emit organizerEventsSelected( true ); | 4007 | emit organizerEventsSelected( true ); |
4010 | } else { | 4008 | } else { |
4011 | emit organizerEventsSelected(false); | 4009 | emit organizerEventsSelected(false); |
4012 | } | 4010 | } |
4013 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 4011 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
4014 | KOPrefs::instance()->email() ) ) { | 4012 | KOPrefs::instance()->email() ) ) { |
4015 | emit groupEventsSelected( true ); | 4013 | emit groupEventsSelected( true ); |
4016 | } else { | 4014 | } else { |
4017 | emit groupEventsSelected(false); | 4015 | emit groupEventsSelected(false); |
4018 | } | 4016 | } |
4019 | return; | 4017 | return; |
4020 | } else { | 4018 | } else { |
4021 | if ( incidence && incidence->typeID() == todoID ) { | 4019 | if ( incidence && incidence->typeID() == todoID ) { |
4022 | emit todoSelected( true ); | 4020 | emit todoSelected( true ); |
4023 | Todo *event = static_cast<Todo *>( incidence ); | 4021 | Todo *event = static_cast<Todo *>( incidence ); |
4024 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 4022 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
4025 | emit organizerEventsSelected( true ); | 4023 | emit organizerEventsSelected( true ); |
4026 | } else { | 4024 | } else { |
4027 | emit organizerEventsSelected(false); | 4025 | emit organizerEventsSelected(false); |
4028 | } | 4026 | } |
4029 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 4027 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
4030 | KOPrefs::instance()->email() ) ) { | 4028 | KOPrefs::instance()->email() ) ) { |
4031 | emit groupEventsSelected( true ); | 4029 | emit groupEventsSelected( true ); |
4032 | } else { | 4030 | } else { |
4033 | emit groupEventsSelected(false); | 4031 | emit groupEventsSelected(false); |
4034 | } | 4032 | } |
4035 | return; | 4033 | return; |
4036 | } else { | 4034 | } else { |
4037 | emit todoSelected( false ); | 4035 | emit todoSelected( false ); |
4038 | emit organizerEventsSelected(false); | 4036 | emit organizerEventsSelected(false); |
4039 | emit groupEventsSelected(false); | 4037 | emit groupEventsSelected(false); |
4040 | } | 4038 | } |
4041 | return; | 4039 | return; |
4042 | } | 4040 | } |
4043 | 4041 | ||
4044 | /* if ( incidence && incidence->typeID() == todoID ) { | 4042 | /* if ( incidence && incidence->typeID() == todoID ) { |
4045 | emit todoSelected( true ); | 4043 | emit todoSelected( true ); |
4046 | } else { | 4044 | } else { |
4047 | emit todoSelected( false ); | 4045 | emit todoSelected( false ); |
4048 | }*/ | 4046 | }*/ |
4049 | } | 4047 | } |
4050 | 4048 | ||
4051 | 4049 | ||
4052 | void CalendarView::checkClipboard() | 4050 | void CalendarView::checkClipboard() |
4053 | { | 4051 | { |
4054 | #ifndef KORG_NODND | 4052 | #ifndef KORG_NODND |
4055 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 4053 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
4056 | emit pasteEnabled(true); | 4054 | emit pasteEnabled(true); |
4057 | } else { | 4055 | } else { |
4058 | emit pasteEnabled(false); | 4056 | emit pasteEnabled(false); |
4059 | } | 4057 | } |
4060 | #endif | 4058 | #endif |
4061 | } | 4059 | } |
4062 | 4060 | ||
4063 | void CalendarView::showDates(const DateList &selectedDates) | 4061 | void CalendarView::showDates(const DateList &selectedDates) |
4064 | { | 4062 | { |
4065 | // kdDebug() << "CalendarView::selectDates()" << endl; | 4063 | // kdDebug() << "CalendarView::selectDates()" << endl; |
4066 | 4064 | ||
4067 | 4065 | ||
4068 | if ( !mBlockShowDates ) { | 4066 | if ( !mBlockShowDates ) { |
4069 | if ( mViewManager->currentView() ) { | 4067 | if ( mViewManager->currentView() ) { |
4070 | updateView( selectedDates.first(), selectedDates.last() ); | 4068 | updateView( selectedDates.first(), selectedDates.last() ); |
4071 | } else { | 4069 | } else { |
4072 | mViewManager->showAgendaView(); | 4070 | mViewManager->showAgendaView(); |
4073 | } | 4071 | } |
4074 | } | 4072 | } |
4075 | 4073 | ||
4076 | QDate date = selectedDates.first(); | 4074 | QDate date = selectedDates.first(); |
4077 | if ( ! date.isValid() ) { | 4075 | if ( ! date.isValid() ) { |
4078 | topLevelWidget()->setCaption(""); | 4076 | topLevelWidget()->setCaption(""); |
4079 | return; | 4077 | return; |
4080 | } | 4078 | } |
4081 | 4079 | ||
4082 | QString selDates; | 4080 | QString selDates; |
4083 | selDates = KGlobal::locale()->formatDate( date, true); | 4081 | selDates = KGlobal::locale()->formatDate( date, true); |
4084 | if (selectedDates.first() < selectedDates.last() ) | 4082 | if (selectedDates.first() < selectedDates.last() ) |
4085 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 4083 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
4086 | else { | 4084 | else { |
4087 | QString addString; | 4085 | QString addString; |
4088 | if ( date == QDateTime::currentDateTime().date() ) | 4086 | if ( date == QDateTime::currentDateTime().date() ) |
4089 | addString = i18n("Today"); | 4087 | addString = i18n("Today"); |
4090 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 4088 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
4091 | addString = i18n("Tomorrow"); | 4089 | addString = i18n("Tomorrow"); |
4092 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) | 4090 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) |
4093 | addString = i18n("Yesterday"); | 4091 | addString = i18n("Yesterday"); |
4094 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) | 4092 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) |
4095 | addString = i18n("Day before yesterday"); | 4093 | addString = i18n("Day before yesterday"); |
4096 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) | 4094 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) |
4097 | addString = i18n("Day after tomorrow"); | 4095 | addString = i18n("Day after tomorrow"); |
4098 | if ( !addString.isEmpty() ) { | 4096 | if ( !addString.isEmpty() ) { |
4099 | topLevelWidget()->setCaption( addString+", " + selDates ); | 4097 | topLevelWidget()->setCaption( addString+", " + selDates ); |
4100 | return; | 4098 | return; |
4101 | } | 4099 | } |
4102 | } | 4100 | } |
4103 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 4101 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
4104 | 4102 | ||
4105 | } | 4103 | } |
4106 | 4104 | ||
4107 | QPtrList<CalFilter> CalendarView::filters() | 4105 | QPtrList<CalFilter> CalendarView::filters() |
4108 | { | 4106 | { |
4109 | return mFilters; | 4107 | return mFilters; |
4110 | 4108 | ||
4111 | } | 4109 | } |
4112 | void CalendarView::editFilters() | 4110 | void CalendarView::editFilters() |
4113 | { | 4111 | { |
4114 | // kdDebug() << "CalendarView::editFilters()" << endl; | 4112 | // kdDebug() << "CalendarView::editFilters()" << endl; |
4115 | 4113 | ||
4116 | CalFilter *filter = mFilters.first(); | 4114 | CalFilter *filter = mFilters.first(); |
4117 | while(filter) { | 4115 | while(filter) { |
4118 | filter = mFilters.next(); | 4116 | filter = mFilters.next(); |
4119 | } | 4117 | } |
4120 | 4118 | ||
4121 | mDialogManager->showFilterEditDialog(&mFilters); | 4119 | mDialogManager->showFilterEditDialog(&mFilters); |
4122 | updateFilter(); | 4120 | updateFilter(); |
4123 | } | 4121 | } |
4124 | void CalendarView::toggleFilter() | 4122 | void CalendarView::toggleFilter() |
4125 | { | 4123 | { |
4126 | if ( mLeftFrame->isHidden() ) { | 4124 | if ( mLeftFrame->isHidden() ) { |
4127 | toggleExpand(); | 4125 | toggleExpand(); |
4128 | showFilter( true ); | 4126 | showFilter( true ); |
4129 | } else | 4127 | } else |
4130 | showFilter(! mCalEditView->isVisible()); | 4128 | showFilter(! mCalEditView->isVisible()); |
4131 | } | 4129 | } |
4132 | 4130 | ||
4133 | KOFilterView *CalendarView::filterView() | 4131 | KOFilterView *CalendarView::filterView() |
4134 | { | 4132 | { |
4135 | return mFilterView; | 4133 | return mFilterView; |
4136 | } | 4134 | } |
4137 | void CalendarView::selectFilter( int fil ) | 4135 | void CalendarView::selectFilter( int fil ) |
4138 | { | 4136 | { |
4139 | mFilterView->setSelectedFilter( fil ); | 4137 | mFilterView->setSelectedFilter( fil ); |
4140 | updateUnmanagedViews(); | 4138 | updateUnmanagedViews(); |
4141 | } | 4139 | } |
4142 | void CalendarView::showFilter(bool visible) | 4140 | void CalendarView::showFilter(bool visible) |
4143 | { | 4141 | { |
4144 | #if 1 | 4142 | #if 1 |
4145 | if (visible) { | 4143 | if (visible) { |
4146 | mCalEditView->readConfig(); | 4144 | mCalEditView->readConfig(); |
4147 | mCalEditView->show(); | 4145 | mCalEditView->show(); |
4148 | QValueList<int> sizes; | 4146 | QValueList<int> sizes; |
4149 | sizes = mLeftFrame->sizes(); | 4147 | sizes = mLeftFrame->sizes(); |
4150 | if ( sizes.count() == 4 && sizes[3] < 20 ) { | 4148 | if ( sizes.count() == 4 && sizes[3] < 20 ) { |
4151 | sizes.clear(); | 4149 | sizes.clear(); |
4152 | sizes << 100; | 4150 | sizes << 100; |
4153 | sizes << 0; | 4151 | sizes << 0; |
4154 | sizes << 0; | 4152 | sizes << 0; |
4155 | sizes << 100; | 4153 | sizes << 100; |
4156 | mLeftFrame->setSizes(sizes); | 4154 | mLeftFrame->setSizes(sizes); |
4157 | } | 4155 | } |
4158 | #if 0 | 4156 | #if 0 |
4159 | sizes = mLeftFrame->sizes(); | 4157 | sizes = mLeftFrame->sizes(); |
4160 | int ccc = 0; | 4158 | int ccc = 0; |
4161 | while ( ccc < sizes.count()) { | 4159 | while ( ccc < sizes.count()) { |
4162 | qDebug("size %d %d ", ccc, sizes[ccc]); | 4160 | qDebug("size %d %d ", ccc, sizes[ccc]); |
4163 | ++ccc; | 4161 | ++ccc; |
4164 | } | 4162 | } |
4165 | #endif | 4163 | #endif |
4166 | 4164 | ||
4167 | } | 4165 | } |
4168 | else { | 4166 | else { |
4169 | mCalEditView->hide(); | 4167 | mCalEditView->hide(); |
4170 | } | 4168 | } |
4171 | #else | 4169 | #else |
4172 | if (visible) mFilterView->show(); | 4170 | if (visible) mFilterView->show(); |
4173 | else mFilterView->hide(); | 4171 | else mFilterView->hide(); |
4174 | #endif | 4172 | #endif |
4175 | } | 4173 | } |
4176 | void CalendarView::toggleFilerEnabled( ) | 4174 | void CalendarView::toggleFilerEnabled( ) |
4177 | { | 4175 | { |
4178 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 4176 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
4179 | if ( !mFilterView->filtersEnabled() ) | 4177 | if ( !mFilterView->filtersEnabled() ) |
4180 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 4178 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
4181 | updateUnmanagedViews(); | 4179 | updateUnmanagedViews(); |
4182 | 4180 | ||
4183 | } | 4181 | } |
4184 | void CalendarView::updateFilter() | 4182 | void CalendarView::updateFilter() |
4185 | { | 4183 | { |
4186 | CalFilter *filter = mFilterView->selectedFilter(); | 4184 | CalFilter *filter = mFilterView->selectedFilter(); |
4187 | if (filter) { | 4185 | if (filter) { |
4188 | QString mess; | 4186 | QString mess; |
4189 | if (mFilterView->filtersEnabled()) { | 4187 | if (mFilterView->filtersEnabled()) { |
4190 | mess = i18n("Filter selected: ")+filter->name(); | 4188 | mess = i18n("Filter selected: ")+filter->name(); |
4191 | filter->setEnabled(true); | 4189 | filter->setEnabled(true); |
4192 | } | 4190 | } |
4193 | else filter->setEnabled(false); | 4191 | else filter->setEnabled(false); |
4194 | mCalendar->setFilter(filter); | 4192 | mCalendar->setFilter(filter); |
4195 | updateView(); | 4193 | updateView(); |
4196 | if ( !mess.isEmpty() ) | 4194 | if ( !mess.isEmpty() ) |
4197 | topLevelWidget()->setCaption( mess ); | 4195 | topLevelWidget()->setCaption( mess ); |
4198 | 4196 | ||
4199 | } | 4197 | } |
4200 | emit filtersUpdated(); | 4198 | emit filtersUpdated(); |
4201 | } | 4199 | } |
4202 | 4200 | ||
4203 | void CalendarView::filterEdited() | 4201 | void CalendarView::filterEdited() |
4204 | { | 4202 | { |
4205 | mFilterView->updateFilters(); | 4203 | mFilterView->updateFilters(); |
4206 | updateFilter(); | 4204 | updateFilter(); |
4207 | writeSettings(); | 4205 | writeSettings(); |
4208 | } | 4206 | } |
4209 | 4207 | ||
4210 | 4208 | ||
4211 | void CalendarView::takeOverEvent() | 4209 | void CalendarView::takeOverEvent() |
4212 | { | 4210 | { |
4213 | Incidence *incidence = currentSelection(); | 4211 | Incidence *incidence = currentSelection(); |
4214 | 4212 | ||
4215 | if (!incidence) return; | 4213 | if (!incidence) return; |
4216 | 4214 | ||
4217 | incidence->setOrganizer(KOPrefs::instance()->email()); | 4215 | incidence->setOrganizer(KOPrefs::instance()->email()); |
4218 | incidence->recreate(); | 4216 | incidence->recreate(); |
4219 | incidence->setReadOnly(false); | 4217 | incidence->setReadOnly(false); |
4220 | 4218 | ||
4221 | updateView(); | 4219 | updateView(); |
4222 | } | 4220 | } |
4223 | 4221 | ||
4224 | void CalendarView::takeOverCalendar() | 4222 | void CalendarView::takeOverCalendar() |
4225 | { | 4223 | { |
4226 | // TODO: Create Calendar::allIncidences() function and use it here | 4224 | // TODO: Create Calendar::allIncidences() function and use it here |
4227 | 4225 | ||
4228 | clearAllViews(); | 4226 | clearAllViews(); |
4229 | QPtrList<Event> events = mCalendar->events(); | 4227 | QPtrList<Event> events = mCalendar->events(); |
4230 | for(uint i=0; i<events.count(); ++i) { | 4228 | for(uint i=0; i<events.count(); ++i) { |
4231 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); | 4229 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); |
4232 | events.at(i)->recreate(); | 4230 | events.at(i)->recreate(); |
4233 | events.at(i)->setReadOnly(false); | 4231 | events.at(i)->setReadOnly(false); |
4234 | } | 4232 | } |
4235 | 4233 | ||
4236 | QPtrList<Todo> todos = mCalendar->todos(); | 4234 | QPtrList<Todo> todos = mCalendar->todos(); |
4237 | for(uint i=0; i<todos.count(); ++i) { | 4235 | for(uint i=0; i<todos.count(); ++i) { |
4238 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); | 4236 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); |
4239 | todos.at(i)->recreate(); | 4237 | todos.at(i)->recreate(); |
4240 | todos.at(i)->setReadOnly(false); | 4238 | todos.at(i)->setReadOnly(false); |
4241 | } | 4239 | } |
4242 | 4240 | ||
4243 | QPtrList<Journal> journals = mCalendar->journals(); | 4241 | QPtrList<Journal> journals = mCalendar->journals(); |
4244 | for(uint i=0; i<journals.count(); ++i) { | 4242 | for(uint i=0; i<journals.count(); ++i) { |
4245 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); | 4243 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); |
4246 | journals.at(i)->recreate(); | 4244 | journals.at(i)->recreate(); |
4247 | journals.at(i)->setReadOnly(false); | 4245 | journals.at(i)->setReadOnly(false); |
4248 | } | 4246 | } |
4249 | 4247 | ||
4250 | updateView(); | 4248 | updateView(); |
4251 | } | 4249 | } |
4252 | 4250 | ||
4253 | void CalendarView::showIntro() | 4251 | void CalendarView::showIntro() |
4254 | { | 4252 | { |
4255 | kdDebug() << "To be implemented." << endl; | 4253 | kdDebug() << "To be implemented." << endl; |
4256 | } | 4254 | } |
4257 | 4255 | ||
4258 | QWidgetStack *CalendarView::viewStack() | 4256 | QWidgetStack *CalendarView::viewStack() |
4259 | { | 4257 | { |
4260 | return mRightFrame; | 4258 | return mRightFrame; |
4261 | } | 4259 | } |
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 92c1cd6..acdf5a0 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -1,413 +1,412 @@ | |||
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 | Marcus Bains line. | 5 | Marcus Bains line. |
6 | Copyright (c) 2001 Ali Rahimi | 6 | Copyright (c) 2001 Ali Rahimi |
7 | 7 | ||
8 | This program is free software; you can redistribute it and/or modify | 8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or | 10 | the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. | 11 | (at your option) any later version. |
12 | 12 | ||
13 | This program is distributed in the hope that it will be useful, | 13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 16 | GNU General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | 19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 | 21 | ||
22 | As a special exception, permission is given to link this program | 22 | As a special exception, permission is given to link this program |
23 | with any edition of Qt, and distribute the resulting executable, | 23 | with any edition of Qt, and distribute the resulting executable, |
24 | without including the source code for Qt in the source distribution. | 24 | without including the source code for Qt in the source distribution. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifndef _WIN32_ | 27 | #ifndef _WIN32_ |
28 | #define protected public | 28 | #define protected public |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #undef protected | 30 | #undef protected |
31 | #endif | 31 | #endif |
32 | #include <qintdict.h> | 32 | #include <qintdict.h> |
33 | #include <qdatetime.h> | 33 | #include <qdatetime.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | #include <qcursor.h> | 36 | #include <qcursor.h> |
37 | #include <qpainter.h> | 37 | #include <qpainter.h> |
38 | 38 | ||
39 | #include <kdebug.h> | 39 | #include <kdebug.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
42 | #include <kglobal.h> | 42 | #include <kglobal.h> |
43 | 43 | ||
44 | #include "koagendaitem.h" | 44 | #include "koagendaitem.h" |
45 | #include "koprefs.h" | 45 | #include "koprefs.h" |
46 | #include "koglobals.h" | 46 | #include "koglobals.h" |
47 | 47 | ||
48 | #include "koagenda.h" | 48 | #include "koagenda.h" |
49 | 49 | ||
50 | #include <libkcal/event.h> | 50 | #include <libkcal/event.h> |
51 | #include <libkcal/todo.h> | 51 | #include <libkcal/todo.h> |
52 | 52 | ||
53 | #ifndef DESKTOP_VERSION | 53 | #ifndef DESKTOP_VERSION |
54 | #include <qpe/qpeapplication.h> | 54 | #include <qpe/qpeapplication.h> |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | //extern bool globalFlagBlockPainting; | 57 | //extern bool globalFlagBlockPainting; |
58 | extern int globalFlagBlockAgenda; | 58 | extern int globalFlagBlockAgenda; |
59 | extern int globalFlagBlockAgendaItemPaint; | 59 | extern int globalFlagBlockAgendaItemPaint; |
60 | extern int globalFlagBlockAgendaItemUpdate; | 60 | extern int globalFlagBlockAgendaItemUpdate; |
61 | extern int globalFlagBlockStartup; | 61 | extern int globalFlagBlockStartup; |
62 | 62 | ||
63 | 63 | ||
64 | //////////////////////////////////////////////////////////////////////////// | 64 | //////////////////////////////////////////////////////////////////////////// |
65 | MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) | 65 | MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) |
66 | : QFrame(_agenda->viewport(),name), agenda(_agenda) | 66 | : QFrame(_agenda->viewport(),name), agenda(_agenda) |
67 | { | 67 | { |
68 | setLineWidth(0); | 68 | setLineWidth(0); |
69 | setMargin(0); | 69 | setMargin(0); |
70 | setBackgroundColor(Qt::red); | 70 | setBackgroundColor(Qt::red); |
71 | minutes = new QTimer(this); | 71 | minutes = new QTimer(this); |
72 | connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); | 72 | connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); |
73 | minutes->start(0, true); | 73 | minutes->start(0, true); |
74 | mTimeBox = new QLabel(this); | 74 | mTimeBox = new QLabel(this); |
75 | mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); | 75 | mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); |
76 | QPalette pal = mTimeBox->palette(); | 76 | QPalette pal = mTimeBox->palette(); |
77 | pal.setColor(QColorGroup::Foreground, Qt::red); | 77 | pal.setColor(QColorGroup::Foreground, Qt::red); |
78 | mTimeBox->setPalette(pal); | 78 | mTimeBox->setPalette(pal); |
79 | //mTimeBox->setAutoMask(true); | 79 | //mTimeBox->setAutoMask(true); |
80 | 80 | ||
81 | agenda->addChild(mTimeBox); | 81 | agenda->addChild(mTimeBox); |
82 | 82 | ||
83 | oldToday = -1; | 83 | oldToday = -1; |
84 | } | 84 | } |
85 | 85 | ||
86 | MarcusBains::~MarcusBains() | 86 | MarcusBains::~MarcusBains() |
87 | { | 87 | { |
88 | //delete minutes; | 88 | //delete minutes; |
89 | } | 89 | } |
90 | 90 | ||
91 | int MarcusBains::todayColumn() | 91 | int MarcusBains::todayColumn() |
92 | { | 92 | { |
93 | QDate currentDate = QDate::currentDate(); | 93 | QDate currentDate = QDate::currentDate(); |
94 | 94 | ||
95 | DateList dateList = agenda->dateList(); | 95 | DateList dateList = agenda->dateList(); |
96 | DateList::ConstIterator it; | 96 | DateList::ConstIterator it; |
97 | int col = 0; | 97 | int col = 0; |
98 | for(it = dateList.begin(); it != dateList.end(); ++it) { | 98 | for(it = dateList.begin(); it != dateList.end(); ++it) { |
99 | if((*it) == currentDate) | 99 | if((*it) == currentDate) |
100 | return KOGlobals::self()->reverseLayout() ? | 100 | return KOGlobals::self()->reverseLayout() ? |
101 | agenda->columns() - 1 - col : col; | 101 | agenda->columns() - 1 - col : col; |
102 | ++col; | 102 | ++col; |
103 | } | 103 | } |
104 | 104 | ||
105 | return -1; | 105 | return -1; |
106 | } | 106 | } |
107 | void MarcusBains::updateLoc() | 107 | void MarcusBains::updateLoc() |
108 | { | 108 | { |
109 | updateLocation(); | 109 | updateLocation(); |
110 | } | 110 | } |
111 | void MarcusBains::updateLocation(bool recalculate) | 111 | void MarcusBains::updateLocation(bool recalculate) |
112 | { | 112 | { |
113 | 113 | ||
114 | QTime tim = QTime::currentTime(); | 114 | QTime tim = QTime::currentTime(); |
115 | //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); | 115 | //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); |
116 | if((tim.hour() == 0) && (oldTime.hour()==23)) | 116 | if((tim.hour() == 0) && (oldTime.hour()==23)) |
117 | recalculate = true; | 117 | recalculate = true; |
118 | 118 | ||
119 | int mins = tim.hour()*60 + tim.minute(); | 119 | int mins = tim.hour()*60 + tim.minute(); |
120 | int minutesPerCell = 24 * 60 / agenda->rows(); | 120 | int minutesPerCell = 24 * 60 / agenda->rows(); |
121 | int y = mins*agenda->gridSpacingY()/minutesPerCell; | 121 | int y = mins*agenda->gridSpacingY()/minutesPerCell; |
122 | int today = recalculate ? todayColumn() : oldToday; | 122 | int today = recalculate ? todayColumn() : oldToday; |
123 | int x = agenda->gridSpacingX()*today; | 123 | int x = agenda->gridSpacingX()*today; |
124 | bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); | 124 | bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); |
125 | 125 | ||
126 | oldTime = tim; | 126 | oldTime = tim; |
127 | oldToday = today; | 127 | oldToday = today; |
128 | 128 | ||
129 | if(disabled || (today<0)) { | 129 | if(disabled || (today<0)) { |
130 | hide(); mTimeBox->hide(); | 130 | hide(); mTimeBox->hide(); |
131 | return; | 131 | return; |
132 | } else { | 132 | } else { |
133 | show(); mTimeBox->show(); | 133 | show(); mTimeBox->show(); |
134 | } | 134 | } |
135 | 135 | ||
136 | if(recalculate) | 136 | if(recalculate) |
137 | setFixedSize(agenda->gridSpacingX(),1); | 137 | setFixedSize(agenda->gridSpacingX(),1); |
138 | agenda->moveChild(this, x, y); | 138 | agenda->moveChild(this, x, y); |
139 | raise(); | 139 | raise(); |
140 | 140 | ||
141 | if(recalculate) | 141 | if(recalculate) |
142 | //mTimeBox->setFont(QFont("helvetica",10)); | 142 | //mTimeBox->setFont(QFont("helvetica",10)); |
143 | mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); | 143 | mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); |
144 | 144 | ||
145 | mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); | 145 | mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); |
146 | mTimeBox->adjustSize(); | 146 | mTimeBox->adjustSize(); |
147 | // the -2 below is there because there is a bug in this program | 147 | // the -2 below is there because there is a bug in this program |
148 | // somewhere, where the last column of this widget is a few pixels | 148 | // somewhere, where the last column of this widget is a few pixels |
149 | // narrower than the other columns. | 149 | // narrower than the other columns. |
150 | int offs = (today==agenda->columns()-1) ? -4 : 0; | 150 | int offs = (today==agenda->columns()-1) ? -4 : 0; |
151 | agenda->moveChild(mTimeBox, | 151 | agenda->moveChild(mTimeBox, |
152 | x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, | 152 | x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, |
153 | y-mTimeBox->height()); | 153 | y-mTimeBox->height()); |
154 | mTimeBox->raise(); | 154 | mTimeBox->raise(); |
155 | //mTimeBox->setAutoMask(true); | 155 | //mTimeBox->setAutoMask(true); |
156 | int secs = QTime::currentTime().second(); | 156 | int secs = QTime::currentTime().second(); |
157 | qDebug("second %d ", secs ); | ||
158 | minutes->start( (60 - secs +1)*1000 ,true); | 157 | minutes->start( (60 - secs +1)*1000 ,true); |
159 | } | 158 | } |
160 | 159 | ||
161 | 160 | ||
162 | //////////////////////////////////////////////////////////////////////////// | 161 | //////////////////////////////////////////////////////////////////////////// |
163 | 162 | ||
164 | 163 | ||
165 | /* | 164 | /* |
166 | Create an agenda widget with rows rows and columns columns. | 165 | Create an agenda widget with rows rows and columns columns. |
167 | */ | 166 | */ |
168 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, | 167 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, |
169 | const char *name,WFlags f) : | 168 | const char *name,WFlags f) : |
170 | QScrollView(parent,name,f) | 169 | QScrollView(parent,name,f) |
171 | { | 170 | { |
172 | 171 | ||
173 | mAllAgendaPopup = 0; | 172 | mAllAgendaPopup = 0; |
174 | mColumns = columns; | 173 | mColumns = columns; |
175 | mRows = rows; | 174 | mRows = rows; |
176 | mGridSpacingY = rowSize; | 175 | mGridSpacingY = rowSize; |
177 | mAllDayMode = false; | 176 | mAllDayMode = false; |
178 | #ifndef DESKTOP_VERSION | 177 | #ifndef DESKTOP_VERSION |
179 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 178 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
180 | #endif | 179 | #endif |
181 | mHolidayMask = 0; | 180 | mHolidayMask = 0; |
182 | init(); | 181 | init(); |
183 | connect ( this, SIGNAL (contentsMoving ( int , int ) ), this, SLOT ( slotContentMove(int,int)) ); | 182 | connect ( this, SIGNAL (contentsMoving ( int , int ) ), this, SLOT ( slotContentMove(int,int)) ); |
184 | } | 183 | } |
185 | 184 | ||
186 | /* | 185 | /* |
187 | Create an agenda widget with columns columns and one row. This is used for | 186 | Create an agenda widget with columns columns and one row. This is used for |
188 | all-day events. | 187 | all-day events. |
189 | */ | 188 | */ |
190 | KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : | 189 | KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : |
191 | QScrollView(parent,name,f) | 190 | QScrollView(parent,name,f) |
192 | { | 191 | { |
193 | mAllAgendaPopup = 0; | 192 | mAllAgendaPopup = 0; |
194 | blockResize = false; | 193 | blockResize = false; |
195 | mColumns = columns; | 194 | mColumns = columns; |
196 | mRows = 1; | 195 | mRows = 1; |
197 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); | 196 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); |
198 | mGridSpacingY = KOPrefs::instance()->mAllDaySize; | 197 | mGridSpacingY = KOPrefs::instance()->mAllDaySize; |
199 | mAllDayMode = true; | 198 | mAllDayMode = true; |
200 | #ifndef DESKTOP_VERSION | 199 | #ifndef DESKTOP_VERSION |
201 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 200 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
202 | #endif | 201 | #endif |
203 | mHolidayMask = 0; | 202 | mHolidayMask = 0; |
204 | init(); | 203 | init(); |
205 | } | 204 | } |
206 | 205 | ||
207 | 206 | ||
208 | KOAgenda::~KOAgenda() | 207 | KOAgenda::~KOAgenda() |
209 | { | 208 | { |
210 | if(mMarcusBains) delete mMarcusBains; | 209 | if(mMarcusBains) delete mMarcusBains; |
211 | 210 | ||
212 | } | 211 | } |
213 | 212 | ||
214 | Incidence *KOAgenda::selectedIncidence() const | 213 | Incidence *KOAgenda::selectedIncidence() const |
215 | { | 214 | { |
216 | return (mSelectedItem ? mSelectedItem->incidence() : 0); | 215 | return (mSelectedItem ? mSelectedItem->incidence() : 0); |
217 | } | 216 | } |
218 | 217 | ||
219 | 218 | ||
220 | QDate KOAgenda::selectedIncidenceDate() const | 219 | QDate KOAgenda::selectedIncidenceDate() const |
221 | { | 220 | { |
222 | return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); | 221 | return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); |
223 | } | 222 | } |
224 | 223 | ||
225 | 224 | ||
226 | void KOAgenda::init() | 225 | void KOAgenda::init() |
227 | { | 226 | { |
228 | mPopupTimer = new QTimer(this); | 227 | mPopupTimer = new QTimer(this); |
229 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | 228 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); |
230 | 229 | ||
231 | mNewItemPopup = new QPopupMenu( this ); | 230 | mNewItemPopup = new QPopupMenu( this ); |
232 | connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); | 231 | connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); |
233 | QString pathString = ""; | 232 | QString pathString = ""; |
234 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { | 233 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { |
235 | if ( QApplication::desktop()->width() < 480 ) | 234 | if ( QApplication::desktop()->width() < 480 ) |
236 | pathString += "icons16/"; | 235 | pathString += "icons16/"; |
237 | } else | 236 | } else |
238 | pathString += "iconsmini/"; | 237 | pathString += "iconsmini/"; |
239 | 238 | ||
240 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); | 239 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); |
241 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); | 240 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); |
242 | mNewItemPopup->insertSeparator ( ); | 241 | mNewItemPopup->insertSeparator ( ); |
243 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); | 242 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); |
244 | mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); | 243 | mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); |
245 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); | 244 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); |
246 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); | 245 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); |
247 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 ); | 246 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 ); |
248 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); | 247 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); |
249 | #ifndef _WIN32_ | 248 | #ifndef _WIN32_ |
250 | int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase | 249 | int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase |
251 | viewport()->setWFlags ( wflags); | 250 | viewport()->setWFlags ( wflags); |
252 | #endif | 251 | #endif |
253 | mGridSpacingX = 80; | 252 | mGridSpacingX = 80; |
254 | mResizeBorderWidth = 8; | 253 | mResizeBorderWidth = 8; |
255 | mScrollBorderWidth = 8; | 254 | mScrollBorderWidth = 8; |
256 | mScrollDelay = 30; | 255 | mScrollDelay = 30; |
257 | mScrollOffset = 10; | 256 | mScrollOffset = 10; |
258 | mPaintPixmap.resize( 20,20); | 257 | mPaintPixmap.resize( 20,20); |
259 | //enableClipper(true); | 258 | //enableClipper(true); |
260 | 259 | ||
261 | // Grab key strokes for keyboard navigation of agenda. Seems to have no | 260 | // Grab key strokes for keyboard navigation of agenda. Seems to have no |
262 | // effect. Has to be fixed. | 261 | // effect. Has to be fixed. |
263 | setFocusPolicy(WheelFocus); | 262 | setFocusPolicy(WheelFocus); |
264 | 263 | ||
265 | connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); | 264 | connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); |
266 | connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); | 265 | connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); |
267 | connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); | 266 | connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); |
268 | 267 | ||
269 | mStartCellX = 0; | 268 | mStartCellX = 0; |
270 | mStartCellY = 0; | 269 | mStartCellY = 0; |
271 | mCurrentCellX = 0; | 270 | mCurrentCellX = 0; |
272 | mCurrentCellY = 0; | 271 | mCurrentCellY = 0; |
273 | 272 | ||
274 | mSelectionCellX = 0; | 273 | mSelectionCellX = 0; |
275 | mSelectionYTop = 0; | 274 | mSelectionYTop = 0; |
276 | mSelectionHeight = 0; | 275 | mSelectionHeight = 0; |
277 | 276 | ||
278 | mOldLowerScrollValue = -1; | 277 | mOldLowerScrollValue = -1; |
279 | mOldUpperScrollValue = -1; | 278 | mOldUpperScrollValue = -1; |
280 | 279 | ||
281 | mClickedItem = 0; | 280 | mClickedItem = 0; |
282 | 281 | ||
283 | mActionItem = 0; | 282 | mActionItem = 0; |
284 | mActionType = NOP; | 283 | mActionType = NOP; |
285 | mItemMoved = false; | 284 | mItemMoved = false; |
286 | 285 | ||
287 | mSelectedItem = 0; | 286 | mSelectedItem = 0; |
288 | 287 | ||
289 | // mItems.setAutoDelete(true); | 288 | // mItems.setAutoDelete(true); |
290 | 289 | ||
291 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 290 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
292 | 291 | ||
293 | viewport()->update(); | 292 | viewport()->update(); |
294 | 293 | ||
295 | setMinimumSize(30, 1); | 294 | setMinimumSize(30, 1); |
296 | // setMaximumHeight(mGridSpacingY * mRows + 5); | 295 | // setMaximumHeight(mGridSpacingY * mRows + 5); |
297 | 296 | ||
298 | // Disable horizontal scrollbar. This is a hack. The geometry should be | 297 | // Disable horizontal scrollbar. This is a hack. The geometry should be |
299 | // controlled in a way that the contents horizontally always fits. Then it is | 298 | // controlled in a way that the contents horizontally always fits. Then it is |
300 | // not necessary to turn off the scrollbar. | 299 | // not necessary to turn off the scrollbar. |
301 | setHScrollBarMode(AlwaysOff); | 300 | setHScrollBarMode(AlwaysOff); |
302 | if ( ! mAllDayMode ) | 301 | if ( ! mAllDayMode ) |
303 | setVScrollBarMode(AlwaysOn); | 302 | setVScrollBarMode(AlwaysOn); |
304 | else | 303 | else |
305 | setVScrollBarMode(AlwaysOff); | 304 | setVScrollBarMode(AlwaysOff); |
306 | 305 | ||
307 | setStartHour(KOPrefs::instance()->mDayBegins); | 306 | setStartHour(KOPrefs::instance()->mDayBegins); |
308 | 307 | ||
309 | calculateWorkingHours(); | 308 | calculateWorkingHours(); |
310 | 309 | ||
311 | connect(verticalScrollBar(),SIGNAL(valueChanged(int)), | 310 | connect(verticalScrollBar(),SIGNAL(valueChanged(int)), |
312 | SLOT(checkScrollBoundaries(int))); | 311 | SLOT(checkScrollBoundaries(int))); |
313 | 312 | ||
314 | // Create the Marcus Bains line. | 313 | // Create the Marcus Bains line. |
315 | if(mAllDayMode) | 314 | if(mAllDayMode) |
316 | mMarcusBains = 0; | 315 | mMarcusBains = 0; |
317 | else { | 316 | else { |
318 | mMarcusBains = new MarcusBains(this); | 317 | mMarcusBains = new MarcusBains(this); |
319 | addChild(mMarcusBains); | 318 | addChild(mMarcusBains); |
320 | } | 319 | } |
321 | mPopupKind = 0; | 320 | mPopupKind = 0; |
322 | mPopupItem = 0; | 321 | mPopupItem = 0; |
323 | mInvalidPixmap = false; | 322 | mInvalidPixmap = false; |
324 | 323 | ||
325 | } | 324 | } |
326 | 325 | ||
327 | void KOAgenda::shrinkPixmap() | 326 | void KOAgenda::shrinkPixmap() |
328 | { | 327 | { |
329 | mPaintPixmap.resize( 20,20); | 328 | mPaintPixmap.resize( 20,20); |
330 | mInvalidPixmap = true; | 329 | mInvalidPixmap = true; |
331 | } | 330 | } |
332 | void KOAgenda::slotContentMove(int,int) | 331 | void KOAgenda::slotContentMove(int,int) |
333 | { | 332 | { |
334 | emit sendPing(); | 333 | emit sendPing(); |
335 | if ( mActionType == NOP ) | 334 | if ( mActionType == NOP ) |
336 | slotClearSelection(); | 335 | slotClearSelection(); |
337 | if ( mSelectedItem && !mActionItem ) { | 336 | if ( mSelectedItem && !mActionItem ) { |
338 | deselectItem(); | 337 | deselectItem(); |
339 | emit incidenceSelected( 0 ); | 338 | emit incidenceSelected( 0 ); |
340 | } | 339 | } |
341 | } | 340 | } |
342 | void KOAgenda::clear() | 341 | void KOAgenda::clear() |
343 | { | 342 | { |
344 | KOAgendaItem *item; | 343 | KOAgendaItem *item; |
345 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 344 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
346 | mUnusedItems.append( item ); | 345 | mUnusedItems.append( item ); |
347 | //item->hide(); | 346 | //item->hide(); |
348 | } | 347 | } |
349 | mItems.clear(); | 348 | mItems.clear(); |
350 | mSelectedItem = 0; | 349 | mSelectedItem = 0; |
351 | clearSelection(); | 350 | clearSelection(); |
352 | } | 351 | } |
353 | 352 | ||
354 | void KOAgenda::clearSelection() | 353 | void KOAgenda::clearSelection() |
355 | { | 354 | { |
356 | mSelectionCellX = 0; | 355 | mSelectionCellX = 0; |
357 | mSelectionYTop = 0; | 356 | mSelectionYTop = 0; |
358 | mSelectionHeight = 0; | 357 | mSelectionHeight = 0; |
359 | } | 358 | } |
360 | 359 | ||
361 | void KOAgenda::marcus_bains() | 360 | void KOAgenda::marcus_bains() |
362 | { | 361 | { |
363 | if(mMarcusBains) mMarcusBains->updateLocation(true); | 362 | if(mMarcusBains) mMarcusBains->updateLocation(true); |
364 | } | 363 | } |
365 | 364 | ||
366 | 365 | ||
367 | void KOAgenda::changeColumns(int columns) | 366 | void KOAgenda::changeColumns(int columns) |
368 | { | 367 | { |
369 | if (columns == 0) { | 368 | if (columns == 0) { |
370 | qDebug("KOAgenda::changeColumns() called with argument 0 "); | 369 | qDebug("KOAgenda::changeColumns() called with argument 0 "); |
371 | return; | 370 | return; |
372 | } | 371 | } |
373 | clear(); | 372 | clear(); |
374 | mColumns = columns; | 373 | mColumns = columns; |
375 | computeSizes(); | 374 | computeSizes(); |
376 | } | 375 | } |
377 | 376 | ||
378 | /* | 377 | /* |
379 | This is the eventFilter function, which gets all events from the KOAgendaItems | 378 | This is the eventFilter function, which gets all events from the KOAgendaItems |
380 | contained in the agenda. It has to handle moving and resizing for all items. | 379 | contained in the agenda. It has to handle moving and resizing for all items. |
381 | */ | 380 | */ |
382 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) | 381 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) |
383 | { | 382 | { |
384 | // kdDebug() << "KOAgenda::eventFilter" << endl; | 383 | // kdDebug() << "KOAgenda::eventFilter" << endl; |
385 | switch(event->type()) { | 384 | switch(event->type()) { |
386 | case QEvent::MouseButtonPress: | 385 | case QEvent::MouseButtonPress: |
387 | case QEvent::MouseButtonDblClick: | 386 | case QEvent::MouseButtonDblClick: |
388 | case QEvent::MouseButtonRelease: | 387 | case QEvent::MouseButtonRelease: |
389 | case QEvent::MouseMove: | 388 | case QEvent::MouseMove: |
390 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); | 389 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); |
391 | 390 | ||
392 | case (QEvent::Leave): | 391 | case (QEvent::Leave): |
393 | if (!mActionItem) | 392 | if (!mActionItem) |
394 | setCursor(arrowCursor); | 393 | setCursor(arrowCursor); |
395 | return true; | 394 | return true; |
396 | 395 | ||
397 | default: | 396 | default: |
398 | return QScrollView::eventFilter(object,event); | 397 | return QScrollView::eventFilter(object,event); |
399 | } | 398 | } |
400 | } | 399 | } |
401 | void KOAgenda::popupMenu() | 400 | void KOAgenda::popupMenu() |
402 | { | 401 | { |
403 | mPopupTimer->stop(); | 402 | mPopupTimer->stop(); |
404 | if ( mPopupKind == 1 || mPopupKind == 3 ) { | 403 | if ( mPopupKind == 1 || mPopupKind == 3 ) { |
405 | if (mActionItem ) { | 404 | if (mActionItem ) { |
406 | endItemAction(); | 405 | endItemAction(); |
407 | } | 406 | } |
408 | mLeftMouseDown = false; // no more leftMouse computation | 407 | mLeftMouseDown = false; // no more leftMouse computation |
409 | if (mPopupItem) { | 408 | if (mPopupItem) { |
410 | //mClickedItem = mPopupItem; | 409 | //mClickedItem = mPopupItem; |
411 | selectItem(mPopupItem); | 410 | selectItem(mPopupItem); |
412 | if ( mAllAgendaPopup && KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 1 ) | 411 | if ( mAllAgendaPopup && KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 1 ) |
413 | mAllAgendaPopup->installEventFilter( this ); | 412 | mAllAgendaPopup->installEventFilter( this ); |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 86e1bd9..a87e6fc 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -901,536 +901,539 @@ void KOTodoView::resetCurrentItem() | |||
901 | foundItem = foundItemParent; | 901 | foundItem = foundItemParent; |
902 | } else { | 902 | } else { |
903 | if ( foundItemRoot ) | 903 | if ( foundItemRoot ) |
904 | foundItem = foundItemRoot; | 904 | foundItem = foundItemRoot; |
905 | else | 905 | else |
906 | foundItem = foundItemAbove; | 906 | foundItem = foundItemAbove; |
907 | } | 907 | } |
908 | } | 908 | } |
909 | } | 909 | } |
910 | if ( foundItem ) { | 910 | if ( foundItem ) { |
911 | mTodoListView->setSelected ( foundItem, true ); | 911 | mTodoListView->setSelected ( foundItem, true ); |
912 | mTodoListView->setCurrentItem( foundItem ); | 912 | mTodoListView->setCurrentItem( foundItem ); |
913 | mTodoListView->ensureItemVisible( foundItem ); | 913 | mTodoListView->ensureItemVisible( foundItem ); |
914 | } else { | 914 | } else { |
915 | if ( mTodoListView->firstChild () ) { | 915 | if ( mTodoListView->firstChild () ) { |
916 | mTodoListView->setSelected ( mTodoListView->firstChild (), true ); | 916 | mTodoListView->setSelected ( mTodoListView->firstChild (), true ); |
917 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); | 917 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); |
918 | } | 918 | } |
919 | } | 919 | } |
920 | } | 920 | } |
921 | processSelectionChange(); | 921 | processSelectionChange(); |
922 | QTimer::singleShot( 100, this, SLOT ( resetFocusToList() )); | 922 | QTimer::singleShot( 100, this, SLOT ( resetFocusToList() )); |
923 | } | 923 | } |
924 | void KOTodoView::resetFocusToList() | 924 | void KOTodoView::resetFocusToList() |
925 | { | 925 | { |
926 | topLevelWidget()->setActiveWindow(); | 926 | topLevelWidget()->setActiveWindow(); |
927 | mTodoListView->setFocus(); | 927 | mTodoListView->setFocus(); |
928 | } | 928 | } |
929 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; | 929 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; |
930 | bool KOTodoView::checkTodo( Todo * todo ) | 930 | bool KOTodoView::checkTodo( Todo * todo ) |
931 | { | 931 | { |
932 | 932 | ||
933 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) | 933 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) |
934 | return false; | 934 | return false; |
935 | if ( !todo->isCompleted() ) { | 935 | if ( !todo->isCompleted() ) { |
936 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) | 936 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) |
937 | return true; | 937 | return true; |
938 | } | 938 | } |
939 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { | 939 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { |
940 | if ( todo->hasStartDate() ) | 940 | if ( todo->hasStartDate() ) |
941 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) | 941 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) |
942 | return false; | 942 | return false; |
943 | if ( todo->hasDueDate() ) | 943 | if ( todo->hasDueDate() ) |
944 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) | 944 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) |
945 | return false; | 945 | return false; |
946 | } | 946 | } |
947 | return true; | 947 | return true; |
948 | } | 948 | } |
949 | 949 | ||
950 | void KOTodoView::restoreItemState( QListViewItem *item ) | 950 | void KOTodoView::restoreItemState( QListViewItem *item ) |
951 | { | 951 | { |
952 | pendingSubtodo = 0; | 952 | pendingSubtodo = 0; |
953 | while( item ) { | 953 | while( item ) { |
954 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 954 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
955 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 955 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
956 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 956 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
957 | item = item->nextSibling(); | 957 | item = item->nextSibling(); |
958 | } | 958 | } |
959 | } | 959 | } |
960 | 960 | ||
961 | 961 | ||
962 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 962 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
963 | KOTodoView::insertTodoItem(Todo *todo) | 963 | KOTodoView::insertTodoItem(Todo *todo) |
964 | { | 964 | { |
965 | 965 | ||
966 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 966 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
967 | // TODO: Check, if dynmaic cast is necessary | 967 | // TODO: Check, if dynmaic cast is necessary |
968 | 968 | ||
969 | pendingSubtodo = 0; | 969 | pendingSubtodo = 0; |
970 | Incidence *incidence = todo->relatedTo(); | 970 | Incidence *incidence = todo->relatedTo(); |
971 | while ( incidence && !incidence->calEnabled() ) | 971 | while ( incidence && !incidence->calEnabled() ) |
972 | incidence = incidence->relatedTo(); | 972 | incidence = incidence->relatedTo(); |
973 | if (incidence && incidence->typeID() == todoID ) { | 973 | if (incidence && incidence->typeID() == todoID ) { |
974 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 974 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
975 | 975 | ||
976 | // kdDebug() << " has Related" << endl; | 976 | // kdDebug() << " has Related" << endl; |
977 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 977 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
978 | itemIterator = mTodoMap.find(relatedTodo); | 978 | itemIterator = mTodoMap.find(relatedTodo); |
979 | if (itemIterator == mTodoMap.end()) { | 979 | if (itemIterator == mTodoMap.end()) { |
980 | // kdDebug() << " related not yet in list" << endl; | 980 | // kdDebug() << " related not yet in list" << endl; |
981 | itemIterator = insertTodoItem (relatedTodo); | 981 | itemIterator = insertTodoItem (relatedTodo); |
982 | } | 982 | } |
983 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | 983 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem |
984 | // and one into the map. Sure finding is more easy but why? -zecke | 984 | // and one into the map. Sure finding is more easy but why? -zecke |
985 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | 985 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); |
986 | return mTodoMap.insert(todo,todoItem); | 986 | return mTodoMap.insert(todo,todoItem); |
987 | } else { | 987 | } else { |
988 | // kdDebug() << " no Related" << endl; | 988 | // kdDebug() << " no Related" << endl; |
989 | // see above -zecke | 989 | // see above -zecke |
990 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 990 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
991 | return mTodoMap.insert(todo,todoItem); | 991 | return mTodoMap.insert(todo,todoItem); |
992 | } | 992 | } |
993 | } | 993 | } |
994 | 994 | ||
995 | 995 | ||
996 | void KOTodoView::updateConfig() | 996 | void KOTodoView::updateConfig() |
997 | { | 997 | { |
998 | updateView(); | 998 | updateView(); |
999 | mTodoListView->repaintContents(); | 999 | mTodoListView->repaintContents(); |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 1002 | QPtrList<Incidence> KOTodoView::selectedIncidences() |
1003 | { | 1003 | { |
1004 | QPtrList<Incidence> selected; | 1004 | QPtrList<Incidence> selected; |
1005 | 1005 | ||
1006 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 1006 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
1007 | // if (!item) item = mActiveItem; | 1007 | // if (!item) item = mActiveItem; |
1008 | if (item) selected.append(item->todo()); | 1008 | if (item) selected.append(item->todo()); |
1009 | 1009 | ||
1010 | return selected; | 1010 | return selected; |
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | QPtrList<Todo> KOTodoView::selectedTodos() | 1013 | QPtrList<Todo> KOTodoView::selectedTodos() |
1014 | { | 1014 | { |
1015 | QPtrList<Todo> selected; | 1015 | QPtrList<Todo> selected; |
1016 | 1016 | ||
1017 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 1017 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
1018 | // if (!item) item = mActiveItem; | 1018 | // if (!item) item = mActiveItem; |
1019 | if (item) selected.append(item->todo()); | 1019 | if (item) selected.append(item->todo()); |
1020 | 1020 | ||
1021 | return selected; | 1021 | return selected; |
1022 | } | 1022 | } |
1023 | 1023 | ||
1024 | void KOTodoView::changeEventDisplay(Event *, int) | 1024 | void KOTodoView::changeEventDisplay(Event *, int) |
1025 | { | 1025 | { |
1026 | updateView(); | 1026 | updateView(); |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | void KOTodoView::showDates(const QDate &, const QDate &) | 1029 | void KOTodoView::showDates(const QDate &, const QDate &) |
1030 | { | 1030 | { |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | void KOTodoView::showEvents(QPtrList<Event>) | 1033 | void KOTodoView::showEvents(QPtrList<Event>) |
1034 | { | 1034 | { |
1035 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; | 1035 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; |
1036 | } | 1036 | } |
1037 | 1037 | ||
1038 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1038 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1039 | const QDate &td) | 1039 | const QDate &td) |
1040 | { | 1040 | { |
1041 | #ifndef KORG_NOPRINTER | 1041 | #ifndef KORG_NOPRINTER |
1042 | calPrinter->preview(CalPrinter::Todolist, fd, td); | 1042 | calPrinter->preview(CalPrinter::Todolist, fd, td); |
1043 | #endif | 1043 | #endif |
1044 | } | 1044 | } |
1045 | 1045 | ||
1046 | void KOTodoView::editItem(QListViewItem *item ) | 1046 | void KOTodoView::editItem(QListViewItem *item ) |
1047 | { | 1047 | { |
1048 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); | 1048 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 1051 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) |
1052 | { | 1052 | { |
1053 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); | 1053 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); |
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) | 1056 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) |
1057 | { | 1057 | { |
1058 | pendingSubtodo = 0; | 1058 | pendingSubtodo = 0; |
1059 | mActiveItem = (KOTodoViewItem *)item; | 1059 | mActiveItem = (KOTodoViewItem *)item; |
1060 | if (item) { | 1060 | if (item) { |
1061 | switch (column){ | 1061 | switch (column){ |
1062 | case 1: | 1062 | case 1: |
1063 | mPriorityPopupMenu->popup(QCursor::pos ()); break; | 1063 | mPriorityPopupMenu->popup(QCursor::pos ()); break; |
1064 | case 2: | 1064 | case 2: |
1065 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; | 1065 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; |
1066 | case 3: | 1066 | case 3: |
1067 | moveTodo(); | 1067 | moveTodo(); |
1068 | break; | 1068 | break; |
1069 | case 8: | 1069 | case 8: |
1070 | mCategoryPopupMenu->popup(QCursor::pos ()); break; | 1070 | mCategoryPopupMenu->popup(QCursor::pos ()); break; |
1071 | case 9: | 1071 | case 9: |
1072 | mCalPopupMenu->popup(QCursor::pos ()); break; | 1072 | mCalPopupMenu->popup(QCursor::pos ()); break; |
1073 | default: | 1073 | default: |
1074 | mItemPopupMenu->popup(QCursor::pos()); | 1074 | mItemPopupMenu->popup(QCursor::pos()); |
1075 | } | 1075 | } |
1076 | } else mPopupMenu->popup(QCursor::pos()); | 1076 | } else mPopupMenu->popup(QCursor::pos()); |
1077 | } | 1077 | } |
1078 | void KOTodoView::newTodo() | 1078 | void KOTodoView::newTodo() |
1079 | { | 1079 | { |
1080 | emit newTodoSignal(); | 1080 | emit newTodoSignal(); |
1081 | } | 1081 | } |
1082 | 1082 | ||
1083 | void KOTodoView::newSubTodo() | 1083 | void KOTodoView::newSubTodo() |
1084 | { | 1084 | { |
1085 | if (mActiveItem) { | 1085 | if (mActiveItem) { |
1086 | emit newSubTodoSignal(mActiveItem->todo()); | 1086 | emit newSubTodoSignal(mActiveItem->todo()); |
1087 | } | 1087 | } |
1088 | } | 1088 | } |
1089 | void KOTodoView::unparentTodo() | 1089 | void KOTodoView::unparentTodo() |
1090 | { | 1090 | { |
1091 | if (mActiveItem) { | 1091 | if (mActiveItem) { |
1092 | emit unparentTodoSignal(mActiveItem->todo()); | 1092 | emit unparentTodoSignal(mActiveItem->todo()); |
1093 | } | 1093 | } |
1094 | } | 1094 | } |
1095 | 1095 | ||
1096 | void KOTodoView::reparentTodo() | 1096 | void KOTodoView::reparentTodo() |
1097 | { | 1097 | { |
1098 | if (mActiveItem) { | 1098 | if (mActiveItem) { |
1099 | topLevelWidget()->setCaption(i18n("Click on new parent item")); | 1099 | topLevelWidget()->setCaption(i18n("Click on new parent item")); |
1100 | pendingSubtodo = mActiveItem; | 1100 | pendingSubtodo = mActiveItem; |
1101 | } | 1101 | } |
1102 | } | 1102 | } |
1103 | void KOTodoView::editTodo() | 1103 | void KOTodoView::editTodo() |
1104 | { | 1104 | { |
1105 | if (mActiveItem) { | 1105 | if (mActiveItem) { |
1106 | emit editTodoSignal(mActiveItem->todo()); | 1106 | emit editTodoSignal(mActiveItem->todo()); |
1107 | } | 1107 | } |
1108 | } | 1108 | } |
1109 | void KOTodoView::cloneTodo() | 1109 | void KOTodoView::cloneTodo() |
1110 | { | 1110 | { |
1111 | if (mActiveItem) { | 1111 | if (mActiveItem) { |
1112 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 1112 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
1113 | } | 1113 | } |
1114 | } | 1114 | } |
1115 | void KOTodoView::cancelTodo() | 1115 | void KOTodoView::cancelTodo() |
1116 | { | 1116 | { |
1117 | if (mActiveItem) { | 1117 | if (mActiveItem) { |
1118 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 1118 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
1119 | } | 1119 | } |
1120 | } | 1120 | } |
1121 | void KOTodoView::moveTodo() | 1121 | void KOTodoView::moveTodo() |
1122 | { | 1122 | { |
1123 | if (mActiveItem) { | 1123 | if (mActiveItem) { |
1124 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); | 1124 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); |
1125 | } | 1125 | } |
1126 | } | 1126 | } |
1127 | void KOTodoView::beamTodo() | 1127 | void KOTodoView::beamTodo() |
1128 | { | 1128 | { |
1129 | if (mActiveItem) { | 1129 | if (mActiveItem) { |
1130 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); | 1130 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); |
1131 | } | 1131 | } |
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | 1134 | ||
1135 | void KOTodoView::showTodo() | 1135 | void KOTodoView::showTodo() |
1136 | { | 1136 | { |
1137 | if (mActiveItem) { | 1137 | if (mActiveItem) { |
1138 | emit showTodoSignal(mActiveItem->todo()); | 1138 | emit showTodoSignal(mActiveItem->todo()); |
1139 | } | 1139 | } |
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | void KOTodoView::deleteTodo() | 1142 | void KOTodoView::deleteTodo() |
1143 | { | 1143 | { |
1144 | if (mActiveItem) { | 1144 | if (mActiveItem) { |
1145 | emit deleteTodoSignal(mActiveItem->todo()); | 1145 | emit deleteTodoSignal(mActiveItem->todo()); |
1146 | } | 1146 | } |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | void KOTodoView::setNewPriority(int index) | 1149 | void KOTodoView::setNewPriority(int index) |
1150 | { | 1150 | { |
1151 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1151 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1152 | mActiveItem->todo()->setPriority(mPriority[index]); | 1152 | mActiveItem->todo()->setPriority(mPriority[index]); |
1153 | mActiveItem->construct(); | 1153 | mActiveItem->construct(); |
1154 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); | 1154 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); |
1155 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1155 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1156 | } | 1156 | } |
1157 | processSelectionChange(); | ||
1157 | } | 1158 | } |
1158 | 1159 | ||
1159 | void KOTodoView::setNewPercentage(int index) | 1160 | void KOTodoView::setNewPercentage(int index) |
1160 | { | 1161 | { |
1161 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1162 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1162 | 1163 | ||
1163 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { | 1164 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { |
1164 | mActiveItem->setOn( true ); | 1165 | mActiveItem->setOn( true ); |
1166 | processSelectionChange(); | ||
1165 | return; | 1167 | return; |
1166 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { | 1168 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { |
1167 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); | 1169 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); |
1168 | if ( par && par->isOn() ) | 1170 | if ( par && par->isOn() ) |
1169 | par->setOn( false ); | 1171 | par->setOn( false ); |
1170 | } | 1172 | } |
1171 | if (mPercentage[index] == 100) { | 1173 | if (mPercentage[index] == 100) { |
1172 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1174 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
1173 | } else { | 1175 | } else { |
1174 | mActiveItem->todo()->setCompleted(false); | 1176 | mActiveItem->todo()->setCompleted(false); |
1175 | } | 1177 | } |
1176 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 1178 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
1177 | mActiveItem->construct(); | 1179 | mActiveItem->construct(); |
1178 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 1180 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
1179 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1181 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1180 | } | 1182 | } |
1183 | processSelectionChange(); | ||
1181 | } | 1184 | } |
1182 | 1185 | ||
1183 | void KOTodoView::fillCategories () | 1186 | void KOTodoView::fillCategories () |
1184 | { | 1187 | { |
1185 | mCategoryPopupMenu->clear(); | 1188 | mCategoryPopupMenu->clear(); |
1186 | if ( ! mActiveItem ) return; | 1189 | if ( ! mActiveItem ) return; |
1187 | QStringList checkedCategories = mActiveItem->todo()->categories (); | 1190 | QStringList checkedCategories = mActiveItem->todo()->categories (); |
1188 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 1191 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
1189 | it != KOPrefs::instance()->mCustomCategories.end (); | 1192 | it != KOPrefs::instance()->mCustomCategories.end (); |
1190 | ++it) { | 1193 | ++it) { |
1191 | int index = mCategoryPopupMenu->insertItem (*it); | 1194 | int index = mCategoryPopupMenu->insertItem (*it); |
1192 | mCategory[index] = *it; | 1195 | mCategory[index] = *it; |
1193 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); | 1196 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); |
1194 | } | 1197 | } |
1195 | } | 1198 | } |
1196 | void KOTodoView::fillCal () | 1199 | void KOTodoView::fillCal () |
1197 | { | 1200 | { |
1198 | mCalPopupMenu->clear(); | 1201 | mCalPopupMenu->clear(); |
1199 | if (!mActiveItem) return; | 1202 | if (!mActiveItem) return; |
1200 | bool readO = mActiveItem->todo()->isReadOnly(); | 1203 | bool readO = mActiveItem->todo()->isReadOnly(); |
1201 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 1204 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
1202 | while ( kkf ) { | 1205 | while ( kkf ) { |
1203 | int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber); | 1206 | int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber); |
1204 | if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) | 1207 | if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) |
1205 | mCalPopupMenu->setItemEnabled( index, false ); | 1208 | mCalPopupMenu->setItemEnabled( index, false ); |
1206 | mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID()); | 1209 | mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID()); |
1207 | kkf = KOPrefs::instance()->mCalendars.next(); | 1210 | kkf = KOPrefs::instance()->mCalendars.next(); |
1208 | } | 1211 | } |
1209 | } | 1212 | } |
1210 | void KOTodoView::changedCal (int index ) | 1213 | void KOTodoView::changedCal (int index ) |
1211 | { | 1214 | { |
1212 | if (!mActiveItem) return; | 1215 | if (!mActiveItem) return; |
1213 | mActiveItem->todo()->setCalID( index ); | 1216 | mActiveItem->todo()->setCalID( index ); |
1214 | mActiveItem->construct(); | 1217 | mActiveItem->construct(); |
1215 | } | 1218 | } |
1216 | void KOTodoView::changedCategories(int index) | 1219 | void KOTodoView::changedCategories(int index) |
1217 | { | 1220 | { |
1218 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1221 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1219 | QStringList categories = mActiveItem->todo()->categories (); | 1222 | QStringList categories = mActiveItem->todo()->categories (); |
1220 | QString colcat = categories.first(); | 1223 | QString colcat = categories.first(); |
1221 | if (categories.find (mCategory[index]) != categories.end ()) | 1224 | if (categories.find (mCategory[index]) != categories.end ()) |
1222 | categories.remove (mCategory[index]); | 1225 | categories.remove (mCategory[index]); |
1223 | else | 1226 | else |
1224 | categories.insert (categories.end(), mCategory[index]); | 1227 | categories.insert (categories.end(), mCategory[index]); |
1225 | categories.sort (); | 1228 | categories.sort (); |
1226 | if ( !colcat.isEmpty() ) { | 1229 | if ( !colcat.isEmpty() ) { |
1227 | if ( categories.find ( colcat ) != categories.end () ) { | 1230 | if ( categories.find ( colcat ) != categories.end () ) { |
1228 | categories.remove( colcat ); | 1231 | categories.remove( colcat ); |
1229 | categories.prepend( colcat ); | 1232 | categories.prepend( colcat ); |
1230 | } | 1233 | } |
1231 | } | 1234 | } |
1232 | mActiveItem->todo()->setCategories (categories); | 1235 | mActiveItem->todo()->setCategories (categories); |
1233 | mActiveItem->construct(); | 1236 | mActiveItem->construct(); |
1234 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1237 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1235 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); | 1238 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); |
1236 | } | 1239 | } |
1237 | } | 1240 | } |
1238 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 1241 | void KOTodoView::itemDoubleClicked(QListViewItem *item) |
1239 | { | 1242 | { |
1240 | if ( pendingSubtodo != 0 ) { | 1243 | if ( pendingSubtodo != 0 ) { |
1241 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1244 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1242 | } | 1245 | } |
1243 | pendingSubtodo = 0; | 1246 | pendingSubtodo = 0; |
1244 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); | 1247 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); |
1245 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); | 1248 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); |
1246 | //qDebug("ROW %d ", row); | 1249 | //qDebug("ROW %d ", row); |
1247 | if (!item) { | 1250 | if (!item) { |
1248 | newTodo(); | 1251 | newTodo(); |
1249 | return; | 1252 | return; |
1250 | } else { | 1253 | } else { |
1251 | if ( row == 1 ) { | 1254 | if ( row == 1 ) { |
1252 | mActiveItem = (KOTodoViewItem *) item; | 1255 | mActiveItem = (KOTodoViewItem *) item; |
1253 | newSubTodo(); | 1256 | newSubTodo(); |
1254 | return; | 1257 | return; |
1255 | } | 1258 | } |
1256 | if ( row == 5 || row == 6 || row == 2) { | 1259 | if ( row == 5 || row == 6 || row == 2) { |
1257 | mActiveItem = (KOTodoViewItem *) item; | 1260 | mActiveItem = (KOTodoViewItem *) item; |
1258 | Todo * t = mActiveItem->todo(); | 1261 | Todo * t = mActiveItem->todo(); |
1259 | if ( t->isRunning() ) { | 1262 | if ( t->isRunning() ) { |
1260 | if ( t->runTime() < 15) { | 1263 | if ( t->runTime() < 15) { |
1261 | t->stopRunning(); | 1264 | t->stopRunning(); |
1262 | mActiveItem->construct(); | 1265 | mActiveItem->construct(); |
1263 | topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); | 1266 | topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); |
1264 | return; | 1267 | return; |
1265 | } | 1268 | } |
1266 | else | 1269 | else |
1267 | toggleRunningItem(); | 1270 | toggleRunningItem(); |
1268 | return; | 1271 | return; |
1269 | } else { | 1272 | } else { |
1270 | t->setRunning( true ); | 1273 | t->setRunning( true ); |
1271 | mActiveItem->construct(); | 1274 | mActiveItem->construct(); |
1272 | topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); | 1275 | topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); |
1273 | return; | 1276 | return; |
1274 | } | 1277 | } |
1275 | } | 1278 | } |
1276 | } | 1279 | } |
1277 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 1280 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
1278 | editItem( item ); | 1281 | editItem( item ); |
1279 | else | 1282 | else |
1280 | showItem( item , QPoint(), 0 ); | 1283 | showItem( item , QPoint(), 0 ); |
1281 | } | 1284 | } |
1282 | void KOTodoView::toggleRunningItem() | 1285 | void KOTodoView::toggleRunningItem() |
1283 | { | 1286 | { |
1284 | // qDebug("KOTodoView::toggleRunning() "); | 1287 | // qDebug("KOTodoView::toggleRunning() "); |
1285 | if ( ! mActiveItem ) | 1288 | if ( ! mActiveItem ) |
1286 | return; | 1289 | return; |
1287 | Todo * t = mActiveItem->todo(); | 1290 | Todo * t = mActiveItem->todo(); |
1288 | if ( t->isRunning() ) { | 1291 | if ( t->isRunning() ) { |
1289 | KOStopTodoPrefs tp ( t, this ); | 1292 | KOStopTodoPrefs tp ( t, this ); |
1290 | if (QApplication::desktop()->width() <= 800 ){ | 1293 | if (QApplication::desktop()->width() <= 800 ){ |
1291 | int wid = tp.width(); | 1294 | int wid = tp.width(); |
1292 | int hei = tp.height(); | 1295 | int hei = tp.height(); |
1293 | int xx = (QApplication::desktop()->width()-wid)/2; | 1296 | int xx = (QApplication::desktop()->width()-wid)/2; |
1294 | int yy = (QApplication::desktop()->height()-hei)/2; | 1297 | int yy = (QApplication::desktop()->height()-hei)/2; |
1295 | tp.setGeometry( xx,yy,wid,hei ); | 1298 | tp.setGeometry( xx,yy,wid,hei ); |
1296 | } | 1299 | } |
1297 | tp.exec(); | 1300 | tp.exec(); |
1298 | mActiveItem->construct(); | 1301 | mActiveItem->construct(); |
1299 | } else { | 1302 | } else { |
1300 | KOStartTodoPrefs tp ( t->summary(), this ); | 1303 | KOStartTodoPrefs tp ( t->summary(), this ); |
1301 | if (QApplication::desktop()->width() <= 800 ){ | 1304 | if (QApplication::desktop()->width() <= 800 ){ |
1302 | int wid = tp.width(); | 1305 | int wid = tp.width(); |
1303 | int hei = tp.height(); | 1306 | int hei = tp.height(); |
1304 | int xx = (QApplication::desktop()->width()-wid)/2; | 1307 | int xx = (QApplication::desktop()->width()-wid)/2; |
1305 | int yy = (QApplication::desktop()->height()-hei)/2; | 1308 | int yy = (QApplication::desktop()->height()-hei)/2; |
1306 | tp.setGeometry( xx,yy,wid,hei ); | 1309 | tp.setGeometry( xx,yy,wid,hei ); |
1307 | } | 1310 | } |
1308 | if ( !tp.exec() ) return; | 1311 | if ( !tp.exec() ) return; |
1309 | if ( tp.stopAll() ) { | 1312 | if ( tp.stopAll() ) { |
1310 | mCalendar->stopAllTodos(); | 1313 | mCalendar->stopAllTodos(); |
1311 | t->setRunning( true ); | 1314 | t->setRunning( true ); |
1312 | updateView(); | 1315 | updateView(); |
1313 | } else { | 1316 | } else { |
1314 | t->setRunning( true ); | 1317 | t->setRunning( true ); |
1315 | mActiveItem->construct(); | 1318 | mActiveItem->construct(); |
1316 | } | 1319 | } |
1317 | } | 1320 | } |
1318 | } | 1321 | } |
1319 | 1322 | ||
1320 | void KOTodoView::itemClicked(QListViewItem *item) | 1323 | void KOTodoView::itemClicked(QListViewItem *item) |
1321 | { | 1324 | { |
1322 | //qDebug("KOTodoView::itemClicked %d", item); | 1325 | //qDebug("KOTodoView::itemClicked %d", item); |
1323 | if (!item) { | 1326 | if (!item) { |
1324 | if ( pendingSubtodo != 0 ) { | 1327 | if ( pendingSubtodo != 0 ) { |
1325 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1328 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1326 | } | 1329 | } |
1327 | pendingSubtodo = 0; | 1330 | pendingSubtodo = 0; |
1328 | return; | 1331 | return; |
1329 | } | 1332 | } |
1330 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1333 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1331 | if ( pendingSubtodo != 0 ) { | 1334 | if ( pendingSubtodo != 0 ) { |
1332 | bool allowReparent = true; | 1335 | bool allowReparent = true; |
1333 | QListViewItem *par = item; | 1336 | QListViewItem *par = item; |
1334 | while ( par ) { | 1337 | while ( par ) { |
1335 | if ( par == pendingSubtodo ) { | 1338 | if ( par == pendingSubtodo ) { |
1336 | allowReparent = false; | 1339 | allowReparent = false; |
1337 | break; | 1340 | break; |
1338 | } | 1341 | } |
1339 | par = par->parent(); | 1342 | par = par->parent(); |
1340 | } | 1343 | } |
1341 | if ( !allowReparent ) { | 1344 | if ( !allowReparent ) { |
1342 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); | 1345 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); |
1343 | pendingSubtodo = 0; | 1346 | pendingSubtodo = 0; |
1344 | } else { | 1347 | } else { |
1345 | Todo* newParent = todoItem->todo(); | 1348 | Todo* newParent = todoItem->todo(); |
1346 | Todo* newSub = pendingSubtodo->todo(); | 1349 | Todo* newSub = pendingSubtodo->todo(); |
1347 | pendingSubtodo = 0; | 1350 | pendingSubtodo = 0; |
1348 | emit reparentTodoSignal( newParent,newSub ); | 1351 | emit reparentTodoSignal( newParent,newSub ); |
1349 | return; | 1352 | return; |
1350 | } | 1353 | } |
1351 | } | 1354 | } |
1352 | 1355 | ||
1353 | } | 1356 | } |
1354 | 1357 | ||
1355 | void KOTodoView::setDocumentId( const QString &id ) | 1358 | void KOTodoView::setDocumentId( const QString &id ) |
1356 | { | 1359 | { |
1357 | 1360 | ||
1358 | mDocPrefs->setDoc( id ); | 1361 | mDocPrefs->setDoc( id ); |
1359 | } | 1362 | } |
1360 | 1363 | ||
1361 | void KOTodoView::itemStateChanged( QListViewItem *item ) | 1364 | void KOTodoView::itemStateChanged( QListViewItem *item ) |
1362 | { | 1365 | { |
1363 | if (!item) return; | 1366 | if (!item) return; |
1364 | 1367 | ||
1365 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1368 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1366 | 1369 | ||
1367 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; | 1370 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; |
1368 | 1371 | ||
1369 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); | 1372 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); |
1370 | } | 1373 | } |
1371 | 1374 | ||
1372 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const | 1375 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const |
1373 | { | 1376 | { |
1374 | mTodoListView->saveLayout(config,group); | 1377 | mTodoListView->saveLayout(config,group); |
1375 | } | 1378 | } |
1376 | 1379 | ||
1377 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) | 1380 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) |
1378 | { | 1381 | { |
1379 | mTodoListView->restoreLayout(config,group); | 1382 | mTodoListView->restoreLayout(config,group); |
1380 | } | 1383 | } |
1381 | 1384 | ||
1382 | void KOTodoView::processSelectionChange() | 1385 | void KOTodoView::processSelectionChange() |
1383 | { | 1386 | { |
1384 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; | 1387 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; |
1385 | 1388 | ||
1386 | KOTodoViewItem *item = | 1389 | KOTodoViewItem *item = |
1387 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); | 1390 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); |
1388 | 1391 | ||
1389 | if ( !item ) { | 1392 | if ( !item ) { |
1390 | emit incidenceSelected( 0 ); | 1393 | emit incidenceSelected( 0 ); |
1391 | } else { | 1394 | } else { |
1392 | emit incidenceSelected( item->todo() ); | 1395 | emit incidenceSelected( item->todo() ); |
1393 | } | 1396 | } |
1394 | } | 1397 | } |
1395 | 1398 | ||
1396 | void KOTodoView::modified(bool b) | 1399 | void KOTodoView::modified(bool b) |
1397 | { | 1400 | { |
1398 | emit isModified(b); | 1401 | emit isModified(b); |
1399 | } | 1402 | } |
1400 | void KOTodoView::setTodoModified( Todo* todo ) | 1403 | void KOTodoView::setTodoModified( Todo* todo ) |
1401 | { | 1404 | { |
1402 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); | 1405 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); |
1403 | } | 1406 | } |
1404 | void KOTodoView::clearSelection() | 1407 | void KOTodoView::clearSelection() |
1405 | { | 1408 | { |
1406 | mTodoListView->selectAll( false ); | 1409 | mTodoListView->selectAll( false ); |
1407 | } | 1410 | } |
1408 | void KOTodoView::setAllOpen() | 1411 | void KOTodoView::setAllOpen() |
1409 | { | 1412 | { |
1410 | if ( isFlatDisplay ) { | 1413 | if ( isFlatDisplay ) { |
1411 | isFlatDisplay = false; | 1414 | isFlatDisplay = false; |
1412 | mPopupMenu->setItemChecked( 8,false ); | 1415 | mPopupMenu->setItemChecked( 8,false ); |
1413 | updateView(); | 1416 | updateView(); |
1414 | } else { | 1417 | } else { |
1415 | storeCurrentItem(); | 1418 | storeCurrentItem(); |
1416 | } | 1419 | } |
1417 | setOpen(mTodoListView->firstChild(), true); | 1420 | setOpen(mTodoListView->firstChild(), true); |
1418 | resetCurrentItem(); | 1421 | resetCurrentItem(); |
1419 | } | 1422 | } |
1420 | void KOTodoView::setAllClose() | 1423 | void KOTodoView::setAllClose() |
1421 | { | 1424 | { |
1422 | if ( isFlatDisplay ) { | 1425 | if ( isFlatDisplay ) { |
1423 | isFlatDisplay = false; | 1426 | isFlatDisplay = false; |
1424 | mPopupMenu->setItemChecked( 8,false ); | 1427 | mPopupMenu->setItemChecked( 8,false ); |
1425 | updateView(); | 1428 | updateView(); |
1426 | } else { | 1429 | } else { |
1427 | storeCurrentItem(); | 1430 | storeCurrentItem(); |
1428 | } | 1431 | } |
1429 | setOpen(mTodoListView->firstChild(), false); | 1432 | setOpen(mTodoListView->firstChild(), false); |
1430 | resetCurrentItem(); | 1433 | resetCurrentItem(); |
1431 | } | 1434 | } |
1432 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) | 1435 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) |
1433 | { | 1436 | { |
1434 | 1437 | ||
1435 | while ( item ) { | 1438 | while ( item ) { |
1436 | setOpen( item->firstChild(), setOpenI ); | 1439 | setOpen( item->firstChild(), setOpenI ); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 88dbd4f..cbf6096 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1429,514 +1429,518 @@ void MainWindow::exportToPhone( int mode ) | |||
1429 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1429 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1430 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1430 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1431 | 1431 | ||
1432 | setCaption( i18n("Writing to phone...")); | 1432 | setCaption( i18n("Writing to phone...")); |
1433 | if ( PhoneFormat::writeToPhone( cal ) ) | 1433 | if ( PhoneFormat::writeToPhone( cal ) ) |
1434 | setCaption( i18n("Export to phone successful!")); | 1434 | setCaption( i18n("Export to phone successful!")); |
1435 | else | 1435 | else |
1436 | setCaption( i18n("Error exporting to phone!")); | 1436 | setCaption( i18n("Error exporting to phone!")); |
1437 | delete cal; | 1437 | delete cal; |
1438 | } | 1438 | } |
1439 | 1439 | ||
1440 | 1440 | ||
1441 | void MainWindow::setDefaultPreferences() | 1441 | void MainWindow::setDefaultPreferences() |
1442 | { | 1442 | { |
1443 | KOPrefs *p = KOPrefs::instance(); | 1443 | KOPrefs *p = KOPrefs::instance(); |
1444 | 1444 | ||
1445 | p->mCompactDialogs = true; | 1445 | p->mCompactDialogs = true; |
1446 | p->mConfirm = true; | 1446 | p->mConfirm = true; |
1447 | // p->mEnableQuickTodo = false; | 1447 | // p->mEnableQuickTodo = false; |
1448 | 1448 | ||
1449 | } | 1449 | } |
1450 | 1450 | ||
1451 | QString MainWindow::resourcePath() | 1451 | QString MainWindow::resourcePath() |
1452 | { | 1452 | { |
1453 | return KGlobal::iconLoader()->iconPath(); | 1453 | return KGlobal::iconLoader()->iconPath(); |
1454 | } | 1454 | } |
1455 | 1455 | ||
1456 | void MainWindow::displayText( QString text ,QString cap ) | 1456 | void MainWindow::displayText( QString text ,QString cap ) |
1457 | { | 1457 | { |
1458 | QDialog dia( this, "name", true ); ; | 1458 | QDialog dia( this, "name", true ); ; |
1459 | dia.setCaption( cap ); | 1459 | dia.setCaption( cap ); |
1460 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1460 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1461 | lay->setSpacing( 3 ); | 1461 | lay->setSpacing( 3 ); |
1462 | lay->setMargin( 3 ); | 1462 | lay->setMargin( 3 ); |
1463 | QTextBrowser tb ( &dia ); | 1463 | QTextBrowser tb ( &dia ); |
1464 | lay->addWidget( &tb ); | 1464 | lay->addWidget( &tb ); |
1465 | tb.setText( text ); | 1465 | tb.setText( text ); |
1466 | #ifdef DESKTOP_VERSION | 1466 | #ifdef DESKTOP_VERSION |
1467 | dia.resize( 640, 480); | 1467 | dia.resize( 640, 480); |
1468 | #else | 1468 | #else |
1469 | dia.showMaximized(); | 1469 | dia.showMaximized(); |
1470 | #endif | 1470 | #endif |
1471 | dia.exec(); | 1471 | dia.exec(); |
1472 | } | 1472 | } |
1473 | 1473 | ||
1474 | void MainWindow::features() | 1474 | void MainWindow::features() |
1475 | { | 1475 | { |
1476 | 1476 | ||
1477 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1477 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1478 | } | 1478 | } |
1479 | 1479 | ||
1480 | void MainWindow::usertrans() | 1480 | void MainWindow::usertrans() |
1481 | { | 1481 | { |
1482 | 1482 | ||
1483 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1483 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1484 | } | 1484 | } |
1485 | 1485 | ||
1486 | void MainWindow::storagehowto() | 1486 | void MainWindow::storagehowto() |
1487 | { | 1487 | { |
1488 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); | 1488 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); |
1489 | } | 1489 | } |
1490 | void MainWindow::timetrackinghowto() | 1490 | void MainWindow::timetrackinghowto() |
1491 | { | 1491 | { |
1492 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); | 1492 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); |
1493 | } | 1493 | } |
1494 | void MainWindow::kdesynchowto() | 1494 | void MainWindow::kdesynchowto() |
1495 | { | 1495 | { |
1496 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1496 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1497 | } | 1497 | } |
1498 | void MainWindow::multisynchowto() | 1498 | void MainWindow::multisynchowto() |
1499 | { | 1499 | { |
1500 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1500 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1501 | } | 1501 | } |
1502 | void MainWindow::synchowto() | 1502 | void MainWindow::synchowto() |
1503 | { | 1503 | { |
1504 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1504 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1505 | } | 1505 | } |
1506 | void MainWindow::faq() | 1506 | void MainWindow::faq() |
1507 | { | 1507 | { |
1508 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1508 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1509 | 1509 | ||
1510 | } | 1510 | } |
1511 | void MainWindow::whatsNew() | 1511 | void MainWindow::whatsNew() |
1512 | { | 1512 | { |
1513 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1513 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1514 | 1514 | ||
1515 | } | 1515 | } |
1516 | void MainWindow::licence() | 1516 | void MainWindow::licence() |
1517 | { | 1517 | { |
1518 | KApplication::showLicence(); | 1518 | KApplication::showLicence(); |
1519 | 1519 | ||
1520 | } | 1520 | } |
1521 | void MainWindow::about() | 1521 | void MainWindow::about() |
1522 | { | 1522 | { |
1523 | QString version; | 1523 | QString version; |
1524 | #include <../version> | 1524 | #include <../version> |
1525 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1525 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1526 | i18n("KOrganizer/Platform-independent\n") + | 1526 | i18n("KOrganizer/Platform-independent\n") + |
1527 | "(KO/Pi) " + version + " - " + | 1527 | "(KO/Pi) " + version + " - " + |
1528 | 1528 | ||
1529 | #ifdef DESKTOP_VERSION | 1529 | #ifdef DESKTOP_VERSION |
1530 | i18n("Desktop Edition\n") + | 1530 | i18n("Desktop Edition\n") + |
1531 | #else | 1531 | #else |
1532 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1532 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1533 | #endif | 1533 | #endif |
1534 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1534 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); |
1535 | } | 1535 | } |
1536 | void MainWindow::keyBindings() | 1536 | void MainWindow::keyBindings() |
1537 | { | 1537 | { |
1538 | QString cap = i18n("KO/Pi Keys + Colors"); | 1538 | QString cap = i18n("KO/Pi Keys + Colors"); |
1539 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1539 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1540 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1540 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1541 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + | 1541 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + |
1542 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + | 1542 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + |
1543 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1543 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1544 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1544 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1545 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ | 1545 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ |
1546 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1546 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1547 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1547 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1548 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ | 1548 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ |
1549 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1549 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1550 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1550 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1551 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1551 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1552 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1552 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1553 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1553 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1554 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1554 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1555 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ | 1555 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ |
1556 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1556 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1557 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1557 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1558 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1558 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1559 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1559 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1560 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1560 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1561 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1561 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1562 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1562 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1563 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1563 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1564 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1564 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1565 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1565 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1566 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1566 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1567 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1567 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1568 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1568 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1569 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1569 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1570 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1570 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1571 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1571 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1572 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1572 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1573 | i18n("<p><h3>In list view:</h3></p>\n") + | 1573 | i18n("<p><h3>In list view:</h3></p>\n") + |
1574 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1574 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1575 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1575 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1576 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1576 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1577 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1577 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1578 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1578 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1579 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1579 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1580 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1580 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1581 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1581 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1582 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1582 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1583 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1583 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1584 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1584 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1585 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1585 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1586 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1586 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1587 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1587 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1588 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1588 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1589 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1589 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1590 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1590 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1591 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1591 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1592 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1592 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1593 | displayText( text, cap); | 1593 | displayText( text, cap); |
1594 | } | 1594 | } |
1595 | void MainWindow::aboutAutoSaving() | 1595 | void MainWindow::aboutAutoSaving() |
1596 | { | 1596 | { |
1597 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); | 1597 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); |
1598 | 1598 | ||
1599 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1599 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1600 | 1600 | ||
1601 | } | 1601 | } |
1602 | void MainWindow::aboutKnownBugs() | 1602 | void MainWindow::aboutKnownBugs() |
1603 | { | 1603 | { |
1604 | QMessageBox* msg; | 1604 | QMessageBox* msg; |
1605 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1605 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1606 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1606 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1607 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1607 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1608 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1608 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1609 | i18n("\nor report them in the bugtracker on\n") + | 1609 | i18n("\nor report them in the bugtracker on\n") + |
1610 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1610 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1611 | QMessageBox::NoIcon, | 1611 | QMessageBox::NoIcon, |
1612 | QMessageBox::Ok, | 1612 | QMessageBox::Ok, |
1613 | QMessageBox::NoButton, | 1613 | QMessageBox::NoButton, |
1614 | QMessageBox::NoButton); | 1614 | QMessageBox::NoButton); |
1615 | msg->exec(); | 1615 | msg->exec(); |
1616 | delete msg; | 1616 | delete msg; |
1617 | 1617 | ||
1618 | } | 1618 | } |
1619 | 1619 | ||
1620 | QString MainWindow::defaultFileName() | 1620 | QString MainWindow::defaultFileName() |
1621 | { | 1621 | { |
1622 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1622 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1623 | } | 1623 | } |
1624 | QString MainWindow::syncFileName() | 1624 | QString MainWindow::syncFileName() |
1625 | { | 1625 | { |
1626 | #ifdef DESKTOP_VERSION | 1626 | #ifdef DESKTOP_VERSION |
1627 | return locateLocal( "tmp", "synccalendar.ics" ); | 1627 | return locateLocal( "tmp", "synccalendar.ics" ); |
1628 | #else | 1628 | #else |
1629 | return QString( "/tmp/synccalendar.ics" ); | 1629 | return QString( "/tmp/synccalendar.ics" ); |
1630 | #endif | 1630 | #endif |
1631 | } | 1631 | } |
1632 | #include "koglobals.h" | 1632 | #include "koglobals.h" |
1633 | #include <kcalendarsystem.h> | 1633 | #include <kcalendarsystem.h> |
1634 | void MainWindow::updateWeek(QDate seda) | 1634 | void MainWindow::updateWeek(QDate seda) |
1635 | { | 1635 | { |
1636 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1636 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1637 | mWeekPixmap.fill( mWeekBgColor ); | 1637 | mWeekPixmap.fill( mWeekBgColor ); |
1638 | QPainter p ( &mWeekPixmap ); | 1638 | QPainter p ( &mWeekPixmap ); |
1639 | p.setFont( mWeekFont ); | 1639 | p.setFont( mWeekFont ); |
1640 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1640 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1641 | p.end(); | 1641 | p.end(); |
1642 | QIconSet icon3 ( mWeekPixmap ); | 1642 | QIconSet icon3 ( mWeekPixmap ); |
1643 | mWeekAction->setIconSet ( icon3 ); | 1643 | mWeekAction->setIconSet ( icon3 ); |
1644 | 1644 | ||
1645 | } | 1645 | } |
1646 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1646 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1647 | { | 1647 | { |
1648 | updateWeek( selectedDates.first() ); | 1648 | updateWeek( selectedDates.first() ); |
1649 | } | 1649 | } |
1650 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1650 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1651 | { | 1651 | { |
1652 | if ( !incidence ) { | 1652 | if ( !incidence ) { |
1653 | mShowAction->setMenuText( i18n("Show") ); | 1653 | mShowAction->setMenuText( i18n("Show") ); |
1654 | enableIncidenceActions( false ); | 1654 | enableIncidenceActions( false ); |
1655 | mNewSubTodoAction->setEnabled( false ); | 1655 | mNewSubTodoAction->setEnabled( false ); |
1656 | setCaptionToDates(); | 1656 | setCaptionToDates(); |
1657 | return; | 1657 | return; |
1658 | } | 1658 | } |
1659 | QString startString = ""; | 1659 | QString startString = ""; |
1660 | if ( incidence->typeID() != todoID ) { | 1660 | if ( incidence->typeID() != todoID ) { |
1661 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1661 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1662 | if ( incidence->doesFloat() ) { | 1662 | if ( incidence->doesFloat() ) { |
1663 | startString += ": "+incidence->dtStartDateStr( true ); | 1663 | startString += ": "+incidence->dtStartDateStr( true ); |
1664 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1664 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1665 | } else { | 1665 | } else { |
1666 | startString = ": "+incidence->dtStartStr(true); | 1666 | startString = ": "+incidence->dtStartStr(true); |
1667 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1667 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1668 | } | 1668 | } |
1669 | } else { | 1669 | } else { |
1670 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1670 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1671 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1671 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1672 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1672 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1673 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { | 1673 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { |
1674 | bool ok; | 1674 | bool ok; |
1675 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1675 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1676 | if ( ok ) { | 1676 | if ( ok ) { |
1677 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1677 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1678 | startString += i18n(" (%1 y.)"). arg( years ); | 1678 | startString += i18n(" (%1 y.)"). arg( years ); |
1679 | } | 1679 | } |
1680 | } | 1680 | } |
1681 | else | 1681 | else |
1682 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1682 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1683 | } | 1683 | } |
1684 | } | 1684 | } |
1685 | else | 1685 | else { |
1686 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1686 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) |
1687 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); | ||
1688 | else | ||
1689 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | ||
1690 | } | ||
1687 | if ( !incidence->location().isEmpty() ) | 1691 | if ( !incidence->location().isEmpty() ) |
1688 | startString += " (" +incidence->location()+")"; | 1692 | startString += " (" +incidence->location()+")"; |
1689 | setCaption( incidence->summary()+startString); | 1693 | setCaption( incidence->summary()+startString); |
1690 | enableIncidenceActions( true ); | 1694 | enableIncidenceActions( true ); |
1691 | if ( incidence->typeID() == eventID ) { | 1695 | if ( incidence->typeID() == eventID ) { |
1692 | mShowAction->setMenuText( i18n("Show Event") ); | 1696 | mShowAction->setMenuText( i18n("Show Event") ); |
1693 | mNewSubTodoAction->setEnabled( false ); | 1697 | mNewSubTodoAction->setEnabled( false ); |
1694 | } else if ( incidence->typeID() == todoID ) { | 1698 | } else if ( incidence->typeID() == todoID ) { |
1695 | mShowAction->setMenuText( i18n("Show Todo") ); | 1699 | mShowAction->setMenuText( i18n("Show Todo") ); |
1696 | mNewSubTodoAction->setEnabled( true ); | 1700 | mNewSubTodoAction->setEnabled( true ); |
1697 | } else { | 1701 | } else { |
1698 | mShowAction->setMenuText( i18n("Show") ); | 1702 | mShowAction->setMenuText( i18n("Show") ); |
1699 | mNewSubTodoAction->setEnabled( false ); | 1703 | mNewSubTodoAction->setEnabled( false ); |
1700 | } | 1704 | } |
1701 | } | 1705 | } |
1702 | 1706 | ||
1703 | void MainWindow::enableIncidenceActions( bool enabled ) | 1707 | void MainWindow::enableIncidenceActions( bool enabled ) |
1704 | { | 1708 | { |
1705 | mShowAction->setEnabled( enabled ); | 1709 | mShowAction->setEnabled( enabled ); |
1706 | mEditAction->setEnabled( enabled ); | 1710 | mEditAction->setEnabled( enabled ); |
1707 | mDeleteAction->setEnabled( enabled ); | 1711 | mDeleteAction->setEnabled( enabled ); |
1708 | 1712 | ||
1709 | mCloneAction->setEnabled( enabled ); | 1713 | mCloneAction->setEnabled( enabled ); |
1710 | mMoveAction->setEnabled( enabled ); | 1714 | mMoveAction->setEnabled( enabled ); |
1711 | #ifndef DESKTOP_VERSION | 1715 | #ifndef DESKTOP_VERSION |
1712 | mBeamAction->setEnabled( enabled ); | 1716 | mBeamAction->setEnabled( enabled ); |
1713 | #endif | 1717 | #endif |
1714 | mCancelAction->setEnabled( enabled ); | 1718 | mCancelAction->setEnabled( enabled ); |
1715 | } | 1719 | } |
1716 | 1720 | ||
1717 | void MainWindow::importOL() | 1721 | void MainWindow::importOL() |
1718 | { | 1722 | { |
1719 | #ifdef _OL_IMPORT_ | 1723 | #ifdef _OL_IMPORT_ |
1720 | mView->clearAllViews(); | 1724 | mView->clearAllViews(); |
1721 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1725 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1722 | id->exec(); | 1726 | id->exec(); |
1723 | delete id; | 1727 | delete id; |
1724 | mView->calendar()->checkAlarmForIncidence( 0, true ); | 1728 | mView->calendar()->checkAlarmForIncidence( 0, true ); |
1725 | mView->updateView(); | 1729 | mView->updateView(); |
1726 | #endif | 1730 | #endif |
1727 | } | 1731 | } |
1728 | void MainWindow::importBday() | 1732 | void MainWindow::importBday() |
1729 | { | 1733 | { |
1730 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), | 1734 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), |
1731 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1735 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1732 | i18n("Import!"), i18n("Cancel"), 0, | 1736 | i18n("Import!"), i18n("Cancel"), 0, |
1733 | 0, 1 ); | 1737 | 0, 1 ); |
1734 | if ( result == 0 ) { | 1738 | if ( result == 0 ) { |
1735 | mView->importBday(); | 1739 | mView->importBday(); |
1736 | 1740 | ||
1737 | } | 1741 | } |
1738 | 1742 | ||
1739 | 1743 | ||
1740 | } | 1744 | } |
1741 | void MainWindow::importQtopia() | 1745 | void MainWindow::importQtopia() |
1742 | { | 1746 | { |
1743 | //#ifndef DESKTOP_VERSION | 1747 | //#ifndef DESKTOP_VERSION |
1744 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); | 1748 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); |
1745 | #ifdef DESKTOP_VERSION | 1749 | #ifdef DESKTOP_VERSION |
1746 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1750 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1747 | #endif | 1751 | #endif |
1748 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1752 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1749 | i18n("Import!"), i18n("Cancel"), 0, | 1753 | i18n("Import!"), i18n("Cancel"), 0, |
1750 | 0, 1 ); | 1754 | 0, 1 ); |
1751 | if ( result == 0 ) { | 1755 | if ( result == 0 ) { |
1752 | #ifndef DESKTOP_VERSION | 1756 | #ifndef DESKTOP_VERSION |
1753 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1757 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1754 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1758 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1755 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1759 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1756 | #else | 1760 | #else |
1757 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1761 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1758 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1762 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1759 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1763 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1760 | #endif | 1764 | #endif |
1761 | mView->importQtopia( categories, datebook, todolist ); | 1765 | mView->importQtopia( categories, datebook, todolist ); |
1762 | } | 1766 | } |
1763 | mView->calendar()->reInitAlarmSettings(); | 1767 | mView->calendar()->reInitAlarmSettings(); |
1764 | #if 0 | 1768 | #if 0 |
1765 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1769 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1766 | i18n("Not supported \non desktop!\n"), | 1770 | i18n("Not supported \non desktop!\n"), |
1767 | i18n("Ok"), i18n("Cancel"), 0, | 1771 | i18n("Ok"), i18n("Cancel"), 0, |
1768 | 0, 1 ); | 1772 | 0, 1 ); |
1769 | 1773 | ||
1770 | #endif | 1774 | #endif |
1771 | } | 1775 | } |
1772 | 1776 | ||
1773 | void MainWindow::saveOnClose() | 1777 | void MainWindow::saveOnClose() |
1774 | { | 1778 | { |
1775 | KOPrefs *p = KOPrefs::instance(); | 1779 | KOPrefs *p = KOPrefs::instance(); |
1776 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1780 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1777 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1781 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1778 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1782 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1779 | if ( filterToolBar ) { | 1783 | if ( filterToolBar ) { |
1780 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1784 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1781 | } | 1785 | } |
1782 | #ifdef DESKTOP_VERSION | 1786 | #ifdef DESKTOP_VERSION |
1783 | 1787 | ||
1784 | QPoint myP; | 1788 | QPoint myP; |
1785 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1789 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1786 | if ( p->mToolBarHor ) | 1790 | if ( p->mToolBarHor ) |
1787 | p->mToolBarUp = myP.y() > height()/2; | 1791 | p->mToolBarUp = myP.y() > height()/2; |
1788 | else | 1792 | else |
1789 | p->mToolBarUp = myP.x() > width()/2; | 1793 | p->mToolBarUp = myP.x() > width()/2; |
1790 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1794 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1791 | if ( p->mToolBarHorV ) | 1795 | if ( p->mToolBarHorV ) |
1792 | p->mToolBarUpV = myP.y() > height()/2; | 1796 | p->mToolBarUpV = myP.y() > height()/2; |
1793 | else | 1797 | else |
1794 | p->mToolBarUpV = myP.x() > width()/2 ; | 1798 | p->mToolBarUpV = myP.x() > width()/2 ; |
1795 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1799 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1796 | if ( p->mToolBarHorN ) | 1800 | if ( p->mToolBarHorN ) |
1797 | p->mToolBarUpN = myP.y() > height()/2; | 1801 | p->mToolBarUpN = myP.y() > height()/2; |
1798 | else | 1802 | else |
1799 | p->mToolBarUpN = myP.x() > width()/2 ; | 1803 | p->mToolBarUpN = myP.x() > width()/2 ; |
1800 | if ( filterToolBar ) { | 1804 | if ( filterToolBar ) { |
1801 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1805 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1802 | if ( p->mToolBarHorF ) | 1806 | if ( p->mToolBarHorF ) |
1803 | p->mToolBarUpF = myP.y() > height()/2; | 1807 | p->mToolBarUpF = myP.y() > height()/2; |
1804 | else | 1808 | else |
1805 | p->mToolBarUpF = myP.x() > width()/2 ; | 1809 | p->mToolBarUpF = myP.x() > width()/2 ; |
1806 | } | 1810 | } |
1807 | #else | 1811 | #else |
1808 | if ( p->mToolBarHor ) | 1812 | if ( p->mToolBarHor ) |
1809 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1813 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1810 | else | 1814 | else |
1811 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1815 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1812 | if ( p->mToolBarHorV ) | 1816 | if ( p->mToolBarHorV ) |
1813 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1817 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1814 | else | 1818 | else |
1815 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1819 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1816 | 1820 | ||
1817 | if ( p->mToolBarHorN ) | 1821 | if ( p->mToolBarHorN ) |
1818 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1822 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1819 | else | 1823 | else |
1820 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1824 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1821 | if ( filterToolBar ) { | 1825 | if ( filterToolBar ) { |
1822 | if ( p->mToolBarHorF ) | 1826 | if ( p->mToolBarHorF ) |
1823 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1827 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1824 | else | 1828 | else |
1825 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1829 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1826 | } | 1830 | } |
1827 | #endif | 1831 | #endif |
1828 | save(); | 1832 | save(); |
1829 | mView->writeSettings(); | 1833 | mView->writeSettings(); |
1830 | mView->checkSuspendAlarm(); | 1834 | mView->checkSuspendAlarm(); |
1831 | } | 1835 | } |
1832 | void MainWindow::slotModifiedChanged( bool ) | 1836 | void MainWindow::slotModifiedChanged( bool ) |
1833 | { | 1837 | { |
1834 | if ( mBlockAtStartup ) | 1838 | if ( mBlockAtStartup ) |
1835 | return; | 1839 | return; |
1836 | 1840 | ||
1837 | int msec; | 1841 | int msec; |
1838 | // we store the changes after 1 minute, | 1842 | // we store the changes after 1 minute, |
1839 | // and for safety reasons after 10 minutes again | 1843 | // and for safety reasons after 10 minutes again |
1840 | if ( !mSyncManager->blockSave() ) | 1844 | if ( !mSyncManager->blockSave() ) |
1841 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1845 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1842 | else | 1846 | else |
1843 | msec = 1000 * 600; | 1847 | msec = 1000 * 600; |
1844 | mSaveTimer.start( msec, true ); // 1 minute | 1848 | mSaveTimer.start( msec, true ); // 1 minute |
1845 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1849 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1846 | mCalendarModifiedFlag = true; | 1850 | mCalendarModifiedFlag = true; |
1847 | } | 1851 | } |
1848 | void MainWindow::saveStopTimer() | 1852 | void MainWindow::saveStopTimer() |
1849 | { | 1853 | { |
1850 | mSaveTimer.stop(); | 1854 | mSaveTimer.stop(); |
1851 | } | 1855 | } |
1852 | void MainWindow::backupAllFiles() | 1856 | void MainWindow::backupAllFiles() |
1853 | { | 1857 | { |
1854 | QDate reference ( 2000,1,1); | 1858 | QDate reference ( 2000,1,1); |
1855 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1859 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1856 | setCaption(i18n("Creating backup ... please wait ..." )); | 1860 | setCaption(i18n("Creating backup ... please wait ..." )); |
1857 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); | 1861 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); |
1858 | // we need the file path, the backup dir and the number of bups as param | 1862 | // we need the file path, the backup dir and the number of bups as param |
1859 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 1863 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
1860 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 1864 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
1861 | bupDir = KGlobalSettings::backupDataDir(); | 1865 | bupDir = KGlobalSettings::backupDataDir(); |
1862 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1866 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1863 | if ( retval == 0 ) { | 1867 | if ( retval == 0 ) { |
1864 | setCaption(i18n("Backup cancelled" )); | 1868 | setCaption(i18n("Backup cancelled" )); |
1865 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 1869 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
1866 | // retval == 0 : backup skipped for today, try again tomorrow | 1870 | // retval == 0 : backup skipped for today, try again tomorrow |
1867 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; | 1871 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; |
1868 | } else if ( retval == 1 ){ | 1872 | } else if ( retval == 1 ){ |
1869 | qDebug("KO: Backup created."); | 1873 | qDebug("KO: Backup created."); |
1870 | // backup ok | 1874 | // backup ok |
1871 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1875 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1872 | KopiCalendarFile * cal = calendars.first(); | 1876 | KopiCalendarFile * cal = calendars.first(); |
1873 | cal = calendars.next(); | 1877 | cal = calendars.next(); |
1874 | while ( cal ) { | 1878 | while ( cal ) { |
1875 | if ( !cal->mErrorOnLoad ) { | 1879 | if ( !cal->mErrorOnLoad ) { |
1876 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1880 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1877 | } | 1881 | } |
1878 | cal = calendars.next(); | 1882 | cal = calendars.next(); |
1879 | } | 1883 | } |
1880 | KOPrefs::instance()->mLastBackupDate = daysTo; | 1884 | KOPrefs::instance()->mLastBackupDate = daysTo; |
1881 | setCaption(i18n("Backup succesfully finished" )); | 1885 | setCaption(i18n("Backup succesfully finished" )); |
1882 | } else if ( retval == 2 ){ | 1886 | } else if ( retval == 2 ){ |
1883 | setCaption(i18n("Backup globally disabled" )); | 1887 | setCaption(i18n("Backup globally disabled" )); |
1884 | qDebug("KO: Backup globally cancelled."); | 1888 | qDebug("KO: Backup globally cancelled."); |
1885 | // backup globally cancelled | 1889 | // backup globally cancelled |
1886 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 1890 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
1887 | } | 1891 | } |
1888 | // retval == 3: do nothing, try again later | 1892 | // retval == 3: do nothing, try again later |
1889 | } | 1893 | } |
1890 | void MainWindow::save() | 1894 | void MainWindow::save() |
1891 | { | 1895 | { |
1892 | 1896 | ||
1893 | if ( mView->viewManager()->journalView() ) | 1897 | if ( mView->viewManager()->journalView() ) |
1894 | mView->viewManager()->journalView()->checkModified(); | 1898 | mView->viewManager()->journalView()->checkModified(); |
1895 | if ( !mCalendarModifiedFlag ) { | 1899 | if ( !mCalendarModifiedFlag ) { |
1896 | qDebug("KO: Calendar not modified. Nothing saved."); | 1900 | qDebug("KO: Calendar not modified. Nothing saved."); |
1897 | return; | 1901 | return; |
1898 | } | 1902 | } |
1899 | if ( mSyncManager->blockSave() ) | 1903 | if ( mSyncManager->blockSave() ) |
1900 | return; | 1904 | return; |
1901 | mSyncManager->setBlockSave(true); | 1905 | mSyncManager->setBlockSave(true); |
1902 | if ( mView->checkAllFileVersions() ) { | 1906 | if ( mView->checkAllFileVersions() ) { |
1903 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 1907 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
1904 | QDate reference ( 2000,1,1); | 1908 | QDate reference ( 2000,1,1); |
1905 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1909 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1906 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 1910 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |
1907 | backupAllFiles(); | 1911 | backupAllFiles(); |
1908 | } | 1912 | } |
1909 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 1913 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
1910 | } | 1914 | } |
1911 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1915 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1912 | if ( !isMinimized () ) | 1916 | if ( !isMinimized () ) |
1913 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1917 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1914 | qDebug("KO: Start saving data to file!"); | 1918 | qDebug("KO: Start saving data to file!"); |
1915 | mView->saveCalendars(); | 1919 | mView->saveCalendars(); |
1916 | mCalendarModifiedFlag = false; | 1920 | mCalendarModifiedFlag = false; |
1917 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1921 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1918 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1922 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1919 | QString savemes; | 1923 | QString savemes; |
1920 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1924 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1921 | if ( !isMinimized () ) | 1925 | if ( !isMinimized () ) |
1922 | setCaption(savemes); | 1926 | setCaption(savemes); |
1923 | else | 1927 | else |
1924 | qDebug(savemes); | 1928 | qDebug(savemes); |
1925 | } else | 1929 | } else |
1926 | setCaption(i18n("Saving cancelled!")); | 1930 | setCaption(i18n("Saving cancelled!")); |
1927 | mSyncManager->setBlockSave( false ); | 1931 | mSyncManager->setBlockSave( false ); |
1928 | } | 1932 | } |
1929 | 1933 | ||
1930 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1934 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1931 | { | 1935 | { |
1932 | if ( !e->isAutoRepeat() ) { | 1936 | if ( !e->isAutoRepeat() ) { |
1933 | mFlagKeyPressed = false; | 1937 | mFlagKeyPressed = false; |
1934 | } | 1938 | } |
1935 | } | 1939 | } |
1936 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1940 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1937 | { | 1941 | { |
1938 | qApp->processEvents(); | 1942 | qApp->processEvents(); |
1939 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1943 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1940 | e->ignore(); | 1944 | e->ignore(); |
1941 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1945 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1942 | return; | 1946 | return; |