Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmEventEditor: Set calendar ID when editing event
[xestiacalendar/.git] / source / forms / eventeditor / frmEventEditor.cpp
index 1130c31..4c95dc3 100644 (file)
@@ -1,3 +1,21 @@
+// frmEventEditor.cpp - frmEventEditor form functions.
+//
+// (c) 2016-2017 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 <http://www.gnu.org/licenses/>
+
 #include "frmEventEditor.h"
 
 using namespace std;
@@ -48,13 +66,17 @@ void frmEventEditor::SetupForm(CalendarDataStorage *dataStorage, XCALPreferences
                
                CDSGetCalendarEntryInfo eventInfo = dataStorage->GetEvent(eventID);
                
+               // Set the calendar ID.
+               
+               calendarID = eventInfo.calendarID;
+               
                // Load the calendar info.
                
                cmbCalendar->Show(false);
                lblCalendar->Show(false);
                
                szrDetails->Layout();
-               szrList->Layout();              
+               szrList->Layout();      
                
                // Load the data into the form.
                
@@ -188,11 +210,11 @@ void frmEventEditor::SaveContact(){
        
        // Set the data into the calendar event object.
                
-       eventData.SummaryData = txtEventName->GetValue().ToStdString();
-       eventData.DescriptionList.push_back(txtEventDescription->GetValue().ToStdString());
-       eventData.DescriptionListAltRep.push_back("");
-       eventData.DescriptionListLanguage.push_back("");
-       eventData.DescriptionListTokens.push_back("");
+       eventData.summaryData = txtEventName->GetValue().ToStdString();
+       eventData.descriptionList.push_back(txtEventDescription->GetValue().ToStdString());
+       eventData.descriptionListAltRep.push_back("");
+       eventData.descriptionListLanguage.push_back("");
+       eventData.descriptionListTokens.push_back("");
                
        stringstream stringData;
                
@@ -204,8 +226,8 @@ void frmEventEditor::SaveContact(){
        stringData << txtStartTime->GetValue().ToStdString().substr(3, 2).c_str();
        stringData << "00Z";
 
-       eventData.DateTimeStartData = stringData.str();
-       eventData.DateTimeStampData = stringData.str();
+       eventData.dateTimeStartData = stringData.str();
+       eventData.dateTimeStampData = stringData.str();
                
        stringData.str("");
                
@@ -217,7 +239,7 @@ void frmEventEditor::SaveContact(){
        stringData << txtEndTime->GetValue().ToStdString().substr(3, 2).c_str();
        stringData << "00Z";    
 
-       eventData.DateTimeEndData = stringData.str();
+       eventData.dateTimeEndData = stringData.str();
        
        // TODO: Implement Duration.
        
@@ -246,7 +268,7 @@ void frmEventEditor::SaveContact(){
                eventFile += NewUUID;
                eventFile += ".ics";
 
-               eventData.UniqueID = NewUUID;
+               eventData.uniqueID = NewUUID;
 
                // Write the file.
 
@@ -277,6 +299,7 @@ void frmEventEditor::SaveContact(){
                
                eventFilePath = eventFile;
                editMode = true;
+               calendarID = eventInfo->calendarID;
                
                eventID = addEventResult.calendarEntryID;
                
@@ -307,7 +330,7 @@ void frmEventEditor::SaveContact(){
                
                EventProperties *eventInfo = new EventProperties;
                eventInfo->eventName = txtEventName->GetValue().ToStdString();
-               eventInfo->calendarID = calendarIDList[cmbCalendar->GetSelection()];
+               eventInfo->calendarID = calendarID;
                eventInfo->eventID = eventID;
                eventInfo->eventYear = dapStartDate->GetValue().GetYear();
                eventInfo->eventMonth = dapStartDate->GetValue().GetMonth();
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy