CDSGetCalendarInfo calendarInfo = calendarData.GetCalendar(calendarEventInfo->calendarID);
- if (wxMessageBox(wxString::Format("Are you sure you want to delete the calendar %s from the %s account?", calendarInfo.calendarName, calendarInfo.accountName), "Delete calendar", wxYES_NO|wxICON_QUESTION) == wxNO){
+ if (wxMessageBox(wxString::Format("Are you sure you want to delete the calendar %s from the %s account?", wxString(calendarInfo.calendarName.c_str(), wxConvUTF8), wxString(calendarInfo.accountName.c_str(), wxConvUTF8)), "Delete calendar", wxYES_NO|wxICON_QUESTION) == wxNO){
return;
}
// Get the account configuration file and delete the calendar information.
- CDSGetAccountInfo accountInfo = calendarData.GetAccount(calendarInfo.accountName);
+ CDSGetAccountInfo accountInfo = calendarData.GetAccount(calendarInfo.accountName.c_str());
string accountDirectoryPath = string(GetUserDir().mb_str());
accountDirectoryPath += "accounts/";
- accountDirectoryPath += string(preferences->accounts.GetAccountDirectory(calendarEventInfo->accountPreferencesID).mb_str());
+ accountDirectoryPath += string(preferences->accounts.GetAccountDirectory(calendarEventInfo->accountPreferencesID).ToUTF8());
accountDirectoryPath += ".";
accountDirectoryPath += string(preferences->accounts.GetAccountType(calendarEventInfo->accountPreferencesID).mb_str());
accountDirectoryPath += "/";
wxFileConfig *calendarListFile = new wxFileConfig("", "", wxString(calendarListFilenameFull));
- //calendarListFile->SetPath(wxString(calendarInfo.calendarTextID));
- calendarListFile->DeleteGroup(wxString(calendarInfo.calendarTextID));
-
// Delete the calendar directory.
- wxDir entryListDirectory((wxString)calendarDirectoryPath.c_str());
+ wxDir entryListDirectory(wxString(calendarDirectoryPath.c_str(), wxConvUTF8));
wxString entryListFilename;
bool continueProcessing = entryListDirectory.GetFirst(&entryListFilename, "*", wxDIR_NO_FOLLOW|wxDIR_FILES);
-
+
while (continueProcessing){
string entryListFullFilename;
- entryListFullFilename += calendarDirectoryPath;
+ entryListFullFilename += wxString(calendarDirectoryPath.c_str(), wxConvUTF8);
entryListFullFilename += "/";
entryListFullFilename += string(entryListFilename.mb_str());
- wxRemoveFile(wxString(entryListFullFilename.c_str()));
+ wxRemoveFile(wxString(entryListFullFilename.c_str(), wxConvUTF8));
continueProcessing = entryListDirectory.GetNext(&entryListFilename);
}
-
- wxRmdir(calendarDirectoryPath);
+
+ entryListDirectory.Close();
+
+ // Delete the calendar from the account calendar list.
+
+ calendarListFile->DeleteGroup(wxString(calendarInfo.calendarTextID));
// Delete the calendar from the calendar data storage.
calendarData.DeleteCalendar(calendarEventInfo->calendarID);
+ // Delete the calendar directory.
+
+ //wxRmdir(wxString(calendarDirectoryPath.c_str(), wxConvUTF8));
+
delete calendarListFile;
calendarListFile = nullptr;
// Get the account name.
- CDSGetAccountInfo accountInfo = calendarData.GetAccount(calendarInfo->accountName);
+ CDSGetAccountInfo accountInfo = calendarData.GetAccount(calendarInfo->accountName.c_str());
// Build the account directory path.
string accountDirectoryPath = string(GetUserDir().mb_str());
accountDirectoryPath += "accounts/";
- accountDirectoryPath += string(preferences->accounts.GetAccountDirectory(calendarInfo->accountPreferencesID).mb_str());
+ accountDirectoryPath += string(preferences->accounts.GetAccountDirectory(calendarInfo->accountPreferencesID).ToUTF8());
accountDirectoryPath += ".";
accountDirectoryPath += string(preferences->accounts.GetAccountType(calendarInfo->accountPreferencesID).mb_str());
accountDirectoryPath += "/";
string calendarListFilenameFull = accountDirectoryPath;
calendarListFilenameFull += "calendarlist.db";
- wxFileConfig *calendarListFile = new wxFileConfig("", "", wxString(calendarListFilenameFull));
+ wxFileConfig *calendarListFile = new wxFileConfig("", "", wxString(calendarListFilenameFull.c_str(), wxConvUTF8));
- wxString calendarDescription = wxString(calendarInfo->calendarDescription);
+ wxString calendarDescription = wxString(calendarInfo->calendarDescription.c_str(), wxConvUTF8);
calendarDescription.Replace("\n", "\\n", true);
// not editing a calendar.
calendarListFile->SetPath(wxString(calendarUUID));
- calendarListFile->Write(wxT("name"), wxString(calendarInfo->calendarName));
+ calendarListFile->Write(wxT("name"), wxString(calendarInfo->calendarName.c_str(), wxConvUTF8));
calendarListFile->Write(wxT("description"), calendarDescription);
calendarListFile->Write(wxT("colour"), wxString(calendarInfo->calendarColour));
if (calendarInfo->editMode == false){
- wxMkDir(wxString(calendarPath), wxS_DIR_DEFAULT);
+ wxMkDir(wxString(calendarPath.c_str(), wxConvUTF8), wxS_DIR_DEFAULT);
calendarData.AddCalendar(accountInfo.accountID, calendarInfo->calendarName, calendarUUID, calendarInfo->calendarColour, calendarInfo->calendarDescription);
} else {