From: Steve Brokenshire Date: Sat, 9 Jul 2016 21:23:17 +0000 (+0100) Subject: Merge branch 'master' of ssh://gelforn.xestia.co.uk/scmrepos/xestiaab X-Git-Tag: release-0.14~2 X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=commitdiff_plain;h=e6cd13ea863b88fbb7140e57ab8d3dc31ac9b1b7;hp=-c Merge branch 'master' of ssh://gelforn.xestia.co.uk/scmrepos/xestiaab --- e6cd13ea863b88fbb7140e57ab8d3dc31ac9b1b7 diff --combined source/frmMain.cpp index 6625432,99784a6..b8a80cf --- a/source/frmMain.cpp +++ b/source/frmMain.cpp @@@ -138,6 -138,7 +138,7 @@@ frmMainADT( parent 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); @@@ -153,16 -154,22 +154,22 @@@ 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)); @@@ -245,7 -252,7 +252,7 @@@ #elif defined(__WIN32__) - int stbBottomData [4] = { -1, 16, 16, 16 }; + int stbBottomData [4] = { -1, 8, 8, 8 }; #else @@@ -264,8 -271,10 +271,8 @@@ stbBottom->GetFieldRect(3, rectActivity); SSLToolTip = new wxToolTip(wxT("")); - -#if defined(__WIN32__) - - imgConnStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint(rectOnline.GetX(),rectOnline.GetY()), wxDefaultSize, 0 ); + + imgConnStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint((rectOnline.GetX()),(rectOnline.GetY())), wxDefaultSize, 0 ); imgConnStatus->SetBitmap(*imgOnline); imgConnStatus->Connect( wxEVT_LEFT_DCLICK, wxCommandEventHandler( frmMain::ToggleConnectionStatus ), NULL, this ); @@@ -278,6 -287,23 +285,6 @@@ imgActivityStatus->SetBitmap(*imgActIconSleep); imgActivityStatus->Connect( wxEVT_LEFT_DCLICK, wxCommandEventHandler( frmMain::ShowActivityWindow ), NULL, this ); -#else - - imgConnStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint((rectOnline.GetX()), (rectOnline.GetY())), wxDefaultSize, 0); - imgConnStatus->SetBitmap(*imgOnline); - imgConnStatus->Connect(wxEVT_LEFT_DCLICK, wxCommandEventHandler(frmMain::ToggleConnectionStatus), NULL, this); - - imgSSLStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint((rectSSL.GetX()), (rectSSL.GetY())), wxDefaultSize, 0); - imgSSLStatus->SetBitmap(*imgNoSSL); - imgSSLStatus->SetToolTip(SSLToolTip); - imgSSLStatus->Connect(wxEVT_LEFT_DCLICK, wxCommandEventHandler(frmMain::ShowSSLCertificates), NULL, this); - - imgActivityStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint((rectActivity.GetX()), (rectActivity.GetY())), wxDefaultSize, 0); - imgActivityStatus->SetBitmap(*imgActIconSleep); - imgActivityStatus->Connect(wxEVT_LEFT_DCLICK, wxCommandEventHandler(frmMain::ShowActivityWindow), NULL, this); - -#endif - // Setup the window menu. // By default should be: @@@ -541,6 -567,10 +548,10 @@@ void frmMain::LoadContactList( wxTreeEv 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; @@@ -571,6 -601,8 +582,8 @@@ } 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; @@@ -614,7 -646,7 +627,7 @@@ long ContactSeekPoint = 0; wxDir vcardaccdir(AccountDirFinal); - + // Get the wxTreeItemId and image icon and compare it to the list. if (ActiveItemIcon == AccountGrpID){ @@@ -1080,6 -1112,17 +1093,17 @@@ void frmMain::ShowContactEditorNew( wxC 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. @@@ -1130,7 -1173,7 +1154,7 @@@ void frmMain::ShowContactEditorEdit( wx return; } - + wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png)); wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG); wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1); @@@ -1175,6 -1218,13 +1199,13 @@@ 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. @@@ -1218,7 -1268,7 +1249,7 @@@ void frmMain::RefreshAddressBook( wxCom if (!ActiveAccount.IsEmpty()){ - if (ActiveAccountType != wxT("Local")){ + if (ActiveAccountType == wxT("CardDAV") || ActiveAccountType == wxT("carddav")){ // Account type is not local. @@@ -1228,7 -1278,7 +1259,7 @@@ } 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); } @@@ -1433,7 -1483,7 +1464,7 @@@ void frmMain::LoadPreferences() 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){ @@@ -1458,7 -1508,7 +1489,7 @@@ 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")){ @@@ -1482,10 -1532,15 +1513,15 @@@ 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 @@@ -1498,7 -1553,7 +1534,7 @@@ wxString vCardFilename; wxString vCardDataString; wxString vCardFilenameFull; - + bool ProcFiles = vcardaccdir.GetFirst(&vCardFilename, wxEmptyString, wxDIR_FILES); while(ProcFiles){ @@@ -1927,7 -1982,7 +1963,7 @@@ void frmMain::RevealContact(wxCommandEv void frmMain::DeleteContact(wxCommandEvent& event){ // Delete a contact from the main window. - + // Check if a contact is selected. long intSelected = -1; @@@ -1941,6 -1996,17 +1977,17 @@@ 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(ActMgrPtr); @@@ -2576,7 -2642,7 +2623,7 @@@ void frmMain::ShowSSLCertificates( wxCo // Setup and display the form. - if (SSLCertificateIter == AccountCertificateData.end() || SSLCertificateIter->second->pCertInfo == NULL){ + if (SSLCertificateIter->second->pCertInfo == NULL){ wxMessageBox("No certificate information is available due to invalid connection details, connection being in progress or invalid certificate data received."); @@@ -2791,6 -2857,17 +2838,17 @@@ void frmMain::SetupSSLStatus( int Accou } + // 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); @@@ -3050,7 -3127,7 +3108,7 @@@ void frmMain::ShowContactMenu( wxMouseE bool EnableRefresh = FALSE; - if (!ActiveAccount.IsEmpty()){ + if (!ActiveAccount.IsEmpty() && (ActiveAccountType == "CardDAV" || ActiveAccountType == "carddav")){ EnableRefresh = TRUE;