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

0001 /******************************************************************************
0002  * konsolekalendarvariables.h                                                 *
0003  *                                                                            *
0004  * KonsoleKalendar is a command line interface to KDE calendars               *
0005  * SPDX-FileCopyrightText: 2002-2004 Tuukka Pasanen <illuusio@mailcity.com>   *
0006  * SPDX-FileCopyrightText: 2003-2005 Allen Winter <winter@kde.org>            *
0007  *                                                                            *
0008  * SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 *
0009  *                                                                            *
0010  *****************************************************************************/
0011 
0012 #pragma once
0013 
0014 #include <Akonadi/Collection>
0015 #include <Akonadi/FetchJobCalendar>
0016 #include <KCalendarCore/Event>
0017 
0018 #include <QDateTime>
0019 #include <QString>
0020 
0021 /**
0022  * @file konsolekalendarvariables.h
0023  * Provides the KonsoleKalendarVariables class definition.
0024  */
0025 
0026 /**
0027  * ExportType is the type of Export output
0028  */
0029 enum ExportType {
0030     /** Export none */
0031     ExportTypeNone,
0032     /** Export as text (default) */
0033     ExportTypeText,
0034     /** Export as compact text */
0035     ExportTypeTextShort,
0036     /** Export XHTML (NOT AVAILABLE YET) */
0037     ExportTypeXHTML,
0038     /** Export XML (NOT AVAILABLE YET) */
0039     ExportTypeXML,
0040     /** Export Comma-Separated Values */
0041     ExportTypeCSV,
0042     /** Export VCard (NOT AVAILABLE YET) */
0043     ExportTypeVCard
0044 };
0045 
0046 /**
0047  * @brief
0048  * This class provides all the variables for the program.
0049  * @author Tuukka Pasanen
0050  * @author Allen Winter
0051  */
0052 class KonsoleKalendarVariables
0053 {
0054 public:
0055     /**
0056      * Construct an empty KonsoleKalendarVariables object.
0057      */
0058     KonsoleKalendarVariables();
0059     /**
0060      * Destructor
0061      */
0062     ~KonsoleKalendarVariables();
0063 
0064     /**
0065      * Set switch to use Events.
0066      * @param useEvents if true, operation uses Events.
0067      */
0068     void setUseEvents(bool useEvents);
0069     /**
0070      * Get use Events switch.
0071      * @return true if operation using Events is specified.
0072      */
0073     bool getUseEvents() const;
0074 
0075     /**
0076      * Set switch to use Todos.
0077      * @param useTodos if true, operation uses Todos.
0078      */
0079     void setUseTodos(bool useTodos);
0080     /**
0081      * Get use Todos switch.
0082      * @return true if operation using Todos is specified.
0083      */
0084     bool getUseTodos() const;
0085 
0086     /**
0087      * Set switch to use Journals.
0088      * @param useJournals if true, operation uses Journals.
0089      */
0090     void setUseJournals(bool useJournals);
0091     /**
0092      * Get use Journals switch.
0093      * @return true if operation using Journals is specified.
0094      */
0095     bool getUseJournals() const;
0096 
0097     /**
0098      * Sets start date.
0099      * @param start is the start date.
0100      */
0101     void setStartDateTime(const QDateTime &start);
0102 
0103     /**
0104      * Get start date.
0105      * @return start date.
0106      */
0107     QDateTime getStartDateTime() const;
0108 
0109     /**
0110      * Is there start date?
0111      * @return true if there is false is there isn't.
0112      */
0113     bool isStartDateTime() const;
0114 
0115     /**
0116      * Sets end date.
0117      * @param end is the enddate.
0118      */
0119     void setEndDateTime(const QDateTime &end);
0120 
0121     /**
0122      * Get end date.
0123      * @return end date.
0124      */
0125     QDateTime getEndDateTime() const;
0126 
0127     /**
0128      * Is there end date?
0129      * @return true if there is false is there isn't.
0130      */
0131     bool isEndDateTime() const;
0132 
0133     /**
0134      * Sets the UID, the unique tag for VCard entry.
0135      * @param uid unique tag for VCard entry.
0136      */
0137     void setUID(const QString &uid);
0138 
0139     /**
0140      * Get UID, the unique tag for VCard entry.
0141      * @return UID number.
0142      */
0143     QString getUID() const;
0144 
0145     /**
0146      * Is there UID set?
0147      * @return true there is UID false there isn't.
0148      */
0149     bool isUID() const;
0150 
0151     /**
0152      * Show only next activity and exit.
0153      * @param next true or false.
0154      */
0155     void setNext(bool next);
0156 
0157     /**
0158      * Should we show only next activity and exit?
0159      */
0160     bool isNext() const;
0161 
0162     /**
0163      * Should program be more verbose?
0164      * @param verbose a flag to set verbosity.
0165      */
0166     void setVerbose(bool verbose);
0167 
0168     /**
0169      * Should program be more verbose?
0170      */
0171     bool isVerbose() const;
0172 
0173     /**
0174      * Should we only try to run it and do nothing?
0175      * @param dryrun false no and true just test it.
0176      */
0177     void setDryRun(bool dryrun);
0178 
0179     /**
0180      * Is this program only in testing mode?
0181      * @return true yes false no.
0182      */
0183     bool isDryRun() const;
0184 
0185     /**
0186      * Set calendar file
0187      * @param calendar Calendar files full path.
0188      */
0189     void setCalendarFile(const QString &calendar);
0190 
0191     /**
0192      * Returns fullpath to calendar file.
0193      * @return calendar file.
0194      */
0195     QString getCalendarFile() const;
0196 
0197     /**
0198      * Set file to import active calendar.
0199      * @param calendar Calendar file to import.
0200      */
0201     void setImportFile(const QString &calendar);
0202 
0203     /**
0204      * Return import filename.
0205      * @return File that should be imported.
0206      */
0207     QString getImportFile() const;
0208 
0209     /**
0210      * Add description.
0211      * @param description to event.
0212      */
0213     void setDescription(const QString &description);
0214 
0215     /**
0216      * Return description.
0217      * @return description of event.
0218      */
0219     QString getDescription() const;
0220 
0221     /**
0222      * Is there an event description?
0223      * @return true is there is description false there isn't.
0224      */
0225     bool isDescription() const;
0226 
0227     /**
0228      * Add location information.
0229      * @param location location where the event occurs.
0230      */
0231     void setLocation(const QString &location);
0232 
0233     /**
0234      * Return location information.
0235      * @return location where event is occurring.
0236      */
0237     QString getLocation() const;
0238 
0239     /**
0240      * Is there event location information available?
0241      * @return true is there is description false there isn't.
0242      */
0243     bool isLocation() const;
0244 
0245     /**
0246      * Add summary.
0247      * @param summary event summary.
0248      */
0249     void setSummary(const QString &summary);
0250 
0251     /**
0252      * Get summary.
0253      * @return summary.
0254      */
0255     QString getSummary() const;
0256 
0257     /**
0258      * Is there an event summary?
0259      * @return true there is false there isn't.
0260      */
0261     bool isSummary() const;
0262 
0263     /**
0264      * View all option.
0265      * @param all flag to view all Events.
0266      */
0267     void setAll(bool all);
0268     /**
0269      * Return all option.
0270      */
0271     bool getAll() const;
0272     /**
0273      * Is the all option set?
0274      */
0275     bool isAll() const;
0276 
0277     /**
0278      * Set if Event is floating.
0279      * @param floating if true then the Event is floating.
0280      */
0281     void setFloating(bool floating);
0282 
0283     /**
0284      * Returns if Event is floating.
0285      */
0286     bool getFloating() const;
0287 
0288     /**
0289      * Sets the calendar resources for global use.
0290      *
0291      * @param resources is a pointer to the calendar to use.
0292      */
0293     void setCalendar(const Akonadi::FetchJobCalendar::Ptr &);
0294 
0295     /**
0296      * Get global calendar resources.
0297      */
0298     Akonadi::FetchJobCalendar::Ptr getCalendar() const;
0299 
0300     /**
0301      * Sets the output file name to @p export_file.
0302      *
0303      * @param export_file is the name of the export file.
0304      */
0305     void setExportFile(const QString &export_file);
0306 
0307     /**
0308      * To what file we'll output.
0309      */
0310     QString getExportFile() const;
0311 
0312     /**
0313      * Has an Export File been set?
0314      */
0315     bool isExportFile() const;
0316 
0317     /**
0318      * Sets the #ExportType to use.
0319      *
0320      * @param exportType is the #ExportType to use.
0321      */
0322     void setExportType(ExportType exportType);
0323 
0324     /**
0325      * What export type to use.
0326      */
0327     ExportType getExportType() const;
0328 
0329     /**
0330      * Sets how many day should be seen.
0331      *
0332      * @param count is the number of days to be shown.
0333      */
0334     void setDaysCount(int count);
0335 
0336     /**
0337      * Is there some cound of days should be seen.
0338      */
0339     bool isDaysCount() const;
0340 
0341     /**
0342      * Get how many day should be seen.
0343      */
0344     int getDaysCount() const;
0345 
0346     /**
0347      * Sets whether to allow using resources with potential GUI dependencies.
0348      */
0349     void setAllowGui(bool allow);
0350 
0351     void setCollectionId(Akonadi::Collection::Id);
0352     Akonadi::Collection::Id collectionId() const;
0353 
0354     /**
0355      * Returns whether to allow using resources with potential GUI dependencies.
0356      */
0357     bool allowGui() const;
0358 
0359 private:
0360     //@cond PRIVATE
0361     bool m_bIsUID;
0362     QString m_UID;
0363     bool m_bIsStartDateTime;
0364     QDateTime m_startDateTime;
0365     bool m_bIsEndDateTime;
0366     QDateTime m_endDateTime;
0367     bool m_bNext;
0368     bool m_bVerbose;
0369     bool m_bDryRun;
0370     bool m_bUseEvents;
0371     bool m_bUseTodos;
0372     bool m_bUseJournals;
0373     QString m_calendarFile;
0374     QString m_import;
0375     ExportType m_exportType;
0376     bool m_bIsExportFile;
0377     QString m_exportFile;
0378     bool m_bAll;
0379     bool m_bDescription;
0380     QString m_description;
0381     bool m_bLocation;
0382     QString m_location;
0383     bool m_bSummary;
0384     QString m_summary;
0385     bool m_bFloating;
0386     bool m_bDaysCount;
0387     int m_daysCount;
0388     bool m_bAllowGui;
0389     Akonadi::Collection::Id m_collectionId;
0390     Akonadi::FetchJobCalendar::Ptr m_calendar;
0391     //@endcond
0392 };