33 #include "calendaradaptor.h"
36 #include "htmlexportsettings.h"
39 #include "korganizeradaptor.h"
44 #include "reminderclient.h"
47 #include <KHolidays/Holidays>
49 #include <calendarsupport/collectionselection.h>
50 #include <calendarsupport/eventarchiver.h>
51 #include <calendarsupport/kcalprefs.h>
52 #include <calendarsupport/utils.h>
54 #include <incidenceeditor-ng/globalsettings.h>
56 #include <Akonadi/EntityDisplayAttribute>
57 #include <Akonadi/EntityTreeView>
58 #include <Akonadi/EntityTreeModel>
59 #include <Akonadi/ETMViewStateSaver>
60 #include <Akonadi/Calendar/History>
61 #include <Akonadi/Calendar/ICalImporter>
63 #include <KCalCore/FileStorage>
64 #include <KCalCore/ICalFormat>
65 #include <KCalCore/Person>
68 #include <KMime/KMimeMessage>
71 #include <KActionCollection>
72 #include <KCmdLineArgs>
73 #include <KFileDialog>
74 #include <KGlobalSettings>
77 #include <KMessageBox>
78 #include <KMimeTypeTrader>
80 #include <KSelectAction>
81 #include <KShortcutsDialog>
82 #include <KStandardAction>
83 #include <KStandardDirs>
84 #include <KTemporaryFile>
86 #include <KToggleAction>
87 #include <KWindowSystem>
88 #include <KIO/NetAccess>
89 #include <KNS3/DownloadDialog>
91 #include <QApplication>
98 bool isPart, KMenuBar *menuBar )
100 mCollectionViewShowAction( 0 ),
101 mCollectionView( 0 ), mCollectionViewStateSaver( 0 ),
102 mCollectionSelectionModelStateSaver( 0 )
104 new KOrgCalendarAdaptor(
this );
108 mACollection = mGUIClient->actionCollection();
109 mCalendarView = widget;
112 mHtmlExportSync =
false;
113 mMainWindow = mainWindow;
127 delete mCollectionSelectionModelStateSaver;
128 delete mCollectionViewStateSaver;
130 delete mCalendarView;
136 if ( mHideMenuBarAction->isChecked() ) {
139 if ( !dontShowWarning ) {
140 QString accel = mHideMenuBarAction->shortcut().toString();
141 KMessageBox::information( mCalendarView,
142 i18n(
"<qt>This will hide the menu bar completely."
143 " You can show it again by typing %1.</qt>", accel ),
144 i18n(
"Hide menu bar"),
QLatin1String(
"HideMenuBarWarning") );
155 if ( !mWindowList ) {
172 mAutoExportTimer =
new QTimer(
this );
180 mAutoArchiveTimer =
new QTimer(
this );
185 if ( CalendarSupport::KCalPrefs::instance()->mAutoArchive ) {
186 mAutoArchiveTimer->
start( 5 * 60 * 1000 );
191 connect( mCalendarView, SIGNAL(modifiedChanged(
bool)), SLOT(
setTitle()) );
194 connect( mCalendarView, SIGNAL(incidenceSelected(Akonadi::Item,
QDate)),
197 this, SLOT(
exportHTML(KOrg::HTMLExportSettings*)) );
205 Akonadi::ETMCalendar::Ptr ActionManager::calendar()
const
212 Q_ASSERT( calendar() );
215 mCollectionSelectionModelStateSaver =
216 new KViewStateMaintainer<Akonadi::ETMViewStateSaver>(
217 config->group(
"GlobalCollectionSelection" ) );
218 mCollectionSelectionModelStateSaver->setSelectionModel( calendar()->checkableProxyModel()->selectionModel() );
224 connect( mCollectionView, SIGNAL(resourcesAddedRemoved()), SLOT(slotResourcesAddedRemoved()));
225 connect( mCollectionView, SIGNAL(defaultResourceChanged(Akonadi::Collection)),
226 SLOT(slotDefaultResourceChanged(Akonadi::Collection)) );
227 connect( mCollectionView, SIGNAL(colorsChanged()),
230 mCollectionViewStateSaver =
new KViewStateMaintainer<Akonadi::ETMViewStateSaver>( config->group(
"GlobalCollectionView" ) );
231 mCollectionViewStateSaver->setView( mCollectionView->
view() );
238 CalendarSupport::CollectionSelection *collectionSelection =
new CalendarSupport::CollectionSelection( selectionModel );
239 EventViews::EventView::setGlobalCollectionSelection( collectionSelection );
243 connect( calendar().data(), SIGNAL(calendarChanged()),
244 mCalendarView, SLOT(resourcesChanged()) );
247 calendar()->setOwner( KCalCore::Person::Ptr(
new KCalCore::Person( CalendarSupport::KCalPrefs::instance()->fullName(),
248 CalendarSupport::KCalPrefs::instance()->email() ) ) );
252 void ActionManager::initActions()
261 KAction *a = mACollection->addAction( KStandardAction::Open,
this, SLOT(
file_open()) );
262 mACollection->addAction(
QLatin1String(
"korganizer_open"), a );
265 QAction *a = mACollection->addAction( KStandardAction::Print, mCalendarView, SLOT(print()) );
266 mACollection->addAction(
QLatin1String(
"korganizer_print"), a );
267 a = mACollection->addAction( KStandardAction::PrintPreview, mCalendarView, SLOT(print()) );
268 mACollection->addAction(
QLatin1String(
"korganizer_print_preview"), a );
272 KStandardAction::open(
this, SLOT(
file_open()), mACollection );
273 KStandardAction::print( mCalendarView, SLOT(print()), mACollection );
275 KStandardAction::printPreview( mCalendarView, SLOT(printPreview()), mACollection );
281 mImportAction =
new KAction( i18n(
"Import &Calendar..." ),
this );
282 mImportAction->setHelpText(
283 i18n(
"Merge the contents of another iCalendar" ) );
284 mImportAction->setWhatsThis(
285 i18n(
"Select this menu entry if you would like to merge the contents "
286 "of another iCalendar into your current calendar." ) );
287 mACollection->addAction(
QLatin1String(
"import_icalendar"), mImportAction );
290 #if defined(HAVE_PERL)
291 KAction *importAction =
new KAction( i18n(
"&Import From UNIX Ical Tool" ),
this );
292 importAction->setHelpText(
293 i18n(
"Import a calendar in another format" ) );
294 importAction->setWhatsThis(
295 i18n(
"Select this menu entry if you would like to import the contents "
296 "of a non-iCalendar formatted file into your current calendar." ) );
297 mACollection->addAction(
QLatin1String(
"import_ical"), importAction );
300 action =
new KAction( i18n(
"Get &Hot New Stuff..." ),
this );
301 mACollection->addAction(
QLatin1String(
"downloadnewstuff"), action );
304 action =
new KAction( i18n(
"Export &Web Page..." ),
this );
305 mACollection->addAction(
QLatin1String(
"export_web"), action );
306 connect( action, SIGNAL(triggered(
bool)), mCalendarView, SLOT(exportWeb()) );
308 action =
new KAction( i18n(
"Export as &iCalendar..." ),
this );
309 mACollection->addAction(
QLatin1String(
"export_icalendar"), action );
310 connect( action, SIGNAL(triggered(
bool)), mCalendarView, SLOT(exportICalendar()) );
312 action =
new KAction( i18n(
"Export as &vCalendar..." ),
this );
313 mACollection->addAction(
QLatin1String(
"export_vcalendar"), action );
314 connect( action, SIGNAL(triggered(
bool)), mCalendarView, SLOT(exportVCalendar()) );
321 action =
new KAction( i18n(
"Archive O&ld Entries..." ),
this );
322 mACollection->addAction(
QLatin1String(
"file_archive"), action );
325 action =
new KAction( i18n(
"Pur&ge Completed To-dos" ), mACollection );
326 mACollection->addAction(
QLatin1String(
"purge_completed"), action );
327 connect( action, SIGNAL(triggered(
bool)), mCalendarView, SLOT(purgeCompleted()) );
332 Akonadi::History *history = mCalendarView->
history();
335 mCutAction = mACollection->addAction( KStandardAction::Cut,
QLatin1String(
"korganizer_cut"),
336 mCalendarView, SLOT(edit_cut()) );
337 mCopyAction = mACollection->addAction( KStandardAction::Copy,
QLatin1String(
"korganizer_copy"),
338 mCalendarView, SLOT(edit_copy()) );
339 pasteAction = mACollection->addAction( KStandardAction::Paste,
QLatin1String(
"korganizer_paste"),
340 mCalendarView, SLOT(edit_paste()) );
341 mUndoAction = mACollection->addAction( KStandardAction::Undo,
QLatin1String(
"korganizer_undo"),
342 history, SLOT(undo()) );
343 mRedoAction = mACollection->addAction( KStandardAction::Redo,
QLatin1String(
"korganizer_redo"),
344 history, SLOT(redo()) );
346 mCutAction = KStandardAction::cut( mCalendarView, SLOT(edit_cut()), mACollection );
347 mCopyAction = KStandardAction::copy( mCalendarView, SLOT(edit_copy()), mACollection );
348 pasteAction = KStandardAction::paste( mCalendarView, SLOT(edit_paste()), mACollection );
349 mUndoAction = KStandardAction::undo( history, SLOT(undo()), mACollection );
350 mRedoAction = KStandardAction::redo( history, SLOT(redo()), mACollection );
352 mDeleteAction =
new KAction( KIcon(
QLatin1String(
"edit-delete") ), i18n(
"&Delete" ),
this );
353 mACollection->addAction(
QLatin1String(
"edit_delete"), mDeleteAction );
354 connect( mDeleteAction, SIGNAL(triggered(
bool)), mCalendarView, SLOT(appointment_delete()) );
358 SLOT(showSearchDialog()), mACollection );
359 mACollection->addAction(
QLatin1String(
"korganizer_find"), a );
362 SLOT(showSearchDialog()), mACollection );
365 mUndoAction->setEnabled(
false );
366 mRedoAction->setEnabled(
false );
367 connect( mCalendarView, SIGNAL(pasteEnabled(
bool)), pasteAction, SLOT(setEnabled(
bool)) );
373 action =
new KAction( KIcon(
QLatin1String(
"view-calendar-upcoming-events") ), i18n(
"What's &Next" ),
this );
374 mACollection->addAction(
QLatin1String(
"view_whatsnext"), action );
376 SLOT(showWhatsNextView()) );
378 action =
new KAction( KIcon(
QLatin1String(
"view-calendar-month") ), i18n(
"&Month" ),
this );
379 mACollection->addAction(
QLatin1String(
"view_month"), action );
380 connect( action, SIGNAL(triggered(
bool)),
381 mCalendarView->
viewManager(), SLOT(showMonthView()) );
383 action =
new KAction( KIcon(
QLatin1String(
"view-calendar-agenda") ), i18n(
"&Agenda" ),
this );
384 mACollection->addAction(
QLatin1String(
"view_agenda"), action );
385 connect( action, SIGNAL(triggered(
bool)),
386 mCalendarView->
viewManager(), SLOT(showAgendaView()) );
388 action =
new KAction( KIcon(
QLatin1String(
"view-calendar-list") ), i18n(
"&Event List" ),
this );
389 mACollection->addAction(
QLatin1String(
"view_list"), action );
391 SLOT(showListView()) );
393 action =
new KAction( KIcon(
QLatin1String(
"view-calendar-tasks") ), i18n(
"&To-do List" ),
this );
394 mACollection->addAction(
QLatin1String(
"view_todo"), action );
398 action =
new KAction( KIcon(
QLatin1String(
"view-calendar-journal" )), i18n(
"&Journal" ),
this );
399 mACollection->addAction(
QLatin1String(
"view_journal"), action );
403 action =
new KAction( KIcon(
QLatin1String(
"view-calendar-timeline") ), i18n(
"Time&line" ),
this );
404 mACollection->addAction(
QLatin1String(
"view_timeline"), action );
406 SLOT(showTimeLineView()) );
408 action =
new KAction( KIcon(
QLatin1String(
"view-calendar-time-spent") ), i18n(
"Time&spent" ),
this );
409 mACollection->addAction(
QLatin1String(
"view_timespent"), action );
411 SLOT(showTimeSpentView()) );
414 action =
new KAction( i18n(
"&Refresh" ),
this );
416 connect( action, SIGNAL(triggered(
bool)), mCalendarView, SLOT(updateView()) );
420 mFilterAction =
new KSelectAction( i18n(
"F&ilter" ),
this );
421 mFilterAction->setToolBarMode( KSelectAction::MenuMode );
422 mACollection->addAction(
QLatin1String(
"filter_select"), mFilterAction );
423 mFilterAction->setEditable(
false );
424 connect( mFilterAction, SIGNAL(triggered(
int)),
425 mCalendarView, SLOT(filterActivated(
int)) );
428 connect( mCalendarView, SIGNAL(filterChanged()),
433 action =
new KAction( KIcon(
QLatin1String(
"zoom-in") ), i18n(
"In Horizontally" ),
this );
435 mACollection->addAction(
QLatin1String(
"zoom_in_horizontally"), action );
437 SLOT(zoomInHorizontally()) );
439 action =
new KAction( KIcon(
QLatin1String(
"zoom-out") ), i18n(
"Out Horizontally" ),
this );
441 mACollection->addAction(
QLatin1String(
"zoom_out_horizontally"), action );
443 SLOT(zoomOutHorizontally()) );
445 action =
new KAction( KIcon(
QLatin1String(
"zoom-in") ), i18n(
"In Vertically" ),
this );
447 mACollection->addAction(
QLatin1String(
"zoom_in_vertically"), action );
449 SLOT(zoomInVertically()) );
451 action =
new KAction( KIcon(
QLatin1String(
"zoom-out") ), i18n(
"Out Vertically" ),
this );
453 mACollection->addAction(
QLatin1String(
"zoom_out_vertically"), action );
455 SLOT(zoomOutVertically()) );
460 action =
new KAction( KIcon(
QLatin1String(
"go-jump-today") ),
461 i18nc(
"@action Jump to today",
"To &Today" ),
this );
462 action->setIconText( i18n(
"Today" ) );
463 action->setHelpText( i18n(
"Scroll to Today" ) );
464 mACollection->addAction(
QLatin1String(
"go_today"), action );
465 connect( action, SIGNAL(triggered(
bool)), mCalendarView, SLOT(goToday()) );
468 i18nc(
"scroll backward",
"&Backward" ),
this );
469 action->setIconText( i18nc(
"scroll backward",
"Back" ) );
470 action->setHelpText( i18n(
"Scroll Backward" ) );
471 mACollection->addAction(
QLatin1String(
"go_previous"), action );
472 connect( action, SIGNAL(triggered(
bool)), mCalendarView, SLOT(goPrevious()) );
483 i18nc(
"scroll forward",
"&Forward" ),
this );
484 action->setIconText( i18nc(
"scoll forward",
"Forward" ) );
485 action->setHelpText( i18n(
"Scroll Forward" ) );
487 connect( action, SIGNAL(triggered(
bool)), mCalendarView, SLOT(goNext()) );
493 action =
new KAction( KIcon(
QLatin1String(
"view-calendar-day") ), i18n(
"&Day" ),
this );
494 mACollection->addAction(
QLatin1String(
"select_day"), action );
499 mNextXDays =
new KAction( KIcon(
QLatin1String(
"view-calendar-upcoming-days") ),
QString(),
this );
501 mACollection->addAction(
QLatin1String(
"select_nextx"), mNextXDays );
503 SLOT(selectNextX()) );
504 mNextXDays->setText( i18np(
"&Next Day",
"&Next %1 Days",
KOPrefs::instance()->mNextXDays ) );
506 action =
new KAction( KIcon(
QLatin1String(
"view-calendar-workweek") ), i18n(
"W&ork Week" ),
this );
508 mACollection->addAction(
QLatin1String(
"select_workweek"), action );
510 SLOT(selectWorkWeek()) );
512 action =
new KAction( KIcon(
QLatin1String(
"view-calendar-week") ), i18n(
"&Week" ),
this );
514 mACollection->addAction(
QLatin1String(
"select_week"), action );
516 SLOT(selectWeek()) );
519 mNewEventAction =
new KAction( KIcon(
QLatin1String(
"appointment-new") ), i18n(
"New E&vent..." ),
this );
521 mNewEventAction->setHelpText( i18n(
"Create a new Event" ) );
523 mACollection->addAction(
QLatin1String(
"new_event"), mNewEventAction );
524 connect( mNewEventAction, SIGNAL(triggered(
bool)),
this,
525 SLOT(slotNewEvent()) );
527 mNewTodoAction =
new KAction( KIcon(
QLatin1String(
"task-new") ), i18n(
"New &To-do..." ),
this );
529 mNewTodoAction->setHelpText( i18n(
"Create a new To-do" ) );
530 mACollection->addAction(
QLatin1String(
"new_todo"), mNewTodoAction );
531 connect( mNewTodoAction, SIGNAL(triggered(
bool)),
this,
532 SLOT(slotNewTodo()) );
534 mNewSubtodoAction =
new KAction( i18n(
"New Su&b-to-do..." ),
this );
535 mACollection->addAction(
QLatin1String(
"new_subtodo"), mNewSubtodoAction );
536 connect( mNewSubtodoAction, SIGNAL(triggered(
bool)),
this,
537 SLOT(slotNewSubTodo()));
538 mNewSubtodoAction->setEnabled(
false );
539 connect( mCalendarView,SIGNAL(todoSelected(
bool)), mNewSubtodoAction,
540 SLOT(setEnabled(
bool)) );
542 mNewJournalAction =
new KAction( KIcon(
QLatin1String(
"journal-new") ), i18n(
"New &Journal..." ),
this );
544 mNewJournalAction->setHelpText( i18n(
"Create a new Journal" ) );
545 mACollection->addAction(
QLatin1String(
"new_journal"), mNewJournalAction );
546 connect( mNewJournalAction, SIGNAL(triggered(
bool)),
this,
547 SLOT(slotNewJournal()) );
549 mConfigureViewAction =
new KAction( KIcon(
QLatin1String(
"configure") ), i18n(
"Configure View..." ),
this );
550 mConfigureViewAction->setIconText( i18n(
"Configure" ) );
551 mConfigureViewAction->setHelpText( i18n(
"Configure the view" ) );
552 mConfigureViewAction->setEnabled( mCalendarView->
currentView() &&
554 mACollection->addAction(
QLatin1String(
"configure_view"), mConfigureViewAction );
555 connect( mConfigureViewAction, SIGNAL(triggered(
bool)), mCalendarView,
556 SLOT(configureCurrentView()) );
558 mShowIncidenceAction =
new KAction( i18n(
"&Show" ),
this );
559 mACollection->addAction(
QLatin1String(
"show_incidence"), mShowIncidenceAction );
560 connect( mShowIncidenceAction, SIGNAL(triggered(
bool)), mCalendarView,
563 mEditIncidenceAction =
new KAction( i18n(
"&Edit..." ),
this );
564 mACollection->addAction(
QLatin1String(
"edit_incidence"), mEditIncidenceAction );
565 connect( mEditIncidenceAction, SIGNAL(triggered(
bool)), mCalendarView,
568 mDeleteIncidenceAction =
new KAction( i18n(
"&Delete" ),
this );
569 mACollection->addAction(
QLatin1String(
"delete_incidence"), mDeleteIncidenceAction );
570 connect( mDeleteIncidenceAction, SIGNAL(triggered(
bool)), mCalendarView,
572 mDeleteIncidenceAction->setShortcut(
QKeySequence( Qt::Key_Delete ) );
574 action =
new KAction( i18n(
"&Make Sub-to-do Independent" ),
this );
575 mACollection->addAction(
QLatin1String(
"unsub_todo"), action );
576 connect( action, SIGNAL(triggered(
bool)), mCalendarView,
577 SLOT(todo_unsub()) );
578 action->setEnabled(
false );
579 connect( mCalendarView, SIGNAL(subtodoSelected(
bool)), action,
580 SLOT(setEnabled(
bool)) );
588 mPublishEvent =
new KAction( KIcon(
QLatin1String(
"mail-send") ), i18n(
"&Publish Item Information..." ),
this );
589 mACollection->addAction(
QLatin1String(
"schedule_publish"), mPublishEvent );
590 connect( mPublishEvent, SIGNAL(triggered(
bool)), mCalendarView, SLOT(schedule_publish()) );
591 mPublishEvent->setEnabled(
false );
594 new KAction( KIcon(
QLatin1String(
"mail-send") ), i18n(
"Send &Invitation to Attendees" ),
this );
595 mACollection->addAction(
QLatin1String(
"schedule_request"), mSendInvitation );
596 connect( mSendInvitation, SIGNAL(triggered(
bool)), mCalendarView, SLOT(schedule_request()) );
597 mSendInvitation->setEnabled(
false );
598 connect( mCalendarView, SIGNAL(organizerEventsSelected(
bool)),
599 mSendInvitation, SLOT(setEnabled(
bool)) );
601 mRequestUpdate =
new KAction( i18n(
"Re&quest Update" ),
this );
602 mACollection->addAction(
QLatin1String(
"schedule_refresh"), mRequestUpdate );
603 connect( mRequestUpdate, SIGNAL(triggered(
bool)), mCalendarView, SLOT(schedule_refresh()) );
604 mRequestUpdate->setEnabled(
false );
605 connect( mCalendarView, SIGNAL(groupEventsSelected(
bool)),
606 mRequestUpdate, SLOT(setEnabled(
bool)) );
608 mSendCancel =
new KAction( i18n(
"Send &Cancellation to Attendees" ),
this );
609 mACollection->addAction(
QLatin1String(
"schedule_cancel"), mSendCancel );
610 connect( mSendCancel, SIGNAL(triggered(
bool)), mCalendarView, SLOT(schedule_cancel()) );
611 mSendCancel->setEnabled(
false );
612 connect( mCalendarView, SIGNAL(organizerEventsSelected(
bool)),
613 mSendCancel, SLOT(setEnabled(
bool)) );
616 new KAction( KIcon(
QLatin1String(
"mail-reply-sender") ), i18n(
"Send Status &Update" ),
this );
617 mACollection->addAction(
QLatin1String(
"schedule_reply"), mSendStatusUpdate );
618 connect( mSendStatusUpdate, SIGNAL(triggered(
bool)), mCalendarView, SLOT(schedule_reply()) );
619 mSendStatusUpdate->setEnabled(
false );
620 connect( mCalendarView, SIGNAL(groupEventsSelected(
bool)),
621 mSendStatusUpdate, SLOT(setEnabled(
bool)) );
623 mRequestChange =
new KAction( i18nc(
"counter proposal",
"Request Chan&ge" ),
this );
624 mACollection->addAction(
QLatin1String(
"schedule_counter"), mRequestChange );
625 connect( mRequestChange, SIGNAL(triggered(
bool)), mCalendarView, SLOT(schedule_counter()) );
626 mRequestChange->setEnabled(
false );
627 connect( mCalendarView, SIGNAL(groupEventsSelected(
bool)),
628 mRequestChange, SLOT(setEnabled(
bool)) );
630 action =
new KAction( i18n(
"&Mail Free Busy Information..." ),
this );
631 mACollection->addAction(
QLatin1String(
"mail_freebusy"), action );
632 connect( action, SIGNAL(triggered(
bool)), mCalendarView, SLOT(mailFreeBusy()) );
633 action->setEnabled(
true );
635 mForwardEvent =
new KAction( KIcon(
QLatin1String(
"mail-forward") ), i18n(
"&Send as iCalendar..." ),
this );
636 mACollection->addAction(
QLatin1String(
"schedule_forward"), mForwardEvent );
637 connect( mForwardEvent, SIGNAL(triggered(
bool)), mCalendarView, SLOT(schedule_forward()) );
638 mForwardEvent->setEnabled(
false );
640 action =
new KAction( i18n(
"&Upload Free Busy Information" ),
this );
641 mACollection->addAction(
QLatin1String(
"upload_freebusy"), action );
642 connect( action, SIGNAL(triggered(
bool)), mCalendarView, SLOT(uploadFreeBusy()) );
643 action->setEnabled(
true );
646 action =
new KAction( KIcon(
QLatin1String(
"help-contents") ), i18n(
"&Address Book" ),
this );
647 mACollection->addAction(
QLatin1String(
"addressbook"), action );
648 connect( action, SIGNAL(triggered(
bool)), mCalendarView, SLOT(openAddressbook()) );
654 mDateNavigatorShowAction =
new KToggleAction( i18n(
"Show Date Navigator" ),
this );
655 mACollection->addAction(
QLatin1String(
"show_datenavigator"), mDateNavigatorShowAction );
658 mTodoViewShowAction =
new KToggleAction( i18n(
"Show To-do View" ),
this );
659 mACollection->addAction(
QLatin1String(
"show_todoview"), mTodoViewShowAction );
662 mEventViewerShowAction =
new KToggleAction( i18n(
"Show Item Viewer" ),
this );
663 mACollection->addAction(
QLatin1String(
"show_eventviewer"), mEventViewerShowAction );
666 mDateNavigatorShowAction->setChecked( config.readEntry(
"DateNavigatorVisible",
true ) );
670 mTodoViewShowAction->setChecked(
671 config.readEntry(
"TodoViewVisible",
false ) );
672 mEventViewerShowAction->setChecked( config.readEntry(
"EventViewerVisible",
true ) );
678 mCollectionViewShowAction =
new KToggleAction( i18n(
"Show Calendar Manager" ),
this );
679 mACollection->addAction(
QLatin1String(
"show_resourceview"), mCollectionViewShowAction );
681 mCollectionViewShowAction->setChecked( config.readEntry(
"ResourceViewVisible",
true ) );
687 mHideMenuBarAction = KStandardAction::showMenubar(
this, SLOT(
toggleMenubar()), mACollection );
691 action =
new KAction( i18n(
"Configure &Date && Time..." ),
this );
692 mACollection->addAction(
QLatin1String(
"conf_datetime"), action );
693 connect( action, SIGNAL(triggered(
bool)),
700 action =
new KAction( KIcon(
QLatin1String(
"view-filter") ), i18n(
"Manage View &Filters..." ),
this );
701 mACollection->addAction(
QLatin1String(
"edit_filters"), action );
702 connect( action, SIGNAL(triggered(
bool)), mCalendarView,
703 SLOT(editFilters()) );
705 action =
new KAction( i18n(
"Manage C&ategories..." ),
this );
706 mACollection->addAction(
QLatin1String(
"edit_categories"), action );
708 SLOT(showCategoryEditDialog()) );
711 action =
new KAction( KIcon(
QLatin1String(
"configure") ), i18n(
"&Configure KOrganizer..." ),
this );
712 mACollection->addAction(
QLatin1String(
"korganizer_configure"), action );
713 connect( action, SIGNAL(triggered(
bool)), mCalendarView,
714 SLOT(edit_options()) );
715 mACollection->addAction( KStandardAction::KeyBindings,
QLatin1String(
"korganizer_configure_shortcuts"),
718 KStandardAction::preferences( mCalendarView, SLOT(edit_options()), mACollection );
719 KStandardAction::keyBindings(
this, SLOT(
keyBindings()), mACollection );
723 QAction *a = mACollection->addAction( KStandardAction::TipofDay,
this,
725 mACollection->addAction(
QLatin1String(
"help_tipofday"), a );
730 mFilterAction->setItems( lst );
731 mFilterAction->setCurrentItem( idx );
734 void ActionManager::slotResourcesAddedRemoved()
736 restoreCollectionViewSetting();
739 void ActionManager::slotDefaultResourceChanged(
const Akonadi::Collection &collection )
744 void ActionManager::slotNewEvent()
749 void ActionManager::slotNewTodo()
751 mCalendarView->
newTodo( selectedCollection() );
754 void ActionManager::slotNewSubTodo()
756 mCalendarView->
newSubTodo( selectedCollection() );
759 void ActionManager::slotNewJournal()
761 mCalendarView->
newJournal( selectedCollection() );
764 void ActionManager::slotMergeFinished(
bool success,
int total)
768 mImportAction->setEnabled(
true);
769 Akonadi::ICalImporter *importer = qobject_cast<Akonadi::ICalImporter*>(
sender());
772 mCalendarView->
showMessage(i18np(
"1 incidence was imported successfully.",
"%1 incidences were imported successfully.", total), KMessageWidget::Information);
774 mCalendarView->
showMessage(i18n(
"There was an error while merging the calendar: %1", importer->errorMessage()), KMessageWidget::Error);
778 void ActionManager::slotNewResourceFinished(
bool success)
782 Akonadi::ICalImporter *importer = qobject_cast<Akonadi::ICalImporter*>(
sender());
783 mImportAction->setEnabled(
true);
785 mCalendarView->
showMessage(i18n(
"New calendar added successfully"), KMessageWidget::Information);
787 mCalendarView->
showMessage(i18n(
"Could not add a calendar. Error: %1", importer->errorMessage()), KMessageWidget::Error);
797 restoreCollectionViewSetting();
800 void ActionManager::restoreCollectionViewSetting()
802 mCollectionSelectionModelStateSaver->restoreState();
803 mCollectionViewStateSaver->restoreState();
811 if ( mDateNavigatorShowAction ) {
812 config.writeEntry(
"DateNavigatorVisible", mDateNavigatorShowAction->isChecked() );
815 if ( mTodoViewShowAction ) {
816 config.writeEntry(
"TodoViewVisible", mTodoViewShowAction->isChecked() );
819 if ( mCollectionViewShowAction ) {
820 config.writeEntry(
"ResourceViewVisible", mCollectionViewShowAction->isChecked() );
823 if ( mEventViewerShowAction ) {
824 config.writeEntry(
"EventViewerVisible", mEventViewerShowAction->isChecked() );
827 mCollectionViewStateSaver->saveState();
828 mCollectionSelectionModelStateSaver->saveState();
832 selectionGroup.sync();
833 selectionViewGroup.sync();
854 if ( url.isEmpty() ) {
860 if ( ( 0 != korg )&&( korg != mMainWindow ) ) {
867 kDebug() << url.prettyUrl();
878 KTemporaryFile tmpfn;
885 i18n(
"You have no ical file in your home directory.\n"
886 "Import cannot proceed.\n" ) );
892 retVal = proc.execute();
895 kDebug() <<
"Error executing ical2vcal.";
899 kDebug() <<
"ical2vcal return value:" << retVal;
901 if ( retVal >= 0 && retVal <= 2 ) {
903 const bool success =
importURL(KUrl(tmpfn.fileName()),
true);
905 mCalendarView->
showMessage( i18n(
"KOrganizer encountered some unknown fields while "
906 "parsing your .calendar ical file, and had to "
907 "discard them; please check to see that all "
908 "your relevant data was correctly imported." ), KMessageWidget::Warning);
913 }
else if ( retVal == -1 ) {
914 mCalendarView->
showMessage( i18n(
"KOrganizer encountered an error parsing your "
915 ".calendar file from ical; import has failed." ), KMessageWidget::Error );
916 }
else if ( retVal == -2 ) {
917 mCalendarView->
showMessage( i18n(
"KOrganizer does not think that your .calendar "
918 "file is a valid ical calendar; import has failed." ), KMessageWidget::Error );
924 const KUrl
url = KFileDialog::getOpenUrl( KStandardDirs::locateLocal(
"data",
QLatin1String(
"korganizer/") ),
927 if ( !url.isEmpty() ) {
939 Akonadi::ICalImporter *importer =
new Akonadi::ICalImporter();
942 connect(importer, SIGNAL(importIntoExistingFinished(
bool,
int)), SLOT(slotMergeFinished(
bool,
int))),
943 jobStarted = importer->importIntoExistingResource(url, Akonadi::Collection());
945 connect(importer, SIGNAL(importIntoNewFinished(
bool)), SLOT(slotNewResourceFinished(
bool)));
946 jobStarted = importer->importIntoNewResource(url.path());
950 mImportAction->setEnabled(
false);
953 if (!importer->errorMessage().isEmpty())
954 mCalendarView->
showMessage(i18n(
"An error occurred: %1", importer->errorMessage()), KMessageWidget::Error);
964 if ( mURL.isLocalFile() ) {
965 ext = mFile.
right( 4 );
967 ext = mURL.fileName().right( 4 );
971 int result = KMessageBox::warningContinueCancel(
973 i18n(
"Your calendar will be saved in iCalendar format. Use "
974 "'Export vCalendar' to save in vCalendar format." ),
975 i18n(
"Format Conversion" ), KGuiItem( i18n(
"Proceed" ) ),
976 KStandardGuiItem::cancel(),
977 QLatin1String(
"dontaskFormatConversion" ), KMessageBox::Notify );
978 if ( result != KMessageBox::Continue ) {
982 QString filename = mURL.fileName();
984 mURL.setFileName( filename );
985 if ( mURL.isLocalFile() ) {
986 mFile = mURL.toLocalFile();
992 kDebug() <<
"calendar view save failed.";
996 if ( !mURL.isLocalFile() ) {
997 if ( !KIO::NetAccess::upload( mFile, mURL,
view() ) ) {
998 QString msg = i18n(
"Cannot upload calendar to '%1'",
1005 mMainWindow->
showStatusMessage( i18n(
"Saved calendar '%1'.", mURL.prettyUrl() ) );
1012 HTMLExportSettings *settings =
new HTMLExportSettings(
QLatin1String(
"KOrganizer") );
1013 mSettingsToFree.
insert( settings );
1016 settings->readConfig();
1021 if ( settings->monthView() ) {
1026 settings->setDateStart(
QDateTime( qd1 ) );
1027 settings->setDateEnd(
QDateTime( qd2 ) );
1035 kWarning() <<
"Settings is null" << settings;
1039 if ( settings->outputFile().isEmpty() ) {
1040 int result = KMessageBox::questionYesNo(
1042 i18n(
"The HTML calendar export file has not been specified yet.\n"
1043 "Do you want to set it now?\n\n"
1044 "If you answer \"no\" then this export operation will be canceled" ),
1046 if ( result == KMessageBox::No ) {
1048 i18nc(
"@info:status",
1049 "Calendar HTML operation canceled due to unspecified output file name" ) );
1054 KFileDialog::getSaveFileName(
1055 KGlobalSettings::documentPath(),
1056 i18n(
"*.html|HTML Files" ),
1058 i18n(
"Select path for HTML calendar export" ), KFileDialog::ConfirmOverwrite );
1059 settings->setOutputFile( fileName );
1060 settings->writeConfig();
1063 if ( !autoMode &&
QFileInfo( settings->outputFile() ).exists() ) {
1064 if ( KMessageBox::warningContinueCancel(
1066 i18n(
"Do you want to overwrite file \"%1\"?",
1067 settings->outputFile() ),
1069 KStandardGuiItem::overwrite() ) == KMessageBox::Cancel ) {
1071 i18nc(
"@info:status",
1072 "Calendar HTML operation canceled due to output file overwrite" ) );
1077 settings->setEMail( CalendarSupport::KCalPrefs::instance()->email() );
1078 settings->setName( CalendarSupport::KCalPrefs::instance()->fullName() );
1081 settings->setCreditURL(
QLatin1String(
"http://korganizer.kde.org") );
1087 settings->dateStart().date(), settings->dateEnd().date() );
1088 foreach (
const KHolidays::Holiday &holiday, holidays ) {
1089 exportJob->
addHoliday( holiday.date(), holiday.text() );
1093 connect( exportJob, SIGNAL(result(
KJob*)), SLOT(handleExportJobResult(
KJob*)) );
1099 kDebug() << url.prettyUrl();
1101 if ( url.isEmpty() ) {
1102 kDebug() <<
"Empty URL.";
1105 if ( !url.isValid() ) {
1106 kDebug() <<
"Malformed URL.";
1111 KUrl URLOrig = mURL;
1113 KTemporaryFile *tempFile = 0;
1114 if ( url.isLocalFile() ) {
1115 mFile = url.toLocalFile();
1117 tempFile =
new KTemporaryFile;
1118 tempFile->setAutoRemove(
false);
1120 mFile = tempFile->fileName();
1127 mTempFile = tempFile;
1128 KIO::NetAccess::removeTempFile( fileOrig );
1132 i18n(
"Unable to save calendar to the file %1.", mFile ),
1134 kDebug() <<
"failed";
1143 #ifdef AKONADI_PORT_DISABLED // can go away, kept for reference
1144 bool ActionManager::saveModifiedURL()
1149 if ( !mCalendarView->isModified() ) {
1153 mHtmlExportSync =
true;
1158 int result = KMessageBox::warningYesNoCancel(
1160 i18n(
"The calendar has been modified.\nDo you want to save it?" ),
1162 KStandardGuiItem::save(), KStandardGuiItem::discard() );
1164 case KMessageBox::Yes:
1165 if ( mURL.isEmpty() ) {
1171 case KMessageBox::No:
1173 case KMessageBox::Cancel:
1176 mHtmlExportSync =
false;
1187 KFileDialog::getSaveUrl( KStandardDirs::locateLocal(
"data",
QLatin1String(
"korganizer/") ),
1188 i18n(
"*.ics *.vcs|Calendar Files" ),
1191 if ( url == KUrl() ) {
1195 QString filename = url.fileName();
1203 url.setFileName( filename );
1205 kDebug() <<
"url:" << url.url();
1214 config.writeEntry(
"UseResourceCalendar", !mMainWindow->
hasDocument() );
1216 config.writePathEntry(
"Calendar", mURL.url() );
1222 mMainWindow->
init(
false );
1229 mNextXDays->setText( i18np(
"&Next Day",
"&Next %1 Days",
1236 KPIM::ReminderClient::hideDaemon();
1238 KPIM::ReminderClient::showDaemon();
1243 #ifdef AKONADI_PORT_DISABLED // shouldn't be required anymore
1244 if ( mCollectionView ) {
1245 mCollectionView->updateView();
1255 if ( !proc.startDetached() ) {
1257 i18n(
"Could not start control module for date and time format." ) );
1268 KConfigGroup config( KGlobal::config(),
"TipOfDay" );
1269 KTipDialog::setShowOnStart( config.readEntry(
"RunOnStart",
false ) );
1275 if ( mWindowList ) {
1276 if ( url.isEmpty() ) {
1292 void ActionManager::dumpText(
const QString &str )
1299 bool visible = mDateNavigatorShowAction->isChecked();
1300 if ( mCalendarView ) {
1307 bool visible = mTodoViewShowAction->isChecked();
1308 if ( mCalendarView ) {
1315 bool visible = mEventViewerShowAction->isChecked();
1316 if ( mCalendarView ) {
1323 const bool visible = mCollectionViewShowAction->isChecked();
1324 if ( mCollectionView ) {
1326 mCollectionView->
show();
1328 mCollectionView->
hide();
1365 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
1370 if ( !mainWindow ) {
1371 kError() <<
"Unable to find default calendar resources view.";
1373 }
else if ( args->count() <= 0 ) {
1381 if ( args->isSet(
"import" ) ) {
1382 for (
int i = 0; i < args->count(); ++i ) {
1385 }
else if ( args->isSet(
"merge" ) ) {
1386 for (
int i = 0; i < args->count(); ++i ) {
1390 for (
int i = 0; i < args->count(); ++i ) {
1411 KNS3::DownloadDialog dialog(mCalendarView);
1413 foreach (
const KNS3::Entry &e, dialog.installedEntries() ) {
1414 kDebug() <<
" downloadNewStuff :";
1416 if ( lstFile.
count() != 1 ) {
1420 const KUrl filename( file );
1421 kDebug() <<
"filename :" << filename;
1422 if( ! filename.isValid() ) {
1426 KCalCore::FileStorage storage( calendar() );
1427 storage.setFileName( file );
1428 storage.setSaveFormat(
new KCalCore::ICalFormat );
1429 if ( !storage.load() ) {
1430 KMessageBox::error( mCalendarView, i18n(
"Could not load calendar %1.", file ) );
1433 KCalCore::Event::List events = calendar()->events();
1434 foreach ( KCalCore::Event::Ptr
event, events ) {
1435 eventSummaries.
append( event->summary() );
1438 const int result = KMessageBox::warningContinueCancelList( mCalendarView,
1439 i18n(
"The downloaded events will be merged into your current calendar." ),
1442 if ( result != KMessageBox::Continue ) {
1458 class ActionManager::ActionStringsVisitor :
public KCalCore::Visitor
1461 ActionStringsVisitor() : mShow( 0 ), mEdit( 0 ), mDelete( 0 ) {}
1468 return incidence->accept( *
this, incidence );
1472 bool visit( KCalCore::Event::Ptr )
1475 mShow->
setText( i18n(
"&Show Event" ) );
1478 mEdit->setText( i18n(
"&Edit Event..." ) );
1481 mDelete->setText( i18n(
"&Delete Event" ) );
1486 bool visit( KCalCore::Todo::Ptr )
1489 mShow->setText( i18n(
"&Show To-do" ) );
1492 mEdit->setText( i18n(
"&Edit To-do..." ) );
1495 mDelete->setText( i18n(
"&Delete To-do" ) );
1500 bool visit( KCalCore::Journal::Ptr )
1502 return assignDefaultStrings();
1505 bool visit( KCalCore::FreeBusy::Ptr )
1511 bool assignDefaultStrings()
1514 mShow->setText( i18n(
"&Show" ) );
1517 mEdit->setText( i18n(
"&Edit..." ) );
1520 mDelete->setText( i18n(
"&Delete" ) );
1534 const KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
1536 enableIncidenceActions(
false );
1540 enableIncidenceActions(
true );
1542 if ( !mCalendarView->
calendar()->hasRight( item, Akonadi::Collection::CanDeleteItem ) ) {
1543 mCutAction->setEnabled(
false );
1544 mDeleteAction->setEnabled(
false );
1547 ActionStringsVisitor v;
1548 if ( !v.act( incidence, mShowIncidenceAction, mEditIncidenceAction, mDeleteIncidenceAction ) ) {
1549 mShowIncidenceAction->setText( i18n(
"&Show" ) );
1550 mEditIncidenceAction->setText( i18n(
"&Edit..." ) );
1551 mDeleteIncidenceAction->setText( i18n(
"&Delete" ) );
1555 void ActionManager::enableIncidenceActions(
bool enabled )
1557 mShowIncidenceAction->setEnabled( enabled );
1558 mEditIncidenceAction->setEnabled( enabled );
1559 mDeleteIncidenceAction->setEnabled( enabled );
1561 mCutAction->setEnabled( enabled );
1562 mCopyAction->setEnabled( enabled );
1563 mDeleteAction->setEnabled( enabled );
1564 mPublishEvent->setEnabled( enabled );
1565 mForwardEvent->setEnabled( enabled );
1566 mSendInvitation->setEnabled( enabled );
1567 mSendCancel->setEnabled( enabled );
1568 mSendStatusUpdate->setEnabled( enabled );
1569 mRequestChange->setEnabled( enabled );
1570 mRequestUpdate->setEnabled( enabled );
1573 Akonadi::Collection ActionManager::selectedCollection()
const
1577 return Akonadi::Collection();
1580 return index.
data( Akonadi::EntityTreeModel::CollectionRole ).
value<Akonadi::Collection>();
1585 KShortcutsDialog dlg( KShortcutsEditor::AllActions,
1586 KShortcutsEditor::LetterShortcutsDisallowed,
view() );
1587 if ( mMainWindow ) {
1593 dlg.addCollection( part->actionCollection(), part->
shortInfo() );
1618 mCalendarView->
newEvent( summary, description, attachments );
1626 mCalendarView->
newEvent( summary, description, attachments, attendees );
1634 const QString &attachmentMimetype )
1636 int action = IncidenceEditorNG::GlobalSettings::self()->defaultEmailAttachMethod();
1637 if ( attachmentMimetype !=
QLatin1String(
"message/rfc822") ) {
1638 action = IncidenceEditorNG::GlobalSettings::Link;
1639 }
else if ( IncidenceEditorNG::GlobalSettings::self()->defaultEmailAttachMethod() ==
1640 IncidenceEditorNG::GlobalSettings::Ask ) {
1641 KMenu *menu =
new KMenu( 0 );
1642 QAction *attachLink = menu->addAction( i18n(
"Attach as &link" ) );
1643 QAction *attachInline = menu->addAction( i18n(
"Attach &inline" ) );
1644 QAction *attachBody = menu->addAction( i18n(
"Attach inline &without attachments" ) );
1645 menu->addSeparator();
1646 menu->addAction( KIcon(
QLatin1String(
"dialog-cancel") ), i18n(
"C&ancel" ) );
1651 if ( ret == attachLink ) {
1652 action = IncidenceEditorNG::GlobalSettings::Link;
1653 }
else if ( ret == attachInline ) {
1654 action = IncidenceEditorNG::GlobalSettings::InlineFull;
1655 }
else if ( ret == attachBody ) {
1656 action = IncidenceEditorNG::GlobalSettings::InlineBody;
1664 tf.setAutoRemove(
true );
1666 case IncidenceEditorNG::GlobalSettings::Link:
1669 case IncidenceEditorNG::GlobalSettings::InlineFull:
1672 case IncidenceEditorNG::GlobalSettings::InlineBody:
1675 if ( !f.
open( QFile::ReadOnly ) ) {
1678 KMime::Message *msg =
new KMime::Message();
1679 msg->setContent( f.
readAll() );
1681 if ( msg == msg->textContent() || msg->textContent() == 0 ) {
1684 if ( KMessageBox::warningContinueCancel(
1686 i18n(
"Removing attachments from an email might invalidate its signature." ),
1687 i18n(
"Remove Attachments" ), KStandardGuiItem::cont(), KStandardGuiItem::cancel(),
1688 QLatin1String(
"BodyOnlyInlineAttachment") ) != KMessageBox::Continue ) {
1692 KMime::Message *newMsg =
new KMime::Message();
1693 newMsg->setHead( msg->head() );
1694 newMsg->setBody( msg->textContent()->body() );
1696 newMsg->contentTransferEncoding()->from7BitString(
1697 msg->textContent()->contentTransferEncoding()->as7BitString() );
1698 newMsg->contentType()->from7BitString( msg->textContent()->contentType()->as7BitString() );
1700 tf.write( newMsg->encodedContent() );
1701 attData = tf.fileName();
1713 action != IncidenceEditorNG::GlobalSettings::Link );
1718 mCalendarView->
newTodo( text );
1725 mCalendarView->
newTodo( summary, description, attachments );
1732 mCalendarView->
newTodo( summary, description, attachments, attendees );
1740 const QString &attachmentMimetype )
1743 if ( attachmentMimetype !=
QLatin1String(
"message/rfc822") ) {
1744 action = KOPrefs::TodoAttachLink;
1745 }
else if (
KOPrefs::instance()->defaultTodoAttachMethod() == KOPrefs::TodoAttachAsk ) {
1746 KMenu *menu =
new KMenu( 0 );
1747 QAction *attachLink = menu->addAction( i18n(
"Attach as &link" ) );
1748 QAction *attachInline = menu->addAction( i18n(
"Attach &inline" ) );
1749 menu->addSeparator();
1750 menu->addAction( KIcon(
QLatin1String(
"dialog-cancel") ), i18n(
"C&ancel" ) );
1755 if ( ret == attachLink ) {
1756 action = KOPrefs::TodoAttachLink;
1757 }
else if ( ret == attachInline ) {
1758 action = KOPrefs::TodoAttachInlineFull;
1766 case KOPrefs::TodoAttachLink:
1769 case KOPrefs::TodoAttachInlineFull:
1778 action != KOPrefs::TodoAttachLink );
1813 mCalendarView->
goDate( date );
1818 goDate( KGlobal::locale()->readDate( date ) );
1830 if ( history->undoAvailable() ) {
1831 mUndoAction->setEnabled(
true );
1832 mUndoAction->setText( i18n(
"Undo: %1", history->nextUndoDescription() ) );
1834 mUndoAction->setEnabled(
false );
1835 mUndoAction->setText( i18n(
"Undo" ) );
1838 if ( history->redoAvailable() ) {
1839 mRedoAction->setEnabled(
true );
1840 mRedoAction->setText( i18n(
"Redo: %1", history->nextRedoDescription() ) );
1842 mRedoAction->setEnabled(
false );
1843 mRedoAction->setText( i18n(
"Redo" ) );
1846 mUndoAction->setIconText( i18n(
"Undo" ) );
1856 if ( !url.isValid() ) {
1858 i18n(
"URL '%1' is invalid.", url.prettyUrl() ) );
1864 "<p>Would you like to merge this calendar item into an existing calendar "
1865 "or use it to create a brand new calendar?</p>"
1866 "<p>If you select merge, then you will be given the opportunity to select "
1867 "the destination calendar.</p>"
1868 "<p>If you select add, then a new calendar will be created for you automatically.</p>" );
1871 KMessageBox::questionYesNoCancel(
1874 i18nc(
"@title:window",
"Import Calendar" ),
1875 KGuiItem( i18n(
"Merge into existing calendar" ) ),
1876 KGuiItem( i18n(
"Add as new calendar" ) ) );
1879 case KMessageBox::Yes:
1882 case KMessageBox::No:
1892 if ( CalendarSupport::KCalPrefs::instance()->mAutoArchive ) {
1893 mAutoArchiveTimer->
start( 4 * 60 * 60 * 1000 );
1895 mAutoArchiveTimer->
stop();
1901 if ( !mCalendarView->
calendar() ) {
1905 mAutoArchiveTimer->
stop();
1906 CalendarSupport::EventArchiver archiver;
1908 archiver.runAuto( calendar(), mCalendarView->
incidenceChanger(), mCalendarView,
false );
1937 bool attachmentIsInline )
1939 Q_UNUSED( summary );
1940 Q_UNUSED( description );
1941 Q_UNUSED( attachmentUris );
1942 Q_UNUSED( attendees );
1943 Q_UNUSED( attachmentMimetypes );
1944 Q_UNUSED( attachmentIsInline );
1945 kWarning() <<
"Not implemented in korg-desktop";
1953 bool attachmentIsInline )
1955 Q_UNUSED( summary );
1956 Q_UNUSED( description );
1957 Q_UNUSED( attachmentUris );
1958 Q_UNUSED( attendees );
1959 Q_UNUSED( attachmentMimetypes );
1960 Q_UNUSED( attachmentIsInline );
1961 kWarning() <<
"Not implemented in korg-desktop";
1964 void ActionManager::handleExportJobResult(
KJob *job )
1967 Q_ASSERT( htmlExportJob );
bool editIncidence(Akonadi::Item::Id id)
void setText(const QString &text)
void toggleResourceView()
void toggleDateNavigator()
bool deleteIncidence(const Akonadi::Item &item, bool force=false)
Delete the supplied incidence.
virtual bool supportsDateRangeSelection()
returns whether this view supports date range selection Base implementation returns true...
void configChanged()
When change is made to options dialog, the topwidget will catch this and emit this signal which notif...
void newEvent(const QDate &)
void importCalendar(const KUrl &url)
bool importURL(const KUrl &url, bool merge)
virtual void setTitle()=0
Set window title.
void openTodoEditor(const QString &)
bool mergeURL(const QString &url)
Open calendar file from URL.
void readProperties(const KConfigGroup &)
void showDateNavigator(bool)
virtual Akonadi::IncidenceChanger * incidenceChanger() const
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
ActionManager(KXMLGUIClient *client, CalendarView *widget, QObject *parent, KOrg::MainWindow *mainWindow, bool isPart, KMenuBar *menuBar=0)
bool addIncidence(const QString &ical)
Add an incidence to the active calendar.
KUrl getSaveURL()
Get URL for saving.
KOrg::Part::List loadParts(KOrg::MainWindow *parent)
void removeWindow(KOrg::MainWindow *)
Unregister a main window.
const T & at(int i) const
virtual void init(bool hasDocument)
Akonadi::EntityTreeView * view() const
bool editIncidence(const Akonadi::Item &item, bool isCounter=false)
Create an editor for the supplied incidence.
bool registerObject(const QString &path, QObject *object, QFlags< QDBusConnection::RegisterOption > options)
QWidget * dialogParent()
Return widget used as parent for dialogs and message boxes.
void goDate(const QDate &date)
Move the current view date to the specified date.
void writeSettings()
write current state to config file.
This class manages a list of KOrganizer instances, each associated with a window displaying a calenda...
void unloadParts(KOrg::MainWindow *parent, KOrg::Part::List &parts)
Unload the parts in &p parts for this main window.
virtual bool hasConfigurationDialog() const
QDBusConnection sessionBus()
void exportHTML()
Export the calendar to an HTML file.
void saveProperties(KConfigGroup &)
void file_icalimport()
import a non-ics calendar from another program like ical.
const_iterator insert(const T &value)
bool openURL(const QString &url)
Open calendar file from URL.
KHolidays::HolidayRegion * holidays() const
return the HolidayRegion object or 0 if none has been defined
bool saveCalendar(const QString &filename)
Save calendar data to file.
virtual ActionManager * actionManager()=0
Return ActionManager of this main window.
AkonadiCollectionView * collectionView() const
virtual bool event(QEvent *e)
void archiveCalendar()
Archive old events of calendar.
void updateConfig()
Options dialog made a changed to the configuration.
int count(const T &value) const
void append(const T &value)
KODialogManager * dialogManager() const
This is the main calendar widget.
Akonadi::ETMCalendar::Ptr calendar() const
QDate addMonths(int nmonths) const
void updateUndoRedoActions()
void addWindow(KOrg::MainWindow *)
Register a main window.
static KOrg::MainWindow * findInstance(const KUrl &url)
Is there a instance with this URL?
void addHoliday(const QDate &date, const QString &name)
void setObjectName(const QString &name)
void showTipOnStart()
Show tip of the day.
CalendarView * view() const
void showIncidence(const Akonadi::Item &item)
Create a read-only viewer dialog for the supplied incidence.
bool showIncidence(Akonadi::Item::Id id)
virtual KActionCollection * getActionCollection() const =0
Return actionCollection of this main window.
void addExtension(CalendarViewExtension::Factory *)
Adds a calendar view extension widget.
void openEventEditor(const QString &)
interface for korganizer main window
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
void newTodo()
create new todo
void openJournalEditor(const QDate &date)
QString right(int n) const
KOrg::BaseView * currentView() const
HTMLExportSettings * settings() const
KOrg::MainWindow * defaultInstance()
Return default instance.
bool saveAsURL(const KUrl &kurl)
Save calendar file to URL.
void processIncidenceSelection(const Akonadi::Item &item, const QDate &date)
void showEventViewer(bool)
void configureDateTime()
Open kcontrol module for configuring date and time formats.
bool contains(const T &value) const
static KOGlobals * self()
void showDate(const QDate &date)
Show the given date without changing date selection length.
void goDate(const QDate &)
QString & replace(int position, int n, QChar after)
virtual QWidget * topLevelWidget()=0
Return widget whcih represents this main window.
virtual bool deleteIncidence(Akonadi::Item::Id id, bool force=false)
Delete the incidence with the given unique id from current calendar.
void showIncidenceContext(const Akonadi::Item &incidence)
Show an incidence in context.
bool remove(const T &value)
QVariant data(int role) const
void showMessage(const QString &message, KMessageWidget::MessageType)
void readSettings()
Using the KConfig associated with the kapp variable, read in the settings from the config file...
bool showIncidenceContext(Akonadi::Item::Id id)
Show an incidence in context.
void file_import()
import a generic ics file
bool handleCommandLine()
Called by KOrganizerUniqueAppHandler in the kontact plugin Returns true if the command line was succe...
KOrg::MainWindow * findInstance(const KUrl &url)
Is there a instance with this URL?
Akonadi::History * history() const
void toggleMenubar(bool dontShowWarning=false)
virtual void showStatusMessage(const QString &message)=0
Show status message in status bar.
static KOPrefs * instance()
Get instance of KOPrefs.
void showDate(const QDate &date)
bool saveURL()
Save calendar file to URL of current calendar.
void writeSettings()
Write current state to config file.
void setItems(const QStringList &, int)
QDate addDays(int ndays) const
void setCollectionSelectionProxyModel(KCheckableProxyModel *)
void slotAutoArchive()
called by the auto archive timer to automatically delete/archive events
KUrl url() const
Get current URL.
virtual bool supportsZoom()
returns whether this view supports zoom.
QString getCurrentURLasString() const
Get current URL as QString.
void showTip()
Show tip of the day.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void checkClipboard()
Check if clipboard contains vCalendar event.
bool addIncidence(const QString &ical)
Add an incidence to the active calendar.
void createCalendarAkonadi()
Create Calendar object based on the akonadi framework and set it on the view.
void checkAutoExport()
called by the autoExportTimer to automatically export the calendar
This class provides the functions to export a calendar as a HTML page.
void file_archive()
delete or archive old entries in your calendar for speed/space.
void init()
Peform initialization that requires this* to be full constructed.
KOViewManager * viewManager() const
void file_open()
open new window
virtual QString shortInfo()=0
short name of the part, used as category in the keybindings dialog
void slotAutoArchivingSettingsModified()
connected to CalendarView's signal which comes from the ArchiveDialog
The factory for AkonadiCollectionView instances.