45 #include "htmlexportsettings.h"
53 #include <incidenceeditor-ng/globalsettings.h>
55 #include <KHolidays/Holidays>
57 #include <calendarsupport/collectiongeneralpage.h>
58 #include <calendarsupport/collectionselection.h>
59 #include <calendarsupport/kcalprefs.h>
60 #include <calendarsupport/utils.h>
61 #include <calendarsupport/next/incidenceviewer.h>
62 #include <calendarsupport/printing/calprinter.h>
63 #include <calendarsupport/calendarsingleton.h>
65 #include <incidenceeditor-ng/incidencedefaults.h>
66 #include <incidenceeditor-ng/incidencedialog.h>
67 #include <incidenceeditor-ng/incidencedialogfactory.h>
69 #include <libkdepim/widgets/pimmessagebox.h>
70 #include <akonadi/calendar/freebusymanager.h>
71 #include <akonadi/calendar/history.h>
72 #include <Akonadi/Calendar/IncidenceChanger>
73 #include <Akonadi/Calendar/CalendarSettings>
74 #include <Akonadi/Calendar/CalendarClipboard>
76 #include <pimcommon/acl/collectionaclpage.h>
77 #include <pimcommon/acl/imapaclattribute.h>
79 #include <Akonadi/CollectionPropertiesDialog>
80 #include <Akonadi/Control>
81 #include <Akonadi/AttributeFactory>
82 #include <Akonadi/Calendar/TodoPurger>
84 #include <KCalCore/CalFilter>
85 #include <KCalCore/FileStorage>
86 #include <KCalCore/ICalFormat>
87 #include <KCalCore/VCalFormat>
89 #include <KCalUtils/ICalDrag>
90 #include <KCalUtils/Stringify>
91 #include <KCalUtils/DndFactory>
94 #include <KFileDialog>
95 #include <KNotification>
99 #include <QApplication>
100 #include <QClipboard>
102 #include <QStackedWidget>
103 #include <QVBoxLayout>
106 mCheckableProxyModel( 0 ),
107 mETMCollectionView( 0 )
109 Akonadi::Control::widgetNeedsAkonadi(
this );
110 mChanger =
new Akonadi::IncidenceChanger(
this );
111 mChanger->setDefaultCollection( Akonadi::Collection( CalendarSupport::KCalPrefs::instance()->defaultCalendarId() ) );
113 mChanger->setDestinationPolicy( static_cast<Akonadi::IncidenceChanger::DestinationPolicy>(
KOPrefs::instance()->destination() ) );
118 mCalendar = Akonadi::ETMCalendar::Ptr(
new Akonadi::ETMCalendar( CalendarSupport::calendarSingleton().data() ) );
121 mCalendarClipboard =
new Akonadi::CalendarClipboard( mCalendar,
mChanger,
this );
122 mITIPHandler =
new Akonadi::ITIPHandler(
this );
123 mITIPHandler->setCalendar( mCalendar );
126 Akonadi::AttributeFactory::registerAttribute<PimCommon::ImapAclAttribute>();
130 mTodoPurger =
new Akonadi::TodoPurger(
this );
131 mTodoPurger->setCalendar( mCalendar );
132 mTodoPurger->setIncidenceChager(
mChanger );
133 connect(mTodoPurger, SIGNAL(todosPurged(
bool,
int,
int)),
134 SLOT(onTodosPurged(
bool,
int,
int)));
137 mSplitterSizesValid =
false;
148 mPanner =
new QSplitter( Qt::Horizontal,
this );
152 mLeftSplitter =
new QSplitter( Qt::Vertical, mPanner );
162 mTodoList =
new KOTodoView(
true, mLeftSplitter );
165 mEventViewerBox =
new KVBox( mLeftSplitter );
166 mEventViewerBox->setMargin( 0 );
167 mEventViewer =
new CalendarSupport::IncidenceViewer( mCalendar.data(), mEventViewerBox );
170 KVBox *rightBox =
new KVBox( mPanner );
171 rightBox->layout()->setMargin( 0 );
174 mMessageWidget =
new CalendarSupport::MessageWidget( rightBox );
176 rightBox->setStretchFactor( mRightFrame, 1 );
178 mLeftFrame = mLeftSplitter;
181 mChanger->setGroupwareCommunication( CalendarSupport::KCalPrefs::instance()->useGroupwareCommunication() );
183 SIGNAL(createFinished(
int,Akonadi::Item,Akonadi::IncidenceChanger::ResultCode,
QString)),
191 SIGNAL(modifyFinished(
int,Akonadi::Item,Akonadi::IncidenceChanger::ResultCode,
QString)),
195 connect( mDateNavigator, SIGNAL(datesSelected(KCalCore::DateList,
QDate)),
206 connect( mNavigatorBar, SIGNAL(prevYearClicked()),
207 mDateNavigator, SLOT(selectPreviousYear()) );
208 connect( mNavigatorBar, SIGNAL(nextYearClicked()),
209 mDateNavigator, SLOT(selectNextYear()) );
210 connect( mNavigatorBar, SIGNAL(prevMonthClicked()),
211 mDateNavigator, SLOT(selectPreviousMonth()) );
212 connect( mNavigatorBar, SIGNAL(nextMonthClicked()),
213 mDateNavigator, SLOT(selectNextMonth()) );
214 connect( mNavigatorBar, SIGNAL(monthSelected(
int)),
215 mDateNavigator, SLOT(selectMonth(
int)) );
216 connect( mNavigatorBar, SIGNAL(yearSelected(
int)),
217 mDateNavigator, SLOT(selectYear(
int)) );
227 connect( mDateNavigatorContainer, SIGNAL(prevYearClicked()),
228 mDateNavigator, SLOT(selectPreviousYear()) );
229 connect( mDateNavigatorContainer, SIGNAL(nextYearClicked()),
230 mDateNavigator, SLOT(selectNextYear()) );
231 connect( mDateNavigatorContainer, SIGNAL(monthSelected(
int)),
232 mDateNavigator, SLOT(selectMonth(
int)) );
233 connect( mDateNavigatorContainer, SIGNAL(yearSelected(
int)),
234 mDateNavigator, SLOT(selectYear(
int)) );
236 mDateNavigator, SLOT(selectPrevious()) );
238 mDateNavigator, SLOT(selectNext()) );
240 connect( mDateNavigatorContainer, SIGNAL(datesSelected(KCalCore::DateList,
QDate)),
241 mDateNavigator, SLOT(selectDates(KCalCore::DateList,
QDate)) );
243 connect( mViewManager, SIGNAL(datesSelected(KCalCore::DateList)),
244 mDateNavigator, SLOT(selectDates(KCalCore::DateList)) );
246 connect( mDateNavigatorContainer, SIGNAL(incidenceDropped(Akonadi::Item,
QDate)),
248 connect( mDateNavigatorContainer, SIGNAL(incidenceDroppedMove(Akonadi::Item,
QDate)),
256 mDateNavigatorContainer, SLOT(updateToday()) );
262 mEventViewer, SLOT(setIncidence(Akonadi::Item,
QDate)) );
266 s = i18n(
"<p><em>No Item Selected</em></p>"
267 "<p>Select an event, to-do or journal entry to view its details "
270 mEventViewer->setDefaultMessage( s );
271 mEventViewer->setWhatsThis(
272 i18n(
"View the details of events, journal entries or to-dos "
273 "selected in KOrganizer's main view here." ) );
274 mEventViewer->setIncidence( Akonadi::Item(),
QDate() );
276 mViewManager->connectTodoView( mTodoList );
277 mViewManager->connectView( mTodoList );
289 static bool pageRegistered =
false;
291 if ( !pageRegistered ) {
292 Akonadi::CollectionPropertiesDialog::registerPage(
293 new CalendarSupport::CollectionGeneralPageFactory );
294 Akonadi::CollectionPropertiesDialog::registerPage(
new PimCommon::CollectionAclPageFactory );
295 pageRegistered =
true;
299 Akonadi::FreeBusyManager::self()->setCalendar( mCalendar );
301 mCalendar->registerObserver(
this );
304 mEventViewer->setCalendar( mCalendar.data() );
309 mCalendar->unregisterObserver(
this );
310 mCalendar->setFilter( 0 );
311 qDeleteAll( mFilters );
312 qDeleteAll( mExtensions );
314 delete mDialogManager;
341 if ( fallbackToToday ) {
353 if ( !dates.isEmpty() ) {
354 return dates.first();
364 return dates.first();
373 void CalendarView::createPrinter()
375 if ( !mCalPrinter ) {
376 mCalPrinter =
new CalendarSupport::CalPrinter(
this, mCalendar );
386 KCalCore::FileStorage storage( mCalendar );
387 storage.setFileName( filename );
388 storage.setSaveFormat(
new KCalCore::ICalFormat );
390 return storage.save();
407 KConfigGroup geometryConfig( config,
"KOrganizer Geometry" );
416 sizes = geometryConfig.readEntry(
"Separator2",
QList<int>() );
426 KConfigGroup viewConfig( config,
"Views" );
427 int dateCount = viewConfig.readEntry(
"ShownDatesCount", 7 );
428 if ( dateCount == 7 ) {
439 KConfigGroup geometryConfig( config,
"KOrganizer Geometry" );
443 if ( list.
count() != list.
count( 0 ) && mSplitterSizesValid ) {
444 geometryConfig.writeEntry(
"Separator1", list );
447 list = mLeftSplitter->
sizes();
448 if ( list.
count() != list.
count( 0 ) && mSplitterSizesValid ) {
449 geometryConfig.writeEntry(
"Separator2", list );
455 Akonadi::CalendarSettings::self()->writeConfig();
457 CalendarSupport::KCalPrefs::instance()->writeConfig();
461 KConfigGroup viewConfig( config,
"Views" );
462 viewConfig.writeEntry(
"ShownDatesCount", mDateNavigator->
selectedDates().count() );
469 qDeleteAll( mFilters );
472 KConfigGroup generalConfig( config,
"General" );
475 QString currentFilter = generalConfig.readEntry(
"Current Filter" );
479 while ( it != end ) {
480 KCalCore::CalFilter *filter =
new KCalCore::CalFilter( *it );
481 KConfigGroup filterConfig( config,
QLatin1String(
"Filter_") + (*it) );
482 filter->setCriteria( filterConfig.readEntry(
"Criteria", 0 ) );
483 filter->setCategoryList( filterConfig.readEntry(
"CategoryList",
QStringList() ) );
484 if ( filter->criteria() & KCalCore::CalFilter::HideNoMatchingAttendeeTodos ) {
485 filter->setEmailList( CalendarSupport::KCalPrefs::instance()->allEmails() );
487 filter->setCompletedTimeSpan( filterConfig.readEntry(
"HideTodoDays", 0 ) );
488 mFilters.
append( filter );
493 int pos = filterList.
indexOf( currentFilter );
496 mCurrentFilter = mFilters.
at( pos );
507 Q_FOREACH (
const QString &conf, oldFilterList) {
508 KConfigGroup group = config->group(conf);
513 foreach ( KCalCore::CalFilter *filter, mFilters ) {
514 filterList << filter->name();
515 KConfigGroup filterConfig( config,
QLatin1String(
"Filter_") + filter->name() );
516 filterConfig.writeEntry(
"Criteria", filter->criteria() );
517 filterConfig.writeEntry(
"CategoryList", filter->categoryList() );
518 filterConfig.writeEntry(
"HideTodoDays", filter->completedTimeSpan() );
520 KConfigGroup generalConfig( config,
"General" );
521 generalConfig.writeEntry(
"CalendarFilters", filterList );
522 if ( mCurrentFilter ) {
523 generalConfig.writeEntry(
"Current Filter", mCurrentFilter->name() );
525 generalConfig.writeEntry(
"Current Filter",
QString() );
537 if ( dateCount == 7 ) {
551 if ( dynamic_cast<MonthView*>( mViewManager->
currentView() ) ) {
562 if ( dynamic_cast<MonthView*>( mViewManager->
currentView() ) ) {
578 if ( receiver !=
"korganizer" ) {
583 mCalPrinter->deleteLater();
591 KDateTime::Spec newTimeSpec = CalendarSupport::KCalPrefs::instance()->timeSpec();
592 if ( mCalendar->viewTimeSpec() != newTimeSpec ) {
594 const QString question( i18n(
"The time zone setting was changed. "
595 "Do you want to keep the absolute time of "
596 "the items in your calendar, which will show "
597 "them to be at a different time than "
598 "before, or move them to be at the old time "
599 "also in the new time zone?" ) );
600 int rc = KMessageBox::questionYesNo(
this, question,
601 i18n(
"Keep Absolute Times?" ),
602 KGuiItem( i18n(
"Keep Times" ) ),
603 KGuiItem( i18n(
"Move Times" ) ),
605 if ( rc == KMessageBox::Yes ) {
607 mCalendar->setViewTimeSpec( newTimeSpec );
611 mCalendar->shiftTimes( mCalendar->viewTimeSpec(), newTimeSpec );
628 static_cast<Akonadi::IncidenceChanger::DestinationPolicy>(
631 mChanger->setGroupwareCommunication( CalendarSupport::KCalPrefs::instance()->useGroupwareCommunication() );
635 const Akonadi::Item &item,
636 Akonadi::IncidenceChanger::ResultCode resultCode,
639 Q_UNUSED( changeId );
640 if ( resultCode == Akonadi::IncidenceChanger::ResultCodeSuccess ) {
644 }
else if (!errorString.
isEmpty()){
645 kError() <<
"Incidence not added, job reported error: " << errorString;
650 const Akonadi::Item &item,
651 Akonadi::IncidenceChanger::ResultCode resultCode,
654 Q_UNUSED( changeId );
655 if ( resultCode != Akonadi::IncidenceChanger::ResultCodeSuccess ) {
656 kError() <<
"Incidence not modified, job reported error: " << errorString;
660 Q_ASSERT( item.isValid() );
661 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
662 Q_ASSERT( incidence );
664 incidence->resetDirtyFields();
668 if ( incidence->type() == KCalCore::Incidence::TypeTodo &&
670 ( dirtyFields.
contains( KCalCore::Incidence::FieldCompleted ) ) ) {
671 KCalCore::Todo::Ptr todo = incidence.dynamicCast<KCalCore::Todo>();
672 if ( todo->isCompleted() || todo->recurs() ) {
674 QString description = i18n(
"Todo completed: %1 (%2)", incidence->summary(), timeStr );
678 if ( journals.isEmpty() ) {
679 KCalCore::Journal::Ptr journal(
new KCalCore::Journal );
681 KDateTime::currentDateTime( CalendarSupport::KCalPrefs::instance()->timeSpec() ) );
684 journal->setSummary( i18n(
"Journal of %1", dateStr ) );
685 journal->setDescription( description );
687 if (
mChanger->createIncidence( journal, item.parentCollection(), this ) == -1 ) {
688 kError() <<
"Unable to add Journal";
693 Akonadi::Item journalItem = mCalendar->item( journals.first()->uid() );
694 KCalCore::Journal::Ptr journal = CalendarSupport::journal( journalItem );
695 KCalCore::Journal::Ptr oldJournal( journal->clone() );
696 journal->setDescription( journal->description().append(
QLatin1Char(
'\n') + description ) );
697 mChanger->modifyIncidence( journalItem, oldJournal,
this );
710 Akonadi::IncidenceChanger::ResultCode resultCode,
713 Q_UNUSED( changeId );
714 if ( resultCode == Akonadi::IncidenceChanger::ResultCodeSuccess ) {
715 foreach( Akonadi::Item::Id
id, itemIdList ) {
716 Akonadi::Item item = mCalendar->item(
id );
717 if ( item.isValid() )
722 kError() <<
"Incidence not deleted, job reported error: " << errorString;
728 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
729 KCalCore::CalFilter *filter =
calendar()->filter();
730 if ( filter && !filter->filterIncidence( incidence ) ) {
733 mMessageWidget->setText( i18n(
"The item \"%1\" is filtered by your current filter rules, "
734 "so it will be hidden and not appear in the view.",
735 incidence->summary() ) );
736 mMessageWidget->show();
742 mChanger->startAtomicOperation( text );
751 Akonadi::IncidenceChanger::ChangeType changeType )
753 if ( mDateNavigatorContainer->
isVisible() ) {
759 if ( CalendarSupport::hasIncidence( item ) ) {
768 const QDate &preferredMonth,
769 const bool updateTodos )
773 if ( updateTodos && !currentViewIsTodoView && mTodoList->
isVisible() ) {
778 if ( start.
isValid() && end.
isValid() && !( currentViewIsTodoView && !updateTodos ) ) {
779 mViewManager->
updateView( start, end, preferredMonth );
782 if ( mDateNavigatorContainer->
isVisible() ) {
789 const KCalCore::DateList tmpList = mDateNavigator->
selectedDates();
793 updateView( tmpList.first(), tmpList.last(), month );
798 if ( mDateNavigatorContainer->
isVisible() ) {
805 return KMessageBox::warningContinueCancel(
808 "Do you really want to permanently remove the item \"%1\"?",
809 CalendarSupport::incidence( item )->summary() ),
810 i18nc(
"@title:window",
"Delete Item?" ),
811 KStandardGuiItem::del() );
817 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
819 kError() <<
"Null incidence";
823 mCalendarClipboard->cutIncidence( incidence, Akonadi::CalendarClipboard::AskMode );
830 if ( !item.isValid() ) {
831 KNotification::beep();
832 kError() <<
"Invalid item";
836 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
837 Q_ASSERT( incidence );
838 if ( !mCalendarClipboard->copyIncidence( incidence, Akonadi::CalendarClipboard::AskMode ) )
839 kError() <<
"Error copying incidence";
850 KDateTime finalDateTime;
851 bool useEndTime =
false;
852 KCalUtils::DndFactory::PasteFlags pasteFlags = 0;
859 kWarning() <<
"No view is selected, can't paste";
868 finalDateTime = KDateTime( date );
874 pasteFlags = KCalUtils::DndFactory::FlagPasteAtOriginalTime;
878 finalDateTime = KDateTime( mDateNavigator->
selectedDates().first() );
879 pasteFlags = KCalUtils::DndFactory::FlagPasteAtOriginalTime;
885 i18n(
"Paste failed: unable to determine a valid target date." ) );
889 KCalUtils::DndFactory factory( mCalendar );
891 KCalCore::Incidence::List pastedIncidences = factory.pasteIncidences( finalDateTime, pasteFlags );
892 KCalCore::Incidence::List::Iterator it;
894 for ( it = pastedIncidences.begin(); it != pastedIncidences.end(); ++it ) {
896 if ( ( *it )->type() == KCalCore::Incidence::TypeEvent ) {
897 KCalCore::Event::Ptr pastedEvent = ( *it ).staticCast<KCalCore::Event>();
900 if ( agendaView && endDT.
isValid() && useEndTime ) {
903 KDateTime kdt( endDT, CalendarSupport::KCalPrefs::instance()->timeSpec() );
904 pastedEvent->setDtEnd( kdt.toTimeSpec( pastedEvent->dtEnd().timeSpec() ) );
908 pastedEvent->setRelatedTo(
QString() );
909 mChanger->createIncidence( KCalCore::Event::Ptr( pastedEvent->clone() ),
910 Akonadi::Collection(), this );
911 }
else if ( ( *it )->type() == KCalCore::Incidence::TypeTodo ) {
912 KCalCore::Todo::Ptr pastedTodo = ( *it ).staticCast<KCalCore::Todo>();
917 KCalCore::Todo::Ptr _selectedTodo = CalendarSupport::todo( _selectedTodoItem );
918 if ( _selectedTodo && pastedTodo->relatedTo().isEmpty() ) {
919 pastedTodo->setRelatedTo( _selectedTodo->uid() );
923 mChanger->createIncidence( KCalCore::Todo::Ptr( pastedTodo->clone() ),
924 Akonadi::Collection(), this );
925 }
else if ( ( *it )->type() == KCalCore::Incidence::TypeJournal ) {
927 mChanger->createIncidence( KCalCore::Incidence::Ptr( ( *it )->clone() ),
928 Akonadi::Collection(), this );
945 startDt.
setTime( CalendarSupport::KCalPrefs::instance()->mStartTime.time() );
948 ( CalendarSupport::KCalPrefs::instance()->mDefaultDuration.time().hour() * 3600 ) +
949 ( CalendarSupport::KCalPrefs::instance()->mDefaultDuration.time().minute() * 60 );
950 endDt = startDt.
addSecs( addSecs );
956 IncidenceEditorNG::IncidenceDialog *dialog = mDialogManager->
createDialog(item);
964 item.setPayload( event );
967 dialog->load( item );
982 QDateTime startDt( dt, CalendarSupport::KCalPrefs::instance()->mStartTime.time() );
983 QTime duration = CalendarSupport::KCalPrefs::instance()->defaultDuration().time();
984 QTime time = startDt.time();
986 time = time.
addSecs( duration.hour() * 3600 +
987 duration.minute() * 60 +
1010 IncidenceEditorNG::IncidenceDefaults defaults =
1011 IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults();
1012 defaults.setStartDateTime( KDateTime( startDt ) );
1013 defaults.setEndDateTime( KDateTime( endDt ) );
1015 KCalCore::Event::Ptr
event(
new KCalCore::Event );
1016 defaults.setDefaults( event );
1017 event->setAllDay( allDay );
1019 IncidenceEditorNG::IncidenceDialog *eventEditor =
newEventEditor( event );
1020 Q_ASSERT( eventEditor );
1023 eventEditor->selectCollection( defaultCollection( KCalCore::Event::eventMimeType() ) );
1028 const QStringList &attachmentMimetypes,
bool inlineAttachment )
1034 bool allDay =
false;
1037 IncidenceEditorNG::IncidenceDefaults defaults =
1038 IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults();
1039 defaults.setStartDateTime( KDateTime( startDt ) );
1040 defaults.setEndDateTime( KDateTime( endDt ) );
1043 defaults.setAttachments( attachments, attachmentMimetypes,
QStringList(), inlineAttachment );
1044 defaults.setAttendees( attendees );
1046 KCalCore::Event::Ptr
event(
new KCalCore::Event );
1047 defaults.setDefaults( event );
1049 event->setSummary( summary );
1050 event->setDescription( description );
1051 event->setAllDay( allDay );
1058 bool inlineAttachment )
1060 Akonadi::Collection defaultCol = defaultCollection( KCalCore::Todo::todoMimeType() );
1062 IncidenceEditorNG::IncidenceDialogFactory::createTodoEditor(
1063 summary, description, attachments,
1064 attendees, attachmentMimetypes,
1066 inlineAttachment, defaultCol,
1072 newTodo( Akonadi::Collection() );
1077 IncidenceEditorNG::IncidenceDefaults defaults =
1078 IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults();
1086 defaults.setStartDateTime( KDateTime( startDt ) );
1087 defaults.setEndDateTime( KDateTime( endDt ) );
1090 KCalCore::Todo::Ptr todo(
new KCalCore::Todo );
1091 defaults.setDefaults( todo );
1092 todo->setAllDay( allDay );
1095 item.setPayload( todo );
1097 IncidenceEditorNG::IncidenceDialog *dialog = createIncidenceEditor( item, collection );
1099 dialog->load( item );
1104 IncidenceEditorNG::IncidenceDefaults defaults =
1105 IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults();
1108 KCalCore::Todo::Ptr todo(
new KCalCore::Todo );
1109 defaults.setDefaults( todo );
1110 todo->setAllDay(
true );
1113 item.setPayload( todo );
1115 IncidenceEditorNG::IncidenceDialog *dialog = createIncidenceEditor( item );
1116 dialog->load( item );
1131 IncidenceEditorNG::IncidenceDefaults defaults =
1132 IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults();
1140 defaults.setStartDateTime( KDateTime( startDt ) );
1141 defaults.setEndDateTime( KDateTime( endDt ) );
1144 KCalCore::Journal::Ptr journal(
new KCalCore::Journal );
1145 defaults.setDefaults( journal );
1148 item.setPayload( journal );
1149 IncidenceEditorNG::IncidenceDialog *dialog = createIncidenceEditor( item, collection );
1150 dialog->load( item );
1155 IncidenceEditorNG::IncidenceDefaults defaults =
1156 IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults();
1158 KCalCore::Journal::Ptr journal(
new KCalCore::Journal );
1159 defaults.setStartDateTime( KDateTime( date ) );
1160 defaults.setDefaults( journal );
1162 journal->setSummary( text );
1165 item.setPayload( journal );
1167 IncidenceEditorNG::IncidenceDialog *dialog = createIncidenceEditor( item );
1168 dialog->load( item );
1187 if ( CalendarSupport::hasTodo( item ) ) {
1195 kWarning() <<
"CalendarSupport::hasTodo() is false";
1199 IncidenceEditorNG::IncidenceDefaults defaults =
1200 IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults();
1201 defaults.setRelatedIncidence( CalendarSupport::incidence(
selectedTodo() ) );
1203 KCalCore::Todo::Ptr todo(
new KCalCore::Todo );
1204 defaults.setDefaults( todo );
1207 item.setPayload( todo );
1209 IncidenceEditorNG::IncidenceDialog *dialog = createIncidenceEditor( item, collection );
1210 dialog->load( item );
1215 IncidenceEditorNG::IncidenceDefaults defaults =
1216 IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults();
1217 defaults.setRelatedIncidence( CalendarSupport::incidence( parentTodo ) );
1219 KCalCore::Todo::Ptr todo(
new KCalCore::Todo );
1220 defaults.setDefaults( todo );
1222 Q_ASSERT( !todo->relatedTo().isEmpty() );
1225 item.setPayload( todo );
1228 Akonadi::Collection collection = mCalendar->collection( parentTodo.storageCollectionId() );
1229 IncidenceEditorNG::IncidenceDialog *dialog = createIncidenceEditor( item, collection );
1230 dialog->load( item );
1242 KCalCore::ICalFormat format;
1243 format.setTimeSpec( mCalendar->timeSpec() );
1244 KCalCore::Incidence::Ptr incidence( format.fromString( ical ) );
1250 return incidence ?
mChanger->createIncidence( incidence, Akonadi::Collection(),
this ) != -1 :
false;
1256 if ( CalendarSupport::hasIncidence( item ) ) {
1259 KNotification::beep();
1266 if ( CalendarSupport::hasIncidence( item ) ) {
1269 KNotification::beep();
1276 if ( CalendarSupport::hasIncidence( item ) ) {
1279 KNotification::beep();
1293 const KCalCore::Incidence::Ptr inc = CalendarSupport::incidence( item );
1295 if ( !inc || inc->relatedTo().isEmpty() ) {
1296 kDebug() <<
"Refusing to unparent this to-do" << inc;
1300 KCalCore::Incidence::Ptr oldInc( inc->clone() );
1301 inc->setRelatedTo(
QString() );
1302 mChanger->modifyIncidence( item, oldInc,
this );
1309 bool status =
false;
1321 const KCalCore::Incidence::Ptr inc = CalendarSupport::incidence( item );
1323 Akonadi::Item::List subIncs = mCalendar->childItems( item.id() );
1325 if ( !inc || subIncs.isEmpty() ) {
1326 kDebug() <<
"Refusing to make children independent" << inc;
1331 foreach (
const Akonadi::Item &item, subIncs ) {
1341 Akonadi::Item item = mCalendar->item(
id );
1342 if ( !CalendarSupport::hasIncidence( item ) ) {
1343 kError() <<
"CalendarView::deleteIncidence(): Item does not contain incidence.";
1351 const KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
1353 kError() <<
"Null incidence";
1356 KCalCore::Incidence::Ptr oldincidence( incidence->clone() );
1358 KCalCore::Alarm::List alarms = incidence->alarms();
1359 KCalCore::Alarm::List::ConstIterator it;
1360 for ( it = alarms.constBegin(); it != alarms.constEnd(); ++it ) {
1361 (*it)->toggleAlarm();
1363 if ( alarms.isEmpty() ) {
1365 KCalCore::Alarm::Ptr alm = incidence->newAlarm();
1366 alm->setType( KCalCore::Alarm::Display );
1367 alm->setEnabled(
true );
1369 switch( CalendarSupport::KCalPrefs::instance()->mReminderTimeUnits ) {
1372 duration = CalendarSupport::KCalPrefs::instance()->mReminderTime * 60;
1375 duration = CalendarSupport::KCalPrefs::instance()->mReminderTime * 60 * 60;
1378 duration = CalendarSupport::KCalPrefs::instance()->mReminderTime * 60 * 60 * 24;
1381 if ( incidence->type() == KCalCore::Incidence::TypeEvent ) {
1382 alm->setStartOffset( KCalCore::Duration( -duration ) );
1384 alm->setEndOffset( KCalCore::Duration( -duration ) );
1387 mChanger->startAtomicOperation( i18n(
"Toggle Reminder" ) );
1388 mChanger->modifyIncidence( item, oldincidence,
this );
1394 const KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( todoItem );
1397 kError() <<
"Null incidence";
1400 if ( incidence->type() != KCalCore::Incidence::TypeTodo ) {
1401 kDebug() <<
"called for a non-Todo incidence";
1405 KCalCore::Todo::Ptr todo = CalendarSupport::todo( todoItem );
1407 KCalCore::Todo::Ptr oldtodo( todo->clone() );
1409 if ( todo->isCompleted() ) {
1410 todo->setPercentComplete( 0 );
1412 todo->setCompleted( KDateTime::currentDateTime(
1413 CalendarSupport::KCalPrefs::instance()->timeSpec() ) );
1416 mChanger->startAtomicOperation( i18n(
"Toggle To-do Completed") );
1417 mChanger->modifyIncidence( todoItem, oldtodo,
this );
1423 #ifdef AKONADI_PORT_DISABLED
1425 kError() <<
"Null incidence";
1429 KCalCore::CalendarResources *
const resources = KOrg::StdCalendar::self();
1430 KCalCore::CalendarResourceManager *
const manager = resources->resourceManager();
1433 ResourceCalendar *newCal = 0;
1434 KCalCore::CalendarResourceManager::iterator it;
1435 for ( it = manager->begin(); it != manager->end(); ++it ) {
1436 ResourceCalendar *
const resource = *it;
1437 if ( resource->identifier() == resourceId ) {
1447 KCalCore::Incidence::Ptr newInc;
1448 if ( incidence->type() == KCalCore::Incidence::TypeEvent ) {
1449 KCalCore::Event::Ptr nEvent( static_cast<KCalCore::Event::Ptr >( incidence )->clone() );
1450 nEvent->setUid( KCalCore::CalFormat::createUniqueId() );
1452 }
else if ( incidence->type() == KCalCore::Incidence::TypeTodo ) {
1453 KCalCore::Todo::Ptr nTodo( static_cast<KCalCore::Todo::Ptr >( incidence )->clone() );
1454 nTodo->setUid( KCalCore::CalFormat::createUniqueId() );
1456 }
else if ( incidence->type() == KCalCore::Incidence::TypeJournal ) {
1457 KCalCore::Journal::Ptr nJournal( static_cast<KCalCore::Journal::Ptr >( incidence )->clone() );
1458 nJournal->setUid( KCalCore::CalFormat::createUniqueId() );
1461 kWarning() <<
"Trying to copy an incidence type that cannot be copied";
1465 if ( resources->addIncidence( newInc, newCal ) ) {
1466 incidenceAddFinished( newInc,
true );
1467 KMessageBox::information(
1470 "\"%1\" was successfully copied to %2.",
1471 incidence->summary(),
1472 newCal->resourceName() ),
1473 i18nc(
"@title:window",
"Copying Succeeded" ),
1474 "CalendarIncidenceCopy" );
1479 "Unable to copy the item \"%1\" to %2.",
1480 incidence->summary(),
1481 newCal->resourceName() ),
1482 i18nc(
"@title:window",
"Copying Failed" ) );
1487 kDebug() <<
"AKONADI PORT: Disabled code in " << Q_FUNC_INFO;
1493 #ifdef AKONADI_PORT_DISABLED
1495 kError() <<
"Null incidence";
1499 KCalCore::CalendarResources *
const resources = KOrg::StdCalendar::self();
1500 KCalCore::CalendarResourceManager *
const manager = resources->resourceManager();
1503 ResourceCalendar *newCal = 0;
1504 KCalCore::CalendarResourceManager::iterator it;
1505 for ( it = manager->begin(); it != manager->end(); ++it ) {
1506 ResourceCalendar *
const resource = *it;
1507 if ( resource->identifier() == resourceId ) {
1517 KCalCore::Incidence *newInc;
1518 if ( incidence->type() == KCalCore::Incidence::TypeEvent ) {
1519 KCalCore::Event::Ptr nEvent =
static_cast<KCalCore::Event::Ptr
>( incidence )->clone();
1520 nEvent->setUid( KCalCore::CalFormat::createUniqueId() );
1522 }
else if ( incidence->type() == KCalCore::Incidence::TypeTodo ) {
1523 KCalCore::Todo::Ptr nTodo =
static_cast<KCalCore::Todo::Ptr
>( incidence )->clone();
1524 nTodo->setUid( KCalCore::CalFormat::createUniqueId() );
1526 }
else if ( incidence->type() == KCalCore::Incidence::TypeJournal ) {
1527 KCalCore::Journal::Ptr nJournal =
static_cast<KCalCore::Journal::Ptr
>( incidence )->clone();
1528 nJournal->setUid( KCalCore::CalFormat::createUniqueId() );
1531 kWarning() <<
"Trying to move an incidence type that cannot be moved";
1535 if ( resources->addIncidence( newInc, newCal ) ) {
1536 incidenceAddFinished( newInc,
true );
1537 ResourceCalendar *
const oldCal = resources->resource( incidence );
1538 if ( !oldCal || resources->deleteIncidence( incidence ) ) {
1542 "Unable to remove the item \"%1\" from %2. "
1543 "However, a copy of this item has been put into %3.",
1544 incidence->summary(),
1545 oldCal->resourceName(),
1546 newCal->resourceName() ),
1547 i18nc(
"@title:window",
"Moving Failed" ) );
1549 incidenceDeleteFinished( incidence,
true );
1550 KMessageBox::information(
1553 "\"%1\" was successfully moved from %2 to %3.",
1554 incidence->summary(),
1555 oldCal->resourceName(),
1556 newCal->resourceName() ),
1557 i18nc(
"@title:window",
"Moving Succeeded" ),
1558 "CalendarIncidenceMove" );
1564 "Unable to add the item \"%1\" into %2. "
1565 "This item has not been moved.",
1566 incidence->summary(),
1567 newCal->resourceName() ),
1568 i18nc(
"@title:window",
"Moving Failed" ) );
1573 kDebug() <<
"AKONADI PORT: Disabled code in " << Q_FUNC_INFO;
1579 const KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
1582 kError() <<
"Null incidence";
1586 KDateTime thisDateTime( date, CalendarSupport::KCalPrefs::instance()->timeSpec() );
1587 bool isFirstOccurrence = !incidence->recurrence()->getPreviousDateTime( thisDateTime ).isValid();
1590 bool doOnlyThis =
false;
1591 bool doFuture =
false;
1593 if ( isFirstOccurrence ) {
1594 answer = KMessageBox::questionYesNo(
1596 i18n(
"Do you want to dissociate "
1597 "the occurrence on %1 "
1598 "from the recurrence?",
1599 KGlobal::locale()->formatDate( date ) ),
1600 i18n(
"KOrganizer Confirmation" ),
1601 KGuiItem( i18n(
"&Dissociate" ) ),
1602 KStandardGuiItem::cancel() );
1604 doOnlyThis = ( answer == KMessageBox::Yes );
1606 answer = KMessageBox::questionYesNoCancel(
1608 i18n(
"Do you want to dissociate "
1609 "the occurrence on %1 "
1610 "from the recurrence or also "
1611 "dissociate future ones?",
1612 KGlobal::locale()->formatDate( date ) ),
1613 i18n(
"KOrganizer Confirmation" ),
1614 KGuiItem( i18n(
"&Only Dissociate This One" ) ),
1615 KGuiItem( i18n(
"&Also Dissociate Future Ones" ) ) );
1617 doOnlyThis = ( answer == KMessageBox::Yes );
1618 doFuture = ( answer == KMessageBox::No );
1622 dissociateOccurrence( item, date,
false );
1623 }
else if ( doFuture ) {
1624 dissociateOccurrence( item, date,
true );
1627 void CalendarView::dissociateOccurrence(
const Akonadi::Item &item,
const QDate &date,
bool thisAndFuture )
1629 const KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
1631 if ( thisAndFuture ) {
1636 KDateTime occurrenceDate( incidence->dtStart() );
1637 occurrenceDate.setDate(date);
1638 kDebug() <<
"create exception: " << occurrenceDate;
1639 KCalCore::Incidence::Ptr newInc( KCalCore::Calendar::createException(
1640 incidence, occurrenceDate, thisAndFuture) );
1642 mChanger->createIncidence( newInc, item.parentCollection(), this );
1644 if ( thisAndFuture ) {
1647 i18n(
"Dissociating the future occurrences failed." ),
1648 i18n(
"Dissociating Failed" ) );
1652 i18n(
"Dissociating the occurrence failed." ),
1653 i18n(
"Dissociating Failed" ) );
1661 Akonadi::Item selectedItem = item;
1662 if ( !item.hasPayload<KCalCore::Incidence::Ptr>() ) {
1666 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( selectedItem );
1668 mITIPHandler->publishInformation( incidence,
this );
1673 schedule( KCalCore::iTIPRequest, incidence );
1678 schedule( KCalCore::iTIPRefresh, incidence );
1683 schedule( KCalCore::iTIPCancel, incidence );
1688 schedule( KCalCore::iTIPAdd, incidence );
1693 schedule( KCalCore::iTIPReply, incidence );
1698 schedule( KCalCore::iTIPCounter, incidence );
1703 schedule( KCalCore::iTIPDeclineCounter, incidence );
1708 Akonadi::Item selectedItem = item;
1709 if ( !item.hasPayload<KCalCore::Incidence::Ptr>() ) {
1713 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( selectedItem );
1716 mITIPHandler->sendAsICalendar( incidence,
this );
1721 Akonadi::FreeBusyManager::self()->mailFreeBusy( daysToPublish,
this );
1726 Akonadi::FreeBusyManager::self()->publishFreeBusy(
this );
1731 Akonadi::Item selectedItem = item;
1732 if ( !item.hasPayload<KCalCore::Incidence::Ptr>() ) {
1736 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( selectedItem );
1739 mITIPHandler->sendiTIPMessage( method, incidence,
this );
1754 if ( mReadOnly != readOnly ) {
1755 mReadOnly = readOnly;
1766 CalendarSupport::CalPrinter::PrintType
printType = CalendarSupport::CalPrinter::Month;
1769 if ( currentView ) {
1772 foreach (
const Akonadi::Item &item, selectedViewIncidences ) {
1773 if ( item.hasPayload<KCalCore::Incidence::Ptr>() ) {
1774 selectedIncidences.append( item.payload<KCalCore::Incidence::Ptr>() );
1779 KCalCore::DateList tmpDateList = mDateNavigator->
selectedDates();
1780 mCalPrinter->print( printType, tmpDateList.first(), tmpDateList.last(),
selectedIncidences );
1789 CalendarSupport::CalPrinter::PrintType
printType = CalendarSupport::CalPrinter::Month;
1792 if ( currentView ) {
1795 foreach (
const Akonadi::Item &item, selectedViewIncidences ) {
1796 if ( item.hasPayload<KCalCore::Incidence::Ptr>() ) {
1797 selectedIncidences.append( item.payload<KCalCore::Incidence::Ptr>() );
1802 KCalCore::DateList tmpDateList = mDateNavigator->
selectedDates();
1803 mCalPrinter->print( printType, tmpDateList.first(), tmpDateList.last(),
1809 KOrg::HTMLExportSettings *settings =
new KOrg::HTMLExportSettings(
QLatin1String(
"KOrganizer") );
1813 settings->readConfig();
1816 this, SIGNAL(
exportHTML(KOrg::HTMLExportSettings*)) );
1823 KFileDialog::getSaveFileName( KUrl(
QLatin1String(
"icalout.ics") ), i18n(
"*.ics|iCalendars" ),
this );
1830 if (
QFile( filename ).exists() ) {
1831 if ( KMessageBox::No == KMessageBox::warningYesNo(
1833 i18n(
"Do you want to overwrite %1?", filename ) ) ) {
1837 KCalCore::ICalFormat *format =
new KCalCore::ICalFormat;
1839 KCalCore::FileStorage storage( mCalendar, filename, format );
1840 if ( !storage.save() ) {
1842 if ( format->exception() ) {
1843 errmess = KCalUtils::Stringify::errorMessage( *format->exception() );
1845 errmess = i18nc(
"save failure cause unknown",
"Reason unknown" );
1850 "Cannot write iCalendar file %1. %2",
1851 filename, errmess ) );
1858 if ( !mCalendar->journals().isEmpty() ) {
1859 int result = KMessageBox::warningContinueCancel(
1861 i18n(
"The journal entries cannot be exported to a vCalendar file." ),
1862 i18n(
"Data Loss Warning" ),
1863 KGuiItem( i18n(
"Proceed" ) ),
1864 KStandardGuiItem::cancel(),
1866 KMessageBox::Notify );
1867 if ( result != KMessageBox::Continue ) {
1873 i18n(
"*.vcs|vCalendars" ),
this,
QString(), KFileDialog::ConfirmOverwrite );
1879 if (
QFile( filename ).exists() ) {
1880 if ( KMessageBox::No == KMessageBox::warningYesNo(
1882 i18n(
"Do you want to overwrite %1?", filename ) ) ) {
1886 KCalCore::VCalFormat *format =
new KCalCore::VCalFormat;
1888 KCalCore::FileStorage storage( mCalendar, filename, format );
1889 if ( !storage.save() ) {
1891 if ( format->exception() ) {
1892 errmess = KCalUtils::Stringify::errorMessage( *format->exception() );
1894 errmess = i18nc(
"save failure cause unknown",
"Reason unknown" );
1899 "Cannot write vCalendar file %1. %2",
1900 filename, errmess ) );
1928 if ( CalendarSupport::hasIncidence( item ) ) {
1936 if ( CalendarSupport::hasIncidence( item ) && mViewManager->
currentView() ) {
1944 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
1945 if ( item != mSelectedIncidence ) {
1951 mSelectedIncidence = item;
1954 if ( item == mSelectedIncidence ) {
1955 if ( !incidence->recurs() || mSaveDate == date ) {
1960 mSelectedIncidence = item;
1964 bool subtodo =
false;
1966 const bool organizerEvents =
1967 CalendarSupport::KCalPrefs::instance()->thatIsMe( incidence->organizer()->email() );
1968 const bool groupEvents = incidence->attendeeByMails( CalendarSupport::KCalPrefs::instance()->allEmails() );
1970 if ( incidence->type() == KCalCore::Incidence::TypeTodo ) {
1972 subtodo = ( incidence->relatedTo() !=
QString() );
1982 emit
pasteEnabled( mCalendarClipboard->pasteAvailable() );
1987 mDateNavigatorContainer->
selectDates( selectedDates, preferredMonth );
1991 updateView( selectedDates.first(), selectedDates.last(), preferredMonth, false );
2006 int pos = mFilters.
indexOf( mCurrentFilter );
2011 filters << i18n(
"No filter" );
2012 foreach ( KCalCore::CalFilter *filter, mFilters ) {
2014 filters << filter->name();
2022 mCalendar->setFilter( mCurrentFilter );
2027 KCalCore::CalFilter *newFilter = 0;
2028 if ( filterNo > 0 && filterNo <=
int( mFilters.
count() ) ) {
2029 newFilter = mFilters.
at( filterNo - 1 );
2031 if ( newFilter != mCurrentFilter ) {
2032 mCurrentFilter = newFilter;
2033 mCalendar->setFilter( mCurrentFilter );
2034 mViewManager->
addChange( EventViews::EventView::FilterChanged );
2042 return mCurrentFilter != 0;
2047 if ( mCurrentFilter ) {
2048 return mCurrentFilter->name();
2050 return i18n(
"No filter" );
2057 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
2063 incidence->setOrganizer(
2064 KCalCore::Person::Ptr(
new KCalCore::Person(
2065 CalendarSupport::KCalPrefs::instance()->fullName(),
2066 CalendarSupport::KCalPrefs::instance()->email() ) ) );
2067 incidence->recreate();
2068 incidence->setReadOnly(
false );
2077 kDebug() <<
"To be implemented.";
2083 mDateNavigatorContainer->
show();
2086 mDateNavigatorContainer->
hide();
2103 mEventViewerBox->show();
2105 mEventViewerBox->hide();
2111 mViewManager->
addView( view );
2122 mExtensions.
append( extension );
2123 if ( !mETMCollectionView ) {
2131 mMainSplitterSizes.
clear();
2136 if ( mMainSplitterSizes.
isEmpty() ) {
2137 mMainSplitterSizes = mPanner->
sizes();
2148 if (
const KCalCore::Todo::Ptr t = CalendarSupport::todo( item ) ) {
2152 Akonadi::Item incidence;
2155 if ( !selectedIncidences.isEmpty() ) {
2156 incidence = selectedIncidences.first();
2158 if (
const KCalCore::Todo::Ptr t = CalendarSupport::todo( item ) ) {
2161 return Akonadi::Item();
2176 if ( !item.isValid() ) {
2178 if ( !selectedIncidences.isEmpty() ) {
2179 item = selectedIncidences.first();
2197 Akonadi::Item item = mCalendar->item(
id );
2203 Akonadi::Item item = mCalendar->item(
id );
2204 if ( !CalendarSupport::hasIncidence( item ) ) {
2213 Akonadi::Item item = mCalendar->item(
id );
2214 if ( !CalendarSupport::hasIncidence( item ) ) {
2228 Q_UNUSED( incidence );
2234 Q_UNUSED( incidence );
2248 if ( !mCalendar->hasRight( item, Akonadi::Collection::CanChangeItem ) ) {
2249 eventViewer->enableButton( KDialog::User1,
false );
2252 eventViewer->show();
2257 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
2258 if ( CalendarSupport::hasEvent( item ) ) {
2264 incidence->dtStart().toTimeSpec(
2265 CalendarSupport::KCalPrefs::instance()->timeSpec() ).date() );
2267 }
else if ( CalendarSupport::hasJournal( item ) ) {
2271 }
else if ( CalendarSupport::hasTodo( item ) ) {
2276 Akonadi::Item::List list;
2277 list.append( item );
2283 Q_UNUSED( isCounter );
2284 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
2286 kError() <<
"Null incidence";
2287 KNotification::beep();
2291 if ( !mCalendar->hasRight( item, Akonadi::Collection::CanChangeItem ) ) {
2307 const KCalCore::Todo::Ptr todo = CalendarSupport::todo( todoItem );
2311 Akonadi::Item::List subTodos = mCalendar->childItems( todoItem.id() );
2312 foreach (
const Akonadi::Item &item, subTodos ) {
2313 if ( CalendarSupport::hasTodo( item ) ) {
2318 if ( !
mChanger->deletedRecently( todoItem.id() ) ) {
2319 mChanger->deleteIncidence( todoItem,
this );
2325 const KCalCore::Todo::Ptr todo = CalendarSupport::todo( todoItem );
2331 if ( mCalendar->childItems( todoItem.id() ).isEmpty() ) {
2332 bool doDelete =
true;
2334 doDelete = (
msgItemDelete( todoItem ) == KMessageBox::Continue );
2336 if ( doDelete && !
mChanger->deletedRecently( todoItem.id() ) ) {
2337 mChanger->deleteIncidence( todoItem,
this );
2343 int km = KMessageBox::No;
2345 km = KMessageBox::questionYesNoCancel(
2347 i18n(
"The item \"%1\" has sub-to-dos. "
2348 "Do you want to delete just this item and "
2349 "make all its sub-to-dos independent, or "
2350 "delete the to-do with all its sub-to-dos?",
2352 i18n(
"KOrganizer Confirmation" ),
2353 KGuiItem( i18n(
"Delete Only This" ) ),
2354 KGuiItem( i18n(
"Delete All" ) ) );
2357 if ( km == KMessageBox::Yes ) {
2360 if ( !
mChanger->deletedRecently( todoItem.id() ) ) {
2361 mChanger->deleteIncidence( todoItem,
this );
2363 }
else if ( km == KMessageBox::No ) {
2374 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
2377 kError() <<
"Null incidence";
2378 KNotification::beep();
2380 kError() <<
"CalendarView::deleteIncidence(): Unable do delete, incidence is null.";
2384 if (
mChanger->deletedRecently( item.id() ) ) {
2386 kWarning() <<
"CalendarView::deleteIncidence(): item with id" << item.id()
2387 <<
"was deleted recently, skipping";
2391 if ( !mCalendar->hasRight( item, Akonadi::Collection::CanDeleteItem ) ) {
2393 KMessageBox::information(
2395 i18n(
"The item \"%1\" is marked read-only "
2396 "and cannot be deleted; it probably "
2397 "belongs to a read-only calendar.",
2398 incidence->summary() ),
2399 i18n(
"Removing not possible" ),
2402 kWarning() <<
"CalendarView::deleteIncidence(): No rights to delete item";
2408 if ( incidence && incidence->type() == KCalCore::Incidence::TypeTodo ) {
2413 if ( incidence->recurs() ) {
2415 int km = KMessageBox::Ok;
2418 kDebug() <<
"Date Not Valid";
2419 km = KMessageBox::warningContinueCancel(
2421 i18n(
"The calendar item \"%1\" recurs over multiple dates; "
2422 "are you sure you want to delete it "
2423 "and all its recurrences?", incidence->summary() ),
2424 i18n(
"KOrganizer Confirmation" ),
2425 KGuiItem( i18n(
"Delete All" ) ) );
2427 KDateTime itemDateTime( itemDate, CalendarSupport::KCalPrefs::instance()->timeSpec() );
2428 bool isFirst = !incidence->recurrence()->getPreviousDateTime( itemDateTime ).isValid();
2429 bool isLast = !incidence->recurrence()->getNextDateTime( itemDateTime ).isValid();
2432 KGuiItem itemFuture( i18n(
"Also Delete &Future" ) );
2434 if ( !isFirst && !isLast ) {
2435 itemFuture.setEnabled(
true );
2436 message = i18n(
"The calendar item \"%1\" recurs over multiple dates. "
2437 "Do you want to delete only the current one on %2, also "
2438 "future occurrences, or all its occurrences?",
2439 incidence->summary(),
2440 KGlobal::locale()->formatDate( itemDate ) );
2442 itemFuture.setEnabled(
false );
2443 message = i18n(
"The calendar item \"%1\" recurs over multiple dates. "
2444 "Do you want to delete only the current one on %2 "
2445 "or all its occurrences?",
2446 incidence->summary(),
2447 KGlobal::locale()->formatDate( itemDate ) );
2450 if ( !( isFirst && isLast ) ) {
2451 km = PIMMessageBox::fourBtnMsgBox(
2453 QMessageBox::Warning,
2455 i18n(
"KOrganizer Confirmation" ),
2456 KGuiItem ( i18n(
"Delete C&urrent" ) ),
2458 KGuiItem( i18n(
"Delete &All" ) ) );
2464 KCalCore::Incidence::Ptr oldIncidence( incidence->clone() );
2466 case KMessageBox::Ok:
2467 case KMessageBox::Continue:
2468 mChanger->deleteIncidence( item,
this );
2471 case KMessageBox::Yes:
2472 incidence->recurrence()->addExDate( itemDate );
2473 mChanger->modifyIncidence( item, oldIncidence,
this );
2476 case KMessageBox::No:
2477 KCalCore::Recurrence *recur = incidence->recurrence();
2478 recur->setEndDate( itemDate.
addDays( -1 ) );
2479 mChanger->modifyIncidence( item, oldIncidence,
this );
2483 bool doDelete =
true;
2485 doDelete = (
msgItemDelete( item ) == KMessageBox::Continue );
2488 mChanger->deleteIncidence( item,
this );
2498 if ( checkedCollections().isEmpty() ) {
2499 showMessage( i18n(
"All calendars are unchecked in the Calendar Manager. No to-do was purged." ), KMessageWidget::Warning );
2503 if ( mCalendar->rawTodos().isEmpty() ) {
2504 showMessage( i18n(
"There are no completed to-dos to purge." ), KMessageWidget::Information );
2508 int result = KMessageBox::warningContinueCancel(
2510 i18n(
"Delete all completed to-dos from checked calendars?" ),
2511 i18n(
"Purge To-dos" ),
2512 KGuiItem( i18n(
"Purge" ) ) );
2514 if ( result == KMessageBox::Continue ) {
2515 mTodoPurger->purgeCompletedTodos();
2521 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
2526 "Unable to edit \"%1\" because it is locked by another process.",
2527 incidence->summary() ) );
2533 KMessageBox::error(
this, msg );
2538 if ( !CalendarSupport::hasIncidence( itemadd ) ) {
2541 i18n(
"Unable to copy the item to %1.", dt.
toString() ),
2542 i18n(
"Copying Failed" ) );
2545 Akonadi::Item item = mCalendar->item( itemadd.id() );
2546 if ( !item.isValid() ) {
2550 KCalCore::Incidence::Ptr incidence( CalendarSupport::incidence( item )->clone() );
2551 incidence->recreate();
2553 if (
const KCalCore::Event::Ptr
event = incidence.dynamicCast<KCalCore::Event>() ) {
2556 KDateTime start =
event->dtStart();
2557 KDateTime end =
event->dtEnd();
2559 int duration = start.daysTo( end );
2560 start.setDate( dt );
2561 end.setDate( dt.
addDays( duration ) );
2563 event->setDtStart( start );
2564 event->setDtEnd( end );
2566 }
else if (
const KCalCore::Todo::Ptr todo = incidence.dynamicCast<KCalCore::Todo>() ) {
2567 KDateTime due = todo->dtDue();
2570 todo->setDtDue( due );
2573 mChanger->createIncidence( incidence, Akonadi::Collection(),
this );
2578 if ( !CalendarSupport::hasIncidence( itemmove ) ) {
2581 i18n(
"Unable to move the item to %1.", dt.
toString() ),
2582 i18n(
"Moving Failed" ) );
2585 Akonadi::Item item = mCalendar->item( itemmove.id() );
2586 if ( !item.isValid() ) {
2590 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( itemmove );
2592 KCalCore::Incidence::Ptr oldIncidence( incidence->clone() );
2594 if (
const KCalCore::Event::Ptr
event = incidence.dynamicCast<KCalCore::Event>() ) {
2596 KDateTime start =
event->dtStart();
2597 KDateTime end =
event->dtEnd();
2599 int duration = start.daysTo( end );
2600 start.setDate( dt );
2601 end.setDate( dt.
addDays( duration ) );
2603 event->setDtStart( start );
2604 event->setDtEnd( end );
2606 }
if (
const KCalCore::Todo::Ptr todo = incidence.dynamicCast<KCalCore::Todo>() ) {
2607 KDateTime due = todo->dtDue();
2610 todo->setDtDue( due );
2612 mChanger->modifyIncidence( itemmove, oldIncidence,
this );
2617 mViewManager->
addChange( EventViews::EventView::ResourcesChanged );
2623 if ( watched == mLeftFrame && event->
type() == QEvent::Show ) {
2624 mSplitterSizesValid =
true;
2650 mDateNavigator->
selectWeek( date, preferredMonth );
2661 fullView ? mNavigatorBar->
show() : mNavigatorBar->
hide();
2666 Akonadi::Collection CalendarView::defaultCollection(
const QLatin1String &mimeType )
const
2670 bool supportsMimeType = collection.contentMimeTypes().contains( mimeType ) || mimeType ==
"";
2671 bool hasRights = collection.rights() & Akonadi::Collection::CanCreateItem;
2672 if ( collection.isValid() && supportsMimeType && hasRights )
2676 collection = mCalendar->collection( CalendarSupport::KCalPrefs::instance()->defaultCalendarId() );
2677 supportsMimeType = collection.contentMimeTypes().contains( mimeType ) || mimeType ==
"";
2678 hasRights = collection.rights() & Akonadi::Collection::CanCreateItem;
2679 if ( collection.isValid() && supportsMimeType && hasRights )
2683 collection = mCalendar->collection( IncidenceEditorNG::GlobalSettings::self()->lastSelectedFolder() );
2684 supportsMimeType = collection.contentMimeTypes().contains( mimeType ) || mimeType ==
"";
2685 hasRights = collection.rights() & Akonadi::Collection::CanCreateItem;
2686 if ( collection.isValid() && supportsMimeType && hasRights )
2691 collection = selectedCollection();
2692 supportsMimeType = collection.contentMimeTypes().contains( mimeType ) || mimeType ==
"";
2693 hasRights = collection.rights() & Akonadi::Collection::CanCreateItem;
2694 if ( collection.isValid() && supportsMimeType && hasRights )
2698 Akonadi::Collection::List collections = checkedCollections();
2699 foreach(
const Akonadi::Collection &checkedCollection, collections ) {
2700 supportsMimeType = checkedCollection.contentMimeTypes().contains( mimeType ) || mimeType ==
"";
2701 hasRights = checkedCollection.rights() & Akonadi::Collection::CanCreateItem;
2702 if ( checkedCollection.isValid() && supportsMimeType && hasRights )
2703 return checkedCollection;
2707 return Akonadi::Collection();
2710 IncidenceEditorNG::IncidenceDialog *CalendarView::createIncidenceEditor(
2711 const Akonadi::Item &item,
const Akonadi::Collection &collection )
2714 KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
2715 Q_ASSERT( incidence );
2717 if ( collection.isValid() ) {
2718 dialog->selectCollection( collection );
2720 dialog->selectCollection( defaultCollection( incidence->mimeType() ) );
2738 if ( mCheckableProxyModel )
2739 mCheckableProxyModel->disconnect(
this );
2741 mCheckableProxyModel = model;
2742 connect( model, SIGNAL(aboutToToggle(
bool)), SLOT(onCheckableProxyAboutToToggle(
bool)) );
2743 connect( model, SIGNAL(toggled(
bool)), SLOT(onCheckableProxyToggled(
bool)) );
2746 void CalendarView::onCheckableProxyAboutToToggle(
bool newState )
2757 void CalendarView::onCheckableProxyToggled(
bool newState )
2768 void CalendarView::onTodosPurged(
bool success,
int numDeleted,
int numIgnored)
2771 KMessageWidget::MessageType type = KMessageWidget::Information;
2773 if (numDeleted == 0 && numIgnored > 0) {
2774 type = KMessageWidget::Warning;
2775 message = i18n(
"0 completed to-dos were purged.") +
QLatin1Char(
'\n') +
2776 i18np(
"%1 to-do was ignored because it has uncompleted or read-only children.",
2777 "%1 to-dos were ignored because they have uncompleted or read-only children.", numIgnored);
2778 }
else if (numDeleted > 0 && numIgnored == 0) {
2779 message = i18np(
"%1 completed to-do was purged.",
"%1 completed to-dos were purged.", numDeleted);
2780 }
else if (numDeleted == 0 && numIgnored == 0) {
2781 message = i18n(
"There are no completed to-dos to purge.");
2783 type = KMessageWidget::Warning;
2784 message = i18np(
"%1 completed to-do was purged.",
"%1 completed to-dos were purged.", numDeleted) +
QLatin1Char(
'\n') +
2785 i18np(
"%1 to-do was ignored because it has uncompleted or read-only children.",
2786 "%1 to-dos were ignored because they have uncompleted or read-only children.", numIgnored);
2789 message = i18n(
"An error occurred while purging completed to-dos: %1", mTodoPurger->lastError());
2790 type = KMessageWidget::Error;
2798 mMessageWidget->setText(message);
2799 mMessageWidget->setMessageType(type);
2800 mMessageWidget->show();
2803 Akonadi::Collection CalendarView::selectedCollection()
const
2805 return mETMCollectionView ? mETMCollectionView->
selectedCollection() : Akonadi::Collection();
2808 Akonadi::Collection::List CalendarView::checkedCollections()
const
2810 Akonadi::Collection::List collections;
2811 if ( mETMCollectionView )
2815 int count = collections.count();
2816 Akonadi::Collection::Id
id = CalendarSupport::KCalPrefs::instance()->defaultCalendarId();
2817 for(
int i=0; i<count; ++i ) {
2818 if (
id == collections[i].
id() ) {
2819 collections.move( i, 0 );
2829 Akonadi::Collection collection = item.parentCollection();
2830 if (!collection.isValid()) {
2831 kWarning() <<
"Item was creating in an invalid collection !? item id=" << item.id();
2835 const bool collectionIsChecked = mETMCollectionView->
isChecked(collection);
2837 if (!collectionIsChecked) {
2840 message = i18n(
"You created an incidence in a calendar that is currently filtered out.\n"
2841 "On the left sidebar, enable it in the calendar manager to see the incidence.");
2843 message = i18n(
"You created an incidence in a calendar that is currently filtered out.\n"
2844 "You can enable it through the calendar manager (Settings->Sidebar->Show Calendar Manager)");
2847 mMessageWidget->setText(message);
2848 mMessageWidget->setMessageType(KMessageWidget::Information);
2849 mMessageWidget->show();
QDate activeIncidenceDate()
Returns the date of the selected incidence.
virtual CalendarSupport::CalPrinterBase::PrintType printType() const
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.
void copyIncidenceToResource(const Akonadi::Item &incidence, const Akonadi::Collection &col)
virtual void clearSelection()
Clear selection.
void setSizes(const QList< int > &list)
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
QString toString(Qt::DateFormat format) const
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)
const T & at(int i) const
void schedule_cancel(const Akonadi::Item &incidence=Akonadi::Item())
void warningChangeFailed(const Akonadi::Item &)
void setTime(const QTime &time)
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)
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
void calendarViewExpanded(bool)
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())
int indexOf(const T &value, int from) const
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.
int count(const T &value) const
void append(const T &value)
QList< int > sizes() const
void processTodoListSelection(const Akonadi::Item &incidence, const QDate &date)
Akonadi::ETMCalendar::Ptr calendar() const
void installEventFilter(QObject *filterObj)
void setChildrenCollapsible(bool)
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.
bool inherits(const char *className) const
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 setObjectName(const QString &name)
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()
QTime addSecs(int s) const
void setDate(const QDate &date)
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.
virtual bool eventFilter(QObject *watched, QEvent *event)
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 setMargin(int margin)
void newTodo()
create new todo
QSize minimumSizeHint() const
QString right(int n) const
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 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
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())
bool contains(const T &value) const
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 moveIncidenceToResource(const Akonadi::Item &incidence, const Akonadi::Collection &col)
void groupEventsSelected(bool)
Emitted when state of events selection has changed and user is attendee.
static KOPrefs * instance()
Get instance of KOPrefs.
bool isFiltered() const
Returns true if there's a filter applied.
bool isChecked(const Akonadi::Collection &) const
void takeOverEvent()
Take ownership of selected event.
int indexOf(const QRegExp &rx, int from) const
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)
QDate addDays(int ndays) const
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.
QStringList filter(const QString &str, Qt::CaseSensitivity cs) const
const_iterator constEnd() const
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.
const_iterator constBegin() const
void restoreLayout(KConfig *config, const QString &group, bool minimalDefaults)
QDateTime addSecs(int s) const
void toggleTodoCompleted(const Akonadi::Item &incidence)
This class manages the views of the calendar.
interface for main calendar view widget
void startMultiModify(const QString &text)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
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)
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 &)