Commit 33a06825 authored by Laurent Montel's avatar Laurent Montel 😁

Not necessary to use private class here

parent 82d6364a
......@@ -33,103 +33,89 @@
using namespace KOrg;
class MonthView::Private
{
public:
Private(MonthView *qq) : q(qq)
{
QVBoxLayout *layout = new QVBoxLayout(q);
layout->setMargin(0);
mMonthView = new EventViews::MonthView(EventViews::MonthView::Visible, q);
mMonthView->setPreferences(KOPrefs::instance()->eventViewsPreferences());
layout->addWidget(mMonthView);
mPopup = q->eventPopup();
}
EventViews::MonthView *mMonthView = nullptr;
KOEventPopupMenu *mPopup = nullptr;
private:
MonthView *q = nullptr;
};
MonthView::MonthView(QWidget *parent)
: KOEventView(parent), d(new Private(this))
: KOEventView(parent)
{
connect(d->mMonthView, &EventViews::MonthView::showIncidencePopupSignal, d->mPopup, &KOEventPopupMenu::showIncidencePopup);
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setMargin(0);
mMonthView = new EventViews::MonthView(EventViews::MonthView::Visible, this);
mMonthView->setPreferences(KOPrefs::instance()->eventViewsPreferences());
layout->addWidget(mMonthView);
mPopup = eventPopup();
connect(mMonthView, &EventViews::MonthView::showIncidencePopupSignal, mPopup, &KOEventPopupMenu::showIncidencePopup);
connect(d->mMonthView, &EventViews::MonthView::showNewEventPopupSignal, this, &MonthView::showNewEventPopup);
connect(mMonthView, &EventViews::MonthView::showNewEventPopupSignal, this, &MonthView::showNewEventPopup);
connect(d->mMonthView, &EventViews::EventView::datesSelected,
connect(mMonthView, &EventViews::EventView::datesSelected,
this, &KOEventView::datesSelected);
connect(d->mMonthView, &EventViews::EventView::shiftedEvent,
connect(mMonthView, &EventViews::EventView::shiftedEvent,
this, &KOEventView::shiftedEvent);
connect(d->mMonthView, &EventViews::EventView::incidenceSelected,
connect(mMonthView, &EventViews::EventView::incidenceSelected,
this, &BaseView::incidenceSelected);
connect(d->mMonthView, &EventViews::EventView::showIncidenceSignal,
connect(mMonthView, &EventViews::EventView::showIncidenceSignal,
this, &BaseView::showIncidenceSignal);
connect(d->mMonthView, &EventViews::EventView::editIncidenceSignal,
connect(mMonthView, &EventViews::EventView::editIncidenceSignal,
this, &BaseView::editIncidenceSignal);
connect(d->mMonthView, &EventViews::EventView::deleteIncidenceSignal,
connect(mMonthView, &EventViews::EventView::deleteIncidenceSignal,
this, &BaseView::deleteIncidenceSignal);
connect(d->mMonthView, &EventViews::EventView::cutIncidenceSignal,
connect(mMonthView, &EventViews::EventView::cutIncidenceSignal,
this, &BaseView::cutIncidenceSignal);
connect(d->mMonthView, &EventViews::EventView::copyIncidenceSignal,
connect(mMonthView, &EventViews::EventView::copyIncidenceSignal,
this, &BaseView::copyIncidenceSignal);
connect(d->mMonthView, &EventViews::EventView::pasteIncidenceSignal,
connect(mMonthView, &EventViews::EventView::pasteIncidenceSignal,
this, &BaseView::pasteIncidenceSignal);
connect(d->mMonthView, &EventViews::EventView::toggleAlarmSignal,
connect(mMonthView, &EventViews::EventView::toggleAlarmSignal,
this, &BaseView::toggleAlarmSignal);
connect(d->mMonthView, &EventViews::EventView::toggleTodoCompletedSignal,
connect(mMonthView, &EventViews::EventView::toggleTodoCompletedSignal,
this, &BaseView::toggleTodoCompletedSignal);
connect(d->mMonthView, &EventViews::EventView::copyIncidenceToResourceSignal,
connect(mMonthView, &EventViews::EventView::copyIncidenceToResourceSignal,
this, &BaseView::copyIncidenceToResourceSignal);
connect(d->mMonthView, &EventViews::EventView::moveIncidenceToResourceSignal,
connect(mMonthView, &EventViews::EventView::moveIncidenceToResourceSignal,
this, &BaseView::moveIncidenceToResourceSignal);
connect(d->mMonthView, &EventViews::EventView::dissociateOccurrencesSignal,
connect(mMonthView, &EventViews::EventView::dissociateOccurrencesSignal,
this, &BaseView::dissociateOccurrencesSignal);
connect(d->mMonthView, SIGNAL(newEventSignal()),
connect(mMonthView, SIGNAL(newEventSignal()),
SIGNAL(newEventSignal()));
connect(d->mMonthView, SIGNAL(newEventSignal(QDate)),
connect(mMonthView, SIGNAL(newEventSignal(QDate)),
SIGNAL(newEventSignal(QDate)));
connect(d->mMonthView, SIGNAL(newEventSignal(QDateTime)),
connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
SIGNAL(newEventSignal(QDateTime)));
connect(d->mMonthView, SIGNAL(newEventSignal(QDateTime,QDateTime)),
connect(mMonthView, SIGNAL(newEventSignal(QDateTime,QDateTime)),
SIGNAL(newEventSignal(QDateTime,QDateTime)));
connect(d->mMonthView, &EventViews::EventView::newTodoSignal,
connect(mMonthView, &EventViews::EventView::newTodoSignal,
this, &BaseView::newTodoSignal);
connect(d->mMonthView, &EventViews::EventView::newSubTodoSignal,
connect(mMonthView, &EventViews::EventView::newSubTodoSignal,
this, &BaseView::newSubTodoSignal);
connect(d->mMonthView, &EventViews::EventView::newJournalSignal,
connect(mMonthView, &EventViews::EventView::newJournalSignal,
this, &BaseView::newJournalSignal);
connect(d->mMonthView, &EventViews::MonthView::fullViewChanged,
connect(mMonthView, &EventViews::MonthView::fullViewChanged,
this, &MonthView::fullViewChanged);
}
MonthView::~MonthView()
{
delete d;
}
CalendarSupport::CalPrinterBase::PrintType MonthView::printType() const
......@@ -139,68 +125,68 @@ CalendarSupport::CalPrinterBase::PrintType MonthView::printType() const
int MonthView::currentDateCount() const
{
return d->mMonthView->currentDateCount();
return mMonthView->currentDateCount();
}
int MonthView::currentMonth() const
{
return d->mMonthView->currentMonth();
return mMonthView->currentMonth();
}
KCalCore::DateList MonthView::selectedIncidenceDates()
{
return d->mMonthView->selectedIncidenceDates();
return mMonthView->selectedIncidenceDates();
}
QDateTime MonthView::selectionStart()
{
return d->mMonthView->selectionStart();
return mMonthView->selectionStart();
}
QDateTime MonthView::selectionEnd()
{
return d->mMonthView->selectionEnd();
return mMonthView->selectionEnd();
}
bool MonthView::eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay)
{
return d->mMonthView->eventDurationHint(startDt, endDt, allDay);
return mMonthView->eventDurationHint(startDt, endDt, allDay);
}
QDate MonthView::averageDate() const
{
return d->mMonthView->averageDate();
return mMonthView->averageDate();
}
bool MonthView::usesFullWindow()
{
return d->mMonthView->usesFullWindow();
return mMonthView->usesFullWindow();
}
bool MonthView::supportsDateRangeSelection()
{
return d->mMonthView->supportsDateRangeSelection();
return mMonthView->supportsDateRangeSelection();
}
void MonthView::updateView()
{
d->mMonthView->updateView();
mMonthView->updateView();
}
void MonthView::showIncidences(const Akonadi::Item::List &incidenceList, const QDate &date)
{
d->mMonthView->showIncidences(incidenceList, date);
mMonthView->showIncidences(incidenceList, date);
}
void MonthView::changeIncidenceDisplay(const Akonadi::Item &item,
Akonadi::IncidenceChanger::ChangeType changeType)
{
d->mMonthView->changeIncidenceDisplay(item, changeType);
mMonthView->changeIncidenceDisplay(item, changeType);
}
void MonthView::updateConfig()
{
d->mMonthView->updateConfig();
mMonthView->updateConfig();
}
int MonthView::maxDatesHint() const
......@@ -210,30 +196,30 @@ int MonthView::maxDatesHint() const
Akonadi::Item::List MonthView::selectedIncidences()
{
return d->mMonthView->selectedIncidences();
return mMonthView->selectedIncidences();
}
void MonthView::setTypeAheadReceiver(QObject *o)
{
d->mMonthView->setTypeAheadReceiver(o);
mMonthView->setTypeAheadReceiver(o);
}
void MonthView::setDateRange(const QDateTime &start, const QDateTime &end,
const QDate &preferredMonth)
{
d->mMonthView->setDateRange(start, end, preferredMonth);
mMonthView->setDateRange(start, end, preferredMonth);
}
void MonthView::setCalendar(const Akonadi::ETMCalendar::Ptr &cal)
{
KOEventView::setCalendar(cal);
d->mPopup->setCalendar(cal);
d->mMonthView->setCalendar(cal);
mPopup->setCalendar(cal);
mMonthView->setCalendar(cal);
}
void MonthView::setIncidenceChanger(Akonadi::IncidenceChanger *changer)
{
d->mMonthView->setIncidenceChanger(changer);
mMonthView->setIncidenceChanger(changer);
}
void MonthView::showDates(const QDate &start, const QDate &end, const QDate &preferredMonth)
......
......@@ -28,6 +28,10 @@
#include "koeventview.h"
namespace EventViews
{
class MonthView;
}
namespace KOrg
{
......@@ -89,8 +93,8 @@ private:
void showDates(const QDate &start, const QDate &end,
const QDate &preferredMonth = QDate()) override;
class Private;
Private *const d;
EventViews::MonthView *mMonthView = nullptr;
KOEventPopupMenu *mPopup = nullptr;
};
}
......
......@@ -32,147 +32,131 @@
#include <QVBoxLayout>
class KOTimelineView::Private
{
public:
Private(KOTimelineView *q) : mEventPopup(nullptr), mParent(q)
{
QVBoxLayout *vbox = new QVBoxLayout(mParent);
vbox->setMargin(0);
mTimeLineView = new EventViews::TimelineView(mParent);
vbox->addWidget(mTimeLineView);
mEventPopup = q->eventPopup();
}
~Private()
{
delete mEventPopup;
}
KOEventPopupMenu *mEventPopup = nullptr;
EventViews::TimelineView *mTimeLineView = nullptr;
private:
KOTimelineView *mParent = nullptr;
};
KOTimelineView::KOTimelineView(QWidget *parent)
: KOEventView(parent), d(new Private(this))
: KOEventView(parent)
{
connect(d->mTimeLineView, &EventViews::TimelineView::showIncidencePopupSignal,
d->mEventPopup, &KOEventPopupMenu::showIncidencePopup);
QVBoxLayout *vbox = new QVBoxLayout(this);
vbox->setMargin(0);
mTimeLineView = new EventViews::TimelineView(this);
vbox->addWidget(mTimeLineView);
mEventPopup = eventPopup();
connect(mTimeLineView, &EventViews::TimelineView::showIncidencePopupSignal,
mEventPopup, &KOEventPopupMenu::showIncidencePopup);
connect(d->mTimeLineView, &EventViews::TimelineView::showNewEventPopupSignal,
connect(mTimeLineView, &EventViews::TimelineView::showNewEventPopupSignal,
this, &KOTimelineView::showNewEventPopup);
connect(d->mTimeLineView, &EventViews::EventView::datesSelected,
connect(mTimeLineView, &EventViews::EventView::datesSelected,
this, &KOEventView::datesSelected);
connect(d->mTimeLineView, &EventViews::EventView::shiftedEvent,
connect(mTimeLineView, &EventViews::EventView::shiftedEvent,
this, &KOEventView::shiftedEvent);
connect(d->mTimeLineView, &EventViews::EventView::incidenceSelected,
connect(mTimeLineView, &EventViews::EventView::incidenceSelected,
this, &KOrg::BaseView::incidenceSelected);
connect(d->mTimeLineView, &EventViews::EventView::showIncidenceSignal,
connect(mTimeLineView, &EventViews::EventView::showIncidenceSignal,
this, &KOrg::BaseView::showIncidenceSignal);
connect(d->mTimeLineView, &EventViews::EventView::editIncidenceSignal,
connect(mTimeLineView, &EventViews::EventView::editIncidenceSignal,
this, &KOrg::BaseView::editIncidenceSignal);
connect(d->mTimeLineView, &EventViews::EventView::deleteIncidenceSignal,
connect(mTimeLineView, &EventViews::EventView::deleteIncidenceSignal,
this, &KOrg::BaseView::deleteIncidenceSignal);
connect(d->mTimeLineView, &EventViews::EventView::cutIncidenceSignal,
connect(mTimeLineView, &EventViews::EventView::cutIncidenceSignal,
this, &KOrg::BaseView::cutIncidenceSignal);
connect(d->mTimeLineView, &EventViews::EventView::copyIncidenceSignal,
connect(mTimeLineView, &EventViews::EventView::copyIncidenceSignal,
this, &KOrg::BaseView::copyIncidenceSignal);
connect(d->mTimeLineView, &EventViews::EventView::pasteIncidenceSignal,
connect(mTimeLineView, &EventViews::EventView::pasteIncidenceSignal,
this, &KOrg::BaseView::pasteIncidenceSignal);
connect(d->mTimeLineView, &EventViews::EventView::toggleAlarmSignal,
connect(mTimeLineView, &EventViews::EventView::toggleAlarmSignal,
this, &KOrg::BaseView::toggleAlarmSignal);
connect(d->mTimeLineView, &EventViews::EventView::toggleTodoCompletedSignal,
connect(mTimeLineView, &EventViews::EventView::toggleTodoCompletedSignal,
this, &KOrg::BaseView::toggleTodoCompletedSignal);
connect(d->mTimeLineView, &EventViews::EventView::copyIncidenceToResourceSignal,
connect(mTimeLineView, &EventViews::EventView::copyIncidenceToResourceSignal,
this, &KOrg::BaseView::copyIncidenceToResourceSignal);
connect(d->mTimeLineView, &EventViews::EventView::moveIncidenceToResourceSignal,
connect(mTimeLineView, &EventViews::EventView::moveIncidenceToResourceSignal,
this, &KOrg::BaseView::moveIncidenceToResourceSignal);
connect(d->mTimeLineView, &EventViews::EventView::dissociateOccurrencesSignal,
connect(mTimeLineView, &EventViews::EventView::dissociateOccurrencesSignal,
this, &KOrg::BaseView::dissociateOccurrencesSignal);
connect(d->mTimeLineView, SIGNAL(newEventSignal()),
connect(mTimeLineView, SIGNAL(newEventSignal()),
SIGNAL(newEventSignal()));
connect(d->mTimeLineView, SIGNAL(newEventSignal(QDate)),
connect(mTimeLineView, SIGNAL(newEventSignal(QDate)),
SIGNAL(newEventSignal(QDate)));
connect(d->mTimeLineView, SIGNAL(newEventSignal(QDateTime)),
connect(mTimeLineView, SIGNAL(newEventSignal(QDateTime)),
SIGNAL(newEventSignal(QDateTime)));
connect(d->mTimeLineView, SIGNAL(newEventSignal(QDateTime,QDateTime)),
connect(mTimeLineView, SIGNAL(newEventSignal(QDateTime,QDateTime)),
SIGNAL(newEventSignal(QDateTime,QDateTime)));
connect(d->mTimeLineView, &EventViews::EventView::newTodoSignal,
connect(mTimeLineView, &EventViews::EventView::newTodoSignal,
this, &KOrg::BaseView::newTodoSignal);
connect(d->mTimeLineView, &EventViews::EventView::newSubTodoSignal,
connect(mTimeLineView, &EventViews::EventView::newSubTodoSignal,
this, &KOrg::BaseView::newSubTodoSignal);
connect(d->mTimeLineView, &EventViews::EventView::newJournalSignal,
connect(mTimeLineView, &EventViews::EventView::newJournalSignal,
this, &KOrg::BaseView::newJournalSignal);
}
KOTimelineView::~KOTimelineView()
{
delete d;
delete mEventPopup;
}
Akonadi::Item::List KOTimelineView::selectedIncidences()
{
return d->mTimeLineView->selectedIncidences();
return mTimeLineView->selectedIncidences();
}
KCalCore::DateList KOTimelineView::selectedIncidenceDates()
{
return d->mTimeLineView->selectedIncidenceDates();
return mTimeLineView->selectedIncidenceDates();
}
int KOTimelineView::currentDateCount() const
{
return d->mTimeLineView->currentDateCount();
return mTimeLineView->currentDateCount();
}
void KOTimelineView::showDates(const QDate &start, const QDate &end, const QDate &)
{
d->mTimeLineView->showDates(start, end);
mTimeLineView->showDates(start, end);
}
void KOTimelineView::showIncidences(const Akonadi::Item::List &incidenceList,
const QDate &date)
{
d->mTimeLineView->showIncidences(incidenceList, date);
mTimeLineView->showIncidences(incidenceList, date);
}
void KOTimelineView::updateView()
{
d->mTimeLineView->updateView();
mTimeLineView->updateView();
}
void KOTimelineView::changeIncidenceDisplay(const Akonadi::Item &incidence,
Akonadi::IncidenceChanger::ChangeType changeType)
{
d->mTimeLineView->changeIncidenceDisplay(incidence, changeType);
mTimeLineView->changeIncidenceDisplay(incidence, changeType);
}
bool KOTimelineView::eventDurationHint(QDateTime &startDt, QDateTime &endDt,
bool &allDay)
{
return d->mTimeLineView->eventDurationHint(startDt, endDt, allDay);
return mTimeLineView->eventDurationHint(startDt, endDt, allDay);
}
CalendarSupport::CalPrinterBase::PrintType KOTimelineView::printType() const
......@@ -188,12 +172,12 @@ CalendarSupport::CalPrinterBase::PrintType KOTimelineView::printType() const
void KOTimelineView::setCalendar(const Akonadi::ETMCalendar::Ptr &cal)
{
KOEventView::setCalendar(cal);
d->mEventPopup->setCalendar(cal);
d->mTimeLineView->setCalendar(cal);
mEventPopup->setCalendar(cal);
mTimeLineView->setCalendar(cal);
}
void KOTimelineView::setIncidenceChanger(Akonadi::IncidenceChanger *changer)
{
d->mTimeLineView->setIncidenceChanger(changer);
mTimeLineView->setIncidenceChanger(changer);
}
......@@ -36,6 +36,11 @@ namespace Akonadi
class IncidenceChanger;
}
namespace EventViews
{
class TimelineView;
}
/**
This class provides a view ....
*/
......@@ -65,8 +70,8 @@ public:
CalendarSupport::CalPrinterBase::PrintType printType() const override;
private:
class Private;
Private *const d;
KOEventPopupMenu *mEventPopup = nullptr;
EventViews::TimelineView *mTimeLineView = nullptr;
};
#endif
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