Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added code for viewing vCard data within an unsupported account
[xestiaab/.git] / source / frmPreferences.cpp
index b12e712..c9623e0 100644 (file)
@@ -43,6 +43,7 @@ frmPreferencesADT( parent )
        
        wxMemoryInputStream astream(icons_accinet_png, sizeof(icons_accinet_png));
        wxMemoryInputStream bstream(icons_acclocal_png, sizeof(icons_acclocal_png));
+       wxMemoryInputStream cstream(icons_accunsupported_png, sizeof(icons_accunsupported_png));
        
        wxImage icons_accinet_png(astream, wxBITMAP_TYPE_PNG);
        wxBitmap AccInet(icons_accinet_png, -1);
@@ -53,9 +54,15 @@ frmPreferencesADT( parent )
        wxBitmap AccNIcon(icons_acclocal_png, -1);
        wxIcon wxIAccNIcon;
        wxIAccNIcon.CopyFromBitmap(AccNIcon);
+
+       wxImage icons_accunsupported_png(cstream, wxBITMAP_TYPE_PNG);
+       wxBitmap AccUIcon(icons_accunsupported_png, -1);
+       wxIcon wxIAccUIcon;
+       wxIAccUIcon.CopyFromBitmap(AccUIcon);
        
        AccountID = AccImgList->Add(wxIAccNIcon);
        AccountNetID = AccImgList->Add(wxIAccInet);
+       AccountUnsupportedID = AccImgList->Add(wxIAccUIcon);
 
        NbtPreferences->RemovePage(1);
 
@@ -125,14 +132,27 @@ void frmPreferences::ModifyABAccount( wxCommandEvent& event )
        long lstAccountsIndex = -1;
        wxString AccFilename = GetAccountsFile();
        wxString AccName;
+       wxString AccType;
     
        wxFileConfig *cfgfile = new wxFileConfig("", "", AccFilename);
-    
+       
        // Get the account name.
     
        lstAccountsIndex = lstAccounts->GetNextItem(lstAccountsIndex,
                wxLIST_NEXT_ALL,
                wxLIST_STATE_SELECTED);
+       
+       // Check that the account type is a supported account type.
+       
+       AccType = preferences->accounts.GetAccountType((int)lstAccountsIndex);
+       
+       if (AccType != "CardDAV" && AccType != "carddav" &&
+               AccType != "Local" && AccType != "local"){
+       
+               wxMessageBox(_("Cannot modify the selected account settings as the account type is unsupported."), _("Unsupported account type"), wxICON_ERROR);
+               return;
+                       
+       }
     
        AccName = preferences->accounts.GetAccountName((int)lstAccountsIndex);
     
@@ -226,6 +246,10 @@ void frmPreferences::DeleteABAccount( wxCommandEvent& event )
        
                        AccountDirFull.Append(wxT("carddav"));
        
+               } else {
+                       
+                       AccountDirFull.Append(AccountType.Lower());
+                       
                }
        
                lstAccounts->DeleteItem(lstAccountsIndex);
@@ -254,6 +278,9 @@ void frmPreferences::DeleteABAccount( wxCommandEvent& event )
     
        }
 
+       btnAccountModify->Enable(FALSE);
+       btnAccountDelete->Enable(FALSE);
+       
 }
 
 void frmPreferences::LoadPreferences( wxInitDialogEvent& event )
@@ -344,6 +371,10 @@ void frmPreferences::ReloadAccounts(){
        
                        col0.SetImage(AccountID);
        
+               } else {
+
+                       col0.SetImage(AccountUnsupportedID);
+                       
                }
        
                long itemindex = lstAccounts->InsertItem( col0 );
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