From: Steve Brokenshire Date: Sun, 25 Dec 2016 01:26:47 +0000 (+0000) Subject: Added CalendarList object X-Git-Tag: release-0.02~72 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=9008088556c3a1de66755bc74b40de09e32e61ff;p=xestiacalendar%2F.git Added CalendarList object --- 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