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;
+ }
+ else {
+ 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);
+
+ if (AccDir.Len() > 4){
+
+ 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;
+ }
+
+ accounts.AddAccount(accountname, EntryValue, AccAdr, AccPort,
+ AccSSL, AccUsr, AccPass,
+ AccPrefix, AccDir, AccRef);
+
}
// Clear up for the next account.
wxMemoryInputStream bstream(icons_acclocal_png, sizeof(icons_acclocal_png));
wxMemoryInputStream cstream(icons_accgroup_png, sizeof(icons_accgroup_png));
wxMemoryInputStream dstream(icons_accnone_png, sizeof(icons_accnone_png));
+ wxMemoryInputStream estream(icons_accunsupported_png, sizeof(icons_accunsupported_png));
wxImage icons_accinet_png(astream, wxBITMAP_TYPE_PNG);
wxBitmap AccInet(icons_accinet_png, -1);
wxBitmap AccGrp(icons_accgroup_png, -1);
wxIcon wxIAccGrp;
wxIAccGrp.CopyFromBitmap(AccGrp);
-
+
wxImage icons_accnone_png(dstream, wxBITMAP_TYPE_PNG);
wxBitmap AccNone(icons_accnone_png, -1);
wxIcon wxIAccNone;
wxIAccNone.CopyFromBitmap(AccNone);
+
+ wxImage icons_accunsupported_png(estream, wxBITMAP_TYPE_PNG);
+ wxBitmap AccUnsupported(icons_accunsupported_png, -1);
+ wxIcon wxIAccUnsupported;
+ wxIAccUnsupported.CopyFromBitmap(AccUnsupported);
AccountID = AccImgList->Add(wxIAccNIcon);
AccountNetID = AccImgList->Add(wxIAccInet);
AccountGrpID = AccImgList->Add(wxIAccGrp);
AccountNoneID = AccImgList->Add(wxIAccNone);
+ AccountUnsupportedID = AccImgList->Add(wxIAccUnsupported);
bmpIcon->SetIcon(AccImgList->GetIcon(AccountNoneID));
imgSSLStatus->SetBitmap(*imgOffline);
SSLToolTip->SetTip(wxT("SSL status is not applicable for this account"));
AccountTypeFinal.Append(wxT("local"));
+ } else {
+ imgSSLStatus->SetBitmap(*imgOffline);
+ SSLToolTip->SetTip(wxT("SSL status is not applicable for this account"));
+ AccountTypeFinal.Append(AccountType.Lower());
}
AccountIndex = i;
} else if (AccountType == wxT("Local")){
SSLToolTip->SetTip(wxT("SSL status is not applicable for this account"));
AccountTypeFinal.Append(wxT("local"));
+ } else {
+ AccountTypeFinal.Append(AccountType.Lower());
}
AccountIndex = i;
long ContactSeekPoint = 0;
wxDir vcardaccdir(AccountDirFinal);
-
+
// Get the wxTreeItemId and image icon and compare it to the list.
if (ActiveItemIcon == AccountGrpID){
return;
}
+
+ // Check if the account type is a valid account type, otherwise
+ // display an error message.
+
+ if (ActiveAccountType != "CardDAV" && ActiveAccountType != "carddav" &&
+ ActiveAccountType != "Local" && ActiveAccountType != "local"){
+
+ wxMessageBox(_("Cannot add a new contact as the account type is unsupported."), _("Unsupported account type"), wxICON_ERROR);
+ return;
+
+ }
// Add Pointer to SetupPointers for the ETagDB.
return;
}
-
+
wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png));
wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG);
wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1);
ContactEditor->SetupPointers(frameActMgr, &ETagProcTimer, this);
ContactEditor->SetupHeaders();
+
+ if (ActiveAccountType != "CardDAV" && ActiveAccountType != "carddav" &&
+ ActiveAccountType != "Local" && ActiveAccountType != "local"){
+
+ ContactEditor->SetupAccountData(true);
+
+ }
// Check if pointer is NULL (not from the search forms) or not.
if (!ActiveAccount.IsEmpty()){
- if (ActiveAccountType != wxT("Local")){
+ if (ActiveAccountType == wxT("CardDAV") || ActiveAccountType == wxT("carddav")){
// Account type is not local.
} else {
- wxMessageBox(_("The refresh address book command is not supported with this type of account."), wxT("Not supported for this type of account"));
+ wxMessageBox(_("The refresh address book command is not supported with this type of account."), wxT("Not supported"), wxICON_ERROR);
}
ETagProcTimer.ReloadAccounts();
for (int i = 0; i < preferences.accounts.GetCount(); i++){
-
+
if ((preferences.accounts.GetAccountType(i) == wxT("Local") ||
preferences.accounts.GetAccountType(i) == wxT("local")) && HideLocalABs == TRUE){
AccName = preferences.accounts.GetAccountName(i);
AccName.Trim();
AccountAccDirList.insert(std::make_pair(i, AccDirFull));
-
+
if (preferences.accounts.GetAccountType(i) == wxT("CardDAV") ||
preferences.accounts.GetAccountType(i) == wxT("carddav")){
AccountTreeId = treAccounts->AppendItem(RootNode, preferences.accounts.GetAccountName(i), AccountNetID, -1);
- } else {
+ } else if (preferences.accounts.GetAccountType(i) == wxT("Local") ||
+ preferences.accounts.GetAccountType(i) == wxT("local")) {
AccountTreeId = treAccounts->AppendItem(RootNode, preferences.accounts.GetAccountName(i), AccountID, -1);
+ } else {
+
+ AccountTreeId = treAccounts->AppendItem(RootNode, preferences.accounts.GetAccountName(i), AccountUnsupportedID, -1);
+
}
// Go through the account directory and find contact files with
wxString vCardFilename;
wxString vCardDataString;
wxString vCardFilenameFull;
-
+
bool ProcFiles = vcardaccdir.GetFirst(&vCardFilename, wxEmptyString, wxDIR_FILES);
while(ProcFiles){
void frmMain::DeleteContact(wxCommandEvent& event){
// Delete a contact from the main window.
-
+
// Check if a contact is selected.
long intSelected = -1;
if (intSelected == -1){
return;
}
+
+ // Check if the account type is a valid account type, otherwise
+ // display an error message.
+
+ if (ActiveAccountType != "CardDAV" && ActiveAccountType != "carddav" &&
+ ActiveAccountType != "Local" && ActiveAccountType != "local"){
+
+ wxMessageBox(_("Cannot delete contact as the account type is unsupported."), _("Unsupported account type"), wxICON_ERROR);
+ return;
+
+ }
frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
}
+ // Check the account type is a supported account type.
+
+ if (AccType != "CardDAV" && AccType != "carddav" &&
+ AccType != "Local" && AccType != "local"){
+
+ SSLToolTip->SetTip(wxT("SSL is not enabled for this account"));
+ imgSSLStatus->SetBitmap(*imgNoSSL);
+ return;
+
+ }
+
// Check if the account has SSL enabled.
bool SSLInUse = prefaccounts.GetAccountSSL(AccountID);
bool EnableRefresh = FALSE;
- if (!ActiveAccount.IsEmpty()){
+ if (!ActiveAccount.IsEmpty() && (ActiveAccountType == "CardDAV" || ActiveAccountType == "carddav")){
EnableRefresh = TRUE;
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);
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);
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);
AccountDirFull.Append(wxT("carddav"));
+ } else {
+
+ AccountDirFull.Append(AccountType.Lower());
+
}
lstAccounts->DeleteItem(lstAccountsIndex);
}
+ btnAccountModify->Enable(FALSE);
+ btnAccountDelete->Enable(FALSE);
+
}
void frmPreferences::LoadPreferences( wxInitDialogEvent& event )
col0.SetImage(AccountID);
+ } else {
+
+ col0.SetImage(AccountUnsupportedID);
+
}
long itemindex = lstAccounts->InsertItem( col0 );