33 #include "calendarview.h"
35 #ifndef KORG_NOPRINTER
36 #include "calprinter.h"
38 #include "koeventeditor.h"
39 #include "kotodoeditor.h"
40 #include "kojournaleditor.h"
42 #include "koeventviewerdialog.h"
43 #include "publishdialog.h"
44 #include "koglobals.h"
45 #include "koviewmanager.h"
46 #include "koagendaview.h"
47 #include "kodialogmanager.h"
48 #include "statusdialog.h"
49 #include "datenavigatorcontainer.h"
50 #include "kotodoview.h"
51 #include "datenavigator.h"
52 #include "resourceview.h"
53 #include "navigatorbar.h"
55 #include "kogroupware.h"
56 #include "freebusymanager.h"
57 #include "komonthview.h"
58 #include "datechecker.h"
59 #include "komessagebox.h"
60 #include "exportwebdialog.h"
61 #include "kocorehelper.h"
62 #include "incidencechanger.h"
63 #include "kholidays.h"
64 #include "mailscheduler.h"
65 #include "komailclient.h"
66 #include "multiagendaview.h"
69 #include <libkcal/vcaldrag.h>
70 #include <libkcal/icaldrag.h>
71 #include <libkcal/icalformat.h>
72 #include <libkcal/vcalformat.h>
73 #include <libkcal/scheduler.h>
74 #include <libkcal/calendarlocal.h>
75 #include <libkcal/journal.h>
76 #include <libkcal/calfilter.h>
77 #include <libkcal/attendee.h>
78 #include <libkcal/dndfactory.h>
79 #include <libkcal/freebusy.h>
80 #include <libkcal/filestorage.h>
82 #include <libkcal/calendarnull.h>
83 #include <libkcal/htmlexportsettings.h>
85 #include <tdeglobal.h>
87 #include <kstandarddirs.h>
88 #include <tdefiledialog.h>
89 #include <tdemessagebox.h>
90 #include <knotifyclient.h>
91 #include <tdeconfig.h>
93 #include <kdirwatch.h>
95 #include <tqapplication.h>
96 #include <tqclipboard.h>
98 #include <tqmultilineedit.h>
100 #include <tqwidgetstack.h>
101 #include <tqptrlist.h>
103 #include <tqlayout.h>
104 #ifndef KORG_NOSPLITTER
105 #include <tqsplitter.h>
108 #include <tqwhatsthis.h>
113 using namespace KOrg;
121 kdDebug(5850) <<
"CalendarView::CalendarView( Calendar )" << endl;
128 mSelectedIncidence = 0;
130 mFilters.setAutoDelete(
true );
132 mExtensions.setAutoDelete(
true );
135 mDateChecker =
new DateChecker(
this );
137 TQBoxLayout *topLayout =
new TQVBoxLayout(
this );
139 #ifndef KORG_NOSPLITTER
141 mPanner =
new TQSplitter( TQt::Horizontal,
this,
142 "CalendarView::Panner" );
143 topLayout->addWidget( mPanner );
145 mLeftSplitter =
new TQSplitter( TQt::Vertical, mPanner,
146 "CalendarView::LeftFrame" );
149 mDateNavigatorContainer =
new DateNavigatorContainer( mLeftSplitter,
150 "CalendarView::DateNavigator" );
153 mLeftSplitter->setCollapsible( mDateNavigatorContainer,
true );
154 mTodoList =
new KOTodoView( CalendarNull::self(), mLeftSplitter,
"todolist" );
156 mEventViewer =
new KOEventViewer( CalendarNull::self(), mLeftSplitter,
"EventViewer" );
158 TQVBox *rightBox =
new TQVBox( mPanner );
159 mNavigatorBar =
new NavigatorBar( rightBox );
160 mRightFrame =
new TQWidgetStack( rightBox );
161 rightBox->setStretchFactor( mRightFrame, 1 );
163 mLeftFrame = mLeftSplitter;
168 if ( KOPrefs::instance()->mVerticalScreen ) {
169 mainBox =
new TQVBox(
this );
170 leftFrame =
new TQHBox( mainBox );
172 mainBox =
new TQHBox(
this );
173 leftFrame =
new TQVBox( mainBox );
176 topLayout->addWidget( mainBox );
178 mDateNavigatorContainer =
new KDateNavigator( leftFrame,
true,
179 "CalendarView::DateNavigator",
180 TQDate::currentDate() );
181 mTodoList =
new KOTodoView( CalendarNull::self(), leftFrame,
"todolist" );
183 mEventViewer =
new KOEventViewer ( CalendarNull::self(), leftFrame,
"EventViewer" );
185 TQWidget *rightBox =
new TQWidget( mainBox );
186 TQBoxLayout *rightLayout =
new TQVBoxLayout( rightBox );
188 mNavigatorBar =
new NavigatorBar( TQDate::currentDate(), rightBox );
189 rightLayout->addWidget( mNavigatorBar );
191 mRightFrame =
new TQWidgetStack( rightBox );
192 rightLayout->addWidget( mRightFrame );
194 mLeftFrame = leftFrame;
196 if ( KOPrefs::instance()->mVerticalScreen ) {
198 mTodoList->setFixedHeight( mDateNavigatorContainer->sizeHint().height() );
203 connect( mDateNavigator, TQ_SIGNAL( datesSelected(
const KCal::DateList &,
const TQDate & ) ),
204 TQ_SLOT(
showDates(
const KCal::DateList &,
const TQDate & ) ) );
207 connect( mNavigatorBar, TQ_SIGNAL( prevYearClicked() ),
208 mDateNavigator, TQ_SLOT( selectPreviousYear() ) );
209 connect( mNavigatorBar, TQ_SIGNAL( nextYearClicked() ),
210 mDateNavigator, TQ_SLOT( selectNextYear() ) );
211 connect( mNavigatorBar, TQ_SIGNAL( prevMonthClicked() ),
212 mDateNavigator, TQ_SLOT( selectPreviousMonth() ) );
213 connect( mNavigatorBar, TQ_SIGNAL( nextMonthClicked() ),
214 mDateNavigator, TQ_SLOT( selectNextMonth() ) );
215 connect( mNavigatorBar, TQ_SIGNAL( monthSelected(
int) ),
216 mDateNavigator, TQ_SLOT( selectMonth(
int) ) );
217 connect( mNavigatorBar, TQ_SIGNAL( yearSelected(
int)),
218 mDateNavigator, TQ_SLOT(selectYear(
int)) );
222 connect( mDateNavigatorContainer, TQ_SIGNAL( weekClicked(
const TQDate & ) ),
223 this, TQ_SLOT(
selectWeek(
const TQDate & ) ) );
224 connect( mDateNavigatorContainer, TQ_SIGNAL( prevMonthClicked(
const TQDate &,
const TQDate &,
const TQDate &) ),
225 mDateNavigator, TQ_SLOT( selectPreviousMonth(
const TQDate &,
const TQDate &,
const TQDate &) ) );
226 connect( mDateNavigatorContainer, TQ_SIGNAL( nextMonthClicked(
const TQDate &,
const TQDate &,
const TQDate &) ),
227 mDateNavigator, TQ_SLOT( selectNextMonth(
const TQDate &,
const TQDate &,
const TQDate &) ) );
228 connect( mDateNavigatorContainer, TQ_SIGNAL( prevYearClicked() ),
229 mDateNavigator, TQ_SLOT( selectPreviousYear() ) );
230 connect( mDateNavigatorContainer, TQ_SIGNAL( nextYearClicked() ),
231 mDateNavigator, TQ_SLOT( selectNextYear() ) );
232 connect( mDateNavigatorContainer, TQ_SIGNAL( monthSelected(
int) ),
233 mDateNavigator, TQ_SLOT( selectMonth(
int) ) );
234 connect( mDateNavigatorContainer, TQ_SIGNAL(yearSelected(
int)),
235 mDateNavigator, TQ_SLOT(selectYear(
int)) );
236 connect( mDateNavigatorContainer, TQ_SIGNAL(
goPrevious() ),
237 mDateNavigator, TQ_SLOT( selectPrevious() ) );
238 connect( mDateNavigatorContainer, TQ_SIGNAL(
goNext() ),
239 mDateNavigator, TQ_SLOT( selectNext() ) );
241 connect( mDateNavigatorContainer, TQ_SIGNAL( datesSelected(
const KCal::DateList & ) ),
242 mDateNavigator, TQ_SLOT( selectDates(
const KCal::DateList & ) ) );
244 connect( mDateNavigatorContainer, TQ_SIGNAL(incidenceDropped(
Incidence*,
const TQDate&)),
245 TQ_SLOT( addIncidenceOn(
Incidence *,
const TQDate & ) ) );
246 connect( mDateNavigatorContainer, TQ_SIGNAL(incidenceDroppedMove(
Incidence*,
const TQDate&)),
247 TQ_SLOT( moveIncidenceTo(
Incidence *,
const TQDate & ) ) );
249 connect( mDateChecker, TQ_SIGNAL(
dayPassed(
const TQDate & ) ),
250 mTodoList, TQ_SLOT(
dayPassed(
const TQDate & ) ) );
251 connect( mDateChecker, TQ_SIGNAL(
dayPassed(
const TQDate & ) ),
252 TQ_SIGNAL(
dayPassed(
const TQDate & ) ) );
253 connect( mDateChecker, TQ_SIGNAL(
dayPassed(
const TQDate & ) ),
254 mDateNavigatorContainer, TQ_SLOT( updateToday() ) );
260 mEventViewer, TQ_SLOT ( setIncidence (
Incidence *,
const TQDate &) ) );
264 s = i18n(
"<p><em>No Item Selected</em></p>"
265 "<p>Select an event, to-do or journal entry to view its details "
269 TQWhatsThis::add( mEventViewer,
270 i18n(
"View the details of events, journal entries or to-dos "
271 "selected in KOrganizer's main view here." ) );
274 mViewManager->connectTodoView( mTodoList );
275 mViewManager->connectView( mTodoList );
278 setHolidays(
new KHolidays( KOPrefs::instance()->mHolidays ) );
280 connect( TQApplication::clipboard(), TQ_SIGNAL( dataChanged() ),
284 TQ_SLOT( processTodoListSelection(
Incidence *,
const TQDate & ) ) );
286 this, TQ_SLOT( processMainViewSelection(
Incidence *,
const TQDate & ) ) );
288 kdDebug(5850) <<
"CalendarView::CalendarView() done" << endl;
291 CalendarView::~CalendarView()
293 kdDebug(5850) <<
"~CalendarView()" << endl;
297 delete mDialogManager;
300 kdDebug(5850) <<
"~CalendarView() done" << endl;
303 void CalendarView::setCalendar(
Calendar *cal )
305 kdDebug(5850)<<
"CalendarView::setCalendar"<<endl;
309 mHistory =
new History( mCalendar );
310 connect( mHistory, TQ_SIGNAL( undone() ), TQ_SLOT( updateView() ) );
311 connect( mHistory, TQ_SIGNAL( redone() ), TQ_SLOT( updateView() ) );
313 if ( mChanger )
delete mChanger;
314 setIncidenceChanger(
new IncidenceChanger( mCalendar,
this ) );
318 mDateNavigatorContainer->setCalendar( mCalendar );
320 mTodoList->setCalendar( mCalendar );
325 void CalendarView::setIncidenceChanger( IncidenceChangerBase *changer )
328 emit newIncidenceChanger( mChanger );
329 connect( mChanger, TQ_SIGNAL( incidenceAdded(
Incidence* ) ),
330 this, TQ_SLOT( incidenceAdded(
Incidence* ) ) );
331 connect( mChanger, TQ_SIGNAL( incidenceChanged(
Incidence*,
Incidence*, KOGlobals::WhatChanged ) ),
332 this, TQ_SLOT( incidenceChanged(
Incidence*,
Incidence*, KOGlobals::WhatChanged ) ) );
333 connect( mChanger, TQ_SIGNAL( incidenceToBeDeleted(
Incidence * ) ),
334 this, TQ_SLOT( incidenceToBeDeleted(
Incidence * ) ) );
335 connect( mChanger, TQ_SIGNAL( incidenceDeleted(
Incidence * ) ),
336 this, TQ_SLOT( incidenceDeleted(
Incidence * ) ) );
348 if ( mCalendar )
return mCalendar;
349 else return CalendarNull::self();
352 TQPair<ResourceCalendar *, TQString> CalendarView::viewSubResourceCalendar()
354 TQPair<ResourceCalendar *, TQString> p( 0, TQString() );
356 if ( cV && cV == mViewManager->multiAgendaView() ) {
357 cV = mViewManager->multiAgendaView()->selectedAgendaView();
367 if (mDialogList.find(incidence) != mDialogList.end ())
368 return mDialogList[incidence];
389 if ( fallbackToToday ) {
390 return TQDate::currentDate();
392 return mDateNavigator->selectedDates().first();
401 if ( !dates.isEmpty() ) {
402 return dates.first();
409 TQDate CalendarView::startDate()
411 DateList dates = mDateNavigator->selectedDates();
413 return dates.first();
416 TQDate CalendarView::endDate()
418 DateList dates = mDateNavigator->selectedDates();
426 kdDebug(5850) <<
"CalendarView::openCalendar(): " << filename << endl;
428 if (filename.isEmpty()) {
429 kdDebug(5850) <<
"CalendarView::openCalendar(): Error! Empty filename." << endl;
433 if (!TQFile::exists(filename)) {
434 kdDebug(5850) <<
"CalendarView::openCalendar(): Error! File '" << filename
435 <<
"' doesn't exist." << endl;
438 bool loadedSuccesfully =
true;
443 loadedSuccesfully = cl->
load( filename );
453 if ( cl && !cl->hasCalendarResources() ) {
456 i18n(
"No calendars found, unable to merge the file into your calendar." ) );
463 TQWidget *tmpparent = 0;
470 storage.setFileName( filename );
471 loadedSuccesfully = storage.load();
474 if ( loadedSuccesfully ) {
479 mViewManager->setDocumentId( filename );
480 mTodoList->setDocumentId( filename );
488 if ( !merge ) mCalendar->
close();
490 KMessageBox::error(
this,i18n(
"Could not load calendar '%1'.").arg(filename));
498 kdDebug(5850) <<
"CalendarView::saveCalendar(): " << filename << endl;
501 mViewManager->currentView()->
flushView();
504 storage.setFileName( filename );
507 bool success = storage.save();
518 kdDebug(5850) <<
"CalendarView::closeCalendar()" << endl;
530 mDialogManager->showArchiveDialog();
543 TDEConfig *config = KOGlobals::self()->config();
545 #ifndef KORG_NOSPLITTER
546 config->setGroup(
"KOrganizer Geometry" );
548 TQValueList<int> sizes = config->readIntListEntry(
"Separator1" );
549 if ( sizes.count() != 2 ) {
550 sizes << mDateNavigatorContainer->minimumSizeHint().width();
553 mPanner->setSizes( sizes );
555 sizes = config->readIntListEntry(
"Separator2" );
556 mLeftSplitter->setSizes( sizes );
559 mEventViewer->readSettings( config );
561 mViewManager->readSettings( config );
562 mTodoList->restoreLayout( config, TQString(
"Todo Layout" ) );
566 config->setGroup(
"Views" );
567 const int dateCount = config->readNumEntry(
"ShownDatesCount", 7 );
568 if ( dateCount == 7 ) {
569 mDateNavigator->selectWeek();
571 mDateNavigator->selectDates( mDateNavigator->selectedDates().first(), dateCount );
580 TDEConfig *config = KOGlobals::self()->config();
582 #ifndef KORG_NOSPLITTER
583 config->setGroup(
"KOrganizer Geometry" );
585 TQValueList<int> list = mPanner->sizes();
586 config->writeEntry(
"Separator1", list );
588 list = mLeftSplitter->sizes();
589 config->writeEntry(
"Separator2", list );
591 mEventViewer->writeSettings( config );
592 mViewManager->writeSettings( config );
593 mTodoList->saveLayout( config, TQString(
"Todo Layout" ) );
595 KOPrefs::instance()->writeConfig();
599 config->setGroup(
"Views" );
600 config->writeEntry(
"ShownDatesCount", mDateNavigator->selectedDates().count() );
611 config->setGroup(
"General" );
613 TQStringList filterList = config->readListEntry (
"CalendarFilters" );
614 TQString currentFilter = config->readEntry(
"Current Filter" );
616 TQStringList::ConstIterator it = filterList.begin();
617 TQStringList::ConstIterator end = filterList.end();
622 config->setGroup(
"Filter_" + (*it) );
623 filter->
setCriteria( config->readNumEntry(
"Criteria", 0 ) );
625 if ( filter->
criteria() & KCal::CalFilter::HideTodosWithoutAttendeeInEmailList )
626 filter->
setEmailList( KOPrefs::instance()->allEmails() );
628 mFilters.append( filter );
633 config->setGroup(
"General" );
634 int pos = filterList.findIndex( currentFilter );
637 mCurrentFilter = mFilters.at( pos );
646 TQStringList filterList;
651 filterList << filter->
name();
652 config->setGroup(
"Filter_" + filter->
name() );
653 config->writeEntry(
"Criteria", filter->
criteria() );
654 config->writeEntry(
"CategoryList", filter->
categoryList() );
656 filter = mFilters.next();
658 config->setGroup(
"General" );
659 config->writeEntry(
"CalendarFilters", filterList );
660 if ( mCurrentFilter ) {
661 config->writeEntry(
"Current Filter", mCurrentFilter->
name() );
663 config->writeEntry(
"Current Filter", TQString() );
670 mDateNavigator->selectDate( date );
675 int dateCount = mDateNavigator->datesCount();
676 if ( dateCount == 7 ) {
677 mDateNavigator->selectWeek( date );
679 mDateNavigator->selectDates( date, dateCount );
685 mDateNavigator->selectToday();
690 if (
dynamic_cast<KOMonthView*
>( mViewManager->currentView() ) ) {
691 mDateNavigator->selectNextMonth();
693 mDateNavigator->selectNext();
699 if (
dynamic_cast<KOMonthView*
>( mViewManager->currentView() ) ) {
700 mDateNavigator->selectPreviousMonth();
702 mDateNavigator->selectPrevious();
708 if ( receiver !=
"korganizer" )
return;
709 kdDebug(5850) <<
"CalendarView::updateConfig()" << endl;
712 setHolidays(
new KHolidays( KOPrefs::instance()->mHolidays ) );
717 if ( tz != KOPrefs::instance()->mTimeZoneId ) {
719 const TQString question( i18n(
"The timezone setting was changed. Do you want to keep the absolute time of "
720 "the items in your calendar, which will show them to be at a different time than "
721 "before, or move them to be at the old time also in the new timezone?") );
722 int rc = KMessageBox::questionYesNo(
this, question,
723 i18n(
"Keep Absolute Times?"),
724 KGuiItem(i18n(
"Keep Times")),
725 KGuiItem(i18n(
"Move Times")),
726 "calendarKeepAbsoluteTimes");
727 if ( rc == KMessageBox::Yes ) {
733 mCalendar->
setTimeZoneId( KOPrefs::instance()->mTimeZoneId );
739 mViewManager->updateMultiCalendarDisplay();
742 mViewManager->raiseCurrentView();
746 void CalendarView::incidenceAdded(
Incidence *incidence )
749 history()->recordAdd( incidence );
751 updateUnmanagedViews();
752 checkForFilteredChange( incidence );
755 void CalendarView::incidenceChanged(
Incidence *oldIncidence,
757 KOGlobals::WhatChanged modification )
761 kdDebug(5850) <<
"Incidence modified and open" << endl;
765 history()->recordEdit( oldIncidence, newIncidence );
770 if ( newIncidence->type() ==
"Todo" &&
771 KOPrefs::instance()->recordTodosInJournals() &&
772 ( modification == KOGlobals::COMPLETION_MODIFIED ||
773 modification == KOGlobals::COMPLETION_MODIFIED_WITH_RECURRENCE ) ) {
775 Todo *todo =
static_cast<Todo *
>(newIncidence);
777 modification == KOGlobals::COMPLETION_MODIFIED_WITH_RECURRENCE ) {
778 TQString timeStr = TDEGlobal::locale()->formatTime( TQTime::currentTime() );
779 TQString description = i18n(
"To-do completed: %1 (%2)" ).arg(
780 newIncidence->
summary() ).arg( timeStr );
782 Journal::List journals = calendar()->
journals( TQDate::currentDate() );
785 if ( journals.isEmpty() ) {
787 journal->
setDtStart( TQDateTime::currentDateTime() );
789 TQString dateStr = TDEGlobal::locale()->formatDate( TQDate::currentDate() );
790 journal->
setSummary( i18n(
"Journal of %1").arg( dateStr ) );
794 if ( !mChanger->addIncidence( journal, 0, TQString(),
this ) ) {
795 KODialogManager::errorSaveIncidence(
this, journal );
801 journal = *(journals.at(0));
805 if ( !mChanger->changeIncidence( oldJournal, journal,
806 KOGlobals::DESCRIPTION_MODIFIED,
this ) ) {
807 KODialogManager::errorSaveIncidence(
this, journal );
816 updateUnmanagedViews();
817 checkForFilteredChange( newIncidence );
820 void CalendarView::incidenceToBeDeleted(
Incidence *incidence )
824 kdDebug(5850) <<
"Incidence to be deleted and open in editor" << endl;
825 tmp->delayedDestruct();
828 history()->recordDelete( incidence );
830 updateUnmanagedViews();
833 void CalendarView::incidenceDeleted(
Incidence *incidence )
836 updateUnmanagedViews();
839 void CalendarView::checkForFilteredChange(
Incidence *incidence )
845 KMessageBox::information(
this, i18n(
"The item \"%1\" is filtered by "
846 "your current filter rules, so it will be hidden and not "
847 "appear in the view.").arg( incidence->
summary() ),
848 i18n(
"Filter Applied"),
"ChangedIncidenceFiltered" );
852 void CalendarView::startMultiModify(
const TQString &text )
854 history()->startMultiModify( text );
857 void CalendarView::endMultiModify()
859 history()->endMultiModify();
865 mDateNavigatorContainer->updateView();
866 mDialogManager->updateSearchDialog();
871 if ( mTodoList ) mTodoList->changeIncidenceDisplay( incidence, action );
872 mEventViewer->changeIncidenceDisplay( incidence,
activeDate(
true ), action );
875 if ( mTodoList ) mTodoList->updateView();
880 void CalendarView::updateView(
const TQDate &start,
const TQDate &end)
882 mTodoList->updateView();
883 mViewManager->updateView(start, end);
884 mDateNavigatorContainer->updateView();
887 void CalendarView::updateView()
889 DateList tmpList = mDateNavigator->selectedDates();
892 updateView( tmpList.first(), tmpList.last() );
895 void CalendarView::updateUnmanagedViews()
897 mDateNavigatorContainer->updateDayMatrix();
901 int CalendarView::msgItemDelete(
Incidence *incidence )
903 return KMessageBox::warningContinueCancel(
this,
904 i18n(
"The item \"%1\" will be permanently deleted.").arg( incidence->
summary() ),
905 i18n(
"KOrganizer Confirmation"), KGuiItem(i18n(
"&Delete"),
"edit-delete"));
911 Incidence *incidence = incToSendToClipboard(
true );
913 if ( !incidence || !mChanger ) {
914 KNotifyClient::beep();
918 Incidence::List incidences;
919 int km = KMessageBox::Yes;
921 if ( !incidence->
relations().isEmpty() &&
922 incidence->type() ==
"Todo" ) {
923 km = KMessageBox::questionYesNoCancel(
this,
924 i18n(
"The item \"%1\" has sub-to-dos. "
925 "Do you want to cut just this item and "
926 "make all its sub-to-dos independent, or "
927 "cut the to-do with all its sub-to-dos?"
929 i18n(
"KOrganizer Confirmation"),
930 i18n(
"Cut Only This"),
934 if ( km == KMessageBox::Yes ) {
935 incidences.append( incidence );
937 }
else if ( km == KMessageBox::No ) {
939 getIncidenceHierarchy( incidence, incidences );
942 if ( km != KMessageBox::Cancel ) {
943 mChanger->cutIncidences( incidences,
this );
949 Incidence *incidence = incToSendToClipboard(
false );
952 KNotifyClient::beep();
956 Incidence::List incidences;
957 int km = KMessageBox::Yes;
959 if ( !incidence->
relations().isEmpty() &&
960 incidence->type() ==
"Todo" ) {
961 km = KMessageBox::questionYesNoCancel(
this,
962 i18n(
"The item \"%1\" has sub-to-dos. "
963 "Do you want to copy just this item or "
964 "copy the to-do with all its sub-to-dos?"
966 i18n(
"KOrganizer Confirmation"),
967 i18n(
"Copy Only This"),
971 if ( km == KMessageBox::Yes ) {
972 incidences.append( incidence );
973 }
else if ( km == KMessageBox::No ) {
975 getIncidenceHierarchy( incidence, incidences );
978 if ( km != KMessageBox::Cancel ) {
981 KNotifyClient::beep();
986 Incidence* CalendarView::incToSendToClipboard(
bool cut )
990 if ( originalInc && originalInc->
doesRecur() &&
991 originalInc->type() ==
"Event" ) {
994 KOGlobals::WhichOccurrences chosenOption;
1004 if ( chosenOption == KOGlobals::ALL ) {
1006 delete originalIncSaved;
1010 if ( chosenOption == KOGlobals::NONE ) {
1011 delete originalIncSaved;
1027 bool timeSet =
false;
1030 bool useEndTime =
false;
1036 if ( curView == mViewManager->multiAgendaView() ) {
1037 aView = mViewManager->multiAgendaView()->selectedAgendaView();
1053 }
else if ( curView == mView && mView->
selectionStart().isValid() ) {
1055 }
else if ( !mDateNavigator->selectedDates().isEmpty() &&
1058 date = mDateNavigator->selectedDates().first();
1064 i18n(
"Paste failed: unable to determine a valid target date." ) );
1069 Incidence::List pastedIncidences;
1070 if ( timeSet && time.isValid() ) {
1076 Incidence::List::Iterator it;
1077 for ( it = pastedIncidences.begin(); it != pastedIncidences.end(); ++it ) {
1078 TQPair<ResourceCalendar *, TQString>p = viewSubResourceCalendar();
1081 if ( ( *it )->type() ==
"Event" ) {
1082 Event *pastedEvent =
static_cast<Event*
>( *it );
1085 if ( aView && endDT.isValid() && useEndTime ) {
1097 mChanger->addIncidence( pastedEvent, p.first, p.second,
this );
1099 }
else if ( ( *it )->type() ==
"Todo" ) {
1100 Todo *pastedTodo =
static_cast<Todo*
>( *it );
1101 Todo *_selectedTodo = selectedTodo();
1105 if ( _selectedTodo && !pastedTodo->
relatedTo() ) {
1108 mChanger->addIncidence( pastedTodo, p.first, p.second,
this );
1115 mDialogManager->showOptionsDialog();
1122 if ( !startDt.isValid() || !endDt.isValid() ) {
1124 startDt.setTime( KOPrefs::instance()->mStartTime.time() );
1126 int addSecs = ( KOPrefs::instance()->mDefaultDuration.time().hour() * 3600 ) +
1127 ( KOPrefs::instance()->mDefaultDuration.time().minute() * 60 );
1129 endDt = startDt.addSecs( addSecs );
1134 const TQDateTime &startDtParam,
1135 const TQDateTime &endDtParam,
bool allDayParam )
1138 bool allDay = allDayParam;
1139 TQDateTime startDt( startDtParam ), endDt( endDtParam );
1146 connectIncidenceEditor( eventEditor );
1147 eventEditor->setResource( res, subRes );
1148 eventEditor->
setDates( startDt, endDt, allDay );
1149 mDialogManager->connectTypeAhead( eventEditor,
dynamic_cast<KOrg::AgendaView*
>(viewManager()->currentView()) );
1157 if ( currentView == mViewManager->multiAgendaView() ) {
1158 currentView = mViewManager->multiAgendaView()->selectedAgendaView();
1161 if ( currentView ) {
1169 kdDebug(5850) <<
"CalendarView::newEvent()" << endl;
1170 newEvent( res, subRes, TQDateTime(), TQDateTime() );
1176 TQDateTime startDt( dt, KOPrefs::instance()->mStartTime.time() );
1177 newEvent( res, subRes, TQDateTime( dt ), TQDateTime() );
1181 const TQDateTime &startDt )
1183 newEvent( res, subRes, startDt, TQDateTime() );
1187 const TQDateTime &startDt,
const TQDateTime &endDt,
1191 startDt, endDt, allDay );
1192 eventEditor->show();
1196 const TQString &summary,
const TQString &description,
1197 const TQStringList &attachments,
const TQStringList &attendees,
1198 const TQStringList &attachmentMimetypes,
bool inlineAttachment )
1201 eventEditor->
setTexts( summary, description );
1204 eventEditor->
addAttachments( attachments, attachmentMimetypes, inlineAttachment );
1206 eventEditor->show();
1210 const TQString &summary,
const TQString &description,
1211 const TQStringList &attachments,
const TQStringList &attendees,
1212 const TQStringList &attachmentMimetypes,
1213 bool inlineAttachment,
bool isTask )
1215 kdDebug(5850) << k_funcinfo << endl;
1217 connectIncidenceEditor( todoEditor );
1219 todoEditor->setResource( res, subRes );
1220 todoEditor->
setTexts( summary, description );
1221 todoEditor->
addAttachments( attachments, attachmentMimetypes, inlineAttachment );
1223 todoEditor->selectCreateTask( isTask );
1231 if ( currentView == mViewManager->multiAgendaView() ) {
1232 currentView = mViewManager->multiAgendaView()->selectedAgendaView();
1234 if ( currentView ) {
1242 kdDebug(5850) << k_funcinfo << endl;
1246 connectIncidenceEditor( todoEditor );
1248 todoEditor->setResource( res, subRes );
1249 if ( mViewManager->currentView()->
isEventView() ) {
1250 dtDue.setDate( mDateNavigator->selectedDates().first() );
1251 TQDateTime dtDummy = TQDateTime::currentDateTime();
1253 todoEditor->
setDates( dtDue, allday );
1259 const TQDate &date )
1262 connectIncidenceEditor( todoEditor );
1264 todoEditor->setResource( res, subRes );
1265 todoEditor->
setDates( TQDateTime( date, TQTime::currentTime() ),
true );
1269 void CalendarView::newJournal()
1273 if ( currentView == mViewManager->multiAgendaView() ) {
1274 currentView = mViewManager->multiAgendaView()->selectedAgendaView();
1277 if ( currentView ) {
1283 void CalendarView::newJournal(
ResourceCalendar *res,
const TQString &subRes )
1285 kdDebug(5850) <<
"CalendarView::newJournal()" << endl;
1286 newJournal( res, subRes, TQString(), TQDate() );
1289 void CalendarView::newJournal(
ResourceCalendar *res,
const TQString &subRes,
1292 newJournal( res, subRes, TQString(), date );
1295 void CalendarView::newJournal(
ResourceCalendar *res,
const TQString &subRes,
1296 const TQString &text,
const TQDate &date )
1299 connectIncidenceEditor( journalEditor );
1301 journalEditor->setResource( res, subRes );
1303 if ( !date.isValid() ) {
1304 journalEditor->
setDate( mDateNavigator->selectedDates().first() );
1306 journalEditor->
setDate( date );
1308 journalEditor->show();
1313 Todo *todo = selectedTodo();
1320 connectIncidenceEditor( todoEditor );
1322 todoEditor->
setDates( TQDateTime(),
false, parentEvent );
1328 kdDebug(5850) <<
"CalendarView::addIncidence:\n" << ical << endl;
1332 if ( !incidence )
return false;
1333 if ( !mChanger->addIncidence( incidence, 0, TQString(),
this ) ) {
1346 KNotifyClient::beep();
1356 KNotifyClient::beep();
1364 deleteIncidence( incidence );
1366 KNotifyClient::beep();
1369 void CalendarView::todo_unsub()
1371 Todo *anTodo = selectedTodo();
1372 if( incidence_unsub ( anTodo ) ) {
1377 bool CalendarView::incidence_unsub(
Incidence *inc )
1379 bool status =
false;
1384 if ( mChanger->beginChange( inc, 0, TQString() ) ) {
1387 mChanger->changeIncidence( oldInc, inc, KOGlobals::RELATION_MODIFIED,
this );
1388 mChanger->endChange( inc, 0, TQString() );
1394 KMessageBox::sorry(
this, i18n(
"Unable to turn sub-to-do into a top-level "
1395 "to-do, because it cannot be locked.") );
1403 bool status =
false;
1404 Todo *aTodo = selectedTodo();
1415 if ( !inc || inc->
relations().isEmpty() ) {
1419 startMultiModify ( i18n(
"Make sub-to-dos independent" ) );
1420 Incidence::List subIncs( inc->
relations() );
1421 Incidence::List::Iterator it;
1423 for ( it= subIncs.begin(); it != subIncs.end(); ++it ) {
1424 incidence_unsub ( *it );
1430 bool CalendarView::deleteIncidence(
const TQString &uid,
bool force )
1434 deleteIncidence( inc, force );
1441 void CalendarView::toggleAlarm(
Incidence *incidence )
1443 if ( !incidence || !mChanger ) {
1444 kdDebug(5850) <<
"CalendarView::toggleAlarm() called without having a clicked item" << endl;
1448 if ( !mChanger->beginChange( incidence, 0, TQString() ) ) {
1449 kdDebug(5850) <<
"Unable to lock incidence " << endl;
1450 delete oldincidence;
1454 Alarm::List alarms = incidence->
alarms();
1455 Alarm::List::ConstIterator it;
1456 for ( it = alarms.begin(); it != alarms.end(); ++it ) {
1457 (*it)->toggleAlarm();
1459 if ( alarms.isEmpty() ) {
1462 alm->
setType( Alarm::Display );
1465 switch( KOPrefs::instance()->mReminderTimeUnits ) {
1468 duration = KOPrefs::instance()->mReminderTime * 60;
1471 duration = KOPrefs::instance()->mReminderTime * 60 * 60;
1474 duration = KOPrefs::instance()->mReminderTime * 60 * 60 * 24;
1477 if ( incidence->type() ==
"Event" ) {
1483 mChanger->changeIncidence( oldincidence, incidence, KOGlobals::ALARM_MODIFIED,
this );
1484 mChanger->endChange( incidence, 0, TQString() );
1485 delete oldincidence;
1490 void CalendarView::dissociateOccurrence(
Incidence *incidence,
const TQDate &date )
1492 if ( !incidence || !mChanger ) {
1493 kdDebug(5850) <<
"CalendarView::toggleAlarm() called without having a clicked item" << endl;
1497 TQPair<ResourceCalendar *, TQString>p =
1498 CalHelper::incSubResourceCalendar( calendar(), incidence );
1500 if ( !mChanger->beginChange( incidence, p.first, p.second ) ) {
1501 kdDebug(5850) <<
"Unable to lock incidence " << endl;
1504 startMultiModify( i18n(
"Dissociate occurrence") );
1512 bool success = mChanger->addIncidence( newInc, p.first, p.second,
this );
1514 mChanger->changeIncidence( oldincidence, incidence, KOGlobals::NOTHING_MODIFIED,
this );
1516 KMessageBox::sorry(
this, i18n(
"Dissociating the occurrence failed."),
1517 i18n(
"Dissociating Failed") );
1519 mChanger->endChange( incidence, p.first, p.second );
1521 delete oldincidence;
1524 void CalendarView::dissociateFutureOccurrence(
Incidence *incidence,
const TQDate &date )
1526 if ( !incidence || !mChanger ) {
1527 kdDebug(5850) <<
"CalendarView::toggleAlarm() called without having a clicked item" << endl;
1531 TQPair<ResourceCalendar *, TQString>p =
1532 CalHelper::incSubResourceCalendar( calendar(), incidence );
1534 if ( !mChanger->beginChange( incidence, p.first, p.second ) ) {
1535 kdDebug(5850) <<
"Unable to lock incidence " << endl;
1538 startMultiModify( i18n(
"Dissociate future occurrences") );
1543 mChanger->changeIncidence( oldincidence, incidence, KOGlobals::NOTHING_MODIFIED,
this );
1544 mChanger->addIncidence( newInc, p.first, p.second,
this );
1546 KMessageBox::sorry(
this, i18n(
"Dissociating the future occurrences failed."),
1547 i18n(
"Dissociating Failed") );
1550 mChanger->endChange( incidence, p.first, p.second );
1551 delete oldincidence;
1558 void CalendarView::schedule_publish(
Incidence *incidence)
1564 KMessageBox::information(
this, i18n(
"No item selected."),
1565 "PublishNoEventSelected" );
1569 PublishDialog *publishdlg =
new PublishDialog();
1571 Attendee::List attendees = incidence->
attendees();
1572 Attendee::List::ConstIterator it;
1573 for( it = attendees.begin(); it != attendees.end(); ++it ) {
1574 publishdlg->addAttendee( *it );
1577 if ( publishdlg->exec() == TQDialog::Accepted ) {
1583 KCal::MailScheduler scheduler( mCalendar );
1584 if ( scheduler.publish( incidence, publishdlg->addresses() ) ) {
1585 KMessageBox::information(
this, i18n(
"The item information was successfully sent."),
1586 i18n(
"Publishing"),
"IncidencePublishSuccess" );
1588 KMessageBox::error(
this, i18n(
"Unable to publish the item '%1'").arg( incidence->
summary() ) );
1594 void CalendarView::schedule_request(
Incidence *incidence)
1596 schedule(Scheduler::Request,incidence);
1599 void CalendarView::schedule_refresh(
Incidence *incidence)
1601 schedule(Scheduler::Refresh,incidence);
1604 void CalendarView::schedule_cancel(
Incidence *incidence)
1606 schedule(Scheduler::Cancel,incidence);
1609 void CalendarView::schedule_add(
Incidence *incidence)
1611 schedule(Scheduler::Add,incidence);
1614 void CalendarView::schedule_reply(
Incidence *incidence)
1616 schedule(Scheduler::Reply,incidence);
1619 void CalendarView::schedule_counter(
Incidence *incidence)
1621 schedule(Scheduler::Counter,incidence);
1624 void CalendarView::schedule_declinecounter(
Incidence *incidence)
1626 schedule(Scheduler::Declinecounter,incidence);
1629 void CalendarView::schedule_forward(
Incidence *incidence )
1636 KMessageBox::information(
1638 i18n(
"No item selected." ),
1639 i18n(
"Forwarding" ),
1640 "ForwardNoEventSelected" );
1644 PublishDialog publishdlg;
1645 if ( publishdlg.exec() == TQDialog::Accepted ) {
1646 TQString recipients = publishdlg.addresses();
1647 if ( incidence->organizer().isEmpty() ) {
1649 KOPrefs::instance()->email() ) );
1654 KOMailClient mailer;
1655 if ( mailer.mailTo( incidence, recipients, messageText ) ) {
1656 KMessageBox::information(
1658 i18n(
"The item information was successfully sent." ),
1659 i18n(
"Forwarding" ),
1660 "IncidenceForwardSuccess" );
1664 i18n(
"Unable to forward the item '%1'" ).arg( incidence->
summary() ),
1665 i18n(
"Forwarding Error" ) );
1670 void CalendarView::mailFreeBusy(
int daysToPublish )
1672 TQDateTime start = TQDateTime::currentDateTime();
1673 TQDateTime end = start.addDays(daysToPublish);
1677 KOPrefs::instance()->email() ) );
1679 kdDebug(5850) <<
"calendarview: schedule_publish_freebusy: startDate: "
1680 << TDEGlobal::locale()->formatDateTime( start ) <<
" End Date: "
1681 << TDEGlobal::locale()->formatDateTime( end ) << endl;
1683 PublishDialog *publishdlg =
new PublishDialog();
1684 if ( publishdlg->exec() == TQDialog::Accepted ) {
1686 KCal::MailScheduler scheduler( mCalendar );
1687 if ( scheduler.publish( freebusy, publishdlg->addresses() ) ) {
1688 KMessageBox::information(
this, i18n(
"The free/busy information was successfully sent."),
1689 i18n(
"Sending Free/Busy"),
"FreeBusyPublishSuccess" );
1691 KMessageBox::error(
this, i18n(
"Unable to publish the free/busy data.") );
1698 void CalendarView::uploadFreeBusy()
1700 KOGroupware::instance()->freeBusyManager()->publishFreeBusy();
1710 KMessageBox::sorry(
this, i18n(
"No item selected."),
1711 "ScheduleNoEventSelected" );
1715 if( incidence->
attendeeCount() == 0 && method != Scheduler::Publish ) {
1716 KMessageBox::information(
this, i18n(
"The item has no attendees."),
1717 "ScheduleNoIncidences" );
1726 KCal::MailScheduler scheduler( mCalendar );
1727 if ( scheduler.performTransaction( incidence, method ) ) {
1728 KMessageBox::information(
this, i18n(
"The groupware message for item '%1'"
1729 "was successfully sent.\nMethod: %2")
1731 .arg( Scheduler::methodName( method ) ),
1732 i18n(
"Sending Free/Busy"),
1733 "FreeBusyPublishSuccess" );
1735 KMessageBox::error(
this, i18n(
"Groupware message sending failed. "
1736 "%2 is request/reply/add/cancel/counter/etc.",
1737 "Unable to send the item '%1'.\nMethod: %2")
1739 .arg( Scheduler::methodName( method ) ) );
1743 void CalendarView::openAddressbook()
1745 KRun::runCommand(
"kaddressbook");
1750 if (mModified != modified) {
1751 mModified = modified;
1763 if (mReadOnly != readOnly) {
1764 mReadOnly = readOnly;
1776 #ifndef KORG_NOPRINTER
1777 KOCoreHelper helper;
1778 CalPrinter printer(
this, mCalendar, &helper );
1783 CalPrinterBase::PrintType printType = CalPrinterBase::Month;
1784 if ( currentView ) {
1785 printType = currentView->printType();
1788 DateList tmpDateList = mDateNavigator->selectedDates();
1789 Incidence::List selectedIncidences;
1790 if ( mViewManager->currentView() ) {
1793 printer.print( printType, tmpDateList.first(), tmpDateList.last(), selectedIncidences );
1800 HTMLExportSettings *settings =
new HTMLExportSettings(
"KOrganizer" );
1803 if ( settings ) settings->readConfig();
1805 connect( dlg, TQ_SIGNAL( exportHTML( HTMLExportSettings* ) ),
1806 this, TQ_SIGNAL( exportHTML( HTMLExportSettings* ) ) );
1812 TQString filename = KFileDialog::getSaveFileName(
"icalout.ics",i18n(
"*.ics|ICalendars"),
this);
1813 if ( !filename.isEmpty() )
1816 if (filename.right(4) !=
".ics") filename +=
".ics";
1817 if ( TQFile( filename ).exists() ) {
1818 if ( KMessageBox::No == KMessageBox::warningYesNo(
1820 i18n(
"Do you want to overwrite %1?").arg(filename) ) ) {
1831 if (mCalendar->
journals().count() > 0) {
1832 int result = KMessageBox::warningContinueCancel(
this,
1833 i18n(
"The journal entries can not be exported to a vCalendar file."),
1834 i18n(
"Data Loss Warning"),i18n(
"Proceed"),
"dontaskVCalExport",
1836 if (result != KMessageBox::Continue)
return;
1839 TQString filename = KFileDialog::getSaveFileName(
"vcalout.vcs",i18n(
"*.vcs|vCalendars"),
this);
1840 if ( !filename.isEmpty() )
1844 if (filename.right(4) !=
".vcs") filename +=
".vcs";
1845 if ( TQFile( filename ).exists() ) {
1846 if ( KMessageBox::No == KMessageBox::warningYesNo(
1848 i18n(
"Do you want to overwrite %1?").arg(filename ) ) ) {
1857 void CalendarView::eventUpdated(
Incidence *)
1871 emit changeNavStringNext(i18n(
"&Next Day"));
1874 emit changeNavStringNext(i18n(
"&Next Week"));
1879 void CalendarView::processMainViewSelection(
Incidence *incidence,
const TQDate &date )
1881 if ( incidence ) mTodoList->clearSelection();
1882 processIncidenceSelection( incidence, date );
1885 void CalendarView::processTodoListSelection(
Incidence *incidence,
const TQDate &date )
1887 if ( incidence && mViewManager->currentView() ) {
1890 processIncidenceSelection( incidence, date );
1893 void CalendarView::processIncidenceSelection(
Incidence *incidence,
const TQDate &date )
1895 if ( incidence != mSelectedIncidence ) {
1901 mSelectedIncidence = incidence;
1904 if ( incidence == mSelectedIncidence ) {
1905 if ( !incidence->
doesRecur() || mSaveDate == date ) {
1910 mSelectedIncidence = incidence;
1914 bool organizerEvents =
false;
1915 bool groupEvents =
false;
1917 bool subtodo =
false;
1919 organizerEvents = KOPrefs::instance()->thatIsMe( incidence->organizer().email() );
1920 groupEvents = incidence->
attendeeByMails( KOPrefs::instance()->allEmails() );
1922 if ( incidence->type() ==
"Todo" ) {
1924 subtodo = ( incidence->
relatedTo() != 0 );
1928 emit subtodoSelected( subtodo );
1937 if (ICalDrag::canDecode(TQApplication::clipboard()->data())) {
1938 kdDebug(5850) <<
"CalendarView::checkClipboard() true" << endl;
1941 kdDebug(5850) <<
"CalendarView::checkClipboard() false" << endl;
1949 mDateNavigatorContainer->selectDates( selectedDates, preferredMonth );
1950 mNavigatorBar->selectDates( selectedDates );
1952 if ( mViewManager->currentView() ) {
1953 updateView( selectedDates.first(), selectedDates.last() );
1955 mViewManager->showAgendaView();
1959 void CalendarView::editFilters()
1961 kdDebug(5850) <<
"CalendarView::editFilters()" << endl;
1965 kdDebug(5850) <<
" Filter: " << filter->
name() << endl;
1966 filter = mFilters.next();
1969 mDialogManager->showFilterEditDialog(&mFilters);
1976 TQStringList filters;
1979 int pos = mFilters.find( mCurrentFilter );
1984 filters << i18n(
"No filter");
1985 for ( filter = mFilters.first(); filter; filter = mFilters.next() ) {
1986 filters << filter->
name();
1989 emit newFilterListSignal( filters );
1992 emit selectFilterSignal( pos+1 );
2002 if ( filterNo > 0 && filterNo <=
int(mFilters.count()) ) {
2003 newFilter = mFilters.at( filterNo-1 );
2005 if ( newFilter != mCurrentFilter ) {
2006 mCurrentFilter = newFilter;
2010 emit filterChanged();
2015 if ( mCurrentFilter) {
2016 return mCurrentFilter->
name();
2017 }
else return i18n(
"No filter");
2024 if (!incidence)
return;
2027 KOPrefs::instance()->email() ) );
2037 Incidence::List::Iterator it;
2039 for ( it = incidences.begin(); it != incidences.end(); ++it ) {
2040 (*it)->setOrganizer(
Person( KOPrefs::instance()->fullName(),
2041 KOPrefs::instance()->email() ) );
2043 (*it)->setReadOnly(
false);
2048 void CalendarView::showIntro()
2050 kdDebug(5850) <<
"To be implemented." << endl;
2053 void CalendarView::showDateNavigator(
bool show )
2056 mDateNavigatorContainer->show();
2058 mDateNavigatorContainer->hide();
2061 void CalendarView::showTodoView(
bool show )
2069 void CalendarView::showEventViewer(
bool show )
2072 mEventViewer->show();
2074 mEventViewer->hide();
2080 mViewManager->addView(view);
2090 CalendarViewExtension *extension = factory->create( mLeftSplitter );
2092 mExtensions.append( extension );
2095 void CalendarView::toggleExpand()
2097 showLeftFrame( mLeftFrame->isHidden() );
2100 void CalendarView::showLeftFrame(
bool show)
2104 emit calendarViewExpanded(
false );
2107 emit calendarViewExpanded(
true );
2111 void CalendarView::calendarModified(
bool modified,
Calendar * )
2116 Todo *CalendarView::selectedTodo()
2119 if ( incidence && incidence->type() ==
"Todo" ) {
2120 return static_cast<Todo *
>( incidence );
2125 if ( !selectedIncidences.isEmpty() ) incidence = selectedIncidences.first();
2126 if ( incidence && incidence->type() ==
"Todo" ) {
2127 return static_cast<Todo *
>( incidence );
2133 void CalendarView::dialogClosing(
Incidence *in )
2136 mChanger->endChange( in, 0, TQString() );
2137 mDialogList.remove( in );
2142 return mViewManager->currentSelection();
2150 if ( !selectedIncidences.isEmpty() )
2151 incidence = selectedIncidences.first();
2156 void CalendarView::showIncidence()
2161 void CalendarView::editIncidence()
2166 bool CalendarView::editIncidence(
const TQString &uid )
2168 return editIncidence( mCalendar->
incidence( uid ), TQDate() );
2171 bool CalendarView::editIncidence(
const TQString &uid,
const TQDate &date )
2173 return editIncidence( mCalendar->
incidence( uid ), date );
2176 void CalendarView::deleteIncidence()
2196 void CalendarView::showIncidence(
Incidence *incidence,
const TQDate &date )
2203 eventViewer->setIncidence( incidence, date );
2204 eventViewer->show();
2207 bool CalendarView::editIncidence(
Incidence *incidence,
const TQDate &date,
bool isCounter )
2209 kdDebug(5850) <<
"CalendarView::editEvent()" << endl;
2212 if( stdcal && !stdcal->hasCalendarResources() ) {
2215 i18n(
"No resources found. We can not edit the item." ) );
2223 TQWidget *tmpparent = 0;
2230 kdDebug(5850) <<
"Empty Incidence" << endl;
2231 KNotifyClient::beep();
2236 kdDebug(5850) <<
"Empty Changer" << endl;
2237 KNotifyClient::beep();
2243 kdDebug(5850) <<
"CalendarView::editIncidence() in List" << endl;
2251 showIncidence( incidence, date );
2255 TQPair<ResourceCalendar *, TQString>p =
2256 CalHelper::incSubResourceCalendar( calendar(), incidence );
2262 KOGlobals::WhichOccurrences chosenOption;
2265 incToChange = incidence;
2269 if ( incToChange ) {
2270 if ( !isCounter && !mChanger->beginChange( incToChange, p.first, p.second ) ) {
2271 warningChangeFailed( incToChange );
2272 showIncidence( incToChange, date );
2277 kdDebug(5850) <<
"CalendarView::editIncidence() new IncidenceEditor" << endl;
2279 connectIncidenceEditor( incidenceEditor );
2281 mDialogList.insert( incToChange, incidenceEditor );
2282 if ( incidence != incToChange ) {
2285 incidenceEditor->setResource( p.first, p.second );
2286 incidenceEditor->
editIncidence( incToChange, date, mCalendar );
2287 incidenceEditor->show();
2298 Incidence::List subTodos( todo->
relations() );
2299 Incidence::List::Iterator it;
2303 for ( it= subTodos.begin(); it != subTodos.end(); ++it ) {
2305 if( aIncidence && aIncidence->type() ==
"Todo" ) {
2306 aTodo =
static_cast<Todo*
>( aIncidence );
2310 mChanger->deleteIncidence ( todo,
this );
2315 if ( !todo ) return ;
2319 bool doDelete =
true;
2320 if ( !force && KOPrefs::instance()->mConfirm ) {
2321 doDelete = ( msgItemDelete( todo ) == KMessageBox::Continue );
2324 mChanger->deleteIncidence( todo,
this );
2329 int km = KMessageBox::No;
2331 km = KMessageBox::questionYesNoCancel(
2333 i18n(
"The item \"%1\" has sub-to-dos. "
2334 "Do you want to delete just this item and "
2335 "make all its sub-to-dos independent, or "
2336 "delete the to-do with all its sub-to-dos?"
2338 i18n(
"KOrganizer Confirmation"),
2339 i18n(
"Delete Only This"),
2340 i18n(
"Delete All"));
2342 startMultiModify( i18n(
"Deleting sub-to-dos" ) );
2344 if( km == KMessageBox::Yes ) {
2348 mChanger->deleteIncidence( todo,
this );
2349 }
else if ( km == KMessageBox::No ) {
2357 void CalendarView::deleteIncidence(
Incidence *incidence,
bool force)
2359 if ( !incidence || !mChanger ) {
2361 KNotifyClient::beep();
2367 KMessageBox::information(
this, i18n(
"The item \"%1\" is marked read-only "
2368 "and cannot be deleted; it probably belongs to "
2369 "a read-only calendar resource.")
2371 i18n(
"Removing not possible"),
2372 "deleteReadOnlyIncidence" );
2377 CanDeleteIncidenceVisitor v;
2381 if ( !v.act( incidence,
this ) )
2385 if ( incidence && incidence->type()==
"Todo" ) {
2391 TQDate itemDate = mViewManager->currentSelectionDate();
2392 kdDebug(5850) <<
"Recurrence-Date: " << TQString(itemDate.toString()) << endl;
2393 int km = KMessageBox::Ok;
2395 if ( !itemDate.isValid() ) {
2396 kdDebug(5850) <<
"Date Not Valid" << endl;
2397 km = KMessageBox::warningContinueCancel(
this,
2398 i18n(
"The calendar item \"%1\" recurs over multiple dates; "
2399 "are you sure you want to delete it "
2400 "and all its recurrences?").arg( incidence->
summary() ),
2401 i18n(
"KOrganizer Confirmation"), i18n(
"Delete All") );
2403 km = KOMessageBox::fourBtnMsgBox(
this, TQMessageBox::Warning,
2404 i18n(
"The calendar item \"%1\" recurs over multiple dates. "
2405 "Do you want to delete only the current one on %2, only all "
2406 "future recurrences, or all its recurrences?" )
2408 .arg( TDEGlobal::locale()->formatDate(itemDate)),
2409 i18n(
"KOrganizer Confirmation"), i18n(
"Delete C&urrent"),
2410 i18n(
"Delete &Future"),
2411 i18n(
"Delete &All"));
2415 TQPair<ResourceCalendar *, TQString>p =
2416 CalHelper::incSubResourceCalendar( calendar(), incidence );
2419 case KMessageBox::Ok:
2420 case KMessageBox::Continue:
2421 mChanger->deleteIncidence( incidence,
this );
2424 case KMessageBox::Yes:
2425 if ( mChanger->beginChange( incidence, p.first, p.second ) ) {
2430 Event* thisevent =
static_cast<Event*
>(incidence);
2432 TQDateTime newRecurEnd;
2441 incidence->
recurrence()->addExDate( itemDate );
2443 mChanger->changeIncidence( oldIncidence, incidence, KOGlobals::RECURRENCE_MODIFIED_ONE_ONLY,
this );
2444 mChanger->endChange( incidence, p.first, p.second );
2445 delete oldIncidence;
2448 case KMessageBox::No:
2449 if ( mChanger->beginChange( incidence, p.first, p.second ) ) {
2453 mChanger->changeIncidence( oldIncidence, incidence, KOGlobals::RECURRENCE_MODIFIED_ONE_ONLY,
this );
2454 mChanger->endChange( incidence, p.first, p.second );
2455 delete oldIncidence;
2460 bool doDelete =
true;
2461 if ( !force && KOPrefs::instance()->mConfirm ) {
2462 doDelete = ( msgItemDelete( incidence ) == KMessageBox::Continue );
2465 mChanger->deleteIncidence( incidence,
this );
2466 processIncidenceSelection( 0, TQDate() );
2475 connect(
this, TQ_SIGNAL( newIncidenceChanger( IncidenceChangerBase* ) ),
2476 editor, TQ_SLOT( setIncidenceChanger( IncidenceChangerBase* ) ) );
2477 editor->setIncidenceChanger( mChanger );
2480 bool CalendarView::purgeCompletedSubTodos(
Todo* todo,
bool &allPurged )
2482 if ( !todo )
return true;
2483 bool deleteThisTodo =
true;
2484 Incidence::List subTodos( todo->
relations() );
2487 Incidence::List::Iterator it;
2488 for ( it = subTodos.begin(); it != subTodos.end(); ++it ) {
2490 if ( aIncidence && aIncidence->type()==
"Todo" ) {
2491 aTodo =
static_cast<Todo*
>( aIncidence );
2492 deleteThisTodo &= purgeCompletedSubTodos( aTodo, allPurged );
2496 if ( deleteThisTodo ) {
2498 if ( !mChanger->deleteIncidence( todo,
this ) )
2501 deleteThisTodo =
false;
2508 return deleteThisTodo;
2511 void CalendarView::purgeCompleted()
2513 int result = KMessageBox::warningContinueCancel(
this,
2514 i18n(
"Delete all completed to-dos?"),i18n(
"Purge To-dos"),i18n(
"Purge"));
2516 if (result == KMessageBox::Continue) {
2517 bool allDeleted =
true;
2518 startMultiModify( i18n(
"Purging completed to-dos") );
2519 Todo::List todos = calendar()->
rawTodos();
2520 Todo::List rootTodos;
2521 Todo::List::ConstIterator it;
2522 for ( it = todos.begin(); it != todos.end(); ++it ) {
2525 rootTodos.append( aTodo );
2528 for ( it = rootTodos.begin(); it != rootTodos.end(); ++it ) {
2529 purgeCompletedSubTodos( *it, allDeleted );
2532 if ( !allDeleted ) {
2533 KMessageBox::information(
this, i18n(
"Unable to purge to-dos with "
2534 "uncompleted children."), i18n(
"Delete To-do"),
2535 "UncompletedChildrenPurgeTodos" );
2540 void CalendarView::warningChangeFailed(
Incidence *incidence )
2545 i18n(
"Unable to edit \"%1\" because it is locked by another process." ).
2546 arg( incidence->
summary() ) );
2550 void CalendarView::editCanceled(
Incidence *incidence )
2555 void CalendarView::showErrorMessage(
const TQString &msg )
2557 KMessageBox::error(
this, msg );
2562 TQStringList allCats( calendar()->categories() );
2564 TQStringList categories( KOPrefs::instance()->mCustomCategories );
2565 for ( TQStringList::ConstIterator si = allCats.constBegin(); si != allCats.constEnd(); ++si ) {
2566 if ( categories.find( *si ) == categories.end() ) {
2567 categories.append( *si );
2570 KOPrefs::instance()->mCustomCategories = categories;
2571 KOPrefs::instance()->writeConfig();
2576 void CalendarView::addIncidenceOn(
Incidence *incadd,
const TQDate &dt )
2578 if ( !incadd || !mChanger ) {
2579 KMessageBox::sorry(
this, i18n(
"Unable to copy the item to %1.")
2580 .arg( dt.toString() ), i18n(
"Copying Failed") );
2584 if ( !incidence ) incidence = incadd;
2586 incidence = incidence->
clone();
2589 if ( incidence->type() ==
"Event" ) {
2590 Event *
event =
static_cast<Event*
>(incidence);
2593 TQDateTime start =
event->
dtStart();
2594 TQDateTime end =
event->dtEnd();
2596 int duration = start.daysTo( end );
2597 start.setDate( dt );
2598 end.setDate( dt.addDays( duration ) );
2600 event->setDtStart( start );
2601 event->setDtEnd( end );
2603 }
else if ( incidence->type() ==
"Todo" ) {
2604 Todo *todo =
static_cast<Todo*
>(incidence);
2605 TQDateTime due = todo->
dtDue();
2612 TQPair<ResourceCalendar *, TQString>p = viewSubResourceCalendar();
2614 if ( !mChanger->addIncidence( incidence, p.first, p.second,
this ) ) {
2615 KODialogManager::errorSaveIncidence(
this, incidence );
2620 void CalendarView::moveIncidenceTo(
Incidence *incmove,
const TQDate &dt )
2622 if ( !incmove || !mChanger ) {
2623 KMessageBox::sorry(
this, i18n(
"Unable to move the item to %1.")
2624 .arg( dt.toString() ), i18n(
"Moving Failed") );
2629 addIncidenceOn( incidence, dt );
2634 TQPair<ResourceCalendar *, TQString>p = viewSubResourceCalendar();
2636 if ( !mChanger->beginChange( incidence, p.first, p.second ) ) {
2637 delete oldIncidence;
2641 if ( incidence->type() ==
"Event" ) {
2642 Event *
event =
static_cast<Event*
>(incidence);
2645 TQDateTime start =
event->
dtStart();
2646 TQDateTime end =
event->dtEnd();
2648 int duration = start.daysTo( end );
2649 start.setDate( dt );
2650 end.setDate( dt.addDays( duration ) );
2652 event->setDtStart( start );
2653 event->setDtEnd( end );
2655 }
else if ( incidence->type() ==
"Todo" ) {
2656 Todo *todo =
static_cast<Todo*
>(incidence);
2657 TQDateTime due = todo->
dtDue();
2663 mChanger->changeIncidence( oldIncidence, incidence, KOGlobals::DATE_MODIFIED,
this );
2664 mChanger->endChange( incidence, p.first, p.second );
2665 delete oldIncidence;
2668 void CalendarView::resourcesChanged()
2670 mViewManager->resourcesChanged();
2671 mDateNavigatorContainer->setUpdateNeeded();
2676 KOGlobals::OccurrenceAction userAction,
2677 KOGlobals::WhichOccurrences &chosenOption,
2678 const TQDate &itemDate,
2679 const bool commitToCalendar )
2683 if ( inc->type() !=
"Event" ) {
2684 chosenOption = KOGlobals::ALL;
2690 KOGlobals::WhatChanged whatChanged;
2692 bool dissociationOccurred =
false;
2695 TQString dialogTitle;
2696 TQString dialogText;
2698 if ( userAction == KOGlobals::CUT ) {
2699 dialogTitle = i18n(
"Cutting Recurring Item" );
2701 dialogText = i18n(
"The item you try to cut is a recurring item. Do you want to cut "
2702 "only this single occurrence, only future items, "
2703 "or all items in the recurrence?");
2705 }
else if ( userAction == KOGlobals::COPY ) {
2706 dialogTitle = i18n(
"Copying Recurring Item" );
2708 dialogText = i18n(
"The item you try to copy is a recurring item. Do you want to copy "
2709 "only this single occurrence, only future items, "
2710 "or all items in the recurrence?");
2712 dialogTitle = i18n(
"Changing Recurring Item" );
2714 dialogText = i18n(
"The item you try to change is a recurring item. Shall the changes "
2715 "be applied only to this single occurrence, only to the future items, "
2716 "or to all items in the recurrence?" );
2719 int res = KOMessageBox::fourBtnMsgBox(
this, TQMessageBox::Question,
2722 i18n(
"Only &This Item"), i18n(
"Only &Future Items"), i18n(
"&All Occurrences") );
2724 case KMessageBox::Ok:
2726 chosenOption = KOGlobals::ALL;
2728 case KMessageBox::Yes: {
2736 chosenOption = KOGlobals::ONLY_THIS_ONE;
2737 whatChanged = KOGlobals::RECURRENCE_MODIFIED_ONE_ONLY;
2738 startMultiModify( i18n(
"Dissociate event from recurrence") );
2739 incSaved = inc->
clone();
2741 if ( incToReturn ) {
2742 dissociationOccurred =
true;
2744 KMessageBox::sorry(
this, i18n(
"Unable to add the exception item to the "
2745 "calendar. No change will be done."), i18n(
"Error Occurred") );
2750 case KMessageBox::No: {
2757 chosenOption = KOGlobals::ONLY_FUTURE;
2758 whatChanged = KOGlobals::RECURRENCE_MODIFIED_ALL_FUTURE;
2759 startMultiModify( i18n(
"Split future recurrences") );
2760 incSaved = inc->
clone();
2762 if ( incToReturn ) {
2763 dissociationOccurred =
true;
2765 KMessageBox::sorry(
this, i18n(
"Unable to add the future items to the "
2766 "calendar. No change will be done."), i18n(
"Error Occurred") );
2773 chosenOption = KOGlobals::NONE;
2776 if ( dissociationOccurred && commitToCalendar ) {
2777 TQPair<ResourceCalendar *, TQString>p = viewSubResourceCalendar();
2778 mChanger->addIncidence( incToReturn, p.first, p.second,
this );
2779 mChanger->changeIncidence( incSaved, inc, whatChanged,
this );
2787 if ( KOPrefs::instance()->mWeekNumbersShowWork &&
2788 mViewManager->agendaIsSelected() &&
2789 mViewManager->
agendaMode() == KOViewManager::AGENDA_WORK_WEEK ) {
2790 mDateNavigator->selectWorkWeek( date );
2792 mDateNavigator->selectWeek( date );
2796 void CalendarView::getIncidenceHierarchy(
Incidence *inc,
2797 Incidence::List &children )
2800 if ( inc && !children.contains( inc ) ) {
2801 Incidence::List::ConstIterator it;
2802 Incidence::List immediateChildren = inc->
relations();
2803 for ( it = immediateChildren.constBegin(); it != immediateChildren.constEnd(); ++it ) {
2804 getIncidenceHierarchy( *it, children );
2806 children.append( inc );
2810 #include "calendarview.moc"
CalPrinter is a class for printing Calendars.
void appointment_delete()
pop up dialog confirming deletion of currently selected event in the View.
void newSubTodo()
create new todo with a parent todo
void updateCategories()
Calendar configuration was changed, so refresh categories list.
void readFilterSettings(TDEConfig *config)
read settings for calendar filters
void groupEventsSelected(bool)
Emitted when state of events selection has changed and user is attendee.
void setReadOnly(bool readOnly=true)
set state of calendar to read-only
void exportWeb()
Export as HTML file.
bool openCalendar(const TQString &filename, bool merge=false)
Load calendar from file filename.
void cutIncidence(Incidence *)
Cuts the selected incidence using the edit_cut() method.
void updateFilter()
Filter configuration changed.
bool makeSubTodosIndependent()
Make all sub-to-dos of the selected todo independent, update the view.
void dayPassed(const TQDate &)
Emitted, when a day changed (i.e.
TQDate activeDate(bool fallbackToToday=false)
Returns the best guess at the current active date in the view.
CalendarView(TQWidget *parent=0, const char *name=0)
Constructs a new calendar view widget.
void readSettings()
Using the TDEConfig associated with the kapp variable, read in the settings from the config file.
void pasteEnabled(bool)
Emitted, when clipboard content changes.
void changeIncidenceDisplay(Incidence *, int)
passes on the message that an event has changed to the currently activated view so that it can make a...
void appointment_edit()
pop up an Appointment Dialog to edit an existing appointment.
void takeOverCalendar()
Take ownership of all events in calendar.
void deleteSubTodosIncidence(Todo *todo)
Delete the supplied todo and all sub-todos.
TQDate activeIncidenceDate()
Returns the date of the selected incidence.
void edit_cut()
cut the current appointment to the clipboard
void modifiedChanged(bool)
Emitted when state of modified flag changes.
void goNext()
Move to the next date(s) in the current view.
void deleteTodoIncidence(Todo *todo, bool force=false)
Delete the todo incidence, and its sub-to-dos.
void pasteIncidence()
Pastes the curren incidence using the edit_paste() method.
void selectWeek(const TQDate &)
The user clicked on a week number in the date navigator.
void cancelAttendees(Incidence *)
Attendees were removed from this incidence.
bool addIncidence(const TQString &ical)
Add an incidence to the active calendar.
void newEvent()
create new event without having a date hint.
Incidence * singleOccurrenceOrAll(Incidence *inc, KOGlobals::OccurrenceAction userAction, KOGlobals::WhichOccurrences &chosenOption, const TQDate &itemDate=TQDate(), const bool commitToCalendar=false)
Asks the user if he wants to edit only this occurrence, all occurrences or only future occurrences,...
void writeSettings()
write current state to config file.
void print()
Functions for printing, previewing a print, and setting up printing parameters.
void edit_paste()
paste the current vobject(s) in the clipboard buffer into calendar
void organizerEventsSelected(bool)
Emitted when state of events selection has changed and user is organizer.
void filterActivated(int filterNum)
A different filter was selected.
void exportVCalendar()
Export as vCalendar file.
void copyIncidence(Incidence *)
Copies the selected incidence using the edit_copy() method.
void goToday()
Move the current view date to today.
void incidenceSelected(Incidence *incidence, const TQDate &date)
Emitted when an incidence gets selected.
void checkClipboard()
Check if clipboard contains vCalendar event.
bool isModified()
query whether or not the calendar is "dirty".
bool isReadOnly()
query if the calendar is read-only.
void showDates(const KCal::DateList &, const TQDate &preferredMonth=TQDate())
Select a view or adapt the current view to display the specified dates.
TQString currentFilterName() const
Returns the name of the current filter.
bool makeChildrenIndependent(Incidence *inc)
Make all children of incidence independent, not update the view Works with any incidence type,...
void dateTimesForNewEvent(TQDateTime &startDt, TQDateTime &endDt, bool &allDay)
Adjust the given date/times by valid defaults (selection or configured defaults, if invalid values ar...
void showDate(const TQDate &date)
Show the given date without changing date selection length.
void updateConfig(const TQCString &)
options dialog made a changed to the configuration.
void writeFilterSettings(TDEConfig *config)
write settings for calendar filters
void showView(KOrg::BaseView *)
changes the view to be the currently selected view
void takeOverEvent()
Take ownership of selected event.
void edit_options()
edit viewing and configuration options.
void adaptNavigationUnits()
Adapt navigation units corresponding to step size of navigation of the current view.
void addExtension(CalendarViewExtension::Factory *)
Add calendar view extension widget.
void exportICalendar()
Export as iCalendar file.
void edit_copy()
copy the current appointment(s) to the clipboard
void newTodo()
create new todo
Incidence * selectedIncidence()
Return a pointer to the incidence selected in the current view.
void configChanged()
when change is made to options dialog, the topwidget will catch this and emit this signal which notif...
void changeNavStringPrev(const TQString &)
Emitted when the unit of navigation changes.
void readOnlyChanged(bool)
Emitted when state of read-only flag changes.
void closeCalendar()
Close calendar.
void setModified(bool modified=true)
set the state of calendar.
void archiveCalendar()
Archive old events of calendar.
void appointment_show()
pop up a dialog to show an existing appointment.
Incidence * currentSelection()
currentSelection() returns a pointer to the incidence selected in the current view
void goPrevious()
Move to the previous date(s) in the current view.
void goDate(const TQDate &date)
Move the current view date to the specified date.
void categoriesChanged()
Emitted when the categories were updated, and thus the categories editor dialog needs to reload the l...
void closingDown()
emitted when the topwidget is closing down, so that any attached child windows can also close.
void todoSelected(bool)
Emitted, when a todoitem is selected or deselected.
bool saveCalendar(const TQString &filename)
Save calendar data to file.
This class controls date navigation.
ExportWebDialog is a class that provides the dialog and functions to export a calendar as web page.
void setEnabled(bool enable)
void setEndOffset(const Duration &)
void setStartOffset(const Duration &)
void setCompletedTimeSpan(int timespan)
TQStringList categoryList() const
void setCategoryList(const TQStringList &)
bool filterIncidence(Incidence *) const
void setEmailList(const TQStringList &)
int completedTimeSpan() const
bool load(const TQString &fileName, CalFormat *format=0)
void setDialogParentWidget(TQWidget *parent)
TQWidget * dialogParentWidget()
Incidence * dissociateOccurrence(Incidence *incidence, TQDate date, bool single=true)
void setTimeZoneId(const TQString &timeZoneId)
virtual void setTimeZoneIdViewOnly(const TQString &timeZoneId)=0
virtual Incidence::List rawIncidences()
void registerObserver(Observer *observer)
void setFilter(CalFilter *filter)
void unregisterObserver(Observer *observer)
virtual bool endChange(Incidence *incidence)
TQString timeZoneId() const
virtual Journal::List journals(JournalSortField sortField=JournalSortUnsorted, SortDirection sortDirection=SortDirectionAscending)
virtual Todo::List rawTodos(TodoSortField sortField=TodoSortUnsorted, SortDirection sortDirection=SortDirectionAscending)=0
Incidence * incidence(const TQString &uid)
bool copyIncidences(const Incidence::List &incidences)
Incidence::List pasteIncidences(const TQDate &newDate=TQDate(), const TQTime *newTime=0)
void setDtEnd(const TQDateTime &dtEnd)
void setSaveFormat(CalFormat *)
void setOrganizer(const Person &o)
int attendeeCount() const
void registerObserver(Observer *)
const Attendee::List & attendees() const
Attendee * attendeeByMails(const TQStringList &, const TQString &email=TQString()) const
virtual TQDateTime dtStart() const
void setReadOnly(bool readonly)
virtual Incidence * clone()=0
virtual TQDateTime dtEnd() const
const Alarm::List & alarms() const
void setSummary(const TQString &summary)
void setRelatedTo(Incidence *relatedTo)
TQString description() const
Incidence * relatedTo() const
void setDescription(const TQString &description)
void setRelatedToUid(const TQString &)
virtual void setDtStart(const TQDateTime &dtStart)
Incidence::List relations() const
Recurrence * recurrence() const
TQDateTime endDateTime() const
void setEndDateTime(const TQDateTime &endDateTime)
TQDateTime startDateTime() const
void setEndDate(const TQDate &endDate)
TQDateTime getNextDateTime(const TQDateTime &preDateTime) const
void setDtDue(const TQDateTime &dtDue, bool first=false)
TQDateTime dtDue(bool first=false) const
void setHasDueDate(bool hasDueDate)
KOAgendaView is the agenda-like view used to display events in a single one or multi-day view.
bool selectedIsSingleCell()
returns if only a single cell is selected, or a range of cells
TQDateTime selectionEnd()
end-datetime of selection
TQDateTime selectionStart()
start-datetime of selection
bool selectedIsAllDay()
returns true if selection is for whole day
This class manages the dialogs used by the calendar view.
KOJournalEditor * getJournalEditor()
Get an editor dialog for a Journal.
KOIncidenceEditor * getEditor(Incidence *)
Get the appropriate editor for the given incidence.
KOEventEditor * getEventEditor()
Get an editor dialog for an Event.
KOTodoEditor * getTodoEditor()
Get an editor dialog for a Todo.
This class provides a dialog for editing an event.
void setDates(const TQDateTime &from, const TQDateTime &to, bool allDay)
Set widgets to the given date/time values.
void setTexts(const TQString &summary, const TQString &description=TQString())
Sets the given summary and description.
void newEvent()
Clear event win for new event.
Viewer dialog for events.
Viewer widget for events.
void setIncidence(Incidence *incidence, const TQDate &date)
Show given incidence in viewer.
void setCalendar(Calendar *calendar)
Set the Calendar associated with this viewer.
void setDefaultText(const TQString &text)
Set the default text that is showed when there aren't a incidence to show.
This is the base class for the calendar component editors.
virtual void modified()
This incidence has been modified externally.
void setRecurringIncidence(Incidence *originalIncidence, Incidence *incAfterDissociation)
This should be called when editing only one occurrence of a recurring incidence, before showing the e...
void addAttendees(const TQStringList &attendees)
Adds attendees to the editor.
void addAttachments(const TQStringList &attachments, const TQStringList &mimeTypes=TQStringList(), bool inlineAttachment=false)
Adds attachments to the editor.
virtual void editIncidence(Incidence *, const TQDate &, Calendar *)=0
Edit an existing todo.
This class provides a dialog for editing a Journal.
void newJournal()
Clear editor for new Journal.
void setDate(const TQDate &date)
Set widgets to default values.
void setTexts(const TQString &summary, const TQString &description=TQString())
Sets the given summary and description.
The class KOMonthView represents the monthly view in KOrganizer.
virtual TQDateTime selectionStart()
Returns the start of the selection, or an invalid TQDateTime if there is no selection or the view doe...
This class provides a dialog for editing a Todo.
void setTexts(const TQString &summary, const TQString &description=TQString())
Sets the given summary and description.
void setDates(const TQDateTime &due, bool allDay=true, Todo *relatedTodo=0)
Set widgets to default values.
void newTodo()
Edit new todo.
This class provides a multi-column list view of todo events.
Incidence::List selectedIncidences()
This class manages the views of the calendar.
AgendaMode agendaMode() const
If the agenda view is selected it returns the current range mode: week, work week,...
void showView(KOrg::BaseView *)
changes the view to be the currently selected view
Base class for single/multi agenda views.
This class provides an interface for all views being displayed within the main calendar view.
virtual void flushView()
Write all unsaved data back to calendar store.
virtual bool eventDurationHint(TQDateTime &, TQDateTime &, bool &)
Set the default start/end date/time for new events.
virtual TQDateTime selectionStart()
Returns the start of the selection, or an invalid TQDateTime if there is no selection or the view doe...
virtual void changeIncidenceDisplay(Incidence *, int)=0
Updates the current display to reflect the changes to one particular incidence.
ResourceCalendar * resourceCalendar()
Return resourceCalendar of this view.
virtual void updateView()=0
Updates the current display to reflect changes that may have happened in the calendar since the last ...
virtual void clearSelection()
Clear selection.
virtual int currentDateCount()=0
Return number of currently shown dates.
TQString subResourceCalendar() const
Return subResourceCalendar of this view.
virtual DateList selectedIncidenceDates()=0
virtual bool isEventView()
Return if this view is a view for displaying events.
virtual Incidence::List selectedIncidences()=0
virtual bool supportsDateNavigation() const
Returns true if the view supports navigation through the date navigator ( selecting a date range,...
interface for main calendar view widget
bool view(TQWidget *parent, Attachment *attachment)