X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcommon%2Fdefaults.cpp;h=924c550d55b7e4e85ecc0d781b5b65927a01213f;hb=refs%2Ftags%2Frelease-0.24;hp=57a8ad57b0363b14cbd0d5933d4f3deb58b805ef;hpb=b1f76f7e0f139ef9fe84f607ab32b88565c72ddd;p=xestiaab%2F.git
diff --git a/source/common/defaults.cpp b/source/common/defaults.cpp
index 57a8ad5..924c550 100644
--- a/source/common/defaults.cpp
+++ b/source/common/defaults.cpp
@@ -16,8 +16,9 @@
// You should have received a copy of the GNU General Public License along
// with Xestia Address Book. If not, see
-#include
-#include
+#include "defaults.h"
+
+using namespace std;
void SetupDefaultAddressBook(){
@@ -129,10 +130,64 @@ void SetupDefaultSettings(){
PrefsFile.Open(PrefsFilename, wxT("w"));
#endif
- PrefsFile.Write(wxT("HideLocalAddressBooks=false\nSaveWindowPosition=true\n"));
+ PrefsFile.Write(wxT("HideLocalAddressBooks=false\nSaveWindowPosition=true\nUseBackgroundContactColour=false\n"));
}
-
+
+ // Check if the default account is in the accounts list.
+ // Add it if it isn't.
+
+ wxString accountsConfigFile = DefaultPrefDir;
+ accountsConfigFile.Append(wxT("accounts"));
+
+ wxFileConfig *accountConfigData = new wxFileConfig("", "", accountsConfigFile);
+
+ long itemIndex = 0;
+ wxString accountName;
+ wxString accountType;
+ wxString accountDirectory;
+ bool continueProcessing = false;
+ bool defaultCalendarExists = false;
+
+ continueProcessing = accountConfigData->GetFirstGroup(accountName, itemIndex);
+
+ while (continueProcessing){
+
+ accountConfigData->SetPath(accountName);
+ accountConfigData->Read(wxT("type"), &accountType);
+ accountConfigData->Read(wxT("accountdir"), &accountDirectory);
+
+ if (accountType == wxT("Local") && accountDirectory == wxT("Default")){
+
+ defaultCalendarExists = true;
+
+ }
+
+ continueProcessing = accountConfigData->GetNextGroup(accountName, itemIndex);
+
+ }
+
+ if (defaultCalendarExists == false){
+
+ // Create the account in the accounts file.
+
+ accountConfigData->SetPath(wxT("/Default"));
+ accountConfigData->Write(wxT("type"), wxT("Local"));
+ accountConfigData->Write(wxT("accountdir"), wxT("Default"));
+ accountConfigData->Write(wxT("prefix"), wxT(""));
+ accountConfigData->Write(wxT("address"), wxT(""));
+ accountConfigData->Write(wxT("port"), wxT(""));
+ accountConfigData->Write(wxT("ssl"), wxT("false"));
+ accountConfigData->Write(wxT("username"), wxT(""));
+ accountConfigData->Write(wxT("password"), wxT(""));
+ accountConfigData->Write(wxT("prefix"), wxT(""));
+ accountConfigData->Write(wxT("refresh"), wxT("1800"));
+
+ }
+
+ delete accountConfigData;
+ accountConfigData = nullptr;
+
}
void SetupDirectories(){