From: Steve Brokenshire Date: Mon, 14 Mar 2016 23:57:48 +0000 (+0000) Subject: Merge branch 'master' of ssh://gelforn.xestia.co.uk:/scmrepos/xestiaab X-Git-Tag: release-0.11~57 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=3dc679d20b260e631320e3960c9841d670d089ab;hp=f1af82fb637114dfc67e72356c0322928231bebf;p=xestiaab%2F.git Merge branch 'master' of ssh://gelforn.xestia.co.uk:/scmrepos/xestiaab --- diff --git a/source/export/export-vcard3.cpp b/source/export/export-vcard3.cpp index 1d5091c..4f1d0fd 100644 --- a/source/export/export-vcard3.cpp +++ b/source/export/export-vcard3.cpp @@ -26,6 +26,8 @@ void ExportVCard3(bool DirMode, wxString OutputLocation, wxArrayString *FileList, int *ExportCount){ + // Export a vCard 3.0 contact file. + if (DirMode == TRUE){ // Output each contact into the directory. diff --git a/source/export/export-vcard4.cpp b/source/export/export-vcard4.cpp index 4d39de1..a3256c9 100644 --- a/source/export/export-vcard4.cpp +++ b/source/export/export-vcard4.cpp @@ -23,6 +23,8 @@ void ExportVCard4(bool DirMode, wxString OutputLocation, wxArrayString *FileList, int *ExportCount){ + // Export a vCard 4.0 contact file. + if (DirMode == TRUE){ // Output each contact into the directory. diff --git a/source/export/export.cpp b/source/export/export.cpp index dc5a85b..5f0f734 100644 --- a/source/export/export.cpp +++ b/source/export/export.cpp @@ -26,6 +26,9 @@ void ExportRun(frmMain *frmMainPtrInc, wxArrayString *FileListInc){ + // Run the export function. Bring up the export file save + // dialog and run the required export functions as needed. + frmMainPtrInc->PauseAllTimers(); wxString FileTypes; diff --git a/source/import/frmImportContacts.cpp b/source/import/frmImportContacts.cpp index c71341e..ff0341c 100644 --- a/source/import/frmImportContacts.cpp +++ b/source/import/frmImportContacts.cpp @@ -64,101 +64,87 @@ frmImportContactsADT( parent ) treAccounts->AssignImageList(AccImgList); - // Load the preferences. + // Load the preferences. wxString preffilename = GetUserPrefDir(); - XABPreferences preferences(preffilename); + XABPreferences preferences(preffilename); - // Setup the main window position (if needed). + // Setup the main window position (if needed). - bool SaveWindowPos = preferences.GetBoolData(wxT("SaveWindowPosition")); - bool HideLocalABs = preferences.GetBoolData(wxT("HideLocalAddressBooks")); + bool SaveWindowPos = preferences.GetBoolData(wxT("SaveWindowPosition")); + bool HideLocalABs = preferences.GetBoolData(wxT("HideLocalAddressBooks")); - if (SaveWindowPos == TRUE){ + if (SaveWindowPos == TRUE){ - this->SetSize(preferences.GetMainWindowData()); + this->SetSize(preferences.GetMainWindowData()); - } + } - treAccounts->DeleteAllItems(); + treAccounts->DeleteAllItems(); - wxTreeItemId RootNode = treAccounts->AddRoot(wxT("Root Item")); - - /* - for (int i = (preferences.accounts.GetCount() - 1); i > 0; --i){ - treAccounts->AppendItem(RootNode, preferences.accounts.GetAccountName(i)); - } - */ - - wxString AccDir; - wxString AccDirFull; - wxString AccDirFullSfx; - wxString AccName; - wxString AccType; - wxString AccDirFinal; - wxTreeItemId AccountTreeId; - wxTreeItemId GroupTreeId; - - for (int i = 0; i < preferences.accounts.GetCount(); i++){ + wxTreeItemId RootNode = treAccounts->AddRoot(wxT("Root Item")); + + wxString AccDir; + wxString AccDirFull; + wxString AccDirFullSfx; + wxString AccName; + wxString AccType; + wxString AccDirFinal; + wxTreeItemId AccountTreeId; + wxTreeItemId GroupTreeId; + + for (int i = 0; i < preferences.accounts.GetCount(); i++){ - if ((preferences.accounts.GetAccountType(i) == wxT("Local") || - preferences.accounts.GetAccountType(i) == wxT("local")) && HideLocalABs == TRUE){ - - continue; + if ((preferences.accounts.GetAccountType(i) == wxT("Local") || + preferences.accounts.GetAccountType(i) == wxT("local")) && HideLocalABs == TRUE){ + continue; - } + } - AccDir = preferences.accounts.GetAccountDirectory(i); - AccDirFull = preferences.accounts.GetAccountDirectory(i); - AccDirFull.Trim(); - AccDirFull.Append(wxT(".")); - AccDirFullSfx.Append(preferences.accounts.GetAccountType(i)); - AccDirFullSfx.LowerCase(); - AccDirFullSfx.Trim(); - AccDirFull.Append(AccDirFullSfx); - AccName = preferences.accounts.GetAccountName(i); - AccName.Trim(); - AccType = preferences.accounts.GetAccountType(i); - AccType.Trim(); - AccountAccDirList.insert(std::make_pair(i, AccDirFull)); - AccountAccTypeList.insert(std::make_pair(i, AccType)); + AccDir = preferences.accounts.GetAccountDirectory(i); + AccDirFull = preferences.accounts.GetAccountDirectory(i); + AccDirFull.Trim(); + AccDirFull.Append(wxT(".")); + AccDirFullSfx.Append(preferences.accounts.GetAccountType(i)); + AccDirFullSfx.LowerCase(); + AccDirFullSfx.Trim(); + AccDirFull.Append(AccDirFullSfx); + AccName = preferences.accounts.GetAccountName(i); + AccName.Trim(); + AccType = preferences.accounts.GetAccountType(i); + AccType.Trim(); + AccountAccDirList.insert(std::make_pair(i, AccDirFull)); + AccountAccTypeList.insert(std::make_pair(i, AccType)); - if (preferences.accounts.GetAccountType(i) == wxT("CardDAV") || - preferences.accounts.GetAccountType(i) == wxT("carddav")){ + if (preferences.accounts.GetAccountType(i) == wxT("CardDAV") || + preferences.accounts.GetAccountType(i) == wxT("carddav")){ - AccountTreeId = treAccounts->AppendItem(RootNode, preferences.accounts.GetAccountName(i), AccountNetID, -1); + AccountTreeId = treAccounts->AppendItem(RootNode, preferences.accounts.GetAccountName(i), AccountNetID, -1); - } else { + } else { - AccountTreeId = treAccounts->AppendItem(RootNode, preferences.accounts.GetAccountName(i), AccountID, -1); + AccountTreeId = treAccounts->AppendItem(RootNode, preferences.accounts.GetAccountName(i), AccountID, -1); - } + } - // Clearup for next account. + // Clearup for next account. - AccDir.clear(); - AccDirFull.clear(); - AccDirFullSfx.clear(); - AccDirFinal.clear(); - AccName.clear(); + AccDir.clear(); + AccDirFull.clear(); + AccDirFullSfx.clear(); + AccDirFinal.clear(); + AccName.clear(); - } + } - DialogResult = FALSE; + DialogResult = FALSE; } frmImportContacts::~frmImportContacts() { - /*delete AccControl; - AccControl = NULL; - delete treAccounts; - treAccounts = NULL; - delete AccImgList; - AccImgList = NULL;*/ - } void frmImportContacts::GetResult() @@ -186,11 +172,11 @@ void frmImportContacts::ImportContacts( wxCommandEvent& event ) void frmImportContacts::SetupList(std::map* ContactDataInc) { - // Go through the list and setup each contact for the list. + // Go through the list and setup each contact for the list. - int Seek = 0; + int Seek = 0; - for (std::map::iterator iter = ContactDataInc->begin(); + for (std::map::iterator iter = ContactDataInc->begin(); iter != ContactDataInc->end(); iter++){ ImportDataContact *Moo = &iter->second; @@ -207,7 +193,7 @@ void frmImportContacts::SetupList(std::map* ContactDataIn Seek++; - } + } for (int i = 0; i < lstContacts->GetCount(); i++){ @@ -246,20 +232,22 @@ wxString frmImportContacts::GetAccount() wxString AccountName; - //XABPrefAccounts prefaccounts; - wxTreeItemIdValue cookie; wxTreeItemId next = treAccounts->GetRootItem(); - + wxTreeItemId selectedChild = treAccounts->GetSelection(); wxTreeItemId nextChild; for (int i = 0; i < preferences.accounts.GetCount(); i++){ if (!nextChild){ + nextChild = treAccounts->GetFirstChild(next, cookie); + } else { + nextChild = treAccounts->GetNextSibling(nextChild); + } if (nextChild == selectedChild){ @@ -270,7 +258,6 @@ wxString frmImportContacts::GetAccount() } - } return AccountName; @@ -286,8 +273,6 @@ wxString frmImportContacts::GetAccountType() wxString AccountType; - //XABPrefAccounts prefaccounts; - wxTreeItemIdValue cookie; wxTreeItemId next = treAccounts->GetRootItem(); @@ -297,9 +282,13 @@ wxString frmImportContacts::GetAccountType() for (int i = 0; i < preferences.accounts.GetCount(); i++){ if (!nextChild){ + nextChild = treAccounts->GetFirstChild(next, cookie); + } else { + nextChild = treAccounts->GetNextSibling(nextChild); + } if (nextChild == selectedChild){ diff --git a/source/import/frmImportResults.cpp b/source/import/frmImportResults.cpp index 1129ab6..a20b5f2 100644 --- a/source/import/frmImportResults.cpp +++ b/source/import/frmImportResults.cpp @@ -33,6 +33,8 @@ frmImportResultsADT( parent ) void frmImportResults::CopyClipboard( wxCommandEvent& event ) { + // Copy the results to the clipboard. + if (wxTheClipboard->Open()){ wxTextDataObject ResultData; @@ -56,12 +58,18 @@ void frmImportResults::CopyClipboard( wxCommandEvent& event ) void frmImportResults::CloseWindow( wxCommandEvent& event ) { + + // Close the window. + this->Close(); + } void frmImportResults::LoadData(std::map *ResultDataInc, int ImportCount, int ImportErrorCount) { + // Load and process the data from the ResultDataInc pointer. + wxString ResultDataText; for (std::map::iterator iter = ResultDataInc->begin(); diff --git a/source/import/import-vcard3.cpp b/source/import/import-vcard3.cpp index c9c66db..11e1828 100644 --- a/source/import/import-vcard3.cpp +++ b/source/import/import-vcard3.cpp @@ -25,6 +25,8 @@ std::map ImportVCard3(wxArrayString *FileListInc){ + // Import from a vCard 3.0 file. + std::map FinalData; // Go through each of the file names, load them up and collect the diff --git a/source/import/import-vcard4.cpp b/source/import/import-vcard4.cpp index 3f46738..066dc10 100644 --- a/source/import/import-vcard4.cpp +++ b/source/import/import-vcard4.cpp @@ -24,6 +24,8 @@ std::map ImportVCard4(wxArrayString *FileListInc){ + // Import from a vCard 4.0 file. + std::map FinalData; // Go through each of the file names, load them up and collect the diff --git a/source/import/import.cpp b/source/import/import.cpp index aee7f58..3dffa82 100644 --- a/source/import/import.cpp +++ b/source/import/import.cpp @@ -132,7 +132,7 @@ void ImportRun(frmMain *frmMainPtrInc){ delete frmIC; frmIC = NULL; - // Import the contacts into the selected account. + // Import the contacts into the selected account. int ImportCount = 0; int ImportSeek = 0; @@ -165,7 +165,7 @@ void ImportRun(frmMain *frmMainPtrInc){ if (iter->second.ContactSelected == TRUE){ - // Workout the file name. void CloseWindow( wxCommandEvent& event ); + // Workout the file name. // Get the UID value and check if it is empty. // If it isn't empty, check it can be used for a valid // filename other wise generate a file name for the purposes diff --git a/source/search/XABSearchPanel.cpp b/source/search/XABSearchPanel.cpp index 3966fe6..7a22155 100644 --- a/source/search/XABSearchPanel.cpp +++ b/source/search/XABSearchPanel.cpp @@ -36,6 +36,8 @@ XABSearchPanel::XABSearchPanel( wxWindow* parent ) XABSearchPanelADT( parent ) { + // Setup the search panel. + // Setup the images for the add and delete buttons. wxMemoryInputStream astream(buttons_add_png, sizeof(buttons_add_png)); @@ -79,6 +81,8 @@ XABSearchPanelADT( parent ) void XABSearchPanel::UpdateOptions( wxCommandEvent& event ) { + // Update the options in the search panel. + if (choOption->GetSelection() == 12 || choOption->GetSelection() == 13 || choOption->GetSelection() == 14 ){ @@ -102,6 +106,8 @@ void XABSearchPanel::UpdateOptions( wxCommandEvent& event ) void XABSearchPanel::AddSearchWidget( wxCommandEvent& event ) { + // Add the search panel. + frmSearch *SCHWin = static_cast(SCHWinPtr); wxCommandEvent eventsend(SE_ADDSEARCHSETTING); @@ -112,6 +118,8 @@ void XABSearchPanel::AddSearchWidget( wxCommandEvent& event ) void XABSearchPanel::RemoveSearchWidget( wxCommandEvent& event ) { + // Remove the search panel. + frmSearch *SCHWin = static_cast(SCHWinPtr); wxCommandEvent eventsend(SE_REMOVESEARCHSETTING); @@ -123,6 +131,8 @@ void XABSearchPanel::RemoveSearchWidget( wxCommandEvent& event ) void XABSearchPanel::EnableButtons(bool AddButton, bool DeleteButton) { + // Enable the buttons for the search panel. + if (AddButton == TRUE){ btnAdd->Enable(); } else { @@ -139,24 +149,32 @@ void XABSearchPanel::EnableButtons(bool AddButton, bool DeleteButton) void XABSearchPanel::SetupPointers(void* SCHWinPtrInc){ + // Setup the pointers for the search panel. + SCHWinPtr = SCHWinPtrInc; } void XABSearchPanel::SetupInteger(int IntInc){ + // Set the ID of the search panel. + SCHInt = IntInc; } int XABSearchPanel::GetInteger(){ + // Get the ID of the search panel. + return SCHInt; } void XABSearchPanel::DisableControls(wxCommandEvent &event){ + // Disable the search controls. + choOption->Disable(); chkActive->Disable(); txtSearch->Disable(); @@ -167,6 +185,8 @@ void XABSearchPanel::DisableControls(wxCommandEvent &event){ void XABSearchPanel::EnableControls(wxCommandEvent &event){ + // Enable the search controls. + choOption->Enable(); chkActive->Enable(); txtSearch->Enable(); @@ -177,18 +197,24 @@ void XABSearchPanel::EnableControls(wxCommandEvent &event){ int XABSearchPanel::GetSelectionOption(){ + // Get the selection option. + return choOption->GetSelection(); } bool XABSearchPanel::GetCheckboxSetting(){ + // Get the checkbox setting. + return chkActive->IsChecked(); } wxString XABSearchPanel::GetStringSetting(){ + // Get the search string setting. + return txtSearch->GetValue(); } \ No newline at end of file diff --git a/source/search/frmSearch-contact.cpp b/source/search/frmSearch-contact.cpp index 2f168bb..3a5d028 100644 --- a/source/search/frmSearch-contact.cpp +++ b/source/search/frmSearch-contact.cpp @@ -137,6 +137,8 @@ void frmSearch::RevealContact( wxCommandEvent& event ){ void frmSearch::ShowContactMenu( wxMouseEvent& event ){ + // Show the contact menu. + ContactMenu->SetupPointersSearch(this, lstResults, SearchMode); PopupMenu(ContactMenu->MenuPointer(), wxDefaultPosition); diff --git a/source/search/frmSearch-result.cpp b/source/search/frmSearch-result.cpp index 6216af1..0b95fd3 100644 --- a/source/search/frmSearch-result.cpp +++ b/source/search/frmSearch-result.cpp @@ -22,6 +22,8 @@ void frmSearch::AddResult( wxCommandEvent& event ){ + // Add a search result. + SRNotif *srnotif = (SRNotif*)event.GetClientData(); // Process Data and add to the list of results. @@ -84,6 +86,8 @@ void frmSearch::AddResult( wxCommandEvent& event ){ void frmSearch::UpdateResult( wxCommandEvent& event ){ + // Update a result. + UCNotif *uc = (UCNotif*)event.GetClientData(); long longSelected = -1; @@ -159,6 +163,8 @@ bool frmSearch::CheckDuplicate(wxString Filename, std::map *SRAcc, std::map *SRFN){ + // Check for duplicate search results. + std::map::iterator fniter; // Check comparison code. @@ -183,6 +189,8 @@ bool frmSearch::CheckDuplicate(wxString Filename, void frmSearch::DeleteResult(wxCommandEvent &event){ + // Delete the search result. + UCNotif *uc = (UCNotif*)event.GetClientData(); long longSelected = -1; diff --git a/source/search/frmSearch.cpp b/source/search/frmSearch.cpp index 46d7d1e..d224764 100644 --- a/source/search/frmSearch.cpp +++ b/source/search/frmSearch.cpp @@ -59,6 +59,8 @@ frmSearch::frmSearch( wxWindow* parent ) frmSearchADT( parent ) { + // Setup the search window. + XABSearchPanel *InitPanel = new XABSearchPanel( tabSearch ); InitPanel->EnableButtons(TRUE, FALSE); InitPanel->SetupPointers(this); @@ -255,7 +257,6 @@ void frmSearch::AddSearchSetting( wxCommandEvent& event ) NewPanel->SetupPointers(this); NewPanel->SetupInteger(ScrollGen); szrSearch->Add(NewPanel, 1, wxEXPAND|wxGROW, 5); - //szrSearch->Fit(tabSearch); szrSearch->FitInside(tabSearch); szrSearch->Layout(); szrSearch->RecalcSizes(); @@ -302,13 +303,13 @@ void frmSearch::AddSearchSetting( wxCommandEvent& event ) void frmSearch::RemoveSearchSetting( wxCommandEvent& event ) { + // Remove a search setting frame from the list. + // Get the integer from the event. std::map::iterator iter; iter = SearchFrames.find(event.GetInt()); - // Remove a search setting frame from the list. - XABSearchPanel *XABSPPtr; XABSPPtr = static_cast(iter->second); @@ -321,8 +322,6 @@ void frmSearch::RemoveSearchSetting( wxCommandEvent& event ) delete XABSPPtr; XABSPPtr = NULL; - //szrSearch->Fit(tabSearch); - if (SearchFrames.size() < SEARCHSETTINGS_MAX && SearchFrames.size() > 1){ for (std::map::iterator iter = SearchFrames.begin(); @@ -361,7 +360,9 @@ void frmSearch::ReloadAccountList( wxCommandEvent& event ){ } void frmSearch::SearchBarUpdate( wxCommandEvent& event ){ - + + // Update the status bar. + wxString *SBData = (wxString*)event.GetClientData(); stbBottom->SetStatusText(*SBData, 0); @@ -373,6 +374,9 @@ void frmSearch::SearchBarUpdate( wxCommandEvent& event ){ void frmSearch::SearchFinished( wxCommandEvent& event ){ + // Reset the search button and unlock the search + // panel buttons. + StopMode = FALSE; btnSearch->SetLabel(_("Search")); DisableAllSearchSettings(FALSE); @@ -480,18 +484,24 @@ void frmSearch::CloseWindow( wxCloseEvent& event ){ void frmSearch::CloseWindow( wxCommandEvent& event ){ + // Close this window. + this->Close(); } void frmSearch::SetUID(int UID){ + // Set the UID of the search window. + SearchUID = UID; } void frmSearch::SetSearchMode(bool SearchModeIn){ + // Set the search mode of the window. + SearchMode = SearchModeIn; if (SearchMode == TRUE){ diff --git a/source/search/frmSearchAccounts.cpp b/source/search/frmSearchAccounts.cpp index d968e4c..2a87e79 100644 --- a/source/search/frmSearchAccounts.cpp +++ b/source/search/frmSearchAccounts.cpp @@ -34,6 +34,8 @@ void frmSearchAccounts::LoadSearchAccounts(std::map *SearchAccou std::map *SearchAccountsList) { + // Load the list of accounts to the accounts list in the window. + SAPtr = SearchAccounts; SALPtr = SearchAccountsList; std::map::iterator SALiter; @@ -53,7 +55,6 @@ void frmSearchAccounts::LoadSearchAccounts(std::map *SearchAccou } chlAccounts->Append(AccList); - //chlAccounts->SetSelection(wxNOT_FOUND); // Check if each account is selected. @@ -113,5 +114,9 @@ void frmSearchAccounts::UpdateSelectedAccounts( wxCommandEvent& event ) void frmSearchAccounts::CloseWindow( wxCommandEvent& event ) { + + // Close this window. + this->Close(); + } diff --git a/source/vcard/vcard34conv.cpp b/source/vcard/vcard34conv.cpp index 4faa514..4cccfa3 100644 --- a/source/vcard/vcard34conv.cpp +++ b/source/vcard/vcard34conv.cpp @@ -33,11 +33,13 @@ // RFC 6350 specification. vCard34Conv::vCard34Conv(){ - vCardBegin = FALSE; - vCardEnd = FALSE; - vCardFN = FALSE; - vCardVersion = 0.0; - SettingCount = 0; + + vCardBegin = FALSE; + vCardEnd = FALSE; + vCardFN = FALSE; + vCardVersion = 0.0; + SettingCount = 0; + } void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, @@ -155,31 +157,43 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("INTERNET")){ + continue; + } if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ if (ProcessItemData == FALSE){ + PropertyName = wxT("PREF"); PropertyValue = wxT("50"); + } else { + continue; + } } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ + PropertyValue = wxT("home"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ + PropertyValue = wxT("work"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ + PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); + } // Process properties. @@ -288,25 +302,35 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ if (ProcessItemData == FALSE){ + PropertyName = wxT("PREF"); PropertyValue = wxT("50"); + } else { + continue; + } } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ + PropertyValue = wxT("home"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ + PropertyValue = wxT("work"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ + PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); + } // Process properties. @@ -413,20 +437,28 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ + continue; + } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ + PropertyValue = wxT("home"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ + PropertyValue = wxT("work"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ + PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); + } // Process properties. @@ -555,24 +587,34 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ + continue; + } if (PropertyName == wxT("X-SERVICE-TYPE")){ + continue; + } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ + PropertyValue = wxT("home"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ + PropertyValue = wxT("work"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ + PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); + } // Process properties. @@ -681,22 +723,30 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ + continue; + } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ + TelType.insert(std::make_pair(wxT("home"), wxT("home"))); continue; + } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ + TelType.insert(std::make_pair(wxT("work"), wxT("work"))); continue; + } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ + PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); + } // Process the telephone type options. @@ -704,53 +754,68 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // text if (PropertyName == wxT("type") && (PropertyValue == wxT("TEXT") || PropertyValue == wxT("text"))){ + TelType.insert(std::make_pair(wxT("text"), wxT("text"))); continue; + } // voice if (PropertyName == wxT("type") && (PropertyValue == wxT("VOICE") || PropertyValue == wxT("voice"))){ + TelType.insert(std::make_pair(wxT("voice"), wxT("voice"))); continue; + } // fax if (PropertyName == wxT("type") && (PropertyValue == wxT("FAX") || PropertyValue == wxT("fax"))){ + TelType.insert(std::make_pair(wxT("fax"), wxT("fax"))); continue; + } // cell if (PropertyName == wxT("type") && (PropertyValue == wxT("CELL") || PropertyValue == wxT("cell"))){ + TelType.insert(std::make_pair(wxT("cell"), wxT("cell"))); continue; + } // video if (PropertyName == wxT("type") && (PropertyValue == wxT("VIDEO") || PropertyValue == wxT("video"))){ + TelType.insert(std::make_pair(wxT("video"), wxT("video"))); continue; + } // pager if (PropertyName == wxT("type") && (PropertyValue == wxT("PAGER") || PropertyValue == wxT("pager"))){ + TelType.insert(std::make_pair(wxT("pager"), wxT("pager"))); continue; + } // textphone if (PropertyName == wxT("type") && (PropertyValue == wxT("TEXTPHONE") || PropertyValue == wxT("textphone"))){ + TelType.insert(std::make_pair(wxT("textphone"), wxT("textphone"))); continue; + } if (PropertyName == wxT("type") && PropertyValue.Find(wxT(",")) != wxNOT_FOUND){ + wxStringTokenizer TypeSplit(PropertyValue, wxT(",")); wxString TypeSplitData; while (TypeSplit.HasMoreTokens()){ @@ -916,7 +981,9 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ + continue; + } // Process properties. @@ -1023,20 +1090,28 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ + continue; + } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ + PropertyValue = wxT("home"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ + PropertyValue = wxT("work"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ + PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); + } // Process properties. @@ -1293,7 +1368,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; - int intPrevValue = 3; + int intPrevValue = 3; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("N"); @@ -2735,7 +2810,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool FirstToken = TRUE; + bool FirstToken = TRUE; int intPrevValue = 12; if (ProcessItemData == TRUE){ @@ -5899,21 +5974,21 @@ void vCard34Conv::SplitValues(wxString *PropertyLine, if (PropertyLine->Mid(i, 1) == wxT(";") && PropertyLine->Mid((i - 1), 1) != wxT("\\")){ - if (intSplitsFound == 0){ + if (intSplitsFound == 0){ - SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); + SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); - } else { + } else { - SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); + SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); - } + } - SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); + SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); - intSplitsFound++; - intSplitSeek = i; - intSplitSize = 0; + intSplitsFound++; + intSplitSeek = i; + intSplitSize = 0; } @@ -5955,7 +6030,7 @@ void vCard34Conv::SplitValuesData(wxString *PropertyLine, if (PropertyLine->Mid(i, 1) == wxT(";") && PropertyLine->Mid((i - 1), 1) != wxT("\\")){ - if (intSplitsFound == 0){ + if (intSplitsFound == 0){ DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize)); SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); @@ -5967,24 +6042,24 @@ void vCard34Conv::SplitValuesData(wxString *PropertyLine, } - SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); + SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); - intSplitsFound++; - intSplitSeek = (i + 1); - intSplitSize = 0; + intSplitsFound++; + intSplitSeek = (i + 1); + intSplitSize = 0; - if (!DataStr.IsEmpty()){ + if (!DataStr.IsEmpty()){ - PropertyElement.SetString(DataStr, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - SplitData->insert(std::make_pair(PropertyName, PropertyValue)); + PropertyElement.SetString(DataStr, wxT("=")); + PropertyName = PropertyElement.GetNextToken(); + PropertyValue = PropertyElement.GetNextToken(); + SplitData->insert(std::make_pair(PropertyName, PropertyValue)); - } + } - DataStr.clear(); - PropertyName.clear(); - PropertyValue.clear(); + DataStr.clear(); + PropertyName.clear(); + PropertyValue.clear(); }