File indexing completed on 2025-01-19 04:51:32
0001 /* 0002 This file is part of KOrganizer. 0003 0004 SPDX-FileCopyrightText: 1999 Preston Brown <pbrown@kde.org> 0005 SPDX-FileCopyrightText: 2000, 2001 Cornelius Schumacher <schumacher@kde.org> 0006 SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 0007 SPDX-FileCopyrightText: 2010 Sérgio Martins <iamsergio@gmail.com> 0008 0009 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 0010 */ 0011 0012 #include "kolistview.h" 0013 #include "koeventpopupmenu.h" 0014 0015 #include <EventViews/ListView> 0016 0017 #include <KConfigGroup> 0018 0019 #include <QVBoxLayout> 0020 0021 using namespace KOrg; 0022 0023 KOListView::KOListView(QWidget *parent, bool nonInteractive) 0024 : KOEventView(parent) 0025 { 0026 auto layout = new QVBoxLayout(this); 0027 mListView = new EventViews::ListView(this, nonInteractive); 0028 mPopupMenu = eventPopup(); 0029 0030 layout->addWidget(mListView); 0031 0032 connect(mListView, &EventViews::ListView::showIncidencePopupSignal, mPopupMenu, &KOEventPopupMenu::showIncidencePopup); 0033 0034 connect(mListView, &EventViews::ListView::showNewEventPopupSignal, this, &KOListView::showNewEventPopup); 0035 0036 connect(mListView, &EventViews::EventView::datesSelected, this, &KOEventView::datesSelected); 0037 0038 connect(mListView, &EventViews::EventView::shiftedEvent, this, &KOEventView::shiftedEvent); 0039 0040 connect(mListView, &EventViews::EventView::incidenceSelected, this, &BaseView::incidenceSelected); 0041 0042 connect(mListView, &EventViews::EventView::showIncidenceSignal, this, &BaseView::showIncidenceSignal); 0043 0044 connect(mListView, &EventViews::EventView::editIncidenceSignal, this, &BaseView::editIncidenceSignal); 0045 0046 connect(mListView, &EventViews::EventView::deleteIncidenceSignal, this, &BaseView::deleteIncidenceSignal); 0047 0048 connect(mListView, &EventViews::EventView::cutIncidenceSignal, this, &BaseView::cutIncidenceSignal); 0049 0050 connect(mListView, &EventViews::EventView::copyIncidenceSignal, this, &BaseView::copyIncidenceSignal); 0051 0052 connect(mListView, &EventViews::EventView::pasteIncidenceSignal, this, &BaseView::pasteIncidenceSignal); 0053 0054 connect(mListView, &EventViews::EventView::toggleAlarmSignal, this, &BaseView::toggleAlarmSignal); 0055 0056 connect(mListView, &EventViews::EventView::toggleTodoCompletedSignal, this, &BaseView::toggleTodoCompletedSignal); 0057 0058 connect(mListView, &EventViews::EventView::copyIncidenceToResourceSignal, this, &BaseView::copyIncidenceToResourceSignal); 0059 0060 connect(mListView, &EventViews::EventView::moveIncidenceToResourceSignal, this, &BaseView::moveIncidenceToResourceSignal); 0061 0062 connect(mListView, &EventViews::EventView::dissociateOccurrencesSignal, this, &BaseView::dissociateOccurrencesSignal); 0063 0064 connect(mListView, qOverload<>(&EventViews::EventView::newEventSignal), this, qOverload<>(&KOListView::newEventSignal)); 0065 0066 connect(mListView, qOverload<const QDate &>(&EventViews::EventView::newEventSignal), this, qOverload<const QDate &>(&KOListView::newEventSignal)); 0067 0068 connect(mListView, qOverload<const QDateTime &>(&EventViews::EventView::newEventSignal), this, qOverload<const QDateTime &>(&KOListView::newEventSignal)); 0069 0070 connect(mListView, 0071 qOverload<const QDateTime &, const QDateTime &>(&EventViews::EventView::newEventSignal), 0072 this, 0073 qOverload<const QDateTime &, const QDateTime &>(&KOListView::newEventSignal)); 0074 0075 connect(mListView, &EventViews::EventView::newTodoSignal, this, &BaseView::newTodoSignal); 0076 0077 connect(mListView, &EventViews::EventView::newSubTodoSignal, this, &BaseView::newSubTodoSignal); 0078 0079 connect(mListView, &EventViews::EventView::newJournalSignal, this, &BaseView::newJournalSignal); 0080 } 0081 0082 KOListView::~KOListView() 0083 { 0084 delete mPopupMenu; 0085 delete mListView; 0086 } 0087 0088 int KOListView::maxDatesHint() const 0089 { 0090 return 0; 0091 } 0092 0093 int KOListView::currentDateCount() const 0094 { 0095 return mListView->currentDateCount(); 0096 } 0097 0098 Akonadi::Item::List KOListView::selectedIncidences() 0099 { 0100 return mListView->selectedIncidences(); 0101 } 0102 0103 KCalendarCore::DateList KOListView::selectedIncidenceDates() 0104 { 0105 return mListView->selectedIncidenceDates(); 0106 } 0107 0108 void KOListView::updateView() 0109 { 0110 mListView->updateView(); 0111 } 0112 0113 void KOListView::showDates(const QDate &start, const QDate &end, const QDate &) 0114 { 0115 mListView->showDates(start, end); 0116 } 0117 0118 void KOListView::showAll() 0119 { 0120 mListView->showAll(); 0121 } 0122 0123 void KOListView::showIncidences(const Akonadi::Item::List &incidenceList, const QDate &date) 0124 { 0125 mListView->showIncidences(incidenceList, date); 0126 } 0127 0128 void KOListView::changeIncidenceDisplay(const Akonadi::Item &aitem, Akonadi::IncidenceChanger::ChangeType changeType) 0129 { 0130 mListView->changeIncidenceDisplay(aitem, changeType); 0131 } 0132 0133 void KOListView::defaultItemAction(const QModelIndex &index) 0134 { 0135 mListView->defaultItemAction(index); 0136 } 0137 0138 void KOListView::defaultItemAction(const Akonadi::Item::Id id) 0139 { 0140 mListView->defaultItemAction(id); 0141 } 0142 0143 void KOListView::popupMenu(const QPoint &point) 0144 { 0145 mListView->popupMenu(point); 0146 } 0147 0148 void KOListView::readSettings(KConfig *config) 0149 { 0150 mListView->readSettings(config->group(QStringLiteral("ListView Layout"))); 0151 } 0152 0153 void KOListView::writeSettings(KConfig *config) 0154 { 0155 auto cfgGroup = config->group(QStringLiteral("ListView Layout")); 0156 mListView->writeSettings(cfgGroup); 0157 } 0158 0159 void KOListView::clearSelection() 0160 { 0161 mListView->clearSelection(); 0162 } 0163 0164 void KOListView::clear() 0165 { 0166 mListView->clear(); 0167 } 0168 0169 CalendarSupport::CalPrinterBase::PrintType KOListView::printType() const 0170 { 0171 return CalendarSupport::CalPrinterBase::Incidence; 0172 } 0173 0174 QSize KOListView::sizeHint() const 0175 { 0176 return mListView->sizeHint(); 0177 } 0178 0179 void KOListView::setIncidenceChanger(Akonadi::IncidenceChanger *changer) 0180 { 0181 mListView->setIncidenceChanger(changer); 0182 } 0183 0184 void KOListView::calendarAdded(const Akonadi::CollectionCalendar::Ptr &calendar) 0185 { 0186 mListView->addCalendar(calendar); 0187 } 0188 0189 void KOListView::calendarRemoved(const Akonadi::CollectionCalendar::Ptr &calendar) 0190 { 0191 mListView->removeCalendar(calendar); 0192 } 0193 #include "moc_kolistview.cpp"