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

0001 /******************************************************************************
0002  * konsolekalendarvariables.cpp                                               *
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  * @file konsolekalendarvariables.cpp
0013  * Provides the KonsoleKalendarVariables class definition.
0014  * @author Tuukka Pasanen
0015  * @author Allen Winter
0016  */
0017 #include "konsolekalendarvariables.h"
0018 
0019 #include "konsolekalendar_debug.h"
0020 #include <KLocalizedString>
0021 #include <kconfig.h>
0022 
0023 #include <cstdio>
0024 #include <cstdlib>
0025 #include <ctime>
0026 #include <iostream>
0027 
0028 using namespace KCalendarCore;
0029 using namespace std;
0030 
0031 KonsoleKalendarVariables::KonsoleKalendarVariables()
0032 {
0033     m_bIsUID = false;
0034     m_bIsStartDateTime = false;
0035     m_bIsEndDateTime = false;
0036     m_bNext = false;
0037     m_bVerbose = false;
0038     m_bDryRun = false;
0039     m_bUseEvents = false;
0040     m_bUseTodos = false;
0041     m_bUseJournals = false;
0042     m_exportType = ExportTypeText;
0043     m_bIsExportFile = false;
0044     m_bDescription = false;
0045     m_description.clear();
0046     m_bLocation = false;
0047     m_location = QStringLiteral("Default location"); // i18n ?
0048     m_bSummary = false;
0049     m_summary = QStringLiteral("Default summary"); // i18n?
0050     m_bFloating = true;
0051     m_bAllowGui = false;
0052     m_collectionId = -1;
0053 }
0054 
0055 KonsoleKalendarVariables::~KonsoleKalendarVariables() = default;
0056 
0057 void KonsoleKalendarVariables::setUID(const QString &uid)
0058 {
0059     m_bIsUID = true;
0060     m_UID = uid;
0061 }
0062 
0063 QString KonsoleKalendarVariables::getUID() const
0064 {
0065     return m_UID;
0066 }
0067 
0068 bool KonsoleKalendarVariables::isUID() const
0069 {
0070     return m_bIsUID;
0071 }
0072 
0073 void KonsoleKalendarVariables::setStartDateTime(const QDateTime &start)
0074 {
0075     m_bIsStartDateTime = true;
0076     m_startDateTime = start;
0077 }
0078 
0079 QDateTime KonsoleKalendarVariables::getStartDateTime() const
0080 {
0081     return m_startDateTime;
0082 }
0083 
0084 bool KonsoleKalendarVariables::isStartDateTime() const
0085 {
0086     return m_bIsStartDateTime;
0087 }
0088 
0089 void KonsoleKalendarVariables::setEndDateTime(const QDateTime &end)
0090 {
0091     m_bIsEndDateTime = true;
0092     m_endDateTime = end;
0093 }
0094 
0095 QDateTime KonsoleKalendarVariables::getEndDateTime() const
0096 {
0097     return m_endDateTime;
0098 }
0099 
0100 bool KonsoleKalendarVariables::isEndDateTime() const
0101 {
0102     return m_bIsEndDateTime;
0103 }
0104 
0105 void KonsoleKalendarVariables::setNext(bool next)
0106 {
0107     m_bNext = next;
0108 }
0109 
0110 bool KonsoleKalendarVariables::isNext() const
0111 {
0112     return m_bNext;
0113 }
0114 
0115 void KonsoleKalendarVariables::setVerbose(bool verbose)
0116 {
0117     m_bVerbose = verbose;
0118 }
0119 
0120 bool KonsoleKalendarVariables::isVerbose() const
0121 {
0122     return m_bVerbose;
0123 }
0124 
0125 void KonsoleKalendarVariables::setDryRun(bool dryrun)
0126 {
0127     m_bDryRun = dryrun;
0128 }
0129 
0130 bool KonsoleKalendarVariables::isDryRun() const
0131 {
0132     return m_bDryRun;
0133 }
0134 
0135 void KonsoleKalendarVariables::setUseEvents(bool useEvents)
0136 {
0137     m_bUseEvents = useEvents;
0138 }
0139 
0140 bool KonsoleKalendarVariables::getUseEvents() const
0141 {
0142     return m_bUseEvents;
0143 }
0144 
0145 void KonsoleKalendarVariables::setUseTodos(bool useTodos)
0146 {
0147     m_bUseTodos = useTodos;
0148 }
0149 
0150 bool KonsoleKalendarVariables::getUseTodos() const
0151 {
0152     return m_bUseTodos;
0153 }
0154 
0155 void KonsoleKalendarVariables::setUseJournals(bool useJournals)
0156 {
0157     m_bUseJournals = useJournals;
0158 }
0159 
0160 bool KonsoleKalendarVariables::getUseJournals() const
0161 {
0162     return m_bUseJournals;
0163 }
0164 
0165 void KonsoleKalendarVariables::setCalendarFile(const QString &calendar)
0166 {
0167     m_calendarFile = calendar;
0168 }
0169 
0170 QString KonsoleKalendarVariables::getCalendarFile() const
0171 {
0172     return m_calendarFile;
0173 }
0174 
0175 void KonsoleKalendarVariables::setImportFile(const QString &calendar)
0176 {
0177     m_import = calendar;
0178 }
0179 
0180 QString KonsoleKalendarVariables::getImportFile() const
0181 {
0182     return m_import;
0183 }
0184 
0185 void KonsoleKalendarVariables::setCalendar(const Akonadi::FetchJobCalendar::Ptr &resources)
0186 {
0187     m_calendar = resources;
0188 }
0189 
0190 Akonadi::FetchJobCalendar::Ptr KonsoleKalendarVariables::getCalendar() const
0191 {
0192     return m_calendar;
0193 }
0194 
0195 void KonsoleKalendarVariables::setExportType(ExportType exportType)
0196 {
0197     m_exportType = exportType;
0198 }
0199 
0200 ExportType KonsoleKalendarVariables::getExportType() const
0201 {
0202     return m_exportType;
0203 }
0204 
0205 void KonsoleKalendarVariables::setExportFile(const QString &export_file)
0206 {
0207     m_exportFile = export_file;
0208     m_bIsExportFile = true;
0209 }
0210 
0211 bool KonsoleKalendarVariables::isExportFile() const
0212 {
0213     return m_bIsExportFile;
0214 }
0215 
0216 QString KonsoleKalendarVariables::getExportFile() const
0217 {
0218     return m_exportFile;
0219 }
0220 
0221 bool KonsoleKalendarVariables::isAll() const
0222 {
0223     return m_bAll;
0224 }
0225 
0226 void KonsoleKalendarVariables::setAll(bool all)
0227 {
0228     m_bAll = all;
0229 }
0230 
0231 bool KonsoleKalendarVariables::getAll() const
0232 {
0233     return m_bAll;
0234 }
0235 
0236 void KonsoleKalendarVariables::setDescription(const QString &description)
0237 {
0238     m_bDescription = true;
0239     m_description = description;
0240 }
0241 
0242 QString KonsoleKalendarVariables::getDescription() const
0243 {
0244     return m_description;
0245 }
0246 
0247 bool KonsoleKalendarVariables::isDescription() const
0248 {
0249     return m_bDescription;
0250 }
0251 
0252 void KonsoleKalendarVariables::setLocation(const QString &location)
0253 {
0254     m_bLocation = true;
0255     m_location = location;
0256 }
0257 
0258 QString KonsoleKalendarVariables::getLocation() const
0259 {
0260     return m_location;
0261 }
0262 
0263 bool KonsoleKalendarVariables::isLocation() const
0264 {
0265     return m_bLocation;
0266 }
0267 
0268 void KonsoleKalendarVariables::setSummary(const QString &summary)
0269 {
0270     m_bSummary = true;
0271     m_summary = summary;
0272 }
0273 
0274 QString KonsoleKalendarVariables::getSummary() const
0275 {
0276     return m_summary;
0277 }
0278 
0279 bool KonsoleKalendarVariables::isSummary() const
0280 {
0281     return m_bSummary;
0282 }
0283 
0284 void KonsoleKalendarVariables::setFloating(bool floating)
0285 {
0286     m_bFloating = floating;
0287 }
0288 
0289 bool KonsoleKalendarVariables::getFloating() const
0290 {
0291     return m_bFloating;
0292 }
0293 
0294 void KonsoleKalendarVariables::setDaysCount(int count)
0295 {
0296     m_daysCount = count;
0297     m_bDaysCount = true;
0298 }
0299 
0300 int KonsoleKalendarVariables::getDaysCount() const
0301 {
0302     return m_daysCount;
0303 }
0304 
0305 bool KonsoleKalendarVariables::isDaysCount() const
0306 {
0307     return m_bDaysCount;
0308 }
0309 
0310 void KonsoleKalendarVariables::setAllowGui(bool allow)
0311 {
0312     m_bAllowGui = allow;
0313 }
0314 
0315 void KonsoleKalendarVariables::setCollectionId(Akonadi::Collection::Id id)
0316 {
0317     m_collectionId = id;
0318 }
0319 
0320 Akonadi::Collection::Id KonsoleKalendarVariables::collectionId() const
0321 {
0322     return m_collectionId;
0323 }
0324 
0325 bool KonsoleKalendarVariables::allowGui() const
0326 {
0327     return m_bAllowGui;
0328 }