55 #include <calendarsupport/categoryconfig.h>
56 #include <calendarsupport/collectiongeneralpage.h>
57 #include <calendarsupport/collectionselection.h>
58 #include <calendarsupport/kcalprefs.h>
59 #include <calendarsupport/utils.h>
60 #include <calendarsupport/next/incidenceviewer.h>
62 #include <incidenceeditor-ng/incidencedefaults.h>
63 #include <incidenceeditor-ng/incidencedialog.h>
64 #include <incidenceeditor-ng/incidencedialogfactory.h>
66 #include <libkdepim/widgets/pimmessagebox.h>
67 #include <akonadi/calendar/freebusymanager.h>
68 #include <akonadi/calendar/history.h>
69 #include <Akonadi/Calendar/IncidenceChanger>
70 #include <Akonadi/Calendar/CalendarSettings>
71 #include <Akonadi/Calendar/CalendarClipboard>
73 #include <pimcommon/acl/collectionaclpage.h>
74 #include <pimcommon/acl/imapaclattribute.h>
76 #include <Akonadi/CollectionPropertiesDialog>
77 #include <Akonadi/Control>
78 #include <Akonadi/AttributeFactory>
79 #include <Akonadi/Calendar/TodoPurger>
81 #include <KCalCore/CalFilter>
82 #include <KCalCore/FileStorage>
83 #include <KCalCore/ICalFormat>
84 #include <KCalCore/VCalFormat>
86 #include <KCalUtils/ICalDrag>
87 #include <KCalUtils/Stringify>
88 #include <KCalUtils/DndFactory>
90 #include <KHolidays/Holidays>
92 #include <KFileDialog>
93 #include <KNotification>
97 #include <QApplication>
99 #include <QItemSelectionModel>
101 #include <QStackedWidget>
102 #include <QVBoxLayout>
105 mCheckableProxyModel( 0 ),
106 mETMCollectionView( 0 )
108 Akonadi::Control::widgetNeedsAkonadi(
this );
109 mChanger =
new Akonadi::IncidenceChanger(
this );
110 mChanger->setDefaultCollection( Akonadi::Collection( CalendarSupport::KCalPrefs::instance()->defaultCalendarId() ) );
112 mChanger->setDestinationPolicy( static_cast<Akonadi::IncidenceChanger::DestinationPolicy>(
KOPrefs::instance()->destination() ) );
113 mCalendar = Akonadi::ETMCalendar::Ptr(
new Akonadi::ETMCalendar() );
114 mCalendar->setObjectName( QLatin1String(
"KOrg Calendar") );
115 mCalendarClipboard =
new Akonadi::CalendarClipboard( mCalendar,
mChanger,
this );
116 mITIPHandler =
new Akonadi::ITIPHandler(
this );
117 mITIPHandler->setCalendar( mCalendar );
118 connect( mCalendarClipboard, SIGNAL(cutFinished(
bool,QString)), SLOT(
onCutFinished()) );
120 Akonadi::AttributeFactory::registerAttribute<PimCommon::ImapAclAttribute>();
124 mTodoPurger =
new Akonadi::TodoPurger(
this );
125 mTodoPurger->setCalendar( mCalendar );
126 mTodoPurger->setIncidenceChager(
mChanger );
127 connect(mTodoPurger, SIGNAL(todosPurged(
bool,
int,
int)),
128 SLOT(onTodosPurged(
bool,
int,
int)));
131 mSplitterSizesValid =
false;
138 QVBoxLayout *topLayout =
new QVBoxLayout(
this );
139 topLayout->setMargin( 0 );
142 mPanner =
new QSplitter( Qt::Horizontal,
this );
143 mPanner->setObjectName( QLatin1String(
"CalendarView::Panner") );
144 topLayout->addWidget( mPanner );
146 mLeftSplitter =
new QSplitter( Qt::Vertical, mPanner );
147 mLeftSplitter->setObjectName( QLatin1String(
"CalendarView::LeftFrame") );
151 mLeftSplitter->setChildrenCollapsible(
false );
154 mDateNavigatorContainer->setObjectName( QLatin1String(
"CalendarView::DateNavigator") );
156 mTodoList =
new KOTodoView(
true, mLeftSplitter );
157 mTodoList->setObjectName(QLatin1String(
"todolist") );
159 mEventViewerBox =
new KVBox( mLeftSplitter );
160 mEventViewerBox->setMargin( 0 );
161 mEventViewer =
new CalendarSupport::IncidenceViewer( mCalendar.data(), mEventViewerBox );
162 mEventViewer->setObjectName( QLatin1String(
"EventViewer") );
164 KVBox *rightBox =
new KVBox( mPanner );
165 rightBox->layout()->setMargin( 0 );
167 mRightFrame =
new QStackedWidget( rightBox );
168 mMessageWidget =
new CalendarSupport::MessageWidget( rightBox );
170 rightBox->setStretchFactor( mRightFrame, 1 );
172 mLeftFrame = mLeftSplitter;
173 mLeftFrame->installEventFilter(
this );
175 mChanger->setGroupwareCommunication( CalendarSupport::KCalPrefs::instance()->useGroupwareCommunication() );
177 SIGNAL(createFinished(
int,Akonadi::Item,Akonadi::IncidenceChanger::ResultCode,QString)),
178 SLOT(
slotCreateFinished(
int,Akonadi::Item,Akonadi::IncidenceChanger::ResultCode,QString)) );
181 SIGNAL(deleteFinished(
int,QVector<Akonadi::Item::Id>,Akonadi::IncidenceChanger::ResultCode,QString)),
182 SLOT(
slotDeleteFinished(
int,QVector<Akonadi::Item::Id>,Akonadi::IncidenceChanger::ResultCode,QString)) );
185 SIGNAL(modifyFinished(
int,Akonadi::Item,Akonadi::IncidenceChanger::ResultCode,QString)),
186 SLOT(
slotModifyFinished(
int,Akonadi::Item,Akonadi::IncidenceChanger::ResultCode,QString)) );
189 connect( mDateNavigator, SIGNAL(datesSelected(KCalCore::DateList,QDate)),
190 SLOT(
showDates(KCalCore::DateList,QDate)) );
194 connect( mDateNavigatorContainer, SIGNAL(
newTodoSignal(QDate)),
200 connect( mNavigatorBar, SIGNAL(prevYearClicked()),
201 mDateNavigator, SLOT(selectPreviousYear()) );
202 connect( mNavigatorBar, SIGNAL(nextYearClicked()),
203 mDateNavigator, SLOT(selectNextYear()) );
204 connect( mNavigatorBar, SIGNAL(prevMonthClicked()),
205 mDateNavigator, SLOT(selectPreviousMonth()) );
206 connect( mNavigatorBar, SIGNAL(nextMonthClicked()),
207 mDateNavigator, SLOT(selectNextMonth()) );
208 connect( mNavigatorBar, SIGNAL(monthSelected(
int)),
209 mDateNavigator, SLOT(selectMonth(
int)) );
210 connect( mNavigatorBar, SIGNAL(yearSelected(
int)),
211 mDateNavigator, SLOT(selectYear(
int)) );
214 connect( mDateNavigatorContainer, SIGNAL(weekClicked(QDate,QDate)),
217 connect( mDateNavigatorContainer, SIGNAL(prevMonthClicked(QDate,QDate,QDate)),
218 mDateNavigator, SLOT(selectPreviousMonth(QDate,QDate,QDate)) );
219 connect( mDateNavigatorContainer, SIGNAL(nextMonthClicked(QDate,QDate,QDate)),
220 mDateNavigator, SLOT(selectNextMonth(QDate,QDate,QDate)) );
221 connect( mDateNavigatorContainer, SIGNAL(prevYearClicked()),
222 mDateNavigator, SLOT(selectPreviousYear()) );
223 connect( mDateNavigatorContainer, SIGNAL(nextYearClicked()),
224 mDateNavigator, SLOT(selectNextYear()) );
225 connect( mDateNavigatorContainer, SIGNAL(monthSelected(
int)),
226 mDateNavigator, SLOT(selectMonth(
int)) );
227 connect( mDateNavigatorContainer, SIGNAL(yearSelected(
int)),
228 mDateNavigator, SLOT(selectYear(
int)) );
229 connect( mDateNavigatorContainer, SIGNAL(
goPrevious()),
230 mDateNavigator, SLOT(selectPrevious()) );
231 connect( mDateNavigatorContainer, SIGNAL(
goNext()),
232 mDateNavigator, SLOT(selectNext()) );
234 connect( mDateNavigatorContainer, SIGNAL(datesSelected(KCalCore::DateList,QDate)),
235 mDateNavigator, SLOT(selectDates(KCalCore::DateList,QDate)) );
237 connect( mViewManager, SIGNAL(datesSelected(KCalCore::DateList)),
238 mDateNavigator, SLOT(selectDates(KCalCore::DateList)) );
240 connect( mDateNavigatorContainer, SIGNAL(incidenceDropped(Akonadi::Item,QDate)),
242 connect( mDateNavigatorContainer, SIGNAL(incidenceDroppedMove(Akonadi::Item,QDate)),
245 connect( mDateChecker, SIGNAL(
dayPassed(QDate)),
247 connect( mDateChecker, SIGNAL(
dayPassed(QDate)),
249 connect( mDateChecker, SIGNAL(
dayPassed(QDate)),
250 mDateNavigatorContainer, SLOT(updateToday()) );
256 mEventViewer, SLOT(setIncidence(Akonadi::Item,QDate)) );
260 s = i18n(
"<p><em>No Item Selected</em></p>"
261 "<p>Select an event, to-do or journal entry to view its details "
264 mEventViewer->setDefaultMessage( s );
265 mEventViewer->setWhatsThis(
266 i18n(
"View the details of events, journal entries or to-dos "
267 "selected in KOrganizer's main view here." ) );
268 mEventViewer->setIncidence( Akonadi::Item(), QDate() );
270 mViewManager->connectTodoView( mTodoList );
271 mViewManager->connectView( mTodoList );
275 connect( QApplication::clipboard(), SIGNAL(dataChanged()), SLOT(
checkClipboard()) );
283 static bool pageRegistered =
false;
285 if ( !pageRegistered ) {
286 Akonadi::CollectionPropertiesDialog::registerPage(
287 new CalendarSupport::CollectionGeneralPageFactory );
288 Akonadi::CollectionPropertiesDialog::registerPage(
new PimCommon::CollectionAclPageFactory );
289 pageRegistered =
true;
293 Akonadi::FreeBusyManager::self()->setCalendar( mCalendar );
295 mCalendar->registerObserver(
this );
298 mEventViewer->setCalendar( mCalendar.data() );
303 mCalendar->unregisterObserver(
this );
304 mCalendar->setFilter( 0 );
305 qDeleteAll( mFilters );
306 qDeleteAll( mExtensions );
308 delete mDialogManager;
335 if ( fallbackToToday ) {
336 return QDate::currentDate();
347 if ( !dates.isEmpty() ) {
348 return dates.first();
358 return dates.first();
367 void CalendarView::createPrinter()
369 if ( !mCalPrinter ) {
380 KCalCore::FileStorage storage( mCalendar );
381 storage.setFileName( filename );
382 storage.setSaveFormat(
new KCalCore::ICalFormat );
384 return storage.save();
401 KConfigGroup geometryConfig( config,
"KOrganizer Geometry" );
403 QList<int> sizes = geometryConfig.readEntry(
"Separator1",QList<int>() );
404 if ( sizes.count() != 2 || sizes.count() == sizes.count( 0 ) ) {
408 mPanner->setSizes( sizes );
410 sizes = geometryConfig.readEntry(
"Separator2", QList<int>() );
411 if ( !sizes.isEmpty() && sizes.count() != sizes.count( 0 ) ) {
412 mLeftSplitter->setSizes( sizes );
416 mTodoList->
restoreLayout( config, QLatin1String(
"Sidebar Todo View" ),
true );
420 KConfigGroup viewConfig( config,
"Views" );
421 int dateCount = viewConfig.readEntry(
"ShownDatesCount", 7 );
422 if ( dateCount == 7 ) {
433 KConfigGroup geometryConfig( config,
"KOrganizer Geometry" );
435 QList<int> list = mMainSplitterSizes.isEmpty() ? mPanner->sizes() : mMainSplitterSizes;
437 if ( list.count() != list.count( 0 ) && mSplitterSizesValid ) {
438 geometryConfig.writeEntry(
"Separator1", list );
441 list = mLeftSplitter->sizes();
442 if ( list.count() != list.count( 0 ) && mSplitterSizesValid ) {
443 geometryConfig.writeEntry(
"Separator2", list );
447 mTodoList->
saveLayout( config, QLatin1String(
"Sidebar Todo View" ) );
449 Akonadi::CalendarSettings::self()->writeConfig();
451 CalendarSupport::KCalPrefs::instance()->writeConfig();
455 KConfigGroup viewConfig( config,
"Views" );
456 viewConfig.writeEntry(
"ShownDatesCount", mDateNavigator->
selectedDates().count() );
463 qDeleteAll( mFilters );
466 KConfigGroup generalConfig( config,
"General" );
468 QStringList filterList = generalConfig.readEntry(
"CalendarFilters", QStringList() );
469 QString currentFilter = generalConfig.readEntry(
"Current Filter" );
471 QStringList::ConstIterator it = filterList.constBegin();
472 QStringList::ConstIterator end = filterList.constEnd();
473 while ( it != end ) {
474 KCalCore::CalFilter *filter =
new KCalCore::CalFilter( *it );
475 KConfigGroup filterConfig( config, QLatin1String(
"Filter_") + (*it) );
476 filter->setCriteria( filterConfig.readEntry(
"Criteria", 0 ) );
477 filter->setCategoryList( filterConfig.readEntry(
"CategoryList", QStringList() ) );
478 if ( filter->criteria() & KCalCore::CalFilter::HideNoMatchingAttendeeTodos ) {
479 filter->setEmailList( CalendarSupport::KCalPrefs::instance()->allEmails() );
481 filter->setCompletedTimeSpan( filterConfig.readEntry(
"HideTodoDays", 0 ) );
482 mFilters.append( filter );
487 int pos = filterList.indexOf( currentFilter );
490 mCurrentFilter = mFilters.at( pos );
497 QStringList filterList;
499 foreach ( KCalCore::CalFilter *filter, mFilters ) {
500 filterList << filter->name();
501 KConfigGroup filterConfig( config, QLatin1String(
"Filter_") + filter->name() );
502 filterConfig.writeEntry(
"Criteria", filter->criteria() );
503 filterConfig.writeEntry(
"CategoryList", filter->categoryList() );
504 filterConfig.writeEntry(
"HideTodoDays", filter->completedTimeSpan() );
506 KConfigGroup generalConfig( config,
"General" );
507 generalConfig.writeEntry(
"CalendarFilters", filterList );
508 if ( mCurrentFilter ) {
509 generalConfig.writeEntry(
"Current Filter", mCurrentFilter->name() );
511 generalConfig.writeEntry(
"Current Filter", QString() );
523 if ( dateCount == 7 ) {
537 if ( dynamic_cast<MonthView*>( mViewManager->
currentView() ) ) {
548 if ( dynamic_cast<MonthView*>( mViewManager->
currentView() ) ) {
564 if ( receiver !=
"korganizer" ) {
569 mCalPrinter->deleteLater();
577 KDateTime::Spec newTimeSpec = CalendarSupport::KCalPrefs::instance()->timeSpec();
578 if ( mCalendar->viewTimeSpec() != newTimeSpec ) {
580 const QString question( i18n(
"The time zone setting was changed. "
581 "Do you want to keep the absolute time of "
582 "the items in your calendar, which will show "
583 "them to be at a different time than "
584 "before, or move them to be at the old time "
585 "also in the new time zone?" ) );
586 int rc = KMessageBox::questionYesNo(
this, question,
587 i18n(
"Keep Absolute Times?" ),
588 KGuiItem( i18n(
"Keep Times" ) ),
589 KGuiItem( i18n(
"Move Times" ) ),
590 QLatin1String(
"calendarKeepAbsoluteTimes") );
591 if ( rc == KMessageBox::Yes ) {
593 mCalendar->setViewTimeSpec( newTimeSpec );
597 mCalendar->shiftTimes( mCalendar->viewTimeSpec(), newTimeSpec );
614 static_cast<Akonadi::IncidenceChanger::DestinationPolicy>(
617 mChanger->setGroupwareCommunication( CalendarSupport::KCalPrefs::instance()->useGroupwareCommunication() );
621 const Akonadi::Item &item,
622 Akonadi::IncidenceChanger::ResultCode resultCode,
623 const QString &errorString )
625 Q_UNUSED( changeId );
626 if ( resultCode == Akonadi::IncidenceChanger::ResultCodeSuccess ) {
631 kError() <<
"Incidence not added, job reported error: " << errorString;
636 const Akonadi::Item &item,
637 Akonadi::IncidenceChanger::ResultCode resultCode,
638 const QString &errorString )
640 Q_UNUSED( changeId );
641 if ( resultCode != Akonadi::IncidenceChanger::ResultCodeSuccess ) {
642 kError() <<
"Incidence not modified, job reported error: " << errorString;
646 Q_ASSERT( item.isValid() );
647 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
648 Q_ASSERT( incidence );
649 QSet<KCalCore::IncidenceBase::Field> dirtyFields = incidence->dirtyFields();
650 incidence->resetDirtyFields();
654 if ( incidence->type() == Incidence::TypeTodo &&
656 ( dirtyFields.contains( KCalCore::Incidence::FieldCompleted ) ) ) {
657 KCalCore::Todo::Ptr todo = incidence.dynamicCast<KCalCore::Todo>();
658 if ( todo->isCompleted() || todo->recurs() ) {
659 QString timeStr = KGlobal::locale()->formatTime( QTime::currentTime() );
660 QString description = i18n(
"Todo completed: %1 (%2)", incidence->summary(), timeStr );
662 KCalCore::Journal::List journals =
calendar()->journals( QDate::currentDate() );
664 if ( journals.isEmpty() ) {
665 Journal::Ptr journal(
new Journal );
667 KDateTime::currentDateTime( CalendarSupport::KCalPrefs::instance()->timeSpec() ) );
669 QString dateStr = KGlobal::locale()->formatDate( QDate::currentDate() );
670 journal->setSummary( i18n(
"Journal of %1", dateStr ) );
671 journal->setDescription( description );
673 if (
mChanger->createIncidence( journal, item.parentCollection(), this ) == -1 ) {
674 kError() <<
"Unable to add Journal";
679 Akonadi::Item journalItem = mCalendar->item( journals.first()->uid() );
680 Journal::Ptr journal = CalendarSupport::journal( journalItem );
681 Journal::Ptr oldJournal( journal->clone() );
682 journal->setDescription( journal->description().append( QLatin1Char(
'\n') + description ) );
683 mChanger->modifyIncidence( journalItem, oldJournal,
this );
695 const QVector<Akonadi::Item::Id> &itemIdList,
696 Akonadi::IncidenceChanger::ResultCode resultCode,
697 const QString &errorString )
699 Q_UNUSED( changeId );
700 if ( resultCode == Akonadi::IncidenceChanger::ResultCodeSuccess ) {
701 foreach( Akonadi::Item::Id
id, itemIdList ) {
702 Akonadi::Item item = mCalendar->item(
id );
703 if ( item.isValid() )
708 kError() <<
"Incidence not deleted, job reported error: " << errorString;
714 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
715 KCalCore::CalFilter *filter =
calendar()->filter();
716 if ( filter && !filter->filterIncidence( incidence ) ) {
719 mMessageWidget->setText( i18n(
"The item \"%1\" is filtered by your current filter rules, "
720 "so it will be hidden and not appear in the view.",
721 incidence->summary() ) );
722 mMessageWidget->show();
728 mChanger->startAtomicOperation( text );
737 Akonadi::IncidenceChanger::ChangeType changeType )
739 if ( mDateNavigatorContainer->isVisible() ) {
745 if ( CalendarSupport::hasIncidence( item ) ) {
754 const QDate &preferredMonth,
755 const bool updateTodos )
759 if ( updateTodos && !currentViewIsTodoView && mTodoList->isVisible() ) {
764 if ( start.isValid() && end.isValid() && !( currentViewIsTodoView && !updateTodos ) ) {
765 mViewManager->
updateView( start, end, preferredMonth );
768 if ( mDateNavigatorContainer->isVisible() ) {
779 updateView( tmpList.first(), tmpList.last(), month );
784 if ( mDateNavigatorContainer->isVisible() ) {
791 return KMessageBox::warningContinueCancel(
794 "Do you really want to permanently remove the item \"%1\"?",
795 CalendarSupport::incidence( item )->summary() ),
796 i18nc(
"@title:window",
"Delete Item?" ),
797 KStandardGuiItem::del() );
803 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
805 kError() <<
"Null incidence";
809 mCalendarClipboard->cutIncidence( incidence, Akonadi::CalendarClipboard::AskMode );
816 if ( !item.isValid() ) {
817 KNotification::beep();
818 kError() <<
"Invalid item";
822 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
823 Q_ASSERT( incidence );
824 if ( !mCalendarClipboard->copyIncidence( incidence, Akonadi::CalendarClipboard::AskMode ) )
825 kError() <<
"Error copying incidence";
836 KDateTime finalDateTime;
837 bool useEndTime =
false;
838 KCalUtils::DndFactory::PasteFlags pasteFlags = 0;
845 kWarning() <<
"No view is selected, can't paste";
849 if ( curView == agendaView && agendaView->
selectionStart().isValid() ) {
854 finalDateTime = KDateTime( date );
856 finalDateTime = KDateTime( date, agendaView->
selectionStart().time() );
858 }
else if ( curView == monthView && monthView->
selectionStart().isValid() ) {
860 pasteFlags = KCalUtils::DndFactory::FlagPasteAtOriginalTime;
864 finalDateTime = KDateTime( mDateNavigator->
selectedDates().first() );
865 pasteFlags = KCalUtils::DndFactory::FlagPasteAtOriginalTime;
871 i18n(
"Paste failed: unable to determine a valid target date." ) );
875 KCalUtils::DndFactory factory( mCalendar );
877 Incidence::List pastedIncidences = factory.pasteIncidences( finalDateTime, pasteFlags );
878 Incidence::List::Iterator it;
880 for ( it = pastedIncidences.begin(); it != pastedIncidences.end(); ++it ) {
882 if ( ( *it )->type() == Incidence::TypeEvent ) {
883 KCalCore::Event::Ptr pastedEvent = ( *it ).staticCast<Event>();
886 if ( agendaView && endDT.isValid() && useEndTime ) {
889 KDateTime kdt( endDT, CalendarSupport::KCalPrefs::instance()->timeSpec() );
890 pastedEvent->setDtEnd( kdt.toTimeSpec( pastedEvent->dtEnd().timeSpec() ) );
894 pastedEvent->setRelatedTo( QString() );
895 mChanger->createIncidence( KCalCore::Event::Ptr( pastedEvent->clone() ),
896 Akonadi::Collection(), this );
897 }
else if ( ( *it )->type() == Incidence::TypeTodo ) {
898 KCalCore::Todo::Ptr pastedTodo = ( *it ).staticCast<Todo>();
903 KCalCore::Todo::Ptr _selectedTodo = CalendarSupport::todo( _selectedTodoItem );
904 if ( _selectedTodo && pastedTodo->relatedTo().isEmpty() ) {
905 pastedTodo->setRelatedTo( _selectedTodo->uid() );
909 mChanger->createIncidence( KCalCore::Todo::Ptr( pastedTodo->clone() ),
910 Akonadi::Collection(), this );
911 }
else if ( ( *it )->type() == Incidence::TypeJournal ) {
913 mChanger->createIncidence( KCalCore::Incidence::Ptr( ( *it )->clone() ),
914 Akonadi::Collection(), this );
929 if ( !startDt.isValid() || !endDt.isValid() ) {
931 startDt.setTime( CalendarSupport::KCalPrefs::instance()->mStartTime.time() );
934 ( CalendarSupport::KCalPrefs::instance()->mDefaultDuration.time().hour() * 3600 ) +
935 ( CalendarSupport::KCalPrefs::instance()->mDefaultDuration.time().minute() * 60 );
936 endDt = startDt.addSecs( addSecs );
942 IncidenceEditorNG::IncidenceDialog *dialog = mDialogManager->
createDialog(item);
950 item.setPayload( event );
953 dialog->load( item );
963 newEvent( QDateTime(), QDateTime() );
968 QDateTime startDt( dt, CalendarSupport::KCalPrefs::instance()->mStartTime.time() );
969 QTime duration = CalendarSupport::KCalPrefs::instance()->defaultDuration().time();
970 QTime time = startDt.time();
972 time = time.addSecs( duration.hour() * 3600 +
973 duration.minute() * 60 +
975 QDateTime endDt( startDt );
976 endDt.setTime( time );
989 QDateTime startDt( startDtParam );
990 QDateTime endDt( endDtParam );
996 IncidenceEditorNG::IncidenceDefaults defaults =
997 IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults();
998 defaults.setStartDateTime( KDateTime( startDt ) );
999 defaults.setEndDateTime( KDateTime( endDt ) );
1001 KCalCore::Event::Ptr event(
new Event );
1002 defaults.setDefaults( event );
1003 event->setAllDay( allDay );
1005 IncidenceEditorNG::IncidenceDialog *eventEditor =
newEventEditor( event );
1006 Q_ASSERT( eventEditor );
1009 eventEditor->selectCollection( defaultCollection( KCalCore::Event::eventMimeType() ) );
1013 const QStringList &attachments,
const QStringList &attendees,
1014 const QStringList &attachmentMimetypes,
bool inlineAttachment )
1020 bool allDay =
false;
1023 IncidenceEditorNG::IncidenceDefaults defaults =
1024 IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults();
1025 defaults.setStartDateTime( KDateTime( startDt ) );
1026 defaults.setEndDateTime( KDateTime( endDt ) );
1029 defaults.setAttachments( attachments, attachmentMimetypes, QStringList(), inlineAttachment );
1030 defaults.setAttendees( attendees );
1032 KCalCore::Event::Ptr event(
new Event );
1033 defaults.setDefaults( event );
1035 event->setSummary( summary );
1036 event->setDescription( description );
1037 event->setAllDay( allDay );
1042 const QStringList &attachments,
const QStringList &attendees,
1043 const QStringList &attachmentMimetypes,
1044 bool inlineAttachment )
1046 Akonadi::Collection defaultCol = defaultCollection( Todo::todoMimeType() );
1048 IncidenceEditorNG::IncidenceDialogFactory::createTodoEditor(
1049 summary, description, attachments,
1050 attendees, attachmentMimetypes,
1052 inlineAttachment, defaultCol,
1058 newTodo( Akonadi::Collection() );
1063 IncidenceEditorNG::IncidenceDefaults defaults =
1064 IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults();
1072 defaults.setStartDateTime( KDateTime( startDt ) );
1073 defaults.setEndDateTime( KDateTime( endDt ) );
1076 KCalCore::Todo::Ptr todo(
new Todo );
1077 defaults.setDefaults( todo );
1078 todo->setAllDay( allDay );
1081 item.setPayload( todo );
1083 IncidenceEditorNG::IncidenceDialog *dialog = createIncidenceEditor( item, collection );
1085 dialog->load( item );
1090 IncidenceEditorNG::IncidenceDefaults defaults =
1091 IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults();
1092 defaults.setEndDateTime( KDateTime( date, QTime::currentTime() ) );
1094 KCalCore::Todo::Ptr todo(
new Todo );
1095 defaults.setDefaults( todo );
1096 todo->setAllDay(
true );
1099 item.setPayload( todo );
1101 IncidenceEditorNG::IncidenceDialog *dialog = createIncidenceEditor( item );
1102 dialog->load( item );
1117 IncidenceEditorNG::IncidenceDefaults defaults =
1118 IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults();
1126 defaults.setStartDateTime( KDateTime( startDt ) );
1127 defaults.setEndDateTime( KDateTime( endDt ) );
1130 Journal::Ptr journal(
new Journal );
1131 defaults.setDefaults( journal );
1134 item.setPayload( journal );
1135 IncidenceEditorNG::IncidenceDialog *dialog = createIncidenceEditor( item, collection );
1136 dialog->load( item );
1141 IncidenceEditorNG::IncidenceDefaults defaults =
1142 IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults();
1144 Journal::Ptr journal(
new Journal );
1145 defaults.setStartDateTime( KDateTime( date ) );
1146 defaults.setDefaults( journal );
1148 journal->setSummary( text );
1151 item.setPayload( journal );
1153 IncidenceEditorNG::IncidenceDialog *dialog = createIncidenceEditor( item );
1154 dialog->load( item );
1173 if ( CalendarSupport::hasTodo( item ) ) {
1181 kWarning() <<
"CalendarSupport::hasTodo() is false";
1185 IncidenceEditorNG::IncidenceDefaults defaults =
1186 IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults();
1187 defaults.setRelatedIncidence( CalendarSupport::incidence(
selectedTodo() ) );
1189 KCalCore::Todo::Ptr todo(
new Todo );
1190 defaults.setDefaults( todo );
1193 item.setPayload( todo );
1195 IncidenceEditorNG::IncidenceDialog *dialog = createIncidenceEditor( item, collection );
1196 dialog->load( item );
1201 IncidenceEditorNG::IncidenceDefaults defaults =
1202 IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults();
1203 defaults.setRelatedIncidence( CalendarSupport::incidence( parentTodo ) );
1205 KCalCore::Todo::Ptr todo(
new Todo );
1206 defaults.setDefaults( todo );
1208 Q_ASSERT( !todo->relatedTo().isEmpty() );
1211 item.setPayload( todo );
1214 Akonadi::Collection collection = mCalendar->collection( parentTodo.storageCollectionId() );
1215 IncidenceEditorNG::IncidenceDialog *dialog = createIncidenceEditor( item, collection );
1216 dialog->load( item );
1222 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
1223 QDateTime( date, QTime( 12, 0, 0 ) ),
true );
1228 KCalCore::ICalFormat format;
1229 format.setTimeSpec( mCalendar->timeSpec() );
1230 Incidence::Ptr incidence( format.fromString( ical ) );
1236 return incidence ?
mChanger->createIncidence( incidence, Akonadi::Collection(),
this ) != -1 :
false;
1242 if ( CalendarSupport::hasIncidence( item ) ) {
1245 KNotification::beep();
1252 if ( CalendarSupport::hasIncidence( item ) ) {
1255 KNotification::beep();
1262 if ( CalendarSupport::hasIncidence( item ) ) {
1265 KNotification::beep();
1279 const Incidence::Ptr inc = CalendarSupport::incidence( item );
1281 if ( !inc || inc->relatedTo().isEmpty() ) {
1282 kDebug() <<
"Refusing to unparent this to-do" << inc;
1286 Incidence::Ptr oldInc( inc->clone() );
1287 inc->setRelatedTo( QString() );
1288 mChanger->modifyIncidence( item, oldInc,
this );
1295 bool status =
false;
1307 const Incidence::Ptr inc = CalendarSupport::incidence( item );
1309 Akonadi::Item::List subIncs = mCalendar->childItems( item.id() );
1311 if ( !inc || subIncs.isEmpty() ) {
1312 kDebug() <<
"Refusing to make children independent" << inc;
1317 foreach (
const Akonadi::Item &item, subIncs ) {
1327 Akonadi::Item item = mCalendar->item(
id );
1328 if ( !CalendarSupport::hasIncidence( item ) ) {
1329 kError() <<
"CalendarView::deleteIncidence(): Item does not contain incidence.";
1337 const Incidence::Ptr incidence = CalendarSupport::incidence( item );
1339 kError() <<
"Null incidence";
1342 Incidence::Ptr oldincidence( incidence->clone() );
1344 Alarm::List alarms = incidence->alarms();
1345 Alarm::List::ConstIterator it;
1346 for ( it = alarms.constBegin(); it != alarms.constEnd(); ++it ) {
1347 (*it)->toggleAlarm();
1349 if ( alarms.isEmpty() ) {
1351 Alarm::Ptr alm = incidence->newAlarm();
1352 alm->setType( Alarm::Display );
1353 alm->setEnabled(
true );
1355 switch( CalendarSupport::KCalPrefs::instance()->mReminderTimeUnits ) {
1358 duration = CalendarSupport::KCalPrefs::instance()->mReminderTime * 60;
1361 duration = CalendarSupport::KCalPrefs::instance()->mReminderTime * 60 * 60;
1364 duration = CalendarSupport::KCalPrefs::instance()->mReminderTime * 60 * 60 * 24;
1367 if ( incidence->type() == Incidence::TypeEvent ) {
1368 alm->setStartOffset( KCalCore::Duration( -duration ) );
1370 alm->setEndOffset( KCalCore::Duration( -duration ) );
1373 mChanger->startAtomicOperation( i18n(
"Toggle Reminder" ) );
1374 mChanger->modifyIncidence( item, oldincidence,
this );
1380 const Incidence::Ptr incidence = CalendarSupport::incidence( todoItem );
1383 kError() <<
"Null incidence";
1386 if ( incidence->type() != Incidence::TypeTodo ) {
1387 kDebug() <<
"called for a non-Todo incidence";
1391 KCalCore::Todo::Ptr todo = CalendarSupport::todo( todoItem );
1393 KCalCore::Todo::Ptr oldtodo( todo->clone() );
1395 if ( todo->isCompleted() ) {
1396 todo->setPercentComplete( 0 );
1398 todo->setCompleted( KDateTime::currentDateTime(
1399 CalendarSupport::KCalPrefs::instance()->timeSpec() ) );
1402 mChanger->startAtomicOperation( i18n(
"Toggle To-do Completed") );
1403 mChanger->modifyIncidence( todoItem, oldtodo,
this );
1409 #ifdef AKONADI_PORT_DISABLED
1411 kError() <<
"Null incidence";
1415 KCalCore::CalendarResources *
const resources = KOrg::StdCalendar::self();
1416 KCalCore::CalendarResourceManager *
const manager = resources->resourceManager();
1419 ResourceCalendar *newCal = 0;
1420 KCalCore::CalendarResourceManager::iterator it;
1421 for ( it = manager->begin(); it != manager->end(); ++it ) {
1422 ResourceCalendar *
const resource = *it;
1423 if ( resource->identifier() == resourceId ) {
1433 Incidence::Ptr newInc;
1434 if ( incidence->type() == Incidence::TypeEvent ) {
1435 KCalCore::Event::Ptr nEvent( static_cast<KCalCore::Event::Ptr >( incidence )->clone() );
1436 nEvent->setUid( KCalCore::CalFormat::createUniqueId() );
1438 }
else if ( incidence->type() == Incidence::TypeTodo ) {
1439 KCalCore::Todo::Ptr nTodo( static_cast<KCalCore::Todo::Ptr >( incidence )->clone() );
1440 nTodo->setUid( KCalCore::CalFormat::createUniqueId() );
1442 }
else if ( incidence->type() == Incidence::TypeJournal ) {
1443 KCalCore::Journal::Ptr nJournal( static_cast<KCalCore::Journal::Ptr >( incidence )->clone() );
1444 nJournal->setUid( KCalCore::CalFormat::createUniqueId() );
1447 kWarning() <<
"Trying to copy an incidence type that cannot be copied";
1451 if ( resources->addIncidence( newInc, newCal ) ) {
1452 incidenceAddFinished( newInc,
true );
1453 KMessageBox::information(
1456 "\"%1\" was successfully copied to %2.",
1457 incidence->summary(),
1458 newCal->resourceName() ),
1459 i18nc(
"@title:window",
"Copying Succeeded" ),
1460 "CalendarIncidenceCopy" );
1465 "Unable to copy the item \"%1\" to %2.",
1466 incidence->summary(),
1467 newCal->resourceName() ),
1468 i18nc(
"@title:window",
"Copying Failed" ) );
1471 Q_UNUSED( resourceId );
1473 kDebug() <<
"AKONADI PORT: Disabled code in " << Q_FUNC_INFO;
1479 #ifdef AKONADI_PORT_DISABLED
1481 kError() <<
"Null incidence";
1485 KCalCore::CalendarResources *
const resources = KOrg::StdCalendar::self();
1486 KCalCore::CalendarResourceManager *
const manager = resources->resourceManager();
1489 ResourceCalendar *newCal = 0;
1490 KCalCore::CalendarResourceManager::iterator it;
1491 for ( it = manager->begin(); it != manager->end(); ++it ) {
1492 ResourceCalendar *
const resource = *it;
1493 if ( resource->identifier() == resourceId ) {
1504 if ( incidence->type() == Incidence::TypeEvent ) {
1505 KCalCore::Event::Ptr nEvent =
static_cast<KCalCore::Event::Ptr
>( incidence )->clone();
1506 nEvent->setUid( KCalCore::CalFormat::createUniqueId() );
1508 }
else if ( incidence->type() == Incidence::TypeTodo ) {
1509 KCalCore::Todo::Ptr nTodo =
static_cast<KCalCore::Todo::Ptr
>( incidence )->clone();
1510 nTodo->setUid( KCalCore::CalFormat::createUniqueId() );
1512 }
else if ( incidence->type() == Incidence::TypeJournal ) {
1513 KCalCore::Journal::Ptr nJournal =
static_cast<KCalCore::Journal::Ptr
>( incidence )->clone();
1514 nJournal->setUid( KCalCore::CalFormat::createUniqueId() );
1517 kWarning() <<
"Trying to move an incidence type that cannot be moved";
1521 if ( resources->addIncidence( newInc, newCal ) ) {
1522 incidenceAddFinished( newInc,
true );
1523 ResourceCalendar *
const oldCal = resources->resource( incidence );
1524 if ( !oldCal || resources->deleteIncidence( incidence ) ) {
1528 "Unable to remove the item \"%1\" from %2. "
1529 "However, a copy of this item has been put into %3.",
1530 incidence->summary(),
1531 oldCal->resourceName(),
1532 newCal->resourceName() ),
1533 i18nc(
"@title:window",
"Moving Failed" ) );
1535 incidenceDeleteFinished( incidence,
true );
1536 KMessageBox::information(
1539 "\"%1\" was successfully moved from %2 to %3.",
1540 incidence->summary(),
1541 oldCal->resourceName(),
1542 newCal->resourceName() ),
1543 i18nc(
"@title:window",
"Moving Succeeded" ),
1544 "CalendarIncidenceMove" );
1550 "Unable to add the item \"%1\" into %2. "
1551 "This item has not been moved.",
1552 incidence->summary(),
1553 newCal->resourceName() ),
1554 i18nc(
"@title:window",
"Moving Failed" ) );
1557 Q_UNUSED( resourceId );
1559 kDebug() <<
"AKONADI PORT: Disabled code in " << Q_FUNC_INFO;
1565 const Incidence::Ptr incidence = CalendarSupport::incidence( item );
1568 kError() <<
"Null incidence";
1572 KDateTime thisDateTime( date, CalendarSupport::KCalPrefs::instance()->timeSpec() );
1573 bool isFirstOccurrence = !incidence->recurrence()->getPreviousDateTime( thisDateTime ).isValid();
1576 bool doOnlyThis =
false;
1577 bool doFuture =
false;
1579 if ( isFirstOccurrence ) {
1580 answer = KMessageBox::questionYesNo(
1582 i18n(
"Do you want to dissociate "
1583 "the occurrence on %1 "
1584 "from the recurrence?",
1585 KGlobal::locale()->formatDate( date ) ),
1586 i18n(
"KOrganizer Confirmation" ),
1587 KGuiItem( i18n(
"&Dissociate" ) ),
1588 KStandardGuiItem::cancel() );
1590 doOnlyThis = ( answer == KMessageBox::Yes );
1592 answer = KMessageBox::questionYesNoCancel(
1594 i18n(
"Do you want to dissociate "
1595 "the occurrence on %1 "
1596 "from the recurrence or also "
1597 "dissociate future ones?",
1598 KGlobal::locale()->formatDate( date ) ),
1599 i18n(
"KOrganizer Confirmation" ),
1600 KGuiItem( i18n(
"&Only Dissociate This One" ) ),
1601 KGuiItem( i18n(
"&Also Dissociate Future Ones" ) ) );
1603 doOnlyThis = ( answer == KMessageBox::Yes );
1604 doFuture = ( answer == KMessageBox::No );
1608 dissociateOccurrence( item, date,
false );
1609 }
else if ( doFuture ) {
1610 dissociateOccurrence( item, date,
true );
1613 void CalendarView::dissociateOccurrence(
const Akonadi::Item &item,
const QDate &date,
bool thisAndFuture )
1615 const Incidence::Ptr incidence = CalendarSupport::incidence( item );
1617 if ( thisAndFuture ) {
1622 KDateTime occurrenceDate( incidence->dtStart() );
1623 occurrenceDate.setDate(date);
1624 kDebug() <<
"create exception: " << occurrenceDate;
1625 KCalCore::Incidence::Ptr newInc( KCalCore::Calendar::createException(
1626 incidence, occurrenceDate, thisAndFuture) );
1628 mChanger->createIncidence( newInc, item.parentCollection(), this );
1630 if ( thisAndFuture ) {
1633 i18n(
"Dissociating the future occurrences failed." ),
1634 i18n(
"Dissociating Failed" ) );
1638 i18n(
"Dissociating the occurrence failed." ),
1639 i18n(
"Dissociating Failed" ) );
1647 Akonadi::Item selectedItem = item;
1648 if ( !item.hasPayload<KCalCore::Incidence::Ptr>() ) {
1652 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( selectedItem );
1654 mITIPHandler->publishInformation( incidence,
this );
1659 schedule( iTIPRequest, incidence );
1664 schedule( iTIPRefresh, incidence );
1684 schedule( iTIPCounter, incidence );
1689 schedule( iTIPDeclineCounter, incidence );
1694 Akonadi::Item selectedItem = item;
1695 if ( !item.hasPayload<KCalCore::Incidence::Ptr>() ) {
1699 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( selectedItem );
1702 mITIPHandler->sendAsICalendar( incidence,
this );
1707 Akonadi::FreeBusyManager::self()->mailFreeBusy( daysToPublish,
this );
1712 Akonadi::FreeBusyManager::self()->publishFreeBusy(
this );
1717 Akonadi::Item selectedItem = item;
1718 if ( !item.hasPayload<KCalCore::Incidence::Ptr>() ) {
1722 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( selectedItem );
1725 mITIPHandler->sendiTIPMessage( method, incidence,
this );
1730 KRun::runCommand( QLatin1String(
"kaddressbook"), topLevelWidget() );
1740 if ( mReadOnly != readOnly ) {
1741 mReadOnly = readOnly;
1755 if ( currentView ) {
1758 foreach (
const Akonadi::Item &item, selectedViewIncidences ) {
1759 if ( item.hasPayload<KCalCore::Incidence::Ptr>() ) {
1760 selectedIncidences.append( item.payload<KCalCore::Incidence::Ptr>() );
1778 if ( currentView ) {
1781 foreach (
const Akonadi::Item &item, selectedViewIncidences ) {
1782 if ( item.hasPayload<KCalCore::Incidence::Ptr>() ) {
1783 selectedIncidences.append( item.payload<KCalCore::Incidence::Ptr>() );
1789 mCalPrinter->
print( printType, tmpDateList.first(), tmpDateList.last(),
1799 settings->readConfig();
1809 KFileDialog::getSaveFileName( KUrl( QLatin1String(
"icalout.ics") ), i18n(
"*.ics|iCalendars" ),
this );
1810 if ( !filename.isEmpty() ) {
1812 if ( filename.right( 4 ) != QLatin1String(
".ics") ) {
1813 filename += QLatin1String(
".ics");
1816 if ( QFile( filename ).exists() ) {
1817 if ( KMessageBox::No == KMessageBox::warningYesNo(
1819 i18n(
"Do you want to overwrite %1?", filename ) ) ) {
1823 KCalCore::ICalFormat *format =
new KCalCore::ICalFormat;
1825 KCalCore::FileStorage storage( mCalendar, filename, format );
1826 if ( !storage.save() ) {
1828 if ( format->exception() ) {
1829 errmess = KCalUtils::Stringify::errorMessage( *format->exception() );
1831 errmess = i18nc(
"save failure cause unknown",
"Reason unknown" );
1836 "Cannot write iCalendar file %1. %2",
1837 filename, errmess ) );
1844 if ( !mCalendar->journals().isEmpty() ) {
1845 int result = KMessageBox::warningContinueCancel(
1847 i18n(
"The journal entries cannot be exported to a vCalendar file." ),
1848 i18n(
"Data Loss Warning" ),
1849 KGuiItem( i18n(
"Proceed" ) ),
1850 KStandardGuiItem::cancel(),
1851 QLatin1String(
"dontaskVCalExport" ),
1852 KMessageBox::Notify );
1853 if ( result != KMessageBox::Continue ) {
1858 QString filename = KFileDialog::getSaveFileName( KUrl( QLatin1String(
"vcalout.vcs") ),
1859 i18n(
"*.vcs|vCalendars" ),
this );
1860 if ( !filename.isEmpty() ) {
1862 if ( filename.right( 4 ) != QLatin1String(
".vcs") ) {
1863 filename += QLatin1String(
".vcs");
1865 if ( QFile( filename ).exists() ) {
1866 if ( KMessageBox::No == KMessageBox::warningYesNo(
1868 i18n(
"Do you want to overwrite %1?", filename ) ) ) {
1872 KCalCore::VCalFormat *format =
new KCalCore::VCalFormat;
1874 KCalCore::FileStorage storage( mCalendar, filename, format );
1875 if ( !storage.save() ) {
1877 if ( format->exception() ) {
1878 errmess = KCalUtils::Stringify::errorMessage( *format->exception() );
1880 errmess = i18nc(
"save failure cause unknown",
"Reason unknown" );
1885 "Cannot write vCalendar file %1. %2",
1886 filename, errmess ) );
1914 if ( CalendarSupport::hasIncidence( item ) ) {
1922 if ( CalendarSupport::hasIncidence( item ) && mViewManager->
currentView() ) {
1930 Incidence::Ptr incidence = CalendarSupport::incidence( item );
1931 if ( item != mSelectedIncidence ) {
1937 mSelectedIncidence = item;
1940 if ( item == mSelectedIncidence ) {
1941 if ( !incidence->recurs() || mSaveDate == date ) {
1946 mSelectedIncidence = item;
1950 bool subtodo =
false;
1952 const bool organizerEvents =
1953 CalendarSupport::KCalPrefs::instance()->thatIsMe( incidence->organizer()->email() );
1954 const bool groupEvents = incidence->attendeeByMails( CalendarSupport::KCalPrefs::instance()->allEmails() );
1956 if ( incidence->type() == Incidence::TypeTodo ) {
1958 subtodo = ( incidence->relatedTo() != QString() );
1968 emit
pasteEnabled( mCalendarClipboard->pasteAvailable() );
1973 mDateNavigatorContainer->
selectDates( selectedDates, preferredMonth );
1977 updateView( selectedDates.first(), selectedDates.last(), preferredMonth, false );
1990 QStringList filters;
1992 int pos = mFilters.indexOf( mCurrentFilter );
1997 filters << i18n(
"No filter" );
1998 foreach ( KCalCore::CalFilter *filter, mFilters ) {
2000 filters << filter->name();
2008 mCalendar->setFilter( mCurrentFilter );
2013 KCalCore::CalFilter *newFilter = 0;
2014 if ( filterNo > 0 && filterNo <=
int( mFilters.count() ) ) {
2015 newFilter = mFilters.at( filterNo - 1 );
2017 if ( newFilter != mCurrentFilter ) {
2018 mCurrentFilter = newFilter;
2019 mCalendar->setFilter( mCurrentFilter );
2020 mViewManager->
addChange( EventViews::EventView::FilterChanged );
2028 return mCurrentFilter != 0;
2033 if ( mCurrentFilter ) {
2034 return mCurrentFilter->name();
2036 return i18n(
"No filter" );
2043 Incidence::Ptr incidence = CalendarSupport::incidence( item );
2049 incidence->setOrganizer(
2050 Person::Ptr(
new Person( CalendarSupport::KCalPrefs::instance()->fullName(),
2051 CalendarSupport::KCalPrefs::instance()->email() ) ) );
2052 incidence->recreate();
2053 incidence->setReadOnly(
false );
2062 kDebug() <<
"To be implemented.";
2068 mDateNavigatorContainer->show();
2071 mDateNavigatorContainer->hide();
2088 mEventViewerBox->show();
2090 mEventViewerBox->hide();
2096 mViewManager->
addView( view );
2107 mExtensions.append( extension );
2108 if ( !mETMCollectionView ) {
2116 mMainSplitterSizes.clear();
2121 if ( mMainSplitterSizes.isEmpty() ) {
2122 mMainSplitterSizes = mPanner->sizes();
2133 if (
const KCalCore::Todo::Ptr t = CalendarSupport::todo( item ) ) {
2137 Akonadi::Item incidence;
2140 if ( !selectedIncidences.isEmpty() ) {
2141 incidence = selectedIncidences.first();
2143 if (
const KCalCore::Todo::Ptr t = CalendarSupport::todo( item ) ) {
2146 return Akonadi::Item();
2161 if ( !item.isValid() ) {
2163 if ( !selectedIncidences.isEmpty() ) {
2164 item = selectedIncidences.first();
2182 Akonadi::Item item = mCalendar->item(
id );
2188 Akonadi::Item item = mCalendar->item(
id );
2189 if ( !CalendarSupport::hasIncidence( item ) ) {
2198 Akonadi::Item item = mCalendar->item(
id );
2199 if ( !CalendarSupport::hasIncidence( item ) ) {
2213 Q_UNUSED( incidence );
2219 Q_UNUSED( incidence );
2233 if ( !mCalendar->hasRight( item, Akonadi::Collection::CanChangeItem ) ) {
2234 eventViewer->enableButton( KDialog::User1,
false );
2237 eventViewer->show();
2242 Incidence::Ptr incidence = CalendarSupport::incidence( item );
2243 if ( CalendarSupport::hasEvent( item ) ) {
2249 incidence->dtStart().toTimeSpec(
2250 CalendarSupport::KCalPrefs::instance()->timeSpec() ).date() );
2252 }
else if ( CalendarSupport::hasJournal( item ) ) {
2256 }
else if ( CalendarSupport::hasTodo( item ) ) {
2261 Akonadi::Item::List list;
2262 list.append( item );
2268 Q_UNUSED( isCounter );
2269 Incidence::Ptr incidence = CalendarSupport::incidence( item );
2271 kError() <<
"Null incidence";
2272 KNotification::beep();
2276 if ( !mCalendar->hasRight( item, Akonadi::Collection::CanChangeItem ) ) {
2292 const KCalCore::Todo::Ptr todo = CalendarSupport::todo( todoItem );
2296 Akonadi::Item::List subTodos = mCalendar->childItems( todoItem.id() );
2297 foreach (
const Akonadi::Item &item, subTodos ) {
2298 if ( CalendarSupport::hasTodo( item ) ) {
2303 if ( !
mChanger->deletedRecently( todoItem.id() ) ) {
2304 mChanger->deleteIncidence( todoItem,
this );
2310 const KCalCore::Todo::Ptr todo = CalendarSupport::todo( todoItem );
2316 if ( mCalendar->childItems( todoItem.id() ).isEmpty() ) {
2317 bool doDelete =
true;
2319 doDelete = (
msgItemDelete( todoItem ) == KMessageBox::Continue );
2321 if ( doDelete && !
mChanger->deletedRecently( todoItem.id() ) ) {
2322 mChanger->deleteIncidence( todoItem,
this );
2328 int km = KMessageBox::No;
2330 km = KMessageBox::questionYesNoCancel(
2332 i18n(
"The item \"%1\" has sub-to-dos. "
2333 "Do you want to delete just this item and "
2334 "make all its sub-to-dos independent, or "
2335 "delete the to-do with all its sub-to-dos?",
2337 i18n(
"KOrganizer Confirmation" ),
2338 KGuiItem( i18n(
"Delete Only This" ) ),
2339 KGuiItem( i18n(
"Delete All" ) ) );
2342 if ( km == KMessageBox::Yes ) {
2345 if ( !
mChanger->deletedRecently( todoItem.id() ) ) {
2346 mChanger->deleteIncidence( todoItem,
this );
2348 }
else if ( km == KMessageBox::No ) {
2359 Incidence::Ptr incidence = CalendarSupport::incidence( item );
2362 kError() <<
"Null incidence";
2363 KNotification::beep();
2365 kError() <<
"CalendarView::deleteIncidence(): Unable do delete, incidence is null.";
2369 if (
mChanger->deletedRecently( item.id() ) ) {
2371 kWarning() <<
"CalendarView::deleteIncidence(): item with id" << item.id()
2372 <<
"was deleted recently, skipping";
2376 if ( !mCalendar->hasRight( item, Akonadi::Collection::CanDeleteItem ) ) {
2378 KMessageBox::information(
2380 i18n(
"The item \"%1\" is marked read-only "
2381 "and cannot be deleted; it probably "
2382 "belongs to a read-only calendar.",
2383 incidence->summary() ),
2384 i18n(
"Removing not possible" ),
2385 QLatin1String(
"deleteReadOnlyIncidence") );
2387 kWarning() <<
"CalendarView::deleteIncidence(): No rights to delete item";
2393 if ( incidence && incidence->type() == Incidence::TypeTodo ) {
2398 if ( incidence->recurs() ) {
2400 int km = KMessageBox::Ok;
2402 if ( !itemDate.isValid() ) {
2403 kDebug() <<
"Date Not Valid";
2404 km = KMessageBox::warningContinueCancel(
2406 i18n(
"The calendar item \"%1\" recurs over multiple dates; "
2407 "are you sure you want to delete it "
2408 "and all its recurrences?", incidence->summary() ),
2409 i18n(
"KOrganizer Confirmation" ),
2410 KGuiItem( i18n(
"Delete All" ) ) );
2412 KDateTime itemDateTime( itemDate, CalendarSupport::KCalPrefs::instance()->timeSpec() );
2413 bool isFirst = !incidence->recurrence()->getPreviousDateTime( itemDateTime ).isValid();
2414 bool isLast = !incidence->recurrence()->getNextDateTime( itemDateTime ).isValid();
2417 KGuiItem itemFuture( i18n(
"Also Delete &Future" ) );
2419 if ( !isFirst && !isLast ) {
2420 itemFuture.setEnabled(
true );
2421 message = i18n(
"The calendar item \"%1\" recurs over multiple dates. "
2422 "Do you want to delete only the current one on %2, also "
2423 "future occurrences, or all its occurrences?",
2424 incidence->summary(),
2425 KGlobal::locale()->formatDate( itemDate ) );
2427 itemFuture.setEnabled(
false );
2428 message = i18n(
"The calendar item \"%1\" recurs over multiple dates. "
2429 "Do you want to delete only the current one on %2 "
2430 "or all its occurrences?",
2431 incidence->summary(),
2432 KGlobal::locale()->formatDate( itemDate ) );
2435 if ( !( isFirst && isLast ) ) {
2436 km = PIMMessageBox::fourBtnMsgBox(
2438 QMessageBox::Warning,
2440 i18n(
"KOrganizer Confirmation" ),
2441 KGuiItem ( i18n(
"Delete C&urrent" ) ),
2443 KGuiItem( i18n(
"Delete &All" ) ) );
2449 Incidence::Ptr oldIncidence( incidence->clone() );
2451 case KMessageBox::Ok:
2452 case KMessageBox::Continue:
2453 mChanger->deleteIncidence( item,
this );
2456 case KMessageBox::Yes:
2457 incidence->recurrence()->addExDate( itemDate );
2458 mChanger->modifyIncidence( item, oldIncidence,
this );
2461 case KMessageBox::No:
2462 Recurrence *recur = incidence->recurrence();
2463 recur->setEndDate( itemDate.addDays( -1 ) );
2464 mChanger->modifyIncidence( item, oldIncidence,
this );
2468 bool doDelete =
true;
2470 doDelete = (
msgItemDelete( item ) == KMessageBox::Continue );
2473 mChanger->deleteIncidence( item,
this );
2483 if ( checkedCollections().isEmpty() ) {
2484 showMessage( i18n(
"All calendars are unchecked in the Calendar Manager. No to-do was purged." ), KMessageWidget::Warning );
2488 if ( mCalendar->rawTodos().isEmpty() ) {
2489 showMessage( i18n(
"There are no completed to-dos to purge." ), KMessageWidget::Information );
2493 int result = KMessageBox::warningContinueCancel(
2495 i18n(
"Delete all completed to-dos from checked calendars?" ),
2496 i18n(
"Purge To-dos" ),
2497 KGuiItem( i18n(
"Purge" ) ) );
2499 if ( result == KMessageBox::Continue ) {
2500 mTodoPurger->purgeCompletedTodos();
2506 Incidence::Ptr incidence = CalendarSupport::incidence( item );
2511 "Unable to edit \"%1\" because it is locked by another process.",
2512 incidence->summary() ) );
2518 KMessageBox::error(
this, msg );
2523 QStringList allCats( CalendarSupport::categories( mCalendar->rawIncidences() ) );
2528 QStringList categories( cc.customCategories() );
2529 for ( QStringList::ConstIterator si = allCats.constBegin(); si != allCats.constEnd(); ++si ) {
2530 if ( !categories.contains( *si ) ) {
2531 categories.append( *si );
2534 cc.setCustomCategories( categories );
2542 if ( !CalendarSupport::hasIncidence( itemadd ) ) {
2545 i18n(
"Unable to copy the item to %1.", dt.toString() ),
2546 i18n(
"Copying Failed" ) );
2549 Akonadi::Item item = mCalendar->item( itemadd.id() );
2550 if ( !item.isValid() ) {
2554 Incidence::Ptr incidence( CalendarSupport::incidence( item )->clone() );
2555 incidence->recreate();
2557 if (
const KCalCore::Event::Ptr event = incidence.dynamicCast<KCalCore::Event>() ) {
2560 KDateTime start =
event->dtStart();
2561 KDateTime end =
event->dtEnd();
2563 int duration = start.daysTo( end );
2564 start.setDate( dt );
2565 end.setDate( dt.addDays( duration ) );
2567 event->setDtStart( start );
2568 event->setDtEnd( end );
2570 }
else if (
const KCalCore::Todo::Ptr todo = incidence.dynamicCast<KCalCore::Todo>() ) {
2571 KDateTime due = todo->dtDue();
2574 todo->setDtDue( due );
2577 mChanger->createIncidence( incidence, Akonadi::Collection(),
this );
2582 if ( !CalendarSupport::hasIncidence( itemmove ) ) {
2585 i18n(
"Unable to move the item to %1.", dt.toString() ),
2586 i18n(
"Moving Failed" ) );
2589 Akonadi::Item item = mCalendar->item( itemmove.id() );
2590 if ( !item.isValid() ) {
2594 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( itemmove );
2596 KCalCore::Incidence::Ptr oldIncidence( incidence->clone() );
2598 if (
const KCalCore::Event::Ptr event = incidence.dynamicCast<KCalCore::Event>() ) {
2600 KDateTime start =
event->dtStart();
2601 KDateTime end =
event->dtEnd();
2603 int duration = start.daysTo( end );
2604 start.setDate( dt );
2605 end.setDate( dt.addDays( duration ) );
2607 event->setDtStart( start );
2608 event->setDtEnd( end );
2610 }
if (
const KCalCore::Todo::Ptr todo = incidence.dynamicCast<KCalCore::Todo>() ) {
2611 KDateTime due = todo->dtDue();
2614 todo->setDtDue( due );
2616 mChanger->modifyIncidence( itemmove, oldIncidence,
this );
2621 mViewManager->
addChange( EventViews::EventView::ResourcesChanged );
2627 if ( watched == mLeftFrame && event->type() == QEvent::Show ) {
2628 mSplitterSizesValid =
true;
2630 return KOrg::CalendarViewBase::eventFilter( watched, event );
2654 mDateNavigator->
selectWeek( date, preferredMonth );
2665 fullView ? mNavigatorBar->show() : mNavigatorBar->hide();
2670 Akonadi::Collection CalendarView::defaultCollection(
const QLatin1String &mimeType )
const
2674 bool supportsMimeType = collection.contentMimeTypes().contains( mimeType ) || mimeType ==
"";
2675 bool hasRights = collection.rights() & Akonadi::Collection::CanCreateItem;
2676 if ( collection.isValid() && supportsMimeType && hasRights )
2680 collection = selectedCollection();
2681 supportsMimeType = collection.contentMimeTypes().contains( mimeType ) || mimeType ==
"";
2682 hasRights = collection.rights() & Akonadi::Collection::CanCreateItem;
2683 if ( collection.isValid() && supportsMimeType && hasRights )
2687 Akonadi::Collection::List collections = checkedCollections();
2688 foreach(
const Akonadi::Collection &checkedCollection, collections ) {
2689 supportsMimeType = checkedCollection.contentMimeTypes().contains( mimeType ) || mimeType ==
"";
2690 hasRights = checkedCollection.rights() & Akonadi::Collection::CanCreateItem;
2691 if ( checkedCollection.isValid() && supportsMimeType && hasRights )
2692 return checkedCollection;
2696 collection = mCalendar->collection( CalendarSupport::KCalPrefs::instance()->defaultCalendarId() );
2697 supportsMimeType = collection.contentMimeTypes().contains( mimeType ) || mimeType ==
"";
2698 hasRights = collection.rights() & Akonadi::Collection::CanCreateItem;
2699 if ( collection.isValid() && supportsMimeType && hasRights )
2704 return Akonadi::Collection();
2707 IncidenceEditorNG::IncidenceDialog *CalendarView::createIncidenceEditor(
2708 const Akonadi::Item &item,
const Akonadi::Collection &collection )
2711 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
2712 Q_ASSERT( incidence );
2714 if ( collection.isValid() ) {
2715 dialog->selectCollection( collection );
2717 dialog->selectCollection( defaultCollection( incidence->mimeType() ) );
2735 if ( mCheckableProxyModel )
2736 mCheckableProxyModel->disconnect(
this );
2738 mCheckableProxyModel = model;
2739 connect( model, SIGNAL(aboutToToggle(
bool)), SLOT(onCheckableProxyAboutToToggle(
bool)) );
2740 connect( model, SIGNAL(toggled(
bool)), SLOT(onCheckableProxyToggled(
bool)) );
2743 void CalendarView::onCheckableProxyAboutToToggle(
bool newState )
2754 void CalendarView::onCheckableProxyToggled(
bool newState )
2765 void CalendarView::onTodosPurged(
bool success,
int numDeleted,
int numIgnored)
2768 KMessageWidget::MessageType type = KMessageWidget::Information;
2770 if (numDeleted == 0 && numIgnored > 0) {
2771 type = KMessageWidget::Warning;
2772 message = i18n(
"0 completed to-dos were purged.") + QLatin1Char(
'\n') +
2773 i18np(
"%1 to-do was ignored because it has uncompleted or read-only children.",
2774 "%1 to-dos were ignored because they have uncompleted or read-only children.", numIgnored);
2775 }
else if (numDeleted > 0 && numIgnored == 0) {
2776 message = i18np(
"%1 completed to-do was purged.",
"%1 completed to-dos were purged.", numDeleted);
2777 }
else if (numDeleted == 0 && numIgnored == 0) {
2778 message = i18n(
"There are no completed to-dos to purge.");
2780 type = KMessageWidget::Warning;
2781 message = i18np(
"%1 completed to-do was purged.",
"%1 completed to-dos were purged.", numDeleted) + QLatin1Char(
'\n') +
2782 i18np(
"%1 to-do was ignored because it has uncompleted or read-only children.",
2783 "%1 to-dos were ignored because they have uncompleted or read-only children.", numIgnored);
2786 message = i18n(
"An error occurred while purging completed to-dos: %1", mTodoPurger->lastError());
2787 type = KMessageWidget::Error;
2795 mMessageWidget->setText(message);
2796 mMessageWidget->setMessageType(type);
2797 mMessageWidget->show();
2800 Akonadi::Collection CalendarView::selectedCollection()
const
2802 return mETMCollectionView ? mETMCollectionView->
selectedCollection() : Akonadi::Collection();
2805 Akonadi::Collection::List CalendarView::checkedCollections()
const
2807 Akonadi::Collection::List collections;
2808 if ( mETMCollectionView )
2812 int count = collections.count();
2813 Akonadi::Collection::Id
id = CalendarSupport::KCalPrefs::instance()->defaultCalendarId();
2814 for(
int i=0; i<count; ++i ) {
2815 if (
id == collections[i].
id() ) {
2816 collections.move( i, 0 );
2826 Akonadi::Collection collection = item.parentCollection();
2827 if (!collection.isValid()) {
2828 kWarning() <<
"Item was creating in an invalid collection !? item id=" << item.id();
2832 const bool collectionIsChecked = mETMCollectionView->
isChecked(collection);
2834 if (!collectionIsChecked) {
2836 if (mETMCollectionView->isVisible()) {
2837 message = i18n(
"You created an incidence in a calendar that is currently filtered out.\n"
2838 "On the left sidebar, enable it in the calendar manager to see the incidence.");
2840 message = i18n(
"You created an incidence in a calendar that is currently filtered out.\n"
2841 "You can enabled it through the calendar manager (Settings->Sidebar->Show Calendar Manager)");
2844 mMessageWidget->setText(message);
2845 mMessageWidget->setMessageType(KMessageWidget::Information);
2846 mMessageWidget->show();
2850 #include "calendarview.moc"
QDate activeIncidenceDate()
Returns the date of the selected incidence.
void dialogClosing(const Akonadi::Item &incidence)
void handleIncidenceCreated(const Akonadi::Item &item)
void showLeftFrame(bool show=true)
Akonadi::IncidenceChanger * mChanger
void writeFilterSettings(KConfig *config)
write settings for calendar filters
virtual void updateView()
void setIncidence(const Akonadi::Item &incidence, const QDate &date)
RangeMode rangeMode() const
Return the current range mode: week, work week, day or nextX days, etc.
virtual void clearSelection()
Clear selection.
void showDateNavigator(bool)
KOAgendaView is the agenda-like view that displays events in a single or multi-day view...
void connectTypeAhead(IncidenceEditorNG::IncidenceDialog *editor, KOEventView *view)
void dissociateOccurrences(const Akonadi::Item &incidence, const QDate &date)
void configChanged()
when change is made to options dialog, the topwidget will catch this and emit this signal which notif...
QDate monthOfNavigator(int navigatorIndex=0) const
Returns the month of the specified KDateNavigator.
QByteArray identifier() const
static QPair< QDate, QDate > matrixLimits(const QDate &month)
returns the first and last date of the 6*7 matrix that displays month
void goPrevious()
Move to the previous date(s) in the current view.
void newEvent()
create new event without having a date hint.
virtual Akonadi::Item::List selectedIncidences()
void readOnlyChanged(bool)
Emitted when state of read-only flag changes.
void readSettings()
Using the KConfig associated with the kapp variable, read in the settings from the config file...
void newSubTodo()
create new todo with a parent todo
void schedule_request(const Akonadi::Item &incidence=Akonadi::Item())
void addView(KOrg::BaseView *, bool isTab=false)
bool addIncidence(const QString &ical)
Add an incidence to the active calendar.
void selectDate(const QDate &)
void setHighlightMode(bool highlightEvents, bool highlightTodos, bool highlightJournals) const
virtual bool eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay)
Sets the default start/end date/time for new events.
virtual bool supportsDateNavigation() const
Returns true if the view supports navigation through the date navigator ( selecting a date range...
Akonadi::Item selectedIncidence()
Returns a pointer to the incidence selected in the current view.
IncidenceEditorNG::IncidenceDialog * createDialog(const Akonadi::Item &item)
void schedule_cancel(const Akonadi::Item &incidence=Akonadi::Item())
void warningChangeFailed(const Akonadi::Item &)
void todo_unsub()
Frees a subtodo from it's relation, update the view.
void schedule_add(const Akonadi::Item &incidence=Akonadi::Item())
void exportICalendar()
Export as iCalendar file.
KOAgendaView * agendaView() const
virtual void showConfigurationDialog(QWidget *parent)
virtual bool isEventView()
Returns if this view is a view for displaying events.
void goDate(const QDate &date)
Move the current view date to the specified date.
void showDates(const KCalCore::DateList &, const QDate &preferredMonth=QDate())
Select a view or adapt the current view to display the specified dates.
void writeSettings()
write current state to config file.
virtual bool hasConfigurationDialog() const
void mailFreeBusy(int daysToPublish=30)
void exportWeb()
Export as HTML file.
void addChange(EventViews::EventView::Change change)
Notifies all views that an update is needed.
void dateTimesForNewEvent(QDateTime &startDt, QDateTime &endDt, bool &allDay)
Adjust the given date/times by valid defaults (selection or configured defaults, if invalid values ar...
void addIncidenceOn(const Akonadi::Item &incidence, const QDate &)
void edit_copy()
copy the current appointment(s) to the clipboard
IncidenceEditorNG::IncidenceDialog * newEventEditor(const KCalCore::Event::Ptr &event)
virtual CalPrinterBase::PrintType printType() const
void calendarViewExpanded(bool)
void copyIncidenceToResource(const Akonadi::Item &incidence, const QString &resourceId)
bool saveCalendar(const QString &filename)
Save calendar data to file.
bool isReadOnly() const
query if the calendar is read-only.
void showView(KOrg::BaseView *)
changes the view to be the currently selected view
int msgItemDelete(const Akonadi::Item &incidence)
void selectDates(const KCalCore::DateList &)
void processMainViewSelection(const Akonadi::Item &incidence, const QDate &date)
void checkForFilteredChange(const Akonadi::Item &incidence)
void newTodoSignal(const QDate &)
void schedule_publish(const Akonadi::Item &incidence=Akonadi::Item())
virtual void flushView()
Write all unsaved data back to calendar store.
void archiveCalendar()
Archive old events of calendar.
virtual void getHighlightMode(bool &highlightEvents, bool &highlightTodos, bool &highlightJournals)
Returns which incidence types should used to embolden day numbers in the date navigator when this vie...
virtual void clearSelection()
void setCalendar(const Akonadi::ETMCalendar::Ptr &)
Associate date navigator with a calendar.
QString currentFilterName() const
Returns the name of the current filter.
bool eventFilter(QObject *watched, QEvent *event)
void showFilterEditDialog(QList< KCalCore::CalFilter * > *filters)
void print()
Functions for printing, previewing a print, and setting up printing parameters.
void deleteSubTodosIncidence(const Akonadi::Item &todo)
Delete the supplied todo and all sub-todos.
ExportWebDialog is a class that provides the dialog and functions to export a calendar as web page...
void pasteIncidence()
Pastes the current incidence using the edit_paste() method.
void processTodoListSelection(const Akonadi::Item &incidence, const QDate &date)
Akonadi::ETMCalendar::Ptr calendar() const
void toggleAlarm(const Akonadi::Item &incidence)
void schedule_refresh(const Akonadi::Item &incidence=Akonadi::Item())
void selectDates(const KCalCore::DateList &, const QDate &preferredMonth=QDate())
void readFilterSettings(KConfig *config)
read settings for calendar filters
void copyIncidence(const Akonadi::Item &)
Copies the selected incidence using the edit_copy() method.
void setHolidays(KHolidays::HolidayRegion *h)
Set which holidays the user wants to use.
void changeIncidenceDisplay(const Akonadi::Item &incidence, Akonadi::IncidenceChanger::ChangeType)
passes on the message that an event has changed to the currently activated view so that it can make a...
virtual CalendarViewExtension * create(QWidget *parent)=0
void schedule_counter(const Akonadi::Item &incidence=Akonadi::Item())
KOrg::BaseView * currentView()
void updateMultiCalendarDisplay()
KCalCore::DateList selectedDates()
void exportVCalendar()
Export as vCalendar file.
bool selectedIsAllDay()
returns true if selection is for whole day
Akonadi::Item selectedTodo()
bool makeChildrenIndependent(const Akonadi::Item &item)
Make all children of incidence independent, not update the view Works with any incidence type...
void appointment_edit()
pop up an Appointment Dialog to edit an existing appointment.
void pasteEnabled(bool)
Emitted, when clipboard content changes.
void goToday()
Move the current view date to today.
void appointment_show()
pop up a dialog to show an existing appointment.
KOTodoView * todoView() const
void selectPreviousMonth(const QDate ¤tMonth=QDate(), const QDate &selectionLowerLimit=QDate(), const QDate &selectionUpperLimit=QDate())
void addExtension(CalendarViewExtension::Factory *)
Adds a calendar view extension widget.
virtual void setCalendar(const Akonadi::ETMCalendar::Ptr &)
QDate activeDate(bool fallbackToToday=false)
Returns the best guess at the current active date in the view.
virtual Akonadi::Item::List selectedIncidences()=0
KOrg::MonthView * monthView() const
void newTodo()
create new todo
QSize minimumSizeHint() const
bool recordTodosInJournals() const
Get Record completed to-dos in journal entries.
KOrg::BaseView * currentView() const
void moveIncidenceTo(const Akonadi::Item &incidence, const QDate &)
void updateHighlightModes()
Informs the date navigator which incidence types should be used to embolden days, this function is ma...
void processIncidenceSelection(const Akonadi::Item &incidence, const QDate &date)
void categoriesChanged()
Emitted when the categories were updated, and thus the categories editor dialog needs to reload the l...
void setCheckableProxyModel(KOCheckableProxyModel *)
void slotCreateFinished(int changeId, const Akonadi::Item &item, Akonadi::IncidenceChanger::ResultCode resultCode, const QString &errorString)
void updateConfig()
options dialog made a changed to the configuration.
virtual Akonadi::Collection::Id collectionId() const
Akonadi::Collection::List checkedCollections() const
void saveLayout(KConfig *config, const QString &group) const
CalPrinter is a class for printing Calendars.
void slotDeleteFinished(int changeId, const QVector< Akonadi::Item::Id > &itemIdList, Akonadi::IncidenceChanger::ResultCode resultCode, const QString &errorString)
virtual void updateView()=0
Updates the current display to reflect changes that may have happened in the calendar since the last ...
void edit_options()
edit viewing and configuration options.
void updateUnmanagedViews()
void showEventViewer(bool)
void selectNextMonth(const QDate ¤tMonth=QDate(), const QDate &selectionLowerLimit=QDate(), const QDate &selectionUpperLimit=QDate())
Akonadi::Collection selectedCollection() const
static KOGlobals * self()
Viewer dialog for events.
void showDate(const QDate &date)
Show the given date without changing date selection length.
void showView(KOrg::BaseView *)
changes the view to be the currently selected view
void setReadOnly(bool readOnly=true)
set state of calendar to read-only
void updateSearchDialog()
void organizerEventsSelected(bool)
Emitted when state of events selection has changed and user is organizer.
This class provides an interface for all views being displayed within the main calendar view...
bool selectedIsSingleCell()
returns if only a single cell is selected, or a range of cells
void showIncidenceContext(const Akonadi::Item &incidence)
Show an incidence in context.
virtual void showIncidences(const Akonadi::Item::List &incidenceList, const QDate &date)=0
Shows given incidences.
void goNext()
Move to the next date(s) in the current view.
virtual QDateTime selectionEnd()
end-datetime of selection
bool makeSubTodosIndependent()
Make all sub-to-dos of the selected todo independent, update the view.
void exportHTML(KOrg::HTMLExportSettings *)
QDate currentSelectionDate()
If there's a selected incidence, it's date is returned, otherwise an invalid QDate is returned...
void subtodoSelected(bool)
This class provides a view of calendar resources.
void showMessage(const QString &message, KMessageWidget::MessageType)
This class controls date navigation.
void incidenceSelected(const Akonadi::Item &incidence, const QDate &date)
Emitted when an incidence gets selected.
void changeNavStringNext(const QString &)
void newEventSignal()
instructs the receiver to create a new event in given collection.
virtual void changeIncidenceDisplay(const Akonadi::Item &, Akonadi::IncidenceChanger::ChangeType)=0
Updates the current display to reflect the changes to one particular incidence.
A KCheckableProxyModel that emits a signal before and after toggling.
virtual QDateTime selectionStart()
start-datetime of selection
void deleteTodoIncidence(const Akonadi::Item &todo, bool force=false)
Delete the todo incidence, and its sub-to-dos.
Akonadi::Item currentSelection()
void schedule(KCalCore::iTIPMethod, const Akonadi::Item &incidence)
CalendarView(QWidget *parent=0)
Constructs a new calendar view widget.
void readSettings(KConfig *config)
void cutIncidence(const Akonadi::Item &)
Cuts the selected incidence using the edit_cut() method.
Akonadi::History * history() const
void changeFullView(bool fullView)
Use as much of the full window as possible for the view.
void selectDates(const KCalCore::DateList &, const QDate &preferredMonth=QDate())
preferredMonth is useful when the datelist crosses months, if different from -1, it has the month tha...
void filtersUpdated(const QStringList &, int)
void groupEventsSelected(bool)
Emitted when state of events selection has changed and user is attendee.
static KOPrefs * instance()
Get instance of KOPrefs.
void print(int type, const QDate &fd, const QDate &td, Incidence::List selectedIncidences=Incidence::List(), bool preview=false)
bool isFiltered() const
Returns true if there's a filter applied.
bool isChecked(const Akonadi::Collection &) const
void takeOverEvent()
Take ownership of selected event.
virtual QDateTime selectionStart()
Returns the start of the selection, or an invalid QDateTime if there is no selection or the view does...
void slotModifyFinished(int changeId, const Akonadi::Item &item, Akonadi::IncidenceChanger::ResultCode resultCode, const QString &errorString)
void edit_cut()
cut the current appointment to the clipboard
Akonadi::Item currentSelection()
Returns the item selected in the current view (or an invalid one if none selected) ...
void todoSelected(bool)
Emitted, when a todoitem is selected or deselected.
void selectWeek(const QDate &week, const QDate &preferredMonth)
The user clicked on a week number in the date navigator.
void changeNavStringPrev(const QString &)
Emitted when the unit of navigation changes.
void restoreLayout(KConfig *config, const QString &group, bool minimalDefaults)
void toggleTodoCompleted(const Akonadi::Item &incidence)
This class manages the views of the calendar.
interface for main calendar view widget
void moveIncidenceToResource(const Akonadi::Item &incidence, const QString &resourceId)
void startMultiModify(const QString &text)
void newJournalSignal(const QDate &)
void adaptNavigationUnits()
Adapts navigation units according to the current view's navigation step size.
void checkClipboard()
Check if clipboard contains vCalendar event.
void dayPassed(const QDate &)
Emitted, when a day changed (i.e.
virtual int currentDateCount() const =0
Returns the number of currently shown dates.
void schedule_forward(const Akonadi::Item &incidence=Akonadi::Item())
void schedule_reply(const Akonadi::Item &incidence=Akonadi::Item())
void addView(KOrg::BaseView *)
void schedule_declinecounter(const Akonadi::Item &incidence=Akonadi::Item())
void showErrorMessage(const QString &)
virtual KCalCore::DateList selectedIncidenceDates()=0
Returns a list of the dates of selected events.
void appointment_delete()
pop up dialog confirming deletion of currently selected event in the View.
KOViewManager * viewManager() const
QDateTime selectionStart()
Returns the start of the selection, or an invalid QDateTime if there is no selection or the view does...
void configureCurrentView()
void eventUpdated(const Akonadi::Item &incidence)
void updateCategories()
Calendar configuration was changed, so refresh categories list.
bool incidence_unsub(const Akonadi::Item &item)
void edit_paste()
paste the current vobject(s) in the clipboard buffer into calendar
This class manages the dialogs used by the calendar view.
void writeSettings(KConfig *config)
void filterActivated(int filterNum)
IncidenceEditorNG::IncidenceDialog * incidenceDialog(const Akonadi::Item &)