// Check if the 'Default.local' directory exists.
- wxString DefaultLocalDir;
+ wxString defaultLocalDir;
#if defined(__HAIKU__)
#elif defined(__WIN32__)
- DefaultLocalDir.Clear();
- DefaultLocalDir.Append(wxString::FromUTF8(getenv("APPDATA")));
- DefaultLocalDir.Append(wxT("\\Xestia\\Calendar\\accounts\\"));
- DefaultLocalDir.Append(wxT("Default.local"));
+ defaultLocalDir.Clear();
+ defaultLocalDir.Append(wxString::FromUTF8(getenv("APPDATA")));
+ defaultLocalDir.Append(wxT("\\Xestia\\Calendar\\accounts\\"));
+ defaultLocalDir.Append(wxT("Default.local"));
#elif defined(__APPLE__)
- DefaultLocalDir.Clear();
- DefaultLocalDir.Append(wxString::FromUTF8(getenv("HOME")));
- DefaultLocalDir.Append(wxT("/Library/Preferences/Xestia/Calendar/accounts/"));
- DefaultLocalDir.Append(wxT("Default.local"));
+ defaultLocalDir.Clear();
+ defaultLocalDir.Append(wxString::FromUTF8(getenv("HOME")));
+ defaultLocalDir.Append(wxT("/Library/Preferences/Xestia/Calendar/accounts/"));
+ defaultLocalDir.Append(wxT("Default.local"));
#else
- DefaultLocalDir.Clear();
- DefaultLocalDir.Append(wxString::FromUTF8(getenv("HOME")));
- DefaultLocalDir.Append(wxT("/.xestiacal/accounts/"));
- DefaultLocalDir.Append(wxT("Default.local"));
+ defaultLocalDir.Clear();
+ defaultLocalDir.Append(wxString::FromUTF8(getenv("HOME")));
+ defaultLocalDir.Append(wxT("/.xestiacal/accounts/"));
+ defaultLocalDir.Append(wxT("Default.local"));
#endif
- if (wxDirExists(DefaultLocalDir) == FALSE){
+ if (wxDirExists(defaultLocalDir) == FALSE){
- if (wxMkdir(DefaultLocalDir, 0740) == TRUE){
+ if (wxMkdir(defaultLocalDir, 0740) == TRUE){
}
// Setup default (non account) settings if they don't exist.
- wxString DefaultPrefDir;
+ wxString defaultPrefDir;
#if defined(__HAIKU__)
#elif defined(__WIN32__)
- DefaultPrefDir.Clear();
- DefaultPrefDir.Append(wxString::FromUTF8(getenv("APPDATA")));
- DefaultPrefDir.Append(wxT("\\Xestia\\Calendar\\preferences\\"));
+ defaultPrefDir.Clear();
+ defaultPrefDir.Append(wxString::FromUTF8(getenv("APPDATA")));
+ defaultPrefDir.Append(wxT("\\Xestia\\Calendar\\preferences\\"));
#elif defined(__APPLE__)
- DefaultPrefDir.Clear();
- DefaultPrefDir.Append(wxString::FromUTF8(getenv("HOME")));
- DefaultPrefDir.Append(wxT("/Library/Preferences/Xestia/Calendar/preferences/"));
+ defaultPrefDir.Clear();
+ defaultPrefDir.Append(wxString::FromUTF8(getenv("HOME")));
+ defaultPrefDir.Append(wxT("/Library/Preferences/Xestia/Calendar/preferences/"));
#else
- DefaultPrefDir.Clear();
- DefaultPrefDir.Append(wxString::FromUTF8(getenv("HOME")));
- DefaultPrefDir.Append(wxT("/.xestiacal/preferences/"));
+ defaultPrefDir.Clear();
+ defaultPrefDir.Append(wxString::FromUTF8(getenv("HOME")));
+ defaultPrefDir.Append(wxT("/.xestiacal/preferences/"));
#endif
// Create the accounts file if it doesn't exist.
- if (wxFileExists(DefaultPrefDir + wxT("accounts")) == FALSE){
+ if (wxFileExists(defaultPrefDir + wxT("accounts")) == FALSE){
- wxString AccountsFilename;
- wxFFile AccountsFile;
+ wxString accountsFilename;
+ wxFFile accountsFile;
- AccountsFilename = DefaultPrefDir;
- AccountsFilename.Append(wxT("accounts"));
+ accountsFilename = defaultPrefDir;
+ accountsFilename.Append(wxT("accounts"));
#if wxABI_VERSION < 20900
- AccountsFile.Open(AccountsFilename.c_str(), wxT("w"));
+ accountsFile.Open(accountsFilename.c_str(), wxT("w"));
#else
- AccountsFile.Open(AccountsFilename, wxT("w"));
+ accountsFile.Open(accountsFilename, wxT("w"));
#endif
- AccountsFile.Write(wxT(""));
+ accountsFile.Write(wxT(""));
}
// Create the preferences file if it doesn't exist.
- if (wxFileExists(DefaultPrefDir + wxT("settings")) == FALSE){
+ if (wxFileExists(defaultPrefDir + wxT("settings")) == FALSE){
- wxString PrefsFilename;
- wxFFile PrefsFile;
+ wxString prefsFilename;
+ wxFFile prefsFile;
- PrefsFilename = DefaultPrefDir;
- PrefsFilename.Append(wxT("settings"));
+ prefsFilename = defaultPrefDir;
+ prefsFilename.Append(wxT("settings"));
#if wxABI_VERSION < 20900
- PrefsFile.Open(PrefsFilename.c_str(), wxT("w"));
+ prefsFile.Open(prefsFilename.c_str(), wxT("w"));
#else
- PrefsFile.Open(PrefsFilename, wxT("w"));
+ prefsFile.Open(prefsFilename, wxT("w"));
#endif
- PrefsFile.Write(wxT("HideLocalCalendars=false\nSaveWindowPosition=true\n"));
+ prefsFile.Write(wxT("HideLocalCalendars=false\nSaveWindowPosition=true\n"));
}
// Check if the default account is in the accounts list.
// Add it if it isn't.
- wxString accountsConfigFile = DefaultPrefDir;
+ wxString accountsConfigFile = defaultPrefDir;
accountsConfigFile.Append(wxT("accounts"));
wxFileConfig *accountConfigData = new wxFileConfig("", "", accountsConfigFile);
// Create the directories if they don't exist.
- wxString DefaultSettingsDir;
+ wxString defaultSettingsDir;
#if defined(__HAIKU__)
#elif defined(__WIN32__)
- DefaultSettingsDir.Clear();
- DefaultSettingsDir.Append(wxString::FromUTF8(getenv("APPDATA")));
- DefaultSettingsDir.Append(wxT("\\Xestia\\"));
+ defaultSettingsDir.Clear();
+ defaultSettingsDir.Append(wxString::FromUTF8(getenv("APPDATA")));
+ defaultSettingsDir.Append(wxT("\\Xestia\\"));
- if (wxDirExists(DefaultSettingsDir) == FALSE){
+ if (wxDirExists(defaultSettingsDir) == FALSE){
// Create the directory.
- if (wxMkdir(DefaultSettingsDir, 0740) == TRUE){
+ if (wxMkdir(defaultSettingsDir, 0740) == TRUE){
}
// 'Calendar' to the directory.
- DefaultSettingsDir.Append(wxT("\\Calendar\\"));
+ defaultSettingsDir.Append(wxT("\\Calendar\\"));
#elif defined(__APPLE__)
- DefaultSettingsDir.Clear();
- DefaultSettingsDir.Append(wxString::FromUTF8(getenv("HOME")));
- DefaultSettingsDir.Append(wxT("/Library/Preferences/Xestia/"));
+ defaultSettingsDir.Clear();
+ defaultSettingsDir.Append(wxString::FromUTF8(getenv("HOME")));
+ defaultSettingsDir.Append(wxT("/Library/Preferences/Xestia/"));
- if (wxDirExists(DefaultSettingsDir) == FALSE){
+ if (wxDirExists(defaultSettingsDir) == FALSE){
// Create the directory.
- if (wxMkdir(DefaultSettingsDir, 0740) == TRUE){
+ if (wxMkdir(defaultSettingsDir, 0740) == TRUE){
}
// Append 'Calendar' to the directory.
- DefaultSettingsDir.Append(wxT("/Calendar/"));
+ defaultSettingsDir.Append(wxT("/Calendar/"));
#else
- DefaultSettingsDir.Clear();
- DefaultSettingsDir.Append(wxString::FromUTF8(getenv("HOME")));
- DefaultSettingsDir.Append(wxT("/.xestiacal/"));
+ defaultSettingsDir.Clear();
+ defaultSettingsDir.Append(wxString::FromUTF8(getenv("HOME")));
+ defaultSettingsDir.Append(wxT("/.xestiacal/"));
#endif
// Check if the directory exists.
- if (wxDirExists(DefaultSettingsDir) == FALSE){
+ if (wxDirExists(defaultSettingsDir) == FALSE){
// Create the directory.
- if (wxMkdir(DefaultSettingsDir, 0740) == TRUE){
+ if (wxMkdir(defaultSettingsDir, 0740) == TRUE){
}
}
- if (wxDirExists(DefaultSettingsDir + wxT("accounts")) == FALSE){
+ if (wxDirExists(defaultSettingsDir + wxT("accounts")) == FALSE){
- if (wxMkdir(DefaultSettingsDir + wxT("accounts"), 0740) == TRUE){
+ if (wxMkdir(defaultSettingsDir + wxT("accounts"), 0740) == TRUE){
}
}
- if (wxDirExists(DefaultSettingsDir + wxT("preferences")) == FALSE){
+ if (wxDirExists(defaultSettingsDir + wxT("preferences")) == FALSE){
- if (wxMkdir(DefaultSettingsDir + wxT("preferences"), 0740) == TRUE){
+ if (wxMkdir(defaultSettingsDir + wxT("preferences"), 0740) == TRUE){
}
// Get the user directory.
- wxString UserDir;
+ wxString userDir;
#if defined(__HAIKU__)
#elif defined(__WIN32__)
- UserDir.Clear();
- UserDir.Append(wxString::FromUTF8(getenv("APPDATA")));
- UserDir.Append(wxT("\\Xestia\\Calendar\\"));
+ userDir.Clear();
+ userDir.Append(wxString::FromUTF8(getenv("APPDATA")));
+ userDir.Append(wxT("\\Xestia\\Calendar\\"));
#elif defined(__APPLE__)
- UserDir.Clear();
- UserDir.Append(wxString::FromUTF8(getenv("HOME")));
- UserDir.Append(wxT("/Library/Preferences/Xestia/Calendar/"));
+ userDir.Clear();
+ userDir.Append(wxString::FromUTF8(getenv("HOME")));
+ userDir.Append(wxT("/Library/Preferences/Xestia/Calendar/"));
#else
- UserDir.Clear();
- UserDir.Append(wxString::FromUTF8(getenv("HOME")));
- UserDir.Append(wxT("/.xestiacal/"));
+ userDir.Clear();
+ userDir.Append(wxString::FromUTF8(getenv("HOME")));
+ userDir.Append(wxT("/.xestiacal/"));
#endif
- return UserDir;
+ return userDir;
}
// Get the user preferences directory.
- wxString UserPrefDir;
+ wxString userPrefDir;
#if defined(__HAIKU__)
#elif defined(__WIN32__)
- UserPrefDir.Clear();
- UserPrefDir.Append(wxString::FromUTF8(getenv("APPDATA")));
- UserPrefDir.Append(wxT("\\Xestia\\Calendar\\preferences\\"));
+ userPrefDir.Clear();
+ userPrefDir.Append(wxString::FromUTF8(getenv("APPDATA")));
+ userPrefDir.Append(wxT("\\Xestia\\Calendar\\preferences\\"));
#elif defined(__APPLE__)
- UserPrefDir.Clear();
- UserPrefDir.Append(wxString::FromUTF8(getenv("HOME")));
- UserPrefDir.Append(wxT("/Library/Preferences/Xestia/Calendar/preferences/"));
+ userPrefDir.Clear();
+ userPrefDir.Append(wxString::FromUTF8(getenv("HOME")));
+ userPrefDir.Append(wxT("/Library/Preferences/Xestia/Calendar/preferences/"));
#else
- UserPrefDir.Clear();
- UserPrefDir.Append(wxString::FromUTF8(getenv("HOME")));
- UserPrefDir.Append(wxT("/.xestiacal/preferences/"));
+ userPrefDir.Clear();
+ userPrefDir.Append(wxString::FromUTF8(getenv("HOME")));
+ userPrefDir.Append(wxT("/.xestiacal/preferences/"));
#endif
- return UserPrefDir;
+ return userPrefDir;
}
-wxString GetAccountDir(wxString AccName, bool ServerCert)
+wxString GetAccountDir(wxString accName, bool serverCert)
{
// Get the account directory.
- wxString AccountDir;
+ wxString accountDir;
#if defined(__HAIKU__)
#elif defined(__WIN32__)
- AccountDir.Clear();
- AccountDir.Append(wxString::FromUTF8(getenv("APPDATA")));
- AccountDir.Append(wxT("\\Xestia\\Calendar\\accounts\\"));
- AccountDir.Append(AccName);
- AccountDir.Append(wxT("\\"));
+ accountDir.Clear();
+ accountDir.Append(wxString::FromUTF8(getenv("APPDATA")));
+ accountDir.Append(wxT("\\Xestia\\Calendar\\accounts\\"));
+ accountDir.Append(accName);
+ accountDir.Append(wxT("\\"));
- if (ServerCert == TRUE){
- AccountDir.Append(wxT("server.crt"));
+ if (serverCert == TRUE){
+ accountDir.Append(wxT("server.crt"));
}
#elif defined(__APPLE__)
- AccountDir.Clear();
- AccountDir.Append(wxString::FromUTF8(getenv("HOME")));
- AccountDir.Append(wxT("/Library/Preferences/Xestia/Calendar/accounts/"));
- AccountDir.Append(AccName);
- AccountDir.Append(wxT("/"));
+ accountDir.Clear();
+ accountDir.Append(wxString::FromUTF8(getenv("HOME")));
+ accountDir.Append(wxT("/Library/Preferences/Xestia/Calendar/accounts/"));
+ accountDir.Append(accName);
+ accountDir.Append(wxT("/"));
- if (ServerCert == TRUE){
- AccountDir.Append(wxT("server.crt"));
+ if (serverCert == TRUE){
+ accountDir.Append(wxT("server.crt"));
}
#else
- AccountDir.Clear();
- AccountDir.Append(wxString::FromUTF8(getenv("HOME")));
- AccountDir.Append(wxT("/.xestiacal/accounts/"));
- AccountDir.Append(AccName);
- AccountDir.Append(wxT("/"));
+ accountDir.Clear();
+ accountDir.Append(wxString::FromUTF8(getenv("HOME")));
+ accountDir.Append(wxT("/.xestiacal/accounts/"));
+ accountDir.Append(accName);
+ accountDir.Append(wxT("/"));
- if (ServerCert == TRUE){
- AccountDir.Append(wxT("server.crt"));
+ if (serverCert == TRUE){
+ accountDir.Append(wxT("server.crt"));
}
#endif
- return AccountDir;
+ return accountDir;
}
-std::string GetAccountDir(std::string AccName, bool ServerCert)
+std::string GetAccountDir(std::string accName, bool serverCert)
{
// Get the account directory.
- std::string AccountDir;
+ std::string accountDir;
#if defined(__HAIKU__)
#elif defined(__WIN32__)
- AccountDir.clear();
- AccountDir.append(getenv("APPDATA"));
- AccountDir.append("\\Xestia\\Calendar\\accounts\\");
- AccountDir.append(AccName);
- AccountDir.append("\\");
+ accountDir.clear();
+ accountDir.append(getenv("APPDATA"));
+ accountDir.append("\\Xestia\\Calendar\\accounts\\");
+ accountDir.append(AccName);
+ accountDir.append("\\");
- if (ServerCert == true){
- AccountDir.append("server.crt");
+ if (serverCert == true){
+ accountDir.append("server.crt");
}
#elif defined(__APPLE__)
- AccountDir.clear();
- AccountDir.append(getenv("HOME"));
- AccountDir.append("/Library/Preferences/Xestia/Calendar/accounts/");
- AccountDir.append(AccName);
- AccountDir.append("/");
+ accountDir.clear();
+ accountDir.append(getenv("HOME"));
+ accountDir.append("/Library/Preferences/Xestia/Calendar/accounts/");
+ accountDir.append(accName);
+ accountDir.append("/");
if (ServerCert == true){
AccountDir.append("server.crt");
#else
- AccountDir.clear();
- AccountDir.append(getenv("HOME"));
- AccountDir.append("/.xestiacal/accounts/");
- AccountDir.append(AccName);
- AccountDir.append("/");
+ accountDir.clear();
+ accountDir.append(getenv("HOME"));
+ accountDir.append("/.xestiacal/accounts/");
+ accountDir.append(accName);
+ accountDir.append("/");
- if (ServerCert == true){
- AccountDir.append("server.crt");
+ if (serverCert == true){
+ accountDir.append("server.crt");
}
#endif
- return AccountDir;
+ return accountDir;
}
// Get the accounts preferences file.
- wxString AccountsFile;
+ wxString accountsFile;
#if defined(__HAIKU__)
#elif defined(__WIN32__)
- AccountsFile.Clear();
- AccountsFile.Append(wxString::FromUTF8(getenv("APPDATA")));
- AccountsFile.Append(wxT("\\Xestia\\Calendar\\preferences\\accounts"));
+ accountsFile.Clear();
+ accountsFile.Append(wxString::FromUTF8(getenv("APPDATA")));
+ accountsFile.Append(wxT("\\Xestia\\Calendar\\preferences\\accounts"));
#elif defined(__APPLE__)
- AccountsFile.Clear();
- AccountsFile.Append(wxString::FromUTF8(getenv("HOME")));
- AccountsFile.Append(wxT("/Library/Preferences/Xestia/Calendar/preferences/accounts"));
+ accountsFile.Clear();
+ accountsFile.Append(wxString::FromUTF8(getenv("HOME")));
+ accountsFile.Append(wxT("/Library/Preferences/Xestia/Calendar/preferences/accounts"));
#else
- AccountsFile.Clear();
- AccountsFile.Append(wxString::FromUTF8(getenv("HOME")));
- AccountsFile.Append(wxT("/.xestiacal/preferences/accounts"));
+ accountsFile.Clear();
+ accountsFile.Append(wxString::FromUTF8(getenv("HOME")));
+ accountsFile.Append(wxT("/.xestiacal/preferences/accounts"));
#endif
- return AccountsFile;
+ return accountsFile;
}
// Get the preferences general settings file.
- wxString SettingsFile;
+ wxString settingsFile;
#if defined(__HAIKU__)
#elif defined(__WIN32__)
- SettingsFile.Clear();
- SettingsFile.Append(wxString::FromUTF8(getenv("APPDATA")));
- SettingsFile.Append(wxT("\\Xestia\\Calendar\\preferences\\settings"));
+ settingsFile.Clear();
+ settingsFile.Append(wxString::FromUTF8(getenv("APPDATA")));
+ settingsFile.Append(wxT("\\Xestia\\Calendar\\preferences\\settings"));
#elif defined(__APPLE__)
- SettingsFile.Clear();
- SettingsFile.Append(wxString::FromUTF8(getenv("HOME")));
- SettingsFile.Append(wxT("/Library/Preferences/Xestia/Calendar/preferences/settings"));
+ settingsFile.Clear();
+ settingsFile.Append(wxString::FromUTF8(getenv("HOME")));
+ settingsFile.Append(wxT("/Library/Preferences/Xestia/Calendar/preferences/settings"));
#else
- SettingsFile.Clear();
- SettingsFile.Append(wxString::FromUTF8(getenv("HOME")));
- SettingsFile.Append(wxT("/.xestiacal/preferences/settings"));
+ settingsFile.Clear();
+ settingsFile.Append(wxString::FromUTF8(getenv("HOME")));
+ settingsFile.Append(wxT("/.xestiacal/preferences/settings"));
#endif
- return SettingsFile;
+ return settingsFile;
}
\ No newline at end of file
wxString GetUserDir();
wxString GetUserPrefDir();
-wxString GetAccountDir(wxString AccName, bool ServerCert);
-std::string GetAccountDir(std::string AccName, bool ServerCert);
+wxString GetAccountDir(wxString accName, bool serverCert);
+std::string GetAccountDir(std::string accName, bool serverCert);
wxString GetAccountsFile();
wxString GetSettingsFile();
using namespace std;
-bool FileExists(std::string Filename){
+bool FileExists(std::string filename){
#if defined (__WIN32__)
#else
- struct stat BuffData;
+ struct stat bufferData;
- if (stat(Filename.c_str(), &BuffData) == -1){
+ if (stat(filename.c_str(), &bufferData) == -1){
return false;
}
#include <sys/stat.h>
#endif
-bool FileExists(std::string Filename);
+bool FileExists(std::string filename);
#endif
\ No newline at end of file
using namespace std;
-int PreviousMonthNumberofDays(int Month, int Year){
+int PreviousMonthNumberofDays(int month, int year){
// Work out what the previous month is.
// Return 31 if month matches.
- if (Month == 1 || Month == 2 || Month == 4 ||
- Month == 6 || Month == 8 || Month == 9 || Month == 11){
+ if (month == 1 || month == 2 || month == 4 ||
+ month == 6 || month == 8 || month == 9 || month == 11){
return 31;
// Return 30 if month matches.
- if (Month == 5 || Month == 7 || Month == 10 || Month == 12){
+ if (month == 5 || month == 7 || month == 10 || month == 12){
return 30;
// Work out if year is a leap year and return 28 or 29
// for february.
- if (Year % 4 == 0){
+ if (year % 4 == 0){
- if (Year % 100 == 0){
+ if (year % 100 == 0){
- if (Year % 400 == 0){
+ if (year % 400 == 0){
return 29;
}
-XCCalendarMonthViewGrid GenerateMonthGrid(int Month, int Year){
+XCCalendarMonthViewGrid GenerateMonthGrid(int month, int year){
XCCalendarMonthViewGrid MonthViewOutput;
// Work out which day of the week the first day of
// the month is.
- time_t EmptyTime;
- struct tm * FirstDay;
- int PreviousMonthNumDays = PreviousMonthNumberofDays(Month, Year);
- int PreviousMonthDays = 0;
- int PreviousMonth = 0;
- int PreviousYear = Year;
- int DayWeekCount = 0;
- bool ProcessGrid = true;
- bool FirstWeekProcessing = true;
+ time_t emptyTime;
+ struct tm * firstDay;
+ int previousMonthNumDays = PreviousMonthNumberofDays(month, year);
+ int previousMonthDays = 0;
+ int previousMonth = 0;
+ int previousYear = Year;
+ int dayWeekCount = 0;
+ bool processGrid = true;
+ bool firstWeekProcessing = true;
- time(&EmptyTime);
+ time(&emptyTime);
- FirstDay = localtime(&EmptyTime);
- FirstDay->tm_year = Year - 1900;
- FirstDay->tm_mon = Month - 1;
- FirstDay->tm_mday = 1;
+ firstDay = localtime(&emptyTime);
+ firstDay->tm_year = year - 1900;
+ firstDay->tm_mon = month - 1;
+ firstDay->tm_mday = 1;
- mktime(FirstDay);
+ mktime(firstDay);
- if (FirstDay->tm_wday == 0){
- PreviousMonthDays = 6;
+ if (firstDay->tm_wday == 0){
+ previousMonthDays = 6;
} else {
- PreviousMonthDays = FirstDay->tm_wday - 1;
+ previousMonthDays = firstDay->tm_wday - 1;
}
- if (Month == 1){
+ if (month == 1){
- PreviousMonth = 12;
- PreviousYear--;
+ previousMonth = 12;
+ previousYear--;
} else {
- PreviousMonth = Month - 1;
+ previousMonth = month - 1;
}
// Workout the days of the previous month for the
// first week to be displayed.
- XCCalendarMonthViewGridDayWeek FirstWeek;
+ XCCalendarMonthViewGridDayWeek firstWeek;
- for (int PreviousMonthDaysProcessing = 0;
- PreviousMonthDaysProcessing < PreviousMonthDays;
- PreviousMonthDaysProcessing++){
+ for (int previousMonthDaysProcessing = 0;
+ previousMonthDaysProcessing < previousMonthDays;
+ previousMonthDaysProcessing++){
- XCCalendarMonthViewGridDayData DayItem;
+ XCCalendarMonthViewGridDayData dayItem;
- DayItem.Day = PreviousMonthNumDays - PreviousMonthDaysProcessing;
- DayItem.Month = PreviousMonth;
- DayItem.Year = PreviousYear;
- DayItem.IsInMonth = false;
+ dayItem.Day = previousMonthNumDays - previousMonthDaysProcessing;
+ dayItem.Month = previousMonth;
+ dayItem.Year = previousYear;
+ dayItem.IsInMonth = false;
- FirstWeek.DayList.insert(FirstWeek.DayList.begin(), DayItem);
+ firstWeek.dayList.insert(firstWeek.dayList.begin(), dayItem);
- DayWeekCount++;
+ dayWeekCount++;
}
// Process the actual days of the month.
- XCCalendarMonthViewGridDayWeek MonthWeek;
- int ProcessDay = 1;
+ XCCalendarMonthViewGridDayWeek monthWeek;
+ int processDay = 1;
- while (ProcessGrid == true){
+ while (processGrid == true){
- if (DayWeekCount == 7){
+ if (dayWeekCount == 7){
// Add to the month view grid.
- if (FirstWeekProcessing == true){
+ if (firstWeekProcessing == true){
- FirstWeekProcessing = false;
- MonthViewOutput.WeekList.push_back(FirstWeek);
+ firstWeekProcessing = false;
+ monthViewOutput.weekList.push_back(firstWeek);
} else {
- MonthViewOutput.WeekList.push_back(MonthWeek);
- MonthWeek.DayList.clear();
+ monthViewOutput.weekList.push_back(monthWeek);
+ monthWeek.dayList.clear();
}
- DayWeekCount = 0;
+ dayWeekCount = 0;
continue;
}
- XCCalendarMonthViewGridDayData DayItem;
+ XCCalendarMonthViewGridDayData dayItem;
- DayItem.Day = ProcessDay;
- DayItem.Month = Month;
- DayItem.Year = Year;
- DayItem.IsInMonth = true;
+ dayItem.Day = ProcessDay;
+ dayItem.Month = Month;
+ dayItem.Year = Year;
+ dayItem.IsInMonth = true;
- if (FirstWeekProcessing == true){
+ if (firstWeekProcessing == true){
- FirstWeek.DayList.push_back(DayItem);
+ firstWeek.dayList.push_back(dayItem);
} else {
- MonthWeek.DayList.push_back(DayItem);
+ monthWeek.dayList.push_back(dayItem);
}
- DayWeekCount++;
+ dayWeekCount++;
- if ((Month == 1 || Month == 3 || Month == 5 ||
- Month == 7 || Month == 8 || Month == 10 || Month == 12) &&
- ProcessDay == 31){
+ if ((month == 1 || month == 3 || month == 5 ||
+ month == 7 || month == 8 || month == 10 || month == 12) &&
+ processDay == 31){
break;
}
- if ((Month == 4 || Month == 6 || Month == 9 || Month == 11) &&
- ProcessDay == 30){
+ if ((month == 4 || month == 6 || month == 9 || month == 11) &&
+ processDay == 30){
break;
}
- if (Year % 4 == 0){
+ if (year % 4 == 0){
- if (Year % 100 == 0){
+ if (year % 100 == 0){
- if (Year % 400 == 0){
+ if (year % 400 == 0){
- if (Month == 2 && ProcessDay == 29){
+ if (month == 2 && processDay == 29){
break;
} else {
- if (Month == 2 && ProcessDay == 28){
+ if (month == 2 && processDay == 28){
break;
}
- if (Month == 2 && ProcessDay == 29){
+ if (month == 2 && processDay == 29){
break;
}
- } else if ((Month == 2 && ProcessDay == 28) && Year % 4 != 0){
+ } else if ((month == 2 && processDay == 28) && year % 4 != 0){
break;
}
- ProcessDay++;
+ processDay++;
}
// At the end of the month add any remaining days
// (if required).
- int NextMonthYear = Year;
- int NextMonth = 0;
- int NextMonthDay = 1;
+ int nextMonthYear = year;
+ int nextMonth = 0;
+ int nextMonthDay = 1;
- if (Month == 12){
+ if (month == 12){
- NextMonth = 1;
- NextMonthYear++;
+ nextMonth = 1;
+ nextMonthYear++;
} else {
- NextMonth = Month + 1;
+ nextMonth = month + 1;
}
- for (; DayWeekCount < 7; DayWeekCount++){
+ for (; dayWeekCount < 7; dayWeekCount++){
- XCCalendarMonthViewGridDayData DayItem;
+ XCCalendarMonthViewGridDayData dayItem;
- DayItem.Day = NextMonthDay;
- DayItem.Month = NextMonth;
- DayItem.Year = NextMonthYear;
- DayItem.IsInMonth = false;
+ dayItem.day = nextMonthDay;
+ dayItem.month = nextMonth;
+ dayItem.year = nextMonthYear;
+ dayItem.isInMonth = false;
- MonthWeek.DayList.push_back(DayItem);
- NextMonthDay++;
+ monthWeek.dayList.push_back(dayItem);
+ nextMonthDay++;
}
- if (DayWeekCount == 7){
+ if (dayWeekCount == 7){
- MonthViewOutput.WeekList.push_back(MonthWeek);
+ monthViewOutput.weekList.push_back(monthWeek);
}
- return MonthViewOutput;
+ return monthViewOutput;
}
\ No newline at end of file
struct XCCalendarMonthViewGridDayData{
- int Day = 1;
- int Month = 1;
- int Year = 1;
- bool IsInMonth = false;
+ int day = 1;
+ int month = 1;
+ int year = 1;
+ bool isInMonth = false;
};
struct XCCalendarMonthViewGridDayWeek{
- vector<XCCalendarMonthViewGridDayData> DayList;
+ vector<XCCalendarMonthViewGridDayData> dayList;
};
struct XCCalendarMonthViewGrid{
- vector<XCCalendarMonthViewGridDayWeek> WeekList;
+ vector<XCCalendarMonthViewGridDayWeek> weekList;
};
-XCCalendarMonthViewGrid GenerateMonthGrid(int Month, int Year);
-int PreviousMonthNumberofDays(int Month, int Year);
+XCCalendarMonthViewGrid GenerateMonthGrid(int month, int year);
+int PreviousMonthNumberofDays(int month, int year);
#endif
\ No newline at end of file
void SavePreferences();
void LoadPreferences();
-XCALPreferences::XCALPreferences(wxString PreferencesFilename){
+XCALPreferences::XCALPreferences(wxString preferencesFilename){
// Load the settings into the XCALPreferences object using the
// settings file received in PreferencesFilename.
- wxString fullprefpath;
+ wxString fullPrefPath;
- bool accountnamevalid, accountaddressvalid, accounttypevalid, accountportvalid,
- accountsslvalid, accountusernamevalid, accountpasswordvalid,
- accountdirprefixvalid, accountdirvalid, accountrefreshvalid = FALSE;
-
- bool preaccountstage = FALSE;
- bool isvalidaccount = FALSE;
- bool isvalidsection = FALSE;
- wxString accountname;
- wxString accountaddress;
- wxString accounttype;
- long accountport = 8080;
- long accountrefresh;
- bool accountssl;
- wxString accountusername;
- wxString accountpassword;
- wxString accountdirprefix;
- wxString accountdir;
+ bool accountNameValid, accountAddressValid, accountTypeValid, accountPortValid,
+ accountSSLValid, accountUsernameValid, accountPasswordValid,
+ accountDirPrefixValid, accountDirValid, accountRefreshValid = FALSE;
+
+ bool preAccountStage = FALSE;
+ bool isValidAccount = FALSE;
+ bool isValidSection = FALSE;
+ wxString accountName;
+ wxString accountAddress;
+ wxString accountType;
+ long accountPort = 8080;
+ long accountRefresh;
+ bool accountSSL;
+ wxString accountUsername;
+ wxString accountPassword;
+ wxString accountDirPrefix;
+ wxString accountDir;
- wxString firstchar;
+ wxString firstChar;
string s;
- wxString segmentname;
- wxString segmentvalue;
+ wxString segmentName;
+ wxString segmentValue;
// Load the settings.
- fullprefpath.Append(PreferencesFilename);
- fullprefpath.Append(wxT("settings"));
+ fullPrefPath.Append(preferencesFilename);
+ fullPrefPath.Append(wxT("settings"));
- wxFileConfig *settingfile = new wxFileConfig("", "", fullprefpath);
+ wxFileConfig *settingFile = new wxFileConfig("", "", fullPrefPath);
- wxString ValueInc;
- settingfile->Read(wxT("SaveWindowPosition"), &ValueInc);
+ wxString valueInc;
+ settingFile->Read(wxT("SaveWindowPosition"), &valueInc);
- if (ValueInc == wxT("true")){
+ if (valueInc == wxT("true")){
- SaveWindowPos = TRUE;
- wxRect WindowPosition;
+ saveWindowPos = TRUE;
+ wxRect windowPosition;
- long PosX, PosY, PosH, PosW = 0;
+ long posX, posY, posH, posW = 0;
- bool PosXValid, PosYValid, PosHValid, PosWValid = FALSE;
+ bool posXValid, posYValid, posHValid, posWValid = FALSE;
- PosXValid = settingfile->Read(wxT("WindowPositionX"), &PosX);
- PosYValid = settingfile->Read(wxT("WindowPositionY"), &PosY);
- PosHValid = settingfile->Read(wxT("WindowPositionHeight"), &PosH);
- PosWValid = settingfile->Read(wxT("WindowPositionWidth"), &PosW);
+ posXValid = settingfile->Read(wxT("WindowPositionX"), &posX);
+ posYValid = settingfile->Read(wxT("WindowPositionY"), &posY);
+ posHValid = settingfile->Read(wxT("WindowPositionHeight"), &posH);
+ posWValid = settingfile->Read(wxT("WindowPositionWidth"), &posW);
- if (PosXValid == TRUE && PosYValid == TRUE && PosHValid == TRUE && PosWValid == TRUE){
+ if (posXValid == TRUE && posYValid == TRUE && posHValid == TRUE && posWValid == TRUE){
- WindowPosition.SetX((int)PosX);
- WindowPosition.SetY((int)PosY);
- WindowPosition.SetHeight((int)PosH);
- WindowPosition.SetWidth((int)PosW);
+ windowPosition.SetX((int)posX);
+ windowPosition.SetY((int)posY);
+ windowPosition.SetHeight((int)posH);
+ windowPosition.SetWidth((int)posW);
} else {
- WindowPosition.SetX(-1);
- WindowPosition.SetY(-1);
- WindowPosition.SetHeight(500);
- WindowPosition.SetWidth(300);
+ windowPosition.SetX(-1);
+ windowPosition.SetY(-1);
+ windowPosition.SetHeight(500);
+ windowPosition.SetWidth(300);
}
- SetMainWindowData(WindowPosition);
+ SetMainWindowData(windowPosition);
}
- settingfile->Read(wxT("HideLocalAddressBooks"), &ValueInc);
+ settingFile->Read(wxT("HideLocalAddressBooks"), &valueInc);
- if (ValueInc == wxT("true")){
- HideLocalABs = TRUE;
+ if (valueInc == wxT("true")){
+ hideLocalABs = TRUE;
}
- delete settingfile;
- settingfile = NULL;
+ delete settingFile;
+ settingFile = NULL;
// Load the accounts.
- fullprefpath.Clear();
- fullprefpath.Append(PreferencesFilename);
- fullprefpath.Append(wxT("accounts"));
+ fullPrefPath.Clear();
+ fullPrefPath.Append(preferencesFilename);
+ fullPrefPath.Append(wxT("accounts"));
- wxFileConfig *cfgfile = new wxFileConfig("AddressBook", "Xestia", fullprefpath);
+ wxFileConfig *cfgFile = new wxFileConfig("AddressBook", "Xestia", fullPrefPath);
- wxString EntryName, EntryValue;
- wxString AccAdr, AccUsr, AccPass, AccPrefix, AccDir;
- wxString AccSSLInc;
- bool AccSSL = FALSE;
- int AccRef, AccPort = 0;
- long itemindex = 0;
- bool ContinueAcc = TRUE;
+ wxString entryName, entryValue;
+ wxString accAdr, accUsr, accPass, accPrefix, accDir;
+ wxString accSSLInc;
+ bool accSSL = FALSE;
+ int accRef, accPort = 0;
+ long itemIndex = 0;
+ bool continueAcc = TRUE;
- ContinueAcc = cfgfile->GetFirstGroup(accountname, itemindex);
+ continueAcc = cfgFile->GetFirstGroup(accountname, itemIndex);
- while (ContinueAcc){
+ while (continueAcc){
- cfgfile->SetPath(accountname);
- cfgfile->Read(wxT("type"), &EntryValue);
+ cfgFile->SetPath(accountName);
+ cfgFile->Read(wxT("type"), &entryValue);
- if (EntryValue == wxT("Local")){
+ if (entryValue == wxT("Local")){
// Get the account directory.
- cfgfile->Read(wxT("accountdir"), &AccDir);
+ cfgFile->Read(wxT("accountdir"), &accDir);
- if (AccDir.Len() > 4){
+ if (accDir.Len() > 4){
- accountdirvalid = TRUE;
+ accountDirValid = TRUE;
} else {
- accountdirvalid = FALSE;
+ accountDirValid = FALSE;
}
- if (accountdirvalid == TRUE){
+ if (accountDirValid == TRUE){
- accounts.AddAccount(accountname, wxT("Local"), wxT(""), 0,
+ accounts.AddAccount(accountName, wxT("Local"), wxT(""), 0,
0, wxT(""), wxT(""),
- wxT(""), AccDir, 0);
+ wxT(""), accDir, 0);
}
- } else if (EntryValue == wxT("CalDAV")){
-
- cfgfile->Read(wxT("accountdir"), &AccDir);
- accountaddressvalid = cfgfile->Read(wxT("address"), &AccAdr);
- accountportvalid = cfgfile->Read(wxT("port"), &AccPort);
- accountsslvalid = cfgfile->Read(wxT("ssl"), &AccSSLInc);
- if (AccSSLInc == wxT("true")){
- AccSSL = TRUE;
+ } else if (entryValue == wxT("CalDAV")){
+
+ cfgFile->Read(wxT("accountdir"), &accDir);
+ accountAddressValid = cfgFile->Read(wxT("address"), &accAdr);
+ accountPortValid = cfgFile->Read(wxT("port"), &AccPort);
+ accountSSLValid = cfgFile->Read(wxT("ssl"), &AccSSLInc);
+ if (accSSLInc == wxT("true")){
+ accSSL = TRUE;
}
else {
- AccSSL = FALSE;
+ accSSL = FALSE;
}
- accountusernamevalid = cfgfile->Read(wxT("username"), &AccUsr);
- accountpasswordvalid = cfgfile->Read(wxT("password"), &AccPass);
- accountdirprefixvalid = cfgfile->Read(wxT("prefix"), &AccPrefix);
- accountrefreshvalid = cfgfile->Read(wxT("refresh"), &AccRef);
+ accountUsernameValid = cfgFile->Read(wxT("username"), &accUsr);
+ accountPasswordValid = cfgFile->Read(wxT("password"), &accPass);
+ accountDirPrefixValid = cfgFile->Read(wxT("prefix"), &accPrefix);
+ accountRefreshValid = cfgFile->Read(wxT("refresh"), &accRef);
- if (AccDir.Len() > 4){
+ if (accDir.Len() > 4){
- accountdirvalid = TRUE;
+ accountDirValid = TRUE;
}
// Make sure it is not bigger than 65535 or less than 1.
// If so, default to port 8008.
- if (accountport < 1 || accountport > 65535){
- accountport = 8008;
- accountportvalid = TRUE;
+ if (accountPort < 1 || accountPort > 65535){
+ accountPort = 8008;
+ accountPortValid = TRUE;
}
- accounts.AddAccount(accountname, wxT("CalDAV"), AccAdr, AccPort,
- AccSSL, AccUsr, AccPass,
- AccPrefix, AccDir, AccRef);
+ accounts.AddAccount(accountname, wxT("CalDAV"), accAdr, accPort,
+ accSSL, accUsr, accPass,
+ accPrefix, accDir, accRef);
} else {
- cfgfile->Read(wxT("accountdir"), &AccDir);
- accountaddressvalid = cfgfile->Read(wxT("address"), &AccAdr);
- accountportvalid = cfgfile->Read(wxT("port"), &AccPort);
- accountsslvalid = cfgfile->Read(wxT("ssl"), &AccSSLInc);
- if (AccSSLInc == wxT("true")){
- AccSSL = TRUE;
+ cfgFile->Read(wxT("accountdir"), &accDir);
+ accountAddressValid = cfgFile->Read(wxT("address"), &accAdr);
+ accountPortValid = cfgFile->Read(wxT("port"), &accPort);
+ accountSSLValid = cfgFile->Read(wxT("ssl"), &accSSLInc);
+ if (accSSLInc == wxT("true")){
+ accSSL = TRUE;
}
else {
- AccSSL = FALSE;
+ accSSL = FALSE;
}
- accountusernamevalid = cfgfile->Read(wxT("username"), &AccUsr);
- accountpasswordvalid = cfgfile->Read(wxT("password"), &AccPass);
- accountdirprefixvalid = cfgfile->Read(wxT("prefix"), &AccPrefix);
- accountrefreshvalid = cfgfile->Read(wxT("refresh"), &AccRef);
+ accountUsernameValid = cfgFile->Read(wxT("username"), &accUsr);
+ accountPasswordValid = cfgFile->Read(wxT("password"), &accPass);
+ accountDirPrefixValid = cfgFile->Read(wxT("prefix"), &accPrefix);
+ accountRefreshValid = cfgFile->Read(wxT("refresh"), &accRef);
- if (AccDir.Len() > 4){
+ if (accDir.Len() > 4){
- accountdirvalid = TRUE;
+ accountDirValid = TRUE;
}
// Make sure it is not bigger than 65535 or less than 1.
// If so, default to port 8008.
- if (accountport < 1 || accountport > 65535){
- accountport = 8008;
- accountportvalid = TRUE;
+ if (accountPort < 1 || accountPort > 65535){
+ accountPort = 8008;
+ accountPortValid = TRUE;
}
- accounts.AddAccount(accountname, EntryValue, AccAdr, AccPort,
- AccSSL, AccUsr, AccPass,
- AccPrefix, AccDir, AccRef);
+ accounts.AddAccount(accountName, entryValue, accAdr, accPort,
+ accSSL, accUsr, accPass,
+ accPrefix, accDir, accRef);
}
// Clear up for the next account.
- accountnamevalid, accountaddressvalid, accounttypevalid, accountportvalid,
- accountsslvalid, accountusernamevalid, accountpasswordvalid,
- accountdirprefixvalid, accountdirvalid, accountrefreshvalid, accountssl,
- isvalidaccount, isvalidsection = FALSE;
+ accountNameValid, accountAddressValid, accountTypeValid, accountPortValid,
+ accountSSLValid, accountUsernameValid, accountPasswordValid,
+ accountDirPrefixValid, accountDirValid, accountRefreshValid, accountSSL,
+ isValidAccount, isValidSection = FALSE;
- AccAdr.Clear();
- AccDir.Clear();
- AccUsr.Clear();
- AccPass.Clear();
- AccPrefix.Clear();
- accountname.Clear();
- accountaddress.Clear();
- accounttype.Clear();
- accountport = 0;
- accountrefresh = 0;
- accountusername.Clear();
- accountpassword.Clear();
- accountdirprefix.Clear();
- preaccountstage = TRUE;
+ accAdr.Clear();
+ accDir.Clear();
+ accUsr.Clear();
+ accPass.Clear();
+ accPrefix.Clear();
+ accountName.Clear();
+ accountAddress.Clear();
+ accountType.Clear();
+ accountPort = 0;
+ accountRefresh = 0;
+ accountUsername.Clear();
+ accountPassword.Clear();
+ accountDirPrefix.Clear();
+ preAccountStage = TRUE;
- cfgfile->SetPath(wxT("/"));
- ContinueAcc = cfgfile->GetNextGroup(accountname, itemindex);
+ cfgFile->SetPath(wxT("/"));
+ ContinueAcc = cfgfile->GetNextGroup(accountName, itemIndex);
}
}
-bool XCALPreferences::GetBoolData(wxString SettingName){
+bool XCALPreferences::GetBoolData(wxString settingName){
// GetBoolData from the XCALPreferences object.
- if (SettingName == wxT("SaveWindowPosition")) { return SaveWindowPos; }
- else if (SettingName == wxT("HideLocalAddressBooks")) { return HideLocalABs; }
+ if (settingName == wxT("SaveWindowPosition")) { return saveWindowPos; }
+ else if (settingName == wxT("HideLocalAddressBooks")) { return hideLocalABs; }
return FALSE;
// Return the main window data as a wxRect object.
- return MainWindowData;
+ return mainWindowData;
}
-void XCALPreferences::SetMainWindowData(wxRect WindowData){
+void XCALPreferences::SetMainWindowData(wxRect windowData){
// Set the main window data from a wxRect object.
- MainWindowData = WindowData;
+ mainWindowData = WindowData;
}
}
-int XCALPrefAccounts::AddAccount(wxString NewAccName,
- wxString NewAccType,
- wxString NewAccAddress,
- int NewAccPort,
- int NewAccSSL,
- wxString NewAccUser,
- wxString NewAccPass,
- wxString NewAccDirPrefix,
- wxString NewAccDir,
- long NewAccRefresh
+int XCALPrefAccounts::AddAccount(wxString newAccName,
+ wxString newAccType,
+ wxString newAccAddress,
+ int newAccPort,
+ int newAccSSL,
+ wxString newAccUser,
+ wxString newAccPass,
+ wxString newAccDirPrefix,
+ wxString newAccDir,
+ long newAccRefresh
){
// Add an account to the list of accounts in the
// XCALPrefAccounts object.
- AccountName.Add(NewAccName, 1);
- AccountType.Add(NewAccType, 1);
- AccountAddress.Add(NewAccAddress, 1);
- AccountPort.Add(NewAccPort, 1);
- AccountSSL.Add(NewAccSSL, 1);
- AccountUsername.Add(NewAccUser, 1);
- AccountPassword.Add(NewAccPass, 1);
- DirectoryPrefix.Add(NewAccDirPrefix, 1);
- AccountDirectory.Add(NewAccDir, 1);
- AccountRefresh.Add(NewAccRefresh, 1);
+ accountName.Add(newAccName, 1);
+ accountType.Add(newAccType, 1);
+ accountAddress.Add(newAccAddress, 1);
+ accountPort.Add(newAccPort, 1);
+ accountSSL.Add(newAccSSL, 1);
+ accountUsername.Add(newAccUser, 1);
+ accountPassword.Add(newAccPass, 1);
+ directoryPrefix.Add(newAccDirPrefix, 1);
+ accountDirectory.Add(newAccDir, 1);
+ accountRefresh.Add(newAccRefresh, 1);
- AccountsCount++;
+ accountsCount++;
return 0;
// Get the count of accounts in the XCALPrefAccounts object.
- return AccountsCount;
+ return accountsCount;
}
-wxString XCALPrefAccounts::GetAccountName(int AccountNum){
+wxString XCALPrefAccounts::GetAccountName(int accountNum){
// Get the account name.
- if (AccountNum > AccountsCount){
+ if (accountNum > accountsCount){
return wxT("");
}
- return AccountName[AccountNum];
+ return accountName[accountNum];
}
-wxString XCALPrefAccounts::GetAccountType(int AccountNum){
+wxString XCALPrefAccounts::GetAccountType(int accountNum){
// Get the account type.
- if (AccountNum > AccountsCount){
+ if (accountNum > accountsCount){
return wxT("");
}
- return AccountType[AccountNum];
+ return accountType[accountNum];
}
-wxString XCALPrefAccounts::GetAccountAddress(int AccountNum){
+wxString XCALPrefAccounts::GetAccountAddress(int accountNum){
// Get the account server address.
- if (AccountNum > AccountsCount){
+ if (accountNum > accountsCount){
return wxT("");
}
- return AccountAddress[AccountNum];
+ return accountAddress[accountNum];
}
-int XCALPrefAccounts::GetAccountPort(int AccountNum){
+int XCALPrefAccounts::GetAccountPort(int accountNum){
// Get the account server port.
- if (AccountNum > AccountsCount){
+ if (accountNum > accountsCount){
return 0;
}
- return AccountPort[AccountNum];
+ return accountPort[accountNum];
}
-bool XCALPrefAccounts::GetAccountSSL(int AccountNum){
+bool XCALPrefAccounts::GetAccountSSL(int accountNum){
// Get the account server SSL support.
- if (AccountNum > AccountsCount){
+ if (accountNum > accountsCount){
return wxT("");
}
- return AccountSSL[AccountNum];
+ return accountSSL[accountNum];
}
-wxString XCALPrefAccounts::GetAccountUsername(int AccountNum){
+wxString XCALPrefAccounts::GetAccountUsername(int accountNum){
// Get the account username.
- if (AccountNum > AccountsCount){
+ if (accountNum > accountsCount){
return wxT("");
}
- return AccountUsername[AccountNum];
+ return accountUsername[accountNum];
}
-wxString XCALPrefAccounts::GetAccountPassword(int AccountNum){
+wxString XCALPrefAccounts::GetAccountPassword(int accountNum){
// Get the account password.
- if (AccountNum > AccountsCount){
+ if (accountNum > accountsCount){
return wxT("");
}
- return AccountPassword[AccountNum];
+ return accountPassword[accountNum];
}
-wxString XCALPrefAccounts::GetAccountDirectory(int AccountNum){
+wxString XCALPrefAccounts::GetAccountDirectory(int accountNum){
// Get the account directory.
- if (AccountNum > AccountsCount){
+ if (accountNum > accountsCount){
return wxT("");
}
- return AccountDirectory[AccountNum];
+ return accountDirectory[accountNum];
}
-wxString XCALPrefAccounts::GetAccountDirPrefix(int AccountNum){
+wxString XCALPrefAccounts::GetAccountDirPrefix(int accountNum){
// Get the account server directory prefix.
- if (AccountNum > AccountsCount){
+ if (accountNum > accountsCount){
return wxT("");
}
- return DirectoryPrefix[AccountNum];
+ return directoryPrefix[accountNum];
}
-long XCALPrefAccounts::GetAccountRefresh(int AccountNum){
+long XCALPrefAccounts::GetAccountRefresh(int accountNum){
// Get the account refresh time.
- if (AccountNum > AccountsCount){
+ if (accountNum > accountsCount){
return 0;
}
- return AccountRefresh[AccountNum];
+ return accountRefresh[accountNum];
}
\ No newline at end of file
private:
public:
- wxArrayString ThemeName;
- wxArrayString ThemeData;
+ wxArrayString themeName;
+ wxArrayString themeData;
};
class XCALPrefAccounts
{
private:
- wxArrayString AccountName;
- wxArrayString AccountType;
- wxArrayString AccountAddress;
- wxArrayInt AccountPort;
- wxArrayInt AccountSSL;
- wxArrayString AccountUsername;
- wxArrayString AccountPassword;
- wxArrayString DirectoryPrefix;
- wxArrayString AccountDirectory;
- wxArrayLong AccountRefresh;
- int AccountsCount;
+ wxArrayString accountName;
+ wxArrayString accountType;
+ wxArrayString accountAddress;
+ wxArrayInt accountPort;
+ wxArrayInt accountSSL;
+ wxArrayString accountUsername;
+ wxArrayString accountPassword;
+ wxArrayString directoryPrefix;
+ wxArrayString accountDirectory;
+ wxArrayLong accountRefresh;
+ int accountsCount;
public:
XCALPrefAccounts();
int GetCount();
- wxString GetAccountName(int AccountNum);
- wxString GetAccountType(int AccountNum);
- wxString GetAccountAddress(int AccountNum);
- int GetAccountPort(int AcconutNum);
- bool GetAccountSSL(int AccountNum);
- wxString GetAccountUsername(int AccountNum);
- wxString GetAccountPassword(int AccountNum);
- wxString GetAccountDirectory(int AccountNum);
- wxString GetAccountDirPrefix(int AccountNum);
- long GetAccountRefresh(int AccountNum);
- int AddAccount(wxString NewAccName,
- wxString NewAccType,
- wxString NewAccAddress,
- int NewAccPort,
- int NewAccSSL,
- wxString NewAccUser,
- wxString NewAccPass,
- wxString NewAccDirPrefix,
- wxString NewAccDir,
- long NewAccRefresh
+ wxString GetAccountName(int accountNum);
+ wxString GetAccountType(int accountNum);
+ wxString GetAccountAddress(int accountNum);
+ int GetAccountPort(int acconutNum);
+ bool GetAccountSSL(int accountNum);
+ wxString GetAccountUsername(int accountNum);
+ wxString GetAccountPassword(int accountNum);
+ wxString GetAccountDirectory(int accountNum);
+ wxString GetAccountDirPrefix(int accountNum);
+ long GetAccountRefresh(int accountNum);
+ int AddAccount(wxString newAccName,
+ wxString newAccType,
+ wxString newAccAddress,
+ int newAccPort,
+ int newAccSSL,
+ wxString newAccUser,
+ wxString newAccPass,
+ wxString newAccDirPrefix,
+ wxString newAccDir,
+ long newAccRefresh
);
};
private:
// General Tab
- bool SaveWindowPos = FALSE;
- wxRect MainWindowData;
- bool HideLocalABs = FALSE;
+ bool saveWindowPos = FALSE;
+ wxRect mainWindowData;
+ bool hideLocalABs = FALSE;
// Themes tab
- bool EnableThemes = FALSE;
+ bool enableThemes = FALSE;
// Accounts tab
// General things.
- wxString Filename;
+ wxString filename;
public:
- XCALPreferences(wxString PreferencesFilename);
+ XCALPreferences(wxString preferencesFilename);
~XCALPreferences();
XCALPrefAccounts accounts;
int WritePreferences();
int ReadPreferences();
- bool GetBoolData(wxString SettingName);
- bool SetBoolData(wxString SettingName, bool SettingValue);
+ bool GetBoolData(wxString settingName);
+ bool SetBoolData(wxString settingName, bool settingValue);
wxRect GetMainWindowData();
- void SetMainWindowData(wxRect WindowData);
+ void SetMainWindowData(wxRect windowData);
//int AddAccount(wxString Name);
int GetThemeCount();
- wxString GetThemeData(wxString ThemeName);
+ wxString GetThemeData(wxString themeName);
- int ErrorFlag;
+ int errorFlag;
};
#include <wx/wx.h>
#include <wx/tokenzr.h>
-bool CheckBlacklist(wxString ServerAddress){
+bool CheckBlacklist(wxString serverAddress){
// Check if the server address is on the blacklist.
- wxString ServerBlacklist = "google.com";
- wxString BListHostname;
+ wxString serverBlacklist = "google.com";
+ wxString bListHostname;
- wxStringTokenizer ServerBlacklistTkz(ServerBlacklist, wxT("|"));
+ wxStringTokenizer serverBlacklistTkz(serverBlacklist, wxT("|"));
- while(ServerBlacklistTkz.HasMoreTokens()){
+ while(serverBlacklistTkz.HasMoreTokens()){
- BListHostname = ServerBlacklistTkz.GetNextToken();
- if (BListHostname == ServerAddress){
+ bListHostname = serverBlacklistTkz.GetNextToken();
+ if (bListHostname == serverAddress){
return TRUE;
}
#ifndef COMMON_SVRBLIST_H
#define COMMON_SVRBLIST_H
-bool CheckBlacklist(wxString ServerAddress);
+bool CheckBlacklist(wxString serverAddress);
#endif
\ No newline at end of file
using namespace std;
multimap<string, string> ProcessTextVectors(vector<string> *TextProperties,
- vector<string> *TextValues,
- bool SearchMultiple,
- string Property){
+ vector<string> *textValues,
+ bool searchMultiple,
+ string property){
- multimap<string,string> ProcessResult;
+ multimap<string,string> processResult;
// Go through each of the values.
- int TextSeekCount = 0;
- int TextPropertySize = 0;
- int PropertySeekCount = 0;
- string PropertyName = "";
- int PropertyNameSize = 0;
- char BufferChar = 0;
+ int textSeekCount = 0;
+ int textPropertySize = 0;
+ int propertySeekCount = 0;
+ string propertyName = "";
+ int propertyNameSize = 0;
+ char bufferChar = 0;
- for (vector<string>::iterator iter = TextProperties->begin();
- iter != TextProperties->end(); iter++){
+ for (vector<string>::iterator iter = textProperties->begin();
+ iter != textProperties->end(); iter++){
- TextPropertySize = iter->size();
+ textPropertySize = iter->size();
- if (TextPropertySize == 0){
+ if (textPropertySize == 0){
// Text property size is 0. Go to the next
// pair.
// Get the property data up to the first semi-colon.
- while (TextSeekCount < TextPropertySize){
+ while (textSeekCount < textPropertySize){
- BufferChar = (*iter)[TextSeekCount];
+ bufferChar = (*iter)[textSeekCount];
- if (BufferChar == ';'){
+ if (bufferChar == ';'){
break;
}
- PropertyName += BufferChar;
+ PropertyName += bufferChar;
- TextSeekCount++;
+ textSeekCount++;
}
- if (*iter == Property || PropertyName == Property){
+ if (*iter == property || propertyName == property){
- ProcessResult.insert(make_pair((*TextProperties)[PropertySeekCount],
- (*TextValues)[PropertySeekCount]));
+ processResult.insert(make_pair((*textProperties)[propertySeekCount],
+ (*textValues)[propertySeekCount]));
// Check to continue if one is found.
- if (SearchMultiple == false){
+ if (searchMultiple == false){
// Found one, don't search for anymore.
}
- PropertySeekCount++;
- TextPropertySize = 0;
- TextSeekCount = 0;
- PropertyName.clear();
+ propertySeekCount++;
+ textPropertySize = 0;
+ textSeekCount = 0;
+ propertyName.clear();
}
- return ProcessResult;
+ return processResult;
}
-map<string, string> SplitValues(string InputData){
+map<string, string> SplitValues(string inputData){
- map<string,string> FinalSplitValues;
- map<int,int> SplitPoints;
- map<int,int> SplitLength;
- size_t intPropertyLen = InputData.size();
+ map<string,string> finalSplitValues;
+ map<int,int> splitPoints;
+ map<int,int> splitLength;
+ size_t intPropertyLen = inputData.size();
int intSplitsFound = 0;
int intSplitSize = 0;
int intSplitSeek = 0;
intSplitSize++;
- InputData.substr(intPrevSplitFound, intSplitSize);
+ inputData.substr(intPrevSplitFound, intSplitSize);
- if (InputData.substr(i, 1) == ";" &&
- InputData.substr((i - 1), 1) != "\\"){
+ if (inputData.substr(i, 1) == ";" &&
+ inputData.substr((i - 1), 1) != "\\"){
if (intSplitsFound > 0){
// Split the value into two.
- PropertyNameValue NVData = SplitNameValue(InputData.substr(intPrevSplitFound, (intSplitSize - 1)));
+ PropertyNameValue nVData = SplitNameValue(inputData.substr(intPrevSplitFound, (intSplitSize - 1)));
- if (FinalSplitValues.find(NVData.Name) != FinalSplitValues.end()){
- FinalSplitValues.insert(make_pair(NVData.Name, NVData.Value));
+ if (finalSplitValues.find(nVData.name) != finalSplitValues.end()){
+ finalSplitValues.insert(make_pair(nVData.name, nVData.value));
} else {
- FinalSplitValues[NVData.Name] = NVData.Value;
+ finalSplitValues[nVData.name] = nVData.value;
}
}
if (intSplitsFound > 0){
- PropertyNameValue NVData = SplitNameValue(InputData.substr(intPrevSplitFound, (intSplitSize - 1)));
+ PropertyNameValue nVData = SplitNameValue(inputData.substr(intPrevSplitFound, (intSplitSize - 1)));
- if (FinalSplitValues.find(NVData.Name) != FinalSplitValues.end()){
- FinalSplitValues.insert(make_pair(NVData.Name, NVData.Value));
+ if (finalSplitValues.find(nVData.name) != finalSplitValues.end()){
+ finalSplitValues.insert(make_pair(nVData.name, nVData.value));
} else {
- FinalSplitValues[NVData.Name] = NVData.Value;
+ finalSplitValues[nVData.name] = nVData.value;
}
}
- return FinalSplitValues;
+ return finalSplitValues;
}
-PropertyNameValue SplitNameValue(string InputData){
+PropertyNameValue SplitNameValue(string inputData){
- PropertyNameValue FinalNameValue;
- int InputDataLength = InputData.size();
- int SeekCount = 0;
- bool QuoteMode = false;
- bool DataFound = false;
+ PropertyNameValue finalNameValue;
+ int inputDataLength = inputData.size();
+ int seekCount = 0;
+ bool quoteMode = false;
+ bool dataFound = false;
- while (SeekCount < InputDataLength){
+ while (seekCount < inputDataLength){
- if (InputData[SeekCount] == '='){
+ if (inputData[seekCount] == '='){
- FinalNameValue.Name = InputData.substr(0, SeekCount);
+ finalNameValue.name = inputData.substr(0, seekCount);
try{
- FinalNameValue.Value = InputData.substr((SeekCount + 1));
+ finalNameValue.Value = inputData.substr((seekCount + 1));
}
catch (const out_of_range &oor){
// Do nothing. Have an empty final value.
}
- DataFound = true;
+ dataFound = true;
break;
}
- SeekCount++;
+ seekCount++;
}
- if (DataFound == false){
+ if (dataFound == false){
- FinalNameValue.Name = InputData;
+ finalNameValue.Name = inputData;
}
// Check if the value has quotes at the start and end.
// Remove them if this is the case.
- if (FinalNameValue.Value.front() == '\"' &&
- FinalNameValue.Value.back() == '\"'){
+ if (finalNameValue.value.front() == '\"' &&
+ finalNameValue.value.back() == '\"'){
- FinalNameValue.Value.erase(0, 1);
- FinalNameValue.Value.erase((FinalNameValue.Value.size() - 1), 1);
+ finalNameValue.value.erase(0, 1);
+ finalNameValue.value.erase((finalNameValue.value.size() - 1), 1);
}
- return FinalNameValue;
+ return finalNameValue;
}
-bool HexToInt(std::string *HexString, int *Number){
+bool HexToInt(std::string *hexString, int *number){
// Check that each character in the string is a number
// or a letter (a-f/A-F).
- char Char = 0;
- int CharNum = 0;
+ char charLetter = 0;
+ int charNum = 0;
- for (int CharSeek = 0;
- CharSeek < HexString->size(); CharSeek++){
+ for (int charSeek = 0;
+ charSeek < hexString->size(); charSeek++){
// Check if character is a number (0-9).
- Char = HexString->at(CharSeek);
- CharNum = Char;
+ charLetter = hexString->at(charSeek);
+ charNum = charLetter;
- if (CharNum >= 48 &&
- CharNum <= 57){
+ if (charNum >= 48 &&
+ charNum <= 57){
continue;
// Check if character is a letter (A-F)
- if (CharNum >= 65 &&
- CharNum <= 70){
+ if (charNum >= 65 &&
+ charNum <= 70){
continue;
// Check if character is a letter (a-f).
- if (CharNum >= 97 &&
- CharNum <= 102){
+ if (charNum >= 97 &&
+ charNum <= 102){
continue;
try {
- *Number = stoi((*HexString), nullptr, 16);
+ *number = stoi((*hexString), nullptr, 16);
}
}
-bool IntToHex(int *Number, std::string *HexString, int HexFill){
+bool IntToHex(int *number, std::string *hexString, int hexFill){
- stringstream StringData;
- StringData << setfill('0') << hex << setw(HexFill) << (*Number);
- (*HexString) = StringData.str();
+ stringstream stringData;
+ stringData << setfill('0') << hex << setw(hexFill) << (*number);
+ (*hexString) = stringData.str();
return true;
}
-void SplitPathFilename(string *CalendarEntryHREF, string *EntryURIPath,
- string *EntryFilename){
+void SplitPathFilename(string *calendarEntryHREF, string *entryURIPath,
+ string *entryFilename){
// Look for the last forward slash.
- int LastForwardSlash = -1;
- int CharSeek = 0;
- string StringIterChar = "";
+ int lastForwardSlash = -1;
+ int charSeek = 0;
+ string stringIterChar = "";
- for (string::iterator StringIter = CalendarEntryHREF->begin();
- StringIter != CalendarEntryHREF->end(); StringIter++){
+ for (string::iterator stringIter = calendarEntryHREF->begin();
+ stringIter != calendarEntryHREF->end(); stringIter++){
- StringIterChar = *StringIter;
+ stringIterChar = *stringIter;
- if (StringIterChar == "/"){
- LastForwardSlash = CharSeek;
+ if (stringIterChar == "/"){
+ lastForwardSlash = charSeek;
}
- CharSeek++;
+ charSeek++;
}
- if (LastForwardSlash == -1){
+ if (lastForwardSlash == -1){
return;
// Get the string before the last hash for the path.
- (*EntryURIPath) = CalendarEntryHREF->substr(0, (LastForwardSlash + 1));
+ (*entryURIPath) = calendarEntryHREF->substr(0, (LastForwardSlash + 1));
// Get the string after the last hash for the filename.
- (*EntryFilename) = CalendarEntryHREF->substr((LastForwardSlash + 1));
+ (*entryFilename) = calendarEntryHREF->substr((LastForwardSlash + 1));
}
-string OutputText(string *TextInput){
+string OutputText(string *textInput){
- string OutputTextData;
- string OutputLine;
- int CharSeek = 0;
- int LineSeek = 0;
- int MaxLineSeek = 77;
+ string outputTextData;
+ string outputLine;
+ int charSeek = 0;
+ int lineSeek = 0;
+ int maxLineSeek = 77;
- for (CharSeek = 0; CharSeek < TextInput->size(); CharSeek++){
+ for (charSeek = 0; charSeek < TextInput->size(); charSeek++){
- LineSeek++;
+ lineSeek++;
- if (LineSeek == MaxLineSeek){
+ if (lineSeek == maxLineSeek){
- if (TextInput->substr(CharSeek, 1) != "\n"){
- OutputLine += TextInput->substr(CharSeek, 1);
+ if (textInput->substr(charSeek, 1) != "\n"){
+ outputLine += textInput->substr(charSeek, 1);
}
- OutputLine += "\n";
- OutputTextData += OutputLine;
- OutputLine = " ";
- LineSeek = 0;
- MaxLineSeek = 76;
+ outputLine += "\n";
+ outputTextData += OutputLine;
+ outputLine = " ";
+ lineSeek = 0;
+ maxLineSeek = 76;
continue;
}
- OutputLine += TextInput->substr(CharSeek, 1);
+ outputLine += textInput->substr(charSeek, 1);
}
- if (OutputLine != " "){
+ if (outputLine != " "){
- OutputTextData += OutputLine;
+ outputTextData += outputLine;
}
- return OutputTextData;
+ return outputTextData;
}
\ No newline at end of file
#include <iomanip>
struct PropertyNameValue{
- std::string Name;
- std::string Value;
+ std::string name;
+ std::string value;
};
-std::multimap<std::string, std::string> ProcessTextVectors(std::vector<std::string> *TextProperties,
- std::vector<std::string> *TextValues,
- bool SearchMultiple,
- std::string Property);
-std::map<std::string, std::string> SplitValues(std::string InputData);
-PropertyNameValue SplitNameValue(std::string InputData);
-bool HexToInt(std::string *HexString, int *Number);
-bool IntToHex(int *Number, std::string *HexString, int HexFill);
-void SplitPathFilename(std::string *CalendarEntryHREF, std::string *EntryURIPath,
- std::string *EntryFilename);
-std::string OutputText(std::string *TextInput);
+std::multimap<std::string, std::string> ProcessTextVectors(std::vector<std::string> *textProperties,
+ std::vector<std::string> *textValues,
+ bool searchMultiple,
+ std::string property);
+std::map<std::string, std::string> SplitValues(std::string inputData);
+PropertyNameValue SplitNameValue(std::string inputData);
+bool HexToInt(std::string *hexString, int *number);
+bool IntToHex(int *number, std::string *hexString, int hexFill);
+void SplitPathFilename(std::string *calendarEntryHREF, std::string *entryURIPath,
+ std::string *entryFilename);
+std::string OutputText(std::string *textInput);
#endif
\ No newline at end of file
#include <stdio.h>
- FILE *uuid_hdl = popen("uuidgen", "r");
+ FILE *uuidhdl = popen("uuidgen", "r");
- if (uuid_hdl == NULL) {
+ if (uuidhdl == NULL) {
return "";
}
- char strdata[64];
- std::string uuidout;
+ char strData[64];
+ std::string uuidOut;
- while (fgets(strdata, sizeof(strdata), uuid_hdl) != NULL){
- uuidout.append(strdata);
+ while (fgets(strData, sizeof(strData), uuidhdl) != NULL){
+ uuidOut.append(strData);
}
- pclose(uuid_hdl);
+ pclose(uuidhdl);
#endif
- if (uuidout.back() == '\n'){
+ if (uuidOut.back() == '\n'){
- uuidout.erase(uuidout.end()-1);
+ uuidOut.erase(uuidOut.end()-1);
}
- return uuidout;
+ return uuidOut;
}
\ No newline at end of file
SetupDefaultSettings();
SetupDefaultCalendar();
- frmMain *frame = new frmMain( NULL );
+ frmMain *frameMain = new frmMain( NULL );
wxMemoryInputStream istream(bigimgs_appicon48_png, sizeof(bigimgs_appicon48_png));
wxImage bigimgs_appicon48i(istream, wxBITMAP_TYPE_PNG);
- wxBitmap appiconbmp(bigimgs_appicon48i, -1);
- wxIcon appicon;
+ wxBitmap appIconBMP(bigimgs_appicon48i, -1);
+ wxIcon appIcon;
- appicon.CopyFromBitmap(appiconbmp);
+ appIcon.CopyFromBitmap(appIconBMP);
- frame->SetIcon(appicon);
- frame->Show(true);
+ frameMain->SetIcon(appIcon);
+ frameMain->Show(true);
- SetTopWindow(frame);
+ SetTopWindow(frameMain);
return true;