File indexing completed on 2025-03-09 04:45:09

0001 /*
0002   SPDX-FileCopyrightText: 1999 Preston Brown <pbrown@kde.org>
0003   SPDX-FileCopyrightText: 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
0004   SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
0005 
0006   SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0007 */
0008 #pragma once
0009 
0010 #include "eventview.h"
0011 
0012 #include <memory>
0013 
0014 class KConfig;
0015 
0016 class QModelIndex;
0017 
0018 namespace EventViews
0019 {
0020 class ListViewPrivate;
0021 
0022 /**
0023   This class provides a multi-column list view of events.  It can
0024   display events from one particular day or several days, it doesn't
0025   matter.
0026 
0027   @short multi-column list view of various events.
0028   @author Preston Brown <pbrown@kde.org>
0029   @see EventView
0030 */
0031 class EVENTVIEWS_EXPORT ListView : public EventView
0032 {
0033     Q_OBJECT
0034 public:
0035     explicit ListView(QWidget *parent = nullptr, bool nonInteractive = false);
0036     ~ListView() override;
0037 
0038     [[nodiscard]] int currentDateCount() const override;
0039     [[nodiscard]] Akonadi::Item::List selectedIncidences() const override;
0040     [[nodiscard]] KCalendarCore::DateList selectedIncidenceDates() const override;
0041 
0042     // Shows all incidences of the calendar
0043     void showAll();
0044 
0045     /**
0046      * Read settings from the "ListView Layout" group of the configuration.
0047      * @deprecated Use readSettings with a specific KConfigGroup.
0048      */
0049     void readSettings(KConfig *config);
0050 
0051     /**
0052      * Read settings from the given configuration group.
0053      * @since 5.18.1
0054      */
0055     void readSettings(const KConfigGroup &cfgGroup);
0056 
0057     /**
0058      * Write settings to the "ListView Layout" group of the configuration.
0059      * @deprecated Use writeSettings with a specific KConfigGroup.
0060      */
0061     void writeSettings(KConfig *config);
0062 
0063     /**
0064      * Write settings to the given configuration group.
0065      * @since 5.18.1
0066      */
0067     void writeSettings(KConfigGroup &cfgGroup);
0068 
0069     void clear();
0070     QSize sizeHint() const override;
0071 
0072 public Q_SLOTS:
0073     void updateView() override;
0074 
0075     void showDates(const QDate &start, const QDate &end, const QDate &preferredMonth = QDate()) override;
0076 
0077     void showIncidences(const Akonadi::Item::List &incidenceList, const QDate &date) override;
0078 
0079     void clearSelection() override;
0080 
0081     void changeIncidenceDisplay(const Akonadi::Item &, int);
0082 
0083     void defaultItemAction(const QModelIndex &);
0084     void defaultItemAction(const Akonadi::Item::Id id);
0085 
0086     void popupMenu(const QPoint &);
0087 
0088 Q_SIGNALS:
0089     void showNewEventPopupSignal();
0090     void showIncidencePopupSignal(const Akonadi::CollectionCalendar::Ptr &, const Akonadi::Item &, const QDate &);
0091 
0092 protected Q_SLOTS:
0093     void processSelectionChange();
0094 
0095 private:
0096     EVENTVIEWS_NO_EXPORT void slotSortIndicatorChanged(int logicalIndex, Qt::SortOrder order);
0097 
0098     std::unique_ptr<ListViewPrivate> const d;
0099 };
0100 }