Commit 6ee5b031 authored by Glen Ditchfield's avatar Glen Ditchfield 🐛 Committed by Allen Winter
Browse files

Show occurrence details in Event Viewer

If the user selects an occurrence of a recurring item in the Agenda or
Month views and the Item Viewer is visible in the sidebar, it shows
the start date (for events) or start and due dates (for to-dos) of that
occurrence.  The Event Viewer created from the right-click menu does
something less useful:  it displays the start date of the _first_
occurrence and the due date of the _first incomplete undissociated_
occurrence, no matter which occurrence is clicked.

This patch passes the occurrence's date down to the Event Viewer to
specify which occurrence to display.
parent 4fca10c5
Pipeline #50777 passed with stage
in 7 minutes and 12 seconds
......@@ -2167,9 +2167,14 @@ void CalendarView::pasteIncidence()
}
void CalendarView::showIncidence(const Akonadi::Item &item)
{
showOccurrence(item, QDate());
}
void CalendarView::showOccurrence(const Akonadi::Item &item, const QDate &date)
{
auto *eventViewer = new KOEventViewerDialog(mCalendar.data(), this);
eventViewer->setIncidence(item, QDate());
eventViewer->setIncidence(item, date);
// Disable the Edit button for read-only Incidences.
if (!mCalendar->hasRight(item, Akonadi::Collection::CanChangeItem)) {
eventViewer->editButton()->setEnabled(false);
......
......@@ -299,6 +299,12 @@ public Q_SLOTS:
bool showIncidence(Akonadi::Item::Id id);
void showIncidence();
/**
* Create a read-only viewer dialog for the occurrence of the
* supplied incidence on the given date.
*/
void showOccurrence(const Akonadi::Item &, const QDate &);
/**
Show an incidence in context. This means showing the todo, agenda or
journal view (as appropriate) and scrolling it to show the incidence.
......
......@@ -249,6 +249,12 @@ Q_SIGNALS:
*/
void showIncidenceSignal(const Akonadi::Item &);
/**
* instructs the receiver to show the occurrence of the
* incidence on the given date in read-only mode.
*/
void showOccurrenceSignal(const Akonadi::Item &, const QDate &);
/**
* instructs the receiver to begin editing the incidence specified in
* some manner. Doesn't make sense to connect to more than one
......
......@@ -236,7 +236,7 @@ void KOEventPopupMenu::showIncidencePopup(const Akonadi::Item &item, const QDate
void KOEventPopupMenu::popupShow()
{
if (CalendarSupport::hasIncidence(mCurrentIncidence)) {
Q_EMIT showIncidenceSignal(mCurrentIncidence);
Q_EMIT showOccurrenceSignal(mCurrentIncidence, mCurrentDate);
}
}
......
......@@ -76,6 +76,7 @@ Q_SIGNALS:
void configChanged();
void editIncidenceSignal(const Akonadi::Item &);
void showIncidenceSignal(const Akonadi::Item &);
void showOccurrenceSignal(const Akonadi::Item &, const QDate &);
void deleteIncidenceSignal(const Akonadi::Item &);
void cutIncidenceSignal(const Akonadi::Item &);
void copyIncidenceSignal(const Akonadi::Item &);
......
......@@ -50,8 +50,8 @@ KOEventPopupMenu *KOEventView::eventPopup()
connect(eventPopup, &KOEventPopupMenu::editIncidenceSignal, this,
&KOEventView::editIncidenceSignal);
connect(eventPopup, &KOEventPopupMenu::showIncidenceSignal, this,
&KOEventView::showIncidenceSignal);
connect(eventPopup, &KOEventPopupMenu::showOccurrenceSignal, this,
&KOEventView::showOccurrenceSignal);
connect(eventPopup, &KOEventPopupMenu::deleteIncidenceSignal, this,
&KOEventView::deleteIncidenceSignal);
connect(eventPopup, &KOEventPopupMenu::cutIncidenceSignal, this,
......
......@@ -262,6 +262,8 @@ void KOViewManager::connectView(KOrg::BaseView *view)
mMainView, &CalendarView::processMainViewSelection);
// showing/editing/deleting an incidence. The calendar view takes care of the action.
connect(view, &BaseView::showOccurrenceSignal,
mMainView, &CalendarView::showOccurrence);
connect(view, SIGNAL(showIncidenceSignal(Akonadi::Item)),
mMainView, SLOT(showIncidence(Akonadi::Item)));
connect(view, SIGNAL(editIncidenceSignal(Akonadi::Item)),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment