EventViews::EventView Class
class EventViews::EventViewAbstract class from which all event views are derived. Author: Preston Brown <pbrown@kde.org>. More...
| Header: | #include <EventViews/EventView> |
| CMake: | find_package(KPim6 REQUIRED COMPONENTS EventViews)target_link_libraries(mytarget PRIVATE KPim6::EventViews) |
| Inherited By: | EventViews::AgendaView, EventViews::JournalView, EventViews::ListView, EventViews::MonthView, EventViews::MultiAgendaView, EventViews::TimelineView, EventViews::TodoView, and EventViews::WhatsNextView |
Public Functions
| EventView(QWidget *parent = nullptr) | |
| virtual | ~EventView() override |
| QDateTime | actualEndDateTime() const |
| QDateTime | actualStartDateTime() const |
| virtual void | addCalendar(const Akonadi::CollectionCalendar::Ptr &calendar) |
| Akonadi::CollectionCalendar::Ptr | calendarForCollection(Akonadi::Collection::Id collectionId) const |
| Akonadi::CollectionCalendar::Ptr | calendarForCollection(const Akonadi::Collection &collection) const |
| EventViews::EventView::Changes | changes() const |
| CalendarSupport::CollectionSelection * | collectionSelection() const |
| virtual int | currentDateCount() const = 0 |
| CalendarSupport::CollectionSelection * | customCollectionSelection() const |
| KCheckableProxyModel * | customCollectionSelectionProxyModel() const |
| bool | dateRangeSelectionEnabled() const |
| QDateTime | endDateTime() const |
| Akonadi::EntityTreeModel * | entityTreeModel() const |
| virtual bool | eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay) const |
| virtual bool | hasConfigurationDialog() const |
| QString | iconForItem(const Akonadi::Item &) |
| QByteArray | identifier() const |
| EventViews::KCalPrefsPtr | kcalPreferences() const |
| QAbstractItemModel * | model() const |
| EventViews::PrefsPtr | preferences() const |
| bool | processKeyEvent(QKeyEvent *) |
| virtual void | removeCalendar(const Akonadi::CollectionCalendar::Ptr &calendar) |
| void | restoreConfig(const KConfigGroup &configGroup) |
| void | saveConfig(KConfigGroup &configGroup) |
| virtual KCalendarCore::DateList | selectedIncidenceDates() const = 0 |
| virtual Akonadi::Item::List | selectedIncidences() const = 0 |
| virtual QDateTime | selectionEnd() const |
| virtual QDateTime | selectionStart() const |
| virtual void | setChanges(EventViews::EventView::Changes changes) |
| void | setCustomCollectionSelectionProxyModel(KCheckableProxyModel *model) |
| virtual void | setDateRange(const QDateTime &start, const QDateTime &end, const QDate &preferredMonth = QDate()) |
| void | setDateRangeSelectionEnabled(bool enable) |
| void | setIdentifier(const QByteArray &identifier) |
| virtual void | setKCalPreferences(const EventViews::KCalPrefsPtr &preferences) |
| virtual void | setModel(QAbstractItemModel *model) |
| virtual void | setPreferences(const EventViews::PrefsPtr &preferences) |
| virtual void | showConfigurationDialog(QWidget *parent) |
| int | showMoveRecurDialog(const KCalendarCore::Incidence::Ptr &incidence, QDate date) |
| QDateTime | startDateTime() const |
| virtual bool | supportsZoom() const |
| KCheckableProxyModel * | takeCustomCollectionSelectionProxyModel() |
| virtual EventViews::EventView * | viewAt(const QPoint &p) |
Public Slots
| virtual void | clearSelection() |
| virtual void | dayPassed(const QDate &) |
| void | defaultAction(const Akonadi::Item &item) |
| virtual void | flushView() |
| void | focusChanged(QWidget *, QWidget *) |
| void | setHolidayRegions(const QStringList ®ions) |
| virtual void | setIncidenceChanger(Akonadi::IncidenceChanger *changer) |
| virtual void | showIncidences(const Akonadi::Item::List &incidenceList, const QDate &date) = 0 |
| virtual void | updateConfig() |
| virtual void | updateView() = 0 |
Signals
| void | copyIncidenceSignal(const Akonadi::Item &) |
| void | copyIncidenceToResourceSignal(const Akonadi::Item &, const Akonadi::Collection &) |
| void | cutIncidenceSignal(const Akonadi::Item &) |
| void | datesSelected(const KCalendarCore::DateList &datelist) |
| void | deleteIncidenceSignal(const Akonadi::Item &) |
| void | dissociateOccurrencesSignal(const Akonadi::Item &, const QDate &) |
| void | editIncidenceSignal(const Akonadi::Item &) |
| void | incidenceSelected(const Akonadi::Item &, const QDate) |
| void | moveIncidenceToResourceSignal(const Akonadi::Item &, const Akonadi::Collection &) |
| void | newEventSignal() |
| void | newEventSignal(const QDate &) |
| void | newEventSignal(const QDateTime &) |
| void | newEventSignal(const QDateTime &, const QDateTime &) |
| void | newJournalSignal(const QDate &) |
| void | newSubTodoSignal(const Akonadi::Item &) |
| void | newTodoSignal(const QDate &) |
| void | pasteIncidenceSignal() |
| void | shiftedEvent(const QDate &olddate, const QDate &newdate) |
| void | showIncidenceSignal(const Akonadi::Item &) |
| void | toggleAlarmSignal(const Akonadi::Item &) |
| void | toggleTodoCompletedSignal(const Akonadi::Item &) |
Static Public Members
| CalendarSupport::CollectionSelection * | globalCollectionSelection() |
| QColor | itemFrameColor(const QColor &color, bool selected) |
| void | setGlobalCollectionSelection(CalendarSupport::CollectionSelection *selection) |
Protected Functions
| virtual QPair<QDateTime, QDateTime> | actualDateRange(const QDateTime &start, const QDateTime &end, const QDate &preferredMonth = QDate()) const |
| virtual void | doRestoreConfig(const KConfigGroup &configGroup) |
| virtual void | doSaveConfig(KConfigGroup &configGroup) |
Protected Slots
| virtual void | calendarReset() |
Detailed Description
EventView is the abstract base class from which all other calendar views for event data are derived. It provides methods for displaying appointments and events on one or more days. The actual number of days that a view actually supports is not defined by this abstract class; that is up to the classes that inherit from it. It also provides methods for updating the display, retrieving the currently selected event (or events), and the like.
See also KOListView, AgendaView, and KOMonthView.
Member Function Documentation
[explicit] EventView::EventView(QWidget *parent = nullptr)
Constructs a view. cal is a pointer to the calendar object from which events will be retrieved for display. parent is the parent QWidget.
[override virtual noexcept] EventView::~EventView()
Destructor. Views will do view-specific cleanups here.
[virtual protected] QPair<QDateTime, QDateTime> EventView::actualDateRange(const QDateTime &start, const QDateTime &end, const QDate &preferredMonth = QDate()) const
from the requested date range (passed via setDateRange()), calculates the adjusted date range actually displayed by the view, depending on the view's supported range (e.g., a month view always displays one month) The default implementation returns the range unmodified
preferredMonth Used by month orientated views. Contains the month to show when the week crosses months. It's a QDate instead of uint so it can be easily fed to KCalendarSystem's functions.
QDateTime EventView::actualEndDateTime() const
QDateTime EventView::actualStartDateTime() const
[virtual] void EventView::addCalendar(const Akonadi::CollectionCalendar::Ptr &calendar)
Akonadi::CollectionCalendar::Ptr EventView::calendarForCollection(Akonadi::Collection::Id collectionId) const
Akonadi::CollectionCalendar::Ptr EventView::calendarForCollection(const Akonadi::Collection &collection) const
[virtual protected slot] void EventView::calendarReset()
EventViews::EventView::Changes EventView::changes() const
Returns if there are pending changes and a redraw is needed.
See also setChanges().
[virtual slot] void EventView::clearSelection()
Clear selection. The incidenceSelected signal is not emitted.
CalendarSupport::CollectionSelection *EventView::collectionSelection() const
Returns the selection of collection to be used by this view (custom if set, or global otherwise).
[signal] void EventView::copyIncidenceSignal(const Akonadi::Item &)
instructs the receiver to copy the incidence
[signal] void EventView::copyIncidenceToResourceSignal(const Akonadi::Item &, const Akonadi::Collection &)
Copy the incidence to the specified resource.
[pure virtual] int EventView::currentDateCount() const
Returns the number of currently shown dates. A return value of 0 means no idea.
CalendarSupport::CollectionSelection *EventView::customCollectionSelection() const
KCheckableProxyModel *EventView::customCollectionSelectionProxyModel() const
See also setCustomCollectionSelectionProxyModel().
[signal] void EventView::cutIncidenceSignal(const Akonadi::Item &)
instructs the receiver to cut the Incidence
bool EventView::dateRangeSelectionEnabled() const
Returns whether or not date range selection is enabled. This setting only applies to views that actually supports selecting cells.
See also setDateRangeSelectionEnabled(), selectionStart(), and selectionEnd().
[signal] void EventView::datesSelected(const KCalendarCore::DateList &datelist)
when the view changes the dates that are selected in one way or another, this signal is emitted. It should be connected back to the KDateNavigator object so that it changes appropriately, and any other objects that need to be aware that the list of selected dates has changed. datelist the new list of selected dates
[virtual slot] void EventView::dayPassed(const QDate &)
[slot] void EventView::defaultAction(const Akonadi::Item &item)
Perform the default action for an incidence, e.g. open the event editor, when double-clicking an event in the agenda view.
[signal] void EventView::deleteIncidenceSignal(const Akonadi::Item &)
instructs the receiver to delete the Incidence in some manner; some possibilities include automatically, with a confirmation dialog box, etc. Doesn't make sense to connect to more than one receiver.
[signal] void EventView::dissociateOccurrencesSignal(const Akonadi::Item &, const QDate &)
Dissociate from a recurring incidence the occurrence on the given date to a new incidence or dissociate all occurrences from the given date onwards.
[virtual protected] void EventView::doRestoreConfig(const KConfigGroup &configGroup)
reimplement to read view-specific settings.
[virtual protected] void EventView::doSaveConfig(KConfigGroup &configGroup)
reimplement to write view-specific settings.
[signal] void EventView::editIncidenceSignal(const Akonadi::Item &)
instructs the receiver to begin editing the incidence specified in some manner. Doesn't make sense to connect to more than one receiver.
QDateTime EventView::endDateTime() const
Akonadi::EntityTreeModel *EventView::entityTreeModel() const
[virtual] bool EventView::eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay) const
Sets the default start/end date/time for new events. Return true if anything was changed
[virtual slot] void EventView::flushView()
Write all unsaved data back to calendar store.
[slot] void EventView::focusChanged(QWidget *, QWidget *)
[static] CalendarSupport::CollectionSelection *EventView::globalCollectionSelection()
See also setGlobalCollectionSelection().
[virtual] bool EventView::hasConfigurationDialog() const
QString EventView::iconForItem(const Akonadi::Item &)
QByteArray EventView::identifier() const
See also setIdentifier().
[signal] void EventView::incidenceSelected(const Akonadi::Item &, const QDate)
[static] QColor EventView::itemFrameColor(const QColor &color, bool selected)
Returns a variation of color that will be used for the border of an agenda or month item.
EventViews::KCalPrefsPtr EventView::kcalPreferences() const
QAbstractItemModel *EventView::model() const
See also setModel().
[signal] void EventView::moveIncidenceToResourceSignal(const Akonadi::Item &, const Akonadi::Collection &)
Move the incidence to the specified resource.
[signal] void EventView::newEventSignal()
instructs the receiver to create a new event in given collection. Doesn't make sense to connect to more than one receiver.
Note: This signal is overloaded. To connect to this signal:
// Connect using qOverload:
connect(eventView, qOverload<>(&EventView::newEventSignal),
receiver, &ReceiverClass::slot);
// Or using a lambda:
connect(eventView, qOverload<>(&EventView::newEventSignal),
this, []() { /* handle newEventSignal */ });
For more examples and approaches, see connecting to overloaded signals.
[signal] void EventView::newEventSignal(const QDate &)
instructs the receiver to create a new event with the specified beginning time. Doesn't make sense to connect to more than one receiver.
Note: This signal is overloaded. To connect to this signal:
// Connect using qOverload: connect(eventView, qOverloadFor more examples and approaches, see connecting to overloaded signals.(&EventView::newEventSignal), receiver, &ReceiverClass::slot); // Or using a lambda: connect(eventView, qOverload (&EventView::newEventSignal), this, [](const QDate &) { /* handle newEventSignal */ });
[signal] void EventView::newEventSignal(const QDateTime &)
instructs the receiver to create a new event with the specified beginning time. Doesn't make sense to connect to more than one receiver.
Note: This signal is overloaded. To connect to this signal:
// Connect using qOverload: connect(eventView, qOverloadFor more examples and approaches, see connecting to overloaded signals.(&EventView::newEventSignal), receiver, &ReceiverClass::slot); // Or using a lambda: connect(eventView, qOverload (&EventView::newEventSignal), this, [](const QDateTime &) { /* handle newEventSignal */ });
[signal] void EventView::newEventSignal(const QDateTime &, const QDateTime &)
instructs the receiver to create a new event, with the specified beginning end ending times. Doesn't make sense to connect to more than one receiver.
Note: This signal is overloaded. To connect to this signal:
// Connect using qOverload: connect(eventView, qOverloadFor more examples and approaches, see connecting to overloaded signals.(&EventView::newEventSignal), receiver, &ReceiverClass::slot); // Or using a lambda: connect(eventView, qOverload (&EventView::newEventSignal), this, [](const QDateTime &, const QDateTime &) { /* handle newEventSignal */ });
[signal] void EventView::newJournalSignal(const QDate &)
[signal] void EventView::newSubTodoSignal(const Akonadi::Item &)
[signal] void EventView::newTodoSignal(const QDate &)
[signal] void EventView::pasteIncidenceSignal()
instructs the receiver to paste the incidence
EventViews::PrefsPtr EventView::preferences() const
See also setPreferences().
bool EventView::processKeyEvent(QKeyEvent *)
Handles key events, opens the new event dialog when enter is pressed, activates type ahead.
[virtual] void EventView::removeCalendar(const Akonadi::CollectionCalendar::Ptr &calendar)
void EventView::restoreConfig(const KConfigGroup &configGroup)
reads the view configuration. View-specific configuration can be restored via doRestoreConfig()
configGroup the group to read settings from
See also doRestoreConfig().
void EventView::saveConfig(KConfigGroup &configGroup)
writes out the view configuration. View-specific configuration can be saved via doSaveConfig()
configGroup the group to store settings in
See also doSaveConfig().
[pure virtual] KCalendarCore::DateList EventView::selectedIncidenceDates() const
Returns a list of the dates of selected events. Most views can probably only select a single event at a time, but some may be able to select more than one.
[pure virtual] Akonadi::Item::List EventView::selectedIncidences() const
Returns a list of selected events. Most views can probably only select a single event at a time, but some may be able to select more than one.
[virtual] QDateTime EventView::selectionEnd() const
Returns the end of the selection, or an invalid QDateTime if there is no selection or the view doesn't support selecting cells.
[virtual] QDateTime EventView::selectionStart() const
Returns the start of the selection, or an invalid QDateTime if there is no selection or the view doesn't support selecting cells.
[virtual] void EventView::setChanges(EventViews::EventView::Changes changes)
Notifies the view that there are pending changes so a redraw is needed. needed if the update is needed or not.
See also changes().
void EventView::setCustomCollectionSelectionProxyModel(KCheckableProxyModel *model)
See also customCollectionSelectionProxyModel().
[virtual] void EventView::setDateRange(const QDateTime &start, const QDateTime &end, const QDate &preferredMonth = QDate())
preferredMonth Used by month orientated views. Contains the month to show when the week crosses months. It's a QDate instead of uint so it can be easily fed to KCalendarSystem's functions.
void EventView::setDateRangeSelectionEnabled(bool enable)
Enable or disable date range selection.
See also dateRangeSelectionEnabled().
[static] void EventView::setGlobalCollectionSelection(CalendarSupport::CollectionSelection *selection)
See also globalCollectionSelection().
[slot] void EventView::setHolidayRegions(const QStringList ®ions)
Set which holiday regions the user wants to use. regions a list of Holiday Regions strings.
void EventView::setIdentifier(const QByteArray &identifier)
See also identifier().
[virtual slot] void EventView::setIncidenceChanger(Akonadi::IncidenceChanger *changer)
Assign a new incidence change helper object.
[virtual] void EventView::setKCalPreferences(const EventViews::KCalPrefsPtr &preferences)
[virtual] void EventView::setModel(QAbstractItemModel *model)
See also model().
[virtual] void EventView::setPreferences(const EventViews::PrefsPtr &preferences)
See also preferences().
[signal] void EventView::shiftedEvent(const QDate &olddate, const QDate &newdate)
Emitted when an event is moved using the mouse in an agenda view (week / month).
[virtual] void EventView::showConfigurationDialog(QWidget *parent)
[signal] void EventView::showIncidenceSignal(const Akonadi::Item &)
instructs the receiver to show the incidence in read-only mode.
[pure virtual slot] void EventView::showIncidences(const Akonadi::Item::List &incidenceList, const QDate &date)
Shows given incidences. Depending on the actual view it might not be possible to show all given events.
incidenceList a list of incidences to show. date is the QDate on which the incidences are being shown.
int EventView::showMoveRecurDialog(const KCalendarCore::Incidence::Ptr &incidence, QDate date)
QDateTime EventView::startDateTime() const
[virtual] bool EventView::supportsZoom() const
returns whether this view supports zoom. Base implementation returns false.
KCheckableProxyModel *EventView::takeCustomCollectionSelectionProxyModel()
[signal] void EventView::toggleAlarmSignal(const Akonadi::Item &)
instructs the receiver to toggle the alarms of the Incidence.
[signal] void EventView::toggleTodoCompletedSignal(const Akonadi::Item &)
instructs the receiver to toggle the completion state of the Incidence (which must be a Todo type).
[virtual slot] void EventView::updateConfig()
Re-reads the configuration and picks up relevant changes which are applicable to the view.
[pure virtual slot] void EventView::updateView()
Updates the current display to reflect changes that may have happened in the calendar since the last display refresh.
[virtual] EventViews::EventView *EventView::viewAt(const QPoint &p)
returns the view at the given widget coordinate. This is usually the view itself, except for composite views, where a subview will be returned. The default implementation returns this .