-rw-r--r-- | korganizer/calendarview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 2ba8528..e31a6e1 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3823,386 +3823,386 @@ void CalendarView::newFloatingEvent() | |||
3823 | { | 3823 | { |
3824 | DateList tmpList = mNavigator->selectedDates(); | 3824 | DateList tmpList = mNavigator->selectedDates(); |
3825 | QDate date = tmpList.first(); | 3825 | QDate date = tmpList.first(); |
3826 | 3826 | ||
3827 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), | 3827 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), |
3828 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); | 3828 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); |
3829 | } | 3829 | } |
3830 | 3830 | ||
3831 | 3831 | ||
3832 | void CalendarView::editEvent( Event *event ) | 3832 | void CalendarView::editEvent( Event *event ) |
3833 | { | 3833 | { |
3834 | 3834 | ||
3835 | if ( !event ) return; | 3835 | if ( !event ) return; |
3836 | if ( event->isReadOnly() ) { | 3836 | if ( event->isReadOnly() ) { |
3837 | showEvent( event ); | 3837 | showEvent( event ); |
3838 | return; | 3838 | return; |
3839 | } | 3839 | } |
3840 | showEventEditor(); | 3840 | showEventEditor(); |
3841 | mEventEditor->editEvent( event , mFlagEditDescription); | 3841 | mEventEditor->editEvent( event , mFlagEditDescription); |
3842 | mEventEditor->exec(); | 3842 | mEventEditor->exec(); |
3843 | setActiveWindow(); | 3843 | setActiveWindow(); |
3844 | 3844 | ||
3845 | } | 3845 | } |
3846 | void CalendarView::editJournal( Journal *jour ) | 3846 | void CalendarView::editJournal( Journal *jour ) |
3847 | { | 3847 | { |
3848 | if ( !jour ) return; | 3848 | if ( !jour ) return; |
3849 | mDialogManager->hideSearchDialog(); | 3849 | mDialogManager->hideSearchDialog(); |
3850 | mViewManager->showJournalView(); | 3850 | mViewManager->showJournalView(); |
3851 | mNavigator->slotDaySelect( jour->dtStart().date() ); | 3851 | mNavigator->slotDaySelect( jour->dtStart().date() ); |
3852 | } | 3852 | } |
3853 | void CalendarView::editTodo( Todo *todo ) | 3853 | void CalendarView::editTodo( Todo *todo ) |
3854 | { | 3854 | { |
3855 | if ( !todo ) return; | 3855 | if ( !todo ) return; |
3856 | 3856 | ||
3857 | if ( todo->isReadOnly() ) { | 3857 | if ( todo->isReadOnly() ) { |
3858 | showTodo( todo ); | 3858 | showTodo( todo ); |
3859 | return; | 3859 | return; |
3860 | } | 3860 | } |
3861 | showTodoEditor(); | 3861 | showTodoEditor(); |
3862 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | 3862 | mTodoEditor->editTodo( todo ,mFlagEditDescription); |
3863 | mTodoEditor->exec(); | 3863 | mTodoEditor->exec(); |
3864 | setActiveWindow(); | 3864 | setActiveWindow(); |
3865 | 3865 | ||
3866 | } | 3866 | } |
3867 | 3867 | ||
3868 | KOEventViewerDialog* CalendarView::getEventViewerDialog() | 3868 | KOEventViewerDialog* CalendarView::getEventViewerDialog() |
3869 | { | 3869 | { |
3870 | if ( !mEventViewerDialog ) { | 3870 | if ( !mEventViewerDialog ) { |
3871 | mEventViewerDialog = new KOEventViewerDialog(0); | 3871 | mEventViewerDialog = new KOEventViewerDialog(0); |
3872 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); | 3872 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); |
3873 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 3873 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
3874 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 3874 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
3875 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 3875 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
3876 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 3876 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
3877 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 3877 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
3878 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), | 3878 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), |
3879 | this, SLOT( slotViewerClosed() ) ); | 3879 | this, SLOT( slotViewerClosed() ) ); |
3880 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), | 3880 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), |
3881 | this, SLOT( todoChanged(Todo *) ) ); | 3881 | this, SLOT( todoChanged(Todo *) ) ); |
3882 | connect( mEventViewerDialog, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 3882 | connect( mEventViewerDialog, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
3883 | mEventViewerDialog->resize( 640, 480 ); | 3883 | mEventViewerDialog->resize( 640, 480 ); |
3884 | 3884 | ||
3885 | } | 3885 | } |
3886 | return mEventViewerDialog; | 3886 | return mEventViewerDialog; |
3887 | } | 3887 | } |
3888 | void CalendarView::showEvent(Event *event) | 3888 | void CalendarView::showEvent(Event *event) |
3889 | { | 3889 | { |
3890 | getEventViewerDialog()->setEvent(event); | 3890 | getEventViewerDialog()->setEvent(event); |
3891 | getEventViewerDialog()->showMe(); | 3891 | getEventViewerDialog()->showMe(); |
3892 | } | 3892 | } |
3893 | 3893 | ||
3894 | void CalendarView::showTodo(Todo *event) | 3894 | void CalendarView::showTodo(Todo *event) |
3895 | { | 3895 | { |
3896 | getEventViewerDialog()->setTodo(event); | 3896 | getEventViewerDialog()->setTodo(event); |
3897 | getEventViewerDialog()->showMe(); | 3897 | getEventViewerDialog()->showMe(); |
3898 | } | 3898 | } |
3899 | void CalendarView::showJournal( Journal *jour ) | 3899 | void CalendarView::showJournal( Journal *jour ) |
3900 | { | 3900 | { |
3901 | getEventViewerDialog()->setJournal(jour); | 3901 | getEventViewerDialog()->setJournal(jour); |
3902 | getEventViewerDialog()->showMe(); | 3902 | getEventViewerDialog()->showMe(); |
3903 | 3903 | ||
3904 | } | 3904 | } |
3905 | // void CalendarView::todoModified (Todo *event, int changed) | 3905 | // void CalendarView::todoModified (Todo *event, int changed) |
3906 | // { | 3906 | // { |
3907 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 3907 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
3908 | // // kdDebug() << "Todo modified and open" << endl; | 3908 | // // kdDebug() << "Todo modified and open" << endl; |
3909 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 3909 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
3910 | // // temp->modified (changed); | 3910 | // // temp->modified (changed); |
3911 | 3911 | ||
3912 | // // } | 3912 | // // } |
3913 | 3913 | ||
3914 | // mViewManager->updateView(); | 3914 | // mViewManager->updateView(); |
3915 | // } | 3915 | // } |
3916 | 3916 | ||
3917 | void CalendarView::appointment_show() | 3917 | void CalendarView::appointment_show() |
3918 | { | 3918 | { |
3919 | Event *anEvent = 0; | 3919 | Event *anEvent = 0; |
3920 | 3920 | ||
3921 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3921 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3922 | 3922 | ||
3923 | if (mViewManager->currentView()->isEventView()) { | 3923 | if (mViewManager->currentView()->isEventView()) { |
3924 | if ( incidence && incidence->typeID() == eventID ) { | 3924 | if ( incidence && incidence->typeID() == eventID ) { |
3925 | anEvent = static_cast<Event *>(incidence); | 3925 | anEvent = static_cast<Event *>(incidence); |
3926 | } | 3926 | } |
3927 | } | 3927 | } |
3928 | 3928 | ||
3929 | if (!anEvent) { | 3929 | if (!anEvent) { |
3930 | KNotifyClient::beep(); | 3930 | KNotifyClient::beep(); |
3931 | return; | 3931 | return; |
3932 | } | 3932 | } |
3933 | 3933 | ||
3934 | showEvent(anEvent); | 3934 | showEvent(anEvent); |
3935 | } | 3935 | } |
3936 | 3936 | ||
3937 | void CalendarView::appointment_edit() | 3937 | void CalendarView::appointment_edit() |
3938 | { | 3938 | { |
3939 | Event *anEvent = 0; | 3939 | Event *anEvent = 0; |
3940 | 3940 | ||
3941 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3941 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3942 | 3942 | ||
3943 | if (mViewManager->currentView()->isEventView()) { | 3943 | if (mViewManager->currentView()->isEventView()) { |
3944 | if ( incidence && incidence->typeID() == eventID ) { | 3944 | if ( incidence && incidence->typeID() == eventID ) { |
3945 | anEvent = static_cast<Event *>(incidence); | 3945 | anEvent = static_cast<Event *>(incidence); |
3946 | } | 3946 | } |
3947 | } | 3947 | } |
3948 | 3948 | ||
3949 | if (!anEvent) { | 3949 | if (!anEvent) { |
3950 | KNotifyClient::beep(); | 3950 | KNotifyClient::beep(); |
3951 | return; | 3951 | return; |
3952 | } | 3952 | } |
3953 | 3953 | ||
3954 | editEvent(anEvent); | 3954 | editEvent(anEvent); |
3955 | } | 3955 | } |
3956 | 3956 | ||
3957 | void CalendarView::appointment_delete() | 3957 | void CalendarView::appointment_delete() |
3958 | { | 3958 | { |
3959 | Event *anEvent = 0; | 3959 | Event *anEvent = 0; |
3960 | 3960 | ||
3961 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3961 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3962 | 3962 | ||
3963 | if (mViewManager->currentView()->isEventView()) { | 3963 | if (mViewManager->currentView()->isEventView()) { |
3964 | if ( incidence && incidence->typeID() == eventID ) { | 3964 | if ( incidence && incidence->typeID() == eventID ) { |
3965 | anEvent = static_cast<Event *>(incidence); | 3965 | anEvent = static_cast<Event *>(incidence); |
3966 | } | 3966 | } |
3967 | } | 3967 | } |
3968 | 3968 | ||
3969 | if (!anEvent) { | 3969 | if (!anEvent) { |
3970 | KNotifyClient::beep(); | 3970 | KNotifyClient::beep(); |
3971 | return; | 3971 | return; |
3972 | } | 3972 | } |
3973 | 3973 | ||
3974 | deleteEvent(anEvent); | 3974 | deleteEvent(anEvent); |
3975 | } | 3975 | } |
3976 | 3976 | ||
3977 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | 3977 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) |
3978 | { | 3978 | { |
3979 | if (!sub) return; | 3979 | if (!sub) return; |
3980 | if ( sub->relatedTo() == parent ) | 3980 | if ( sub->relatedTo() == parent ) |
3981 | return; | 3981 | return; |
3982 | sub->setRelatedTo(parent); | 3982 | sub->setRelatedTo(parent); |
3983 | sub->updated(); | 3983 | sub->updated(); |
3984 | setModified(true); | 3984 | setModified(true); |
3985 | updateView(); | 3985 | updateView(); |
3986 | } | 3986 | } |
3987 | void CalendarView::todo_unsub(Todo *anTodo ) | 3987 | void CalendarView::todo_unsub(Todo *anTodo ) |
3988 | { | 3988 | { |
3989 | todo_resub( 0, anTodo ); | 3989 | todo_resub( 0, anTodo ); |
3990 | } | 3990 | } |
3991 | 3991 | ||
3992 | void CalendarView::deleteTodo(Todo *todo) | 3992 | void CalendarView::deleteTodo(Todo *todo) |
3993 | { | 3993 | { |
3994 | if (!todo) { | 3994 | if (!todo) { |
3995 | KNotifyClient::beep(); | 3995 | KNotifyClient::beep(); |
3996 | return; | 3996 | return; |
3997 | } | 3997 | } |
3998 | if (KOPrefs::instance()->mConfirm) { | 3998 | if (KOPrefs::instance()->mConfirm) { |
3999 | QString text = KGlobal::formatMessage ( todo->summary(),0 ); | 3999 | QString text = KGlobal::formatMessage ( todo->summary(),0 ); |
4000 | if (!todo->relations().isEmpty()) { | 4000 | if (!todo->relations().isEmpty()) { |
4001 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); | 4001 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); |
4002 | 4002 | ||
4003 | } | 4003 | } |
4004 | switch (msgItemDelete(i18n("Todo:") +"\n"+text)) { | 4004 | switch (msgItemDelete(i18n("Todo:") +"\n"+text)) { |
4005 | case KMessageBox::Continue: // OK | 4005 | case KMessageBox::Continue: // OK |
4006 | bool deleteT = false; | 4006 | bool deleteT = false; |
4007 | if (!todo->relations().isEmpty()) { | 4007 | if (!todo->relations().isEmpty()) { |
4008 | deleteT = removeCompletedSubTodos( todo ); | 4008 | deleteT = removeCompletedSubTodos( todo ); |
4009 | } | 4009 | } |
4010 | // deleteT == true: todo already deleted in removeCompletedSubTodos | 4010 | // deleteT == true: todo already deleted in removeCompletedSubTodos |
4011 | if ( !deleteT ) { | 4011 | if ( !deleteT ) { |
4012 | checkExternalId( todo ); | 4012 | checkExternalId( todo ); |
4013 | calendar()->deleteTodo(todo); | 4013 | calendar()->deleteTodo(todo); |
4014 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 4014 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
4015 | updateView(); | ||
4016 | } | 4015 | } |
4016 | updateView(); | ||
4017 | break; | 4017 | break; |
4018 | } // switch | 4018 | } // switch |
4019 | } else { | 4019 | } else { |
4020 | checkExternalId( todo ); | 4020 | checkExternalId( todo ); |
4021 | mCalendar->deleteTodo(todo); | 4021 | mCalendar->deleteTodo(todo); |
4022 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 4022 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
4023 | updateView(); | 4023 | updateView(); |
4024 | } | 4024 | } |
4025 | 4025 | ||
4026 | emit updateSearchDialog(); | 4026 | emit updateSearchDialog(); |
4027 | } | 4027 | } |
4028 | void CalendarView::deleteJournal(Journal *jour) | 4028 | void CalendarView::deleteJournal(Journal *jour) |
4029 | { | 4029 | { |
4030 | if (!jour) { | 4030 | if (!jour) { |
4031 | KNotifyClient::beep(); | 4031 | KNotifyClient::beep(); |
4032 | return; | 4032 | return; |
4033 | } | 4033 | } |
4034 | if (KOPrefs::instance()->mConfirm) { | 4034 | if (KOPrefs::instance()->mConfirm) { |
4035 | 4035 | ||
4036 | QString des; | 4036 | QString des; |
4037 | if ( !jour->summary().isEmpty() ) { | 4037 | if ( !jour->summary().isEmpty() ) { |
4038 | des = jour->summary(); | 4038 | des = jour->summary(); |
4039 | } else { | 4039 | } else { |
4040 | des = jour->description().left(30); | 4040 | des = jour->description().left(30); |
4041 | des = des.simplifyWhiteSpace (); | 4041 | des = des.simplifyWhiteSpace (); |
4042 | des.replace (QRegExp ("\\n"),"" ); | 4042 | des.replace (QRegExp ("\\n"),"" ); |
4043 | des.replace (QRegExp ("\\r"),"" ); | 4043 | des.replace (QRegExp ("\\r"),"" ); |
4044 | } | 4044 | } |
4045 | switch (msgItemDelete( i18n("Journal:") +"\n"+KGlobal::formatMessage ( des,0 ))) { | 4045 | switch (msgItemDelete( i18n("Journal:") +"\n"+KGlobal::formatMessage ( des,0 ))) { |
4046 | case KMessageBox::Continue: // OK | 4046 | case KMessageBox::Continue: // OK |
4047 | calendar()->deleteJournal(jour); | 4047 | calendar()->deleteJournal(jour); |
4048 | updateView(); | 4048 | updateView(); |
4049 | break; | 4049 | break; |
4050 | } // switch | 4050 | } // switch |
4051 | } else { | 4051 | } else { |
4052 | calendar()->deleteJournal(jour);; | 4052 | calendar()->deleteJournal(jour);; |
4053 | updateView(); | 4053 | updateView(); |
4054 | } | 4054 | } |
4055 | emit updateSearchDialog(); | 4055 | emit updateSearchDialog(); |
4056 | } | 4056 | } |
4057 | 4057 | ||
4058 | void CalendarView::deleteEvent(Event *anEvent) | 4058 | void CalendarView::deleteEvent(Event *anEvent) |
4059 | { | 4059 | { |
4060 | if (!anEvent) { | 4060 | if (!anEvent) { |
4061 | KNotifyClient::beep(); | 4061 | KNotifyClient::beep(); |
4062 | return; | 4062 | return; |
4063 | } | 4063 | } |
4064 | 4064 | ||
4065 | if (anEvent->doesRecur()) { | 4065 | if (anEvent->doesRecur()) { |
4066 | QDate itemDate = mViewManager->currentSelectionDate(); | 4066 | QDate itemDate = mViewManager->currentSelectionDate(); |
4067 | int km; | 4067 | int km; |
4068 | if (!itemDate.isValid()) { | 4068 | if (!itemDate.isValid()) { |
4069 | //kdDebug() << "Date Not Valid" << endl; | 4069 | //kdDebug() << "Date Not Valid" << endl; |
4070 | if (KOPrefs::instance()->mConfirm) { | 4070 | if (KOPrefs::instance()->mConfirm) { |
4071 | km = KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + | 4071 | km = KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + |
4072 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), | 4072 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), |
4073 | i18n("KO/Pi Confirmation"),i18n("Delete All")); | 4073 | i18n("KO/Pi Confirmation"),i18n("Delete All")); |
4074 | if ( km == KMessageBox::Continue ) | 4074 | if ( km == KMessageBox::Continue ) |
4075 | km = KMessageBox::No; // No = all below | 4075 | km = KMessageBox::No; // No = all below |
4076 | } else | 4076 | } else |
4077 | km = KMessageBox::No; | 4077 | km = KMessageBox::No; |
4078 | } else { | 4078 | } else { |
4079 | km = KMessageBox::warningYesNoCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + | 4079 | km = KMessageBox::warningYesNoCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + |
4080 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ | 4080 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ |
4081 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), | 4081 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), |
4082 | i18n("KO/Pi Confirmation"),i18n("Current"), | 4082 | i18n("KO/Pi Confirmation"),i18n("Current"), |
4083 | i18n("All")); | 4083 | i18n("All")); |
4084 | } | 4084 | } |
4085 | switch(km) { | 4085 | switch(km) { |
4086 | 4086 | ||
4087 | case KMessageBox::No: // Continue // all | 4087 | case KMessageBox::No: // Continue // all |
4088 | //qDebug("KMessageBox::No "); | 4088 | //qDebug("KMessageBox::No "); |
4089 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 4089 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
4090 | schedule(Scheduler::Cancel,anEvent); | 4090 | schedule(Scheduler::Cancel,anEvent); |
4091 | 4091 | ||
4092 | checkExternalId( anEvent); | 4092 | checkExternalId( anEvent); |
4093 | mCalendar->deleteEvent(anEvent); | 4093 | mCalendar->deleteEvent(anEvent); |
4094 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); | 4094 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); |
4095 | break; | 4095 | break; |
4096 | 4096 | ||
4097 | // Disabled because it does not work | 4097 | // Disabled because it does not work |
4098 | //#if 0 | 4098 | //#if 0 |
4099 | case KMessageBox::Yes: // just this one | 4099 | case KMessageBox::Yes: // just this one |
4100 | //QDate qd = mNavigator->selectedDates().first(); | 4100 | //QDate qd = mNavigator->selectedDates().first(); |
4101 | //if (!qd.isValid()) { | 4101 | //if (!qd.isValid()) { |
4102 | // kdDebug() << "no date selected, or invalid date" << endl; | 4102 | // kdDebug() << "no date selected, or invalid date" << endl; |
4103 | // KNotifyClient::beep(); | 4103 | // KNotifyClient::beep(); |
4104 | // return; | 4104 | // return; |
4105 | //} | 4105 | //} |
4106 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); | 4106 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); |
4107 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { | 4107 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { |
4108 | anEvent->addExDate(itemDate); | 4108 | anEvent->addExDate(itemDate); |
4109 | int duration = anEvent->recurrence()->duration(); | 4109 | int duration = anEvent->recurrence()->duration(); |
4110 | if ( duration > 0 ) { | 4110 | if ( duration > 0 ) { |
4111 | anEvent->recurrence()->setDuration( duration - 1 ); | 4111 | anEvent->recurrence()->setDuration( duration - 1 ); |
4112 | } | 4112 | } |
4113 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); | 4113 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); |
4114 | } | 4114 | } |
4115 | break; | 4115 | break; |
4116 | //#endif | 4116 | //#endif |
4117 | } // switch | 4117 | } // switch |
4118 | } else { | 4118 | } else { |
4119 | if (KOPrefs::instance()->mConfirm) { | 4119 | if (KOPrefs::instance()->mConfirm) { |
4120 | switch (KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + | 4120 | switch (KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + |
4121 | i18n("\nAre you sure you want\nto delete this event?"), | 4121 | i18n("\nAre you sure you want\nto delete this event?"), |
4122 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { | 4122 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { |
4123 | case KMessageBox::Continue: // OK | 4123 | case KMessageBox::Continue: // OK |
4124 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 4124 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
4125 | schedule(Scheduler::Cancel,anEvent); | 4125 | schedule(Scheduler::Cancel,anEvent); |
4126 | checkExternalId( anEvent); | 4126 | checkExternalId( anEvent); |
4127 | mCalendar->deleteEvent(anEvent); | 4127 | mCalendar->deleteEvent(anEvent); |
4128 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 4128 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
4129 | break; | 4129 | break; |
4130 | } // switch | 4130 | } // switch |
4131 | } else { | 4131 | } else { |
4132 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 4132 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
4133 | schedule(Scheduler::Cancel,anEvent); | 4133 | schedule(Scheduler::Cancel,anEvent); |
4134 | checkExternalId( anEvent); | 4134 | checkExternalId( anEvent); |
4135 | mCalendar->deleteEvent(anEvent); | 4135 | mCalendar->deleteEvent(anEvent); |
4136 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 4136 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
4137 | } | 4137 | } |
4138 | } // if-else | 4138 | } // if-else |
4139 | emit updateSearchDialog(); | 4139 | emit updateSearchDialog(); |
4140 | } | 4140 | } |
4141 | 4141 | ||
4142 | bool CalendarView::deleteEvent(const QString &uid) | 4142 | bool CalendarView::deleteEvent(const QString &uid) |
4143 | { | 4143 | { |
4144 | Event *ev = mCalendar->event(uid); | 4144 | Event *ev = mCalendar->event(uid); |
4145 | if (ev) { | 4145 | if (ev) { |
4146 | deleteEvent(ev); | 4146 | deleteEvent(ev); |
4147 | return true; | 4147 | return true; |
4148 | } else { | 4148 | } else { |
4149 | return false; | 4149 | return false; |
4150 | } | 4150 | } |
4151 | } | 4151 | } |
4152 | 4152 | ||
4153 | /*****************************************************************************/ | 4153 | /*****************************************************************************/ |
4154 | 4154 | ||
4155 | void CalendarView::action_mail() | 4155 | void CalendarView::action_mail() |
4156 | { | 4156 | { |
4157 | #ifndef KORG_NOMAIL | 4157 | #ifndef KORG_NOMAIL |
4158 | KOMailClient mailClient; | 4158 | KOMailClient mailClient; |
4159 | 4159 | ||
4160 | Incidence *incidence = currentSelection(); | 4160 | Incidence *incidence = currentSelection(); |
4161 | 4161 | ||
4162 | if (!incidence) { | 4162 | if (!incidence) { |
4163 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 4163 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
4164 | return; | 4164 | return; |
4165 | } | 4165 | } |
4166 | if(incidence->attendeeCount() == 0 ) { | 4166 | if(incidence->attendeeCount() == 0 ) { |
4167 | KMessageBox::sorry(this, | 4167 | KMessageBox::sorry(this, |
4168 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 4168 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
4169 | return; | 4169 | return; |
4170 | } | 4170 | } |
4171 | 4171 | ||
4172 | CalendarLocal cal_tmp; | 4172 | CalendarLocal cal_tmp; |
4173 | Event *event = 0; | 4173 | Event *event = 0; |
4174 | Event *ev = 0; | 4174 | Event *ev = 0; |
4175 | if ( incidence && incidence->typeID() == eventID ) { | 4175 | if ( incidence && incidence->typeID() == eventID ) { |
4176 | event = static_cast<Event *>(incidence); | 4176 | event = static_cast<Event *>(incidence); |
4177 | ev = new Event(*event); | 4177 | ev = new Event(*event); |
4178 | cal_tmp.addEvent(ev); | 4178 | cal_tmp.addEvent(ev); |
4179 | } | 4179 | } |
4180 | ICalFormat mForm(); | 4180 | ICalFormat mForm(); |
4181 | QString attachment = mForm.toString( &cal_tmp ); | 4181 | QString attachment = mForm.toString( &cal_tmp ); |
4182 | if (ev) delete(ev); | 4182 | if (ev) delete(ev); |
4183 | 4183 | ||
4184 | mailClient.mailAttendees(currentSelection(), attachment); | 4184 | mailClient.mailAttendees(currentSelection(), attachment); |
4185 | 4185 | ||
4186 | #endif | 4186 | #endif |
4187 | 4187 | ||
4188 | #if 0 | 4188 | #if 0 |
4189 | Event *anEvent = 0; | 4189 | Event *anEvent = 0; |
4190 | if (mViewManager->currentView()->isEventView()) { | 4190 | if (mViewManager->currentView()->isEventView()) { |
4191 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); | 4191 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); |
4192 | } | 4192 | } |
4193 | 4193 | ||
4194 | if (!anEvent) { | 4194 | if (!anEvent) { |
4195 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 4195 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
4196 | return; | 4196 | return; |
4197 | } | 4197 | } |
4198 | if(anEvent->attendeeCount() == 0 ) { | 4198 | if(anEvent->attendeeCount() == 0 ) { |
4199 | KMessageBox::sorry(this, | 4199 | KMessageBox::sorry(this, |
4200 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 4200 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
4201 | return; | 4201 | return; |
4202 | } | 4202 | } |
4203 | 4203 | ||
4204 | mailobject.emailEvent(anEvent); | 4204 | mailobject.emailEvent(anEvent); |
4205 | #endif | 4205 | #endif |
4206 | } | 4206 | } |
4207 | 4207 | ||
4208 | 4208 | ||