Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
macOS: Implemented support for adding, editing and deleting a CalDAV account
[xestiacalendar/.git] / source / forms / preferences / frmPreferences.cpp
index 07a4715..fde8e03 100644 (file)
@@ -23,13 +23,19 @@ frmPreferences::frmPreferences( wxWindow* parent )
 frmPreferencesADT( parent )
 {
 
-       wxMemoryInputStream bstream(icons_acclocal_png, sizeof(icons_acclocal_png));
+       wxMemoryInputStream astream(icons_acclocal_png, sizeof(icons_acclocal_png));
+       wxMemoryInputStream bstream(icons_accinet_png, sizeof(icons_accinet_png));
        wxMemoryInputStream cstream(icons_accunsupported_png, sizeof(icons_accunsupported_png));
 
-       wxImage icons_acclocal_png(bstream, wxBITMAP_TYPE_PNG);
+       wxImage icons_acclocal_png(astream, wxBITMAP_TYPE_PNG);
        wxBitmap accNIcon(icons_acclocal_png, -1);
        wxIcon wxIAccNIcon;
        wxIAccNIcon.CopyFromBitmap(accNIcon);
+
+       wxImage icons_accinet_png(bstream, wxBITMAP_TYPE_PNG);
+       wxBitmap accIIcon(icons_accinet_png, -1);
+       wxIcon wxIAccIIcon;
+       wxIAccIIcon.CopyFromBitmap(accIIcon);
        
        wxImage icons_accunsupported_png(cstream, wxBITMAP_TYPE_PNG);
        wxBitmap accUIcon(icons_accunsupported_png, -1);
@@ -37,6 +43,7 @@ frmPreferencesADT( parent )
        wxIAccUIcon.CopyFromBitmap(accUIcon);
        
        accountID = accImgList->Add(wxIAccNIcon);
+       accountNetID = accImgList->Add(wxIAccIIcon);
        accountUnsupportedID = accImgList->Add(wxIAccUIcon);
 
        NbtPreferences->RemovePage(1);
@@ -144,6 +151,10 @@ void frmPreferences::ReloadAccounts(){
        
                        col0.SetImage(accountID);
        
+               } else if (preferences->accounts.GetAccountType(i) == wxT("CalDAV")){
+               
+                       col0.SetImage(accountNetID);
+               
                } else {
 
                        col0.SetImage(accountUnsupportedID);
@@ -209,7 +220,7 @@ void frmPreferences::ModifyAccount( wxCommandEvent& event )
        
        accType = preferences->accounts.GetAccountType((int)lstAccountsIndex);
        
-       if (accType != "CardDAV" && accType != "carddav" &&
+       if (accType != "CalDAV" && accType != "caldav" &&
                accType != "Local" && accType != "local"){
        
                wxMessageBox(_("Cannot modify the selected account settings as the account type is unsupported."), _("Unsupported account type"), wxICON_ERROR);
@@ -302,32 +313,42 @@ void frmPreferences::DeleteAccount( wxCommandEvent& event )
                accountDirFull.Append(accountDir);
                accountDirFull.Append(wxT("."));
        
-               /*if (AccountType == wxT("CalDAV")){
+               if (accountType == wxT("CalDAV")){
        
-                       AccountDirFull.Append(wxT("local"));
+                       accountDirFull.Append(wxT("CalDAV"));
        
-               } else */
-               
-               if (accountType == wxT("Local")){
+               } else if (accountType == wxT("Local")){
        
                        accountDirFull.Append(wxT("Local"));
        
-               }/*else {
-                       
-                       AccountDirFull.Append(AccountType.Lower());
-                       
-               }*/
+               }
        
                lstAccounts->DeleteItem(lstAccountsIndex);
        
                // Delete the directory that contains the account information.
        
                if (!accountDirFull.IsEmpty()){
-       
+
+#if defined(__WIN32__)
+
+                       accountDirDelFull.Append(GetUserDir());
+                       accountDirDelFull.Append(wxT("\\accounts\\"));
+                       accountDirDelFull.Append(accountDirFull);
+
+#elif defined(__APPLE__)
+            
+            accountDirDelFull.Append(wxString::FromUTF8(getenv("HOME")));
+            accountDirDelFull.Append(wxT("/Library/Preferences/Xestia/Calendar/accounts/"));
+            accountDirDelFull.Append(accountDirFull);
+            
+#else
+
                        accountDirDelFull.Append(wxString::FromUTF8(getenv("HOME")));
                        accountDirDelFull.Append(wxT("/.xestiacal/accounts/"));
                        accountDirDelFull.Append(accountDirFull);
        
+#endif
+
                        wxRmDir(accountDirDelFull);
        
                }
@@ -425,4 +446,4 @@ void frmPreferences::SetupPointers(bool *reloadAccountInc){
        
        reloadAccountConfig = reloadAccountInc;
 
-}
\ No newline at end of file
+}
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