From 9008088556c3a1de66755bc74b40de09e32e61ff Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 25 Dec 2016 01:26:47 +0000 Subject: [PATCH] Added CalendarList object --- source/objects/calendarlist/CalendarList.cpp | 73 ++++++++++++++++++++ source/objects/calendarlist/CalendarList.h | 46 ++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 source/objects/calendarlist/CalendarList.cpp create mode 100644 source/objects/calendarlist/CalendarList.h diff --git a/source/objects/calendarlist/CalendarList.cpp b/source/objects/calendarlist/CalendarList.cpp new file mode 100644 index 0000000..514b3e6 --- /dev/null +++ b/source/objects/calendarlist/CalendarList.cpp @@ -0,0 +1,73 @@ +// CalendarList.cpp - Account calendar list. +// +// (c) 2016 Xestia Software Development. +// +// This file is part of Xestia Calendar. +// +// Xestia Calendar is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by the +// Free Software Foundation, version 3 of the license. +// +// Xestia Calendar is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with Xestia Calendar. If not, see + +#include "CalendarList.h" + +using namespace std; + +XCAccountCalendarList::XCAccountCalendarList(string calendarListFilename){ + + // Load the account calendar list. + + wxString calendarListFilenameFull; + + calendarListFilenameFull.Append(calendarListFilename); + calendarListFilenameFull.Append(wxT("/calendarlist.db")); + + wxFileConfig *calendarListFile = new wxFileConfig("", "", calendarListFilenameFull); + + // Go through the list of calendars. + + bool continueProcessing = true; + wxString accountName; + long itemIndex =0; + + continueProcessing = calendarListFile->GetFirstGroup(accountName, itemIndex); + + while (continueProcessing){ + + wxString valueData; + Colour colourData; + + calendarListFile->SetPath(accountName); + + calendarShortName.push_back(string(accountName.mb_str())); + + calendarListFile->Read(wxT("name"), &valueData); + calendarName.push_back(string(valueData.mb_str())); + + calendarListFile->Read(wxT("description"), &valueData); + calendarDescription.push_back(string(valueData.mb_str())); + + calendarListFile->Read(wxT("colour"), &valueData); + colourData = string(valueData.mb_str()); + calendarColour.push_back(colourData); + + calendarStorageID.push_back(0); + + accountName.clear(); + calendarListFile->SetPath(wxT("/")); + continueProcessing = calendarListFile->GetNextGroup(accountName, itemIndex); + + } + +} + +XCAccountCalendarList::~XCAccountCalendarList(){ + +} \ No newline at end of file diff --git a/source/objects/calendarlist/CalendarList.h b/source/objects/calendarlist/CalendarList.h new file mode 100644 index 0000000..ee9323a --- /dev/null +++ b/source/objects/calendarlist/CalendarList.h @@ -0,0 +1,46 @@ +// CalendarList.h - Account calendar list header. +// +// (c) 2016 Xestia Software Development. +// +// This file is part of Xestia Calendar. +// +// Xestia Calendar is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by the +// Free Software Foundation, version 3 of the license. +// +// Xestia Calendar is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with Xestia Calendar. If not, see + +#ifndef __OBJECTS_CALENDARLIST_CALENDARLIST_H__ +#define __OBJECTS_CALENDARLIST_CALENDARLIST_H__ + +#include +#include +#include +#include +#include +#include + +#include "colour.h" + +class XCAccountCalendarList{ + + public: + std::vector calendarShortName; + std::vector calendarName; + std::vector calendarDescription; + std::vector calendarColour; + std::vector calendarStorageID; + + XCAccountCalendarList(std::string calendarListFilename); + ~XCAccountCalendarList(); + + +}; + +#endif \ No newline at end of file -- 2.39.5