File indexing completed on 2024-05-12 05:10:35

0001 /*
0002   SPDX-FileCopyrightText: 2013 Sérgio Martins <iamsergio@gmail.com>
0003 
0004   SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0005 */
0006 
0007 #pragma once
0008 
0009 #include <Akonadi/Collection>
0010 #include <QList>
0011 
0012 class Options
0013 {
0014 public:
0015     enum SanityCheck {
0016         CheckNone,
0017         CheckEmptySummary, // Checks for empty summary and description. In fix mode, it deletes them.
0018         CheckEmptyUid, // Checks for an empty UID. In fix mode, a new UID is assigned.
0019         CheckEventDates, // Check for missing DTSTART or DTEND. New dates will be assigned.
0020         CheckTodoDates, // Check for recurring to-dos without DTSTART. DTDUE will be assigned to DTSTART, or current date if DTDUE is also invalid.
0021         CheckJournalDates, // Check for journals without DTSTART
0022         CheckOrphans, // Check for orphan to-dos. Will be unparented." <disabled for now>
0023         CheckDuplicateUIDs, // Check for duplicated UIDs. Copies will be deleted if the payload is the same. Otherwise a new UID is assigned.
0024         CheckOrphanRecurId, // Check if incidences with recurrence id belong to an nonexistent master incidence
0025         CheckStats, // Gathers some statistics. No fixing is done.
0026         CheckCount // For iteration purposes. Keep at end.
0027     };
0028 
0029     enum Action { ActionNone, ActionScan, ActionScanAndFix, ActionBackup };
0030 
0031     Options();
0032 
0033     void setAction(Action);
0034     Action action() const;
0035 
0036     /**
0037      * List of collections for backup or fix modes.
0038      * If empty, all collections will be considered.
0039      */
0040     QList<Akonadi::Collection::Id> collections() const;
0041     void setCollections(const QList<Akonadi::Collection::Id> &);
0042     bool testCollection(Akonadi::Collection::Id) const;
0043 
0044     bool stripOldAlarms() const;
0045     void setStripOldAlarms(bool strip);
0046 
0047 private:
0048     QList<Akonadi::Collection::Id> m_collectionIds;
0049     Action m_action = ActionNone;
0050     bool m_stripOldAlarms = false;
0051 };