1 /*
2   SPDX-FileCopyrightText: 2013 Sérgio Martins <iamsergio@gmail.com>
3 
4   SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
5 */
6 
7 #pragma once
8 
9 #include <Akonadi/Collection>
10 #include <QList>
11 
12 class Options
13 {
14 public:
15     enum SanityCheck {
16         CheckNone,
17         CheckEmptySummary, // Checks for empty summary and description. In fix mode, it deletes them.
18         CheckEmptyUid, // Checks for an empty UID. In fix mode, a new UID is assigned.
19         CheckEventDates, // Check for missing DTSTART or DTEND. New dates will be assigned.
20         CheckTodoDates, // Check for recurring to-dos without DTSTART. DTDUE will be assigned to DTSTART, or current date if DTDUE is also invalid.
21         CheckJournalDates, // Check for journals without DTSTART
22         CheckOrphans, // Check for orphan to-dos. Will be unparented." <disabled for now>
23         CheckDuplicateUIDs, // Check for duplicated UIDs. Copies will be deleted if the payload is the same. Otherwise a new UID is assigned.
24         CheckOrphanRecurId, // Check if incidences with recurrence id belong to an nonexistent master incidence
25         CheckStats, // Gathers some statistics. No fixing is done.
26         CheckCount // For iteration purposes. Keep at end.
27     };
28 
29     enum Action { ActionNone, ActionScan, ActionScanAndFix, ActionBackup };
30 
31     Options();
32 
33     void setAction(Action);
34     Action action() const;
35 
36     /**
37      * List of collections for backup or fix modes.
38      * If empty, all collections will be considered.
39      */
40     QList<Akonadi::Collection::Id> collections() const;
41     void setCollections(const QList<Akonadi::Collection::Id> &);
42     bool testCollection(Akonadi::Collection::Id) const;
43 
44     bool stripOldAlarms() const;
45     void setStripOldAlarms(bool strip);
46 
47 private:
48     QList<Akonadi::Collection::Id> m_collectionIds;
49     Action m_action = ActionNone;
50     bool m_stripOldAlarms = false;
51 };
52 
53