1 /******************************************************************************
2  * konsolekalendarvariables.h                                                 *
3  *                                                                            *
4  * KonsoleKalendar is a command line interface to KDE calendars               *
5  * SPDX-FileCopyrightText: 2002-2004 Tuukka Pasanen <illuusio@mailcity.com>   *
6  * SPDX-FileCopyrightText: 2003-2005 Allen Winter <winter@kde.org>            *
7  *                                                                            *
8  * SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 *
9  *                                                                            *
10  *****************************************************************************/
11 
12 #pragma once
13 
14 #include <Akonadi/Calendar/FetchJobCalendar>
15 #include <Akonadi/Collection>
16 #include <KCalendarCore/Event>
17 
18 #include <QDateTime>
19 #include <QString>
20 
21 /**
22  * @file konsolekalendarvariables.h
23  * Provides the KonsoleKalendarVariables class definition.
24  */
25 
26 /**
27  * ExportType is the type of Export output
28  */
29 enum ExportType {
30     /** Export none */
31     ExportTypeNone,
32     /** Export as text (default) */
33     ExportTypeText,
34     /** Export as compact text */
35     ExportTypeTextShort,
36     /** Export HTML for the specified time span */
37     ExportTypeHTML,
38     /** Export HTML for the time span on month boundaries */
39     ExportTypeMonthHTML,
40     /** Export XHTML (NOT AVAILABLE YET) */
41     ExportTypeXHTML,
42     /** Export XML (NOT AVAILABLE YET) */
43     ExportTypeXML,
44     /** Export Comma-Separated Values */
45     ExportTypeCSV,
46     /** Export VCard (NOT AVAILABLE YET) */
47     ExportTypeVCard
48 };
49 
50 /**
51  * @brief
52  * This class provides all the variables for the program.
53  * @author Tuukka Pasanen
54  * @author Allen Winter
55  */
56 class KonsoleKalendarVariables
57 {
58 public:
59     /**
60      * Construct an empty KonsoleKalendarVariables object.
61      */
62     KonsoleKalendarVariables();
63     /**
64      * Destructor
65      */
66     ~KonsoleKalendarVariables();
67 
68     /**
69      * Set switch to use Events.
70      * @param useEvents if true, operation uses Events.
71      */
72     void setUseEvents(bool useEvents);
73     /**
74      * Get use Events switch.
75      * @return true if operation using Events is specified.
76      */
77     bool getUseEvents() const;
78 
79     /**
80      * Set switch to use Todos.
81      * @param useTodos if true, operation uses Todos.
82      */
83     void setUseTodos(bool useTodos);
84     /**
85      * Get use Todos switch.
86      * @return true if operation using Todos is specified.
87      */
88     bool getUseTodos() const;
89 
90     /**
91      * Set switch to use Journals.
92      * @param useJournals if true, operation uses Journals.
93      */
94     void setUseJournals(bool useJournals);
95     /**
96      * Get use Journals switch.
97      * @return true if operation using Journals is specified.
98      */
99     bool getUseJournals() const;
100 
101     /**
102      * Sets start date.
103      * @param start is the start date.
104      */
105     void setStartDateTime(const QDateTime &start);
106 
107     /**
108      * Get start date.
109      * @return start date.
110      */
111     QDateTime getStartDateTime() const;
112 
113     /**
114      * Is there start date?
115      * @return true if there is false is there isn't.
116      */
117     bool isStartDateTime() const;
118 
119     /**
120      * Sets end date.
121      * @param end is the enddate.
122      */
123     void setEndDateTime(const QDateTime &end);
124 
125     /**
126      * Get end date.
127      * @return end date.
128      */
129     QDateTime getEndDateTime() const;
130 
131     /**
132      * Is there end date?
133      * @return true if there is false is there isn't.
134      */
135     bool isEndDateTime() const;
136 
137     /**
138      * Sets the UID, the unique tag for VCard entry.
139      * @param uid unique tag for VCard entry.
140      */
141     void setUID(const QString &uid);
142 
143     /**
144      * Get UID, the unique tag for VCard entry.
145      * @return UID number.
146      */
147     QString getUID() const;
148 
149     /**
150      * Is there UID set?
151      * @return true there is UID false there isn't.
152      */
153     bool isUID() const;
154 
155     /**
156      * Show only next activity and exit.
157      * @param next true or false.
158      */
159     void setNext(bool next);
160 
161     /**
162      * Should we show only next activity and exit?
163      */
164     bool isNext() const;
165 
166     /**
167      * Should program be more verbose?
168      * @param verbose a flag to set verbosity.
169      */
170     void setVerbose(bool verbose);
171 
172     /**
173      * Should program be more verbose?
174      */
175     bool isVerbose() const;
176 
177     /**
178      * Should we only try to run it and do nothing?
179      * @param dryrun false no and true just test it.
180      */
181     void setDryRun(bool dryrun);
182 
183     /**
184      * Is this program only in testing mode?
185      * @return true yes false no.
186      */
187     bool isDryRun() const;
188 
189     /**
190      * Set calendar file
191      * @param calendar Calendar files full path.
192      */
193     void setCalendarFile(const QString &calendar);
194 
195     /**
196      * Returns fullpath to calendar file.
197      * @return calendar file.
198      */
199     QString getCalendarFile() const;
200 
201     /**
202      * Set file to import active calendar.
203      * @param calendar Calendar file to import.
204      */
205     void setImportFile(const QString &calendar);
206 
207     /**
208      * Return import filename.
209      * @return File that should be imported.
210      */
211     QString getImportFile() const;
212 
213     /**
214      * Add description.
215      * @param description to event.
216      */
217     void setDescription(const QString &description);
218 
219     /**
220      * Return description.
221      * @return description of event.
222      */
223     QString getDescription() const;
224 
225     /**
226      * Is there an event description?
227      * @return true is there is description false there isn't.
228      */
229     bool isDescription() const;
230 
231     /**
232      * Add location information.
233      * @param location location where the event occurs.
234      */
235     void setLocation(const QString &location);
236 
237     /**
238      * Return location information.
239      * @return location where event is occurring.
240      */
241     QString getLocation() const;
242 
243     /**
244      * Is there event location information available?
245      * @return true is there is description false there isn't.
246      */
247     bool isLocation() const;
248 
249     /**
250      * Add summary.
251      * @param summary event summary.
252      */
253     void setSummary(const QString &summary);
254 
255     /**
256      * Get summary.
257      * @return summary.
258      */
259     QString getSummary() const;
260 
261     /**
262      * Is there an event summary?
263      * @return true there is false there isn't.
264      */
265     bool isSummary() const;
266 
267     /**
268      * View all option.
269      * @param all flag to view all Events.
270      */
271     void setAll(bool all);
272     /**
273      * Return all option.
274      */
275     bool getAll() const;
276     /**
277      * Is the all option set?
278      */
279     bool isAll() const;
280 
281     /**
282      * Set if Event is floating.
283      * @param floating if true then the Event is floating.
284      */
285     void setFloating(bool floating);
286 
287     /**
288      * Returns if Event is floating.
289      */
290     bool getFloating() const;
291 
292     /**
293      * Sets the calendar resources for global use.
294      *
295      * @param resources is a pointer to the calendar to use.
296      */
297     void setCalendar(const Akonadi::FetchJobCalendar::Ptr &);
298 
299     /**
300      * Get global calendar resources.
301      */
302     Akonadi::FetchJobCalendar::Ptr getCalendar() const;
303 
304     /**
305      * Sets the output file name to @p export_file.
306      *
307      * @param export_file is the name of the export file.
308      */
309     void setExportFile(const QString &export_file);
310 
311     /**
312      * To what file we'll output.
313      */
314     QString getExportFile() const;
315 
316     /**
317      * Has an Export File been set?
318      */
319     bool isExportFile() const;
320 
321     /**
322      * Sets the #ExportType to use.
323      *
324      * @param exportType is the #ExportType to use.
325      */
326     void setExportType(ExportType exportType);
327 
328     /**
329      * What export type to use.
330      */
331     ExportType getExportType() const;
332 
333     /**
334      * Sets how many day should be seen.
335      *
336      * @param count is the number of days to be shown.
337      */
338     void setDaysCount(int count);
339 
340     /**
341      * Is there some cound of days should be seen.
342      */
343     bool isDaysCount() const;
344 
345     /**
346      * Get how many day should be seen.
347      */
348     int getDaysCount() const;
349 
350     /**
351      * Sets whether to allow using resources with potential GUI dependencies.
352      */
353     void setAllowGui(bool allow);
354 
355     void setCollectionId(Akonadi::Collection::Id);
356     Akonadi::Collection::Id collectionId() const;
357 
358     /**
359      * Returns whether to allow using resources with potential GUI dependencies.
360      */
361     bool allowGui() const;
362 
363 private:
364     //@cond PRIVATE
365     bool m_bIsUID;
366     QString m_UID;
367     bool m_bIsStartDateTime;
368     QDateTime m_startDateTime;
369     bool m_bIsEndDateTime;
370     QDateTime m_endDateTime;
371     bool m_bNext;
372     bool m_bVerbose;
373     bool m_bDryRun;
374     bool m_bUseEvents;
375     bool m_bUseTodos;
376     bool m_bUseJournals;
377     QString m_calendarFile;
378     QString m_import;
379     ExportType m_exportType;
380     bool m_bIsExportFile;
381     QString m_exportFile;
382     bool m_bAll;
383     bool m_bDescription;
384     QString m_description;
385     bool m_bLocation;
386     QString m_location;
387     bool m_bSummary;
388     QString m_summary;
389     bool m_bFloating;
390     bool m_bDaysCount;
391     int m_daysCount;
392     bool m_bAllowGui;
393     Akonadi::Collection::Id m_collectionId;
394     Akonadi::FetchJobCalendar::Ptr m_calendar;
395     //@endcond
396 };
397 
398