X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=blobdiff_plain;f=source%2FfrmContact.cpp;h=992ef256ceb1b958fbdf5d9485d891abd63d79b0;hp=da88511c2cea5f51787ed0ce2d17a111619ffc9b;hb=2a30393d59c892349cffec18ec16907c2358fd0f;hpb=a73019906500e3a0fc306a61e4b7975f79725866 diff --git a/source/frmContact.cpp b/source/frmContact.cpp index da88511..992ef25 100644 --- a/source/frmContact.cpp +++ b/source/frmContact.cpp @@ -39,6 +39,8 @@ void frmContact::CloseWindowProcessing(){ void frmContact::CloseWindow( wxCommandEvent& event ){ + // Close this window. + this->Close(); } @@ -50,49 +52,56 @@ void frmContact::CloseWindow( wxCloseEvent& event ){ wxFileSystem::AddHandler(new wxMemoryFSHandler); - if (MemoryFSListPtr->find(SessionID) == MemoryFSListPtr->end()){ + // Check if frmContact is the main window, if not + // then do some clear up. + + if (StartupMode == false){ + + if (MemoryFSListPtr->find(SessionID) == MemoryFSListPtr->end()){ + + } else { - } else { + std::map::iterator striter; - std::map::iterator striter; + for (striter = MemoryFSListPtr->begin(); striter != MemoryFSListPtr->end(); striter++){ - for (striter = MemoryFSListPtr->begin(); striter != MemoryFSListPtr->end(); striter++){ + if (SessionID == striter->second){ - if (SessionID == striter->second){ + // Delete the references from the wxMemoryFSHandler + // and the entry from the map. - // Delete the references from the wxMemoryFSHandler - // and the entry from the map. + wxMemoryFSHandler::RemoveFile(striter->first); - wxMemoryFSHandler::RemoveFile(striter->first); + break; - break; + } } - } - - MemoryFSListPtr->erase(striter); + MemoryFSListPtr->erase(striter); - } + } - WindowData *WData = new WindowData; + WindowData *WData = new WindowData; - WData->DataType = 0; - WData->WindowPointer = this; - WData->WindowID = ContactUID; + WData->DataType = 0; + WData->WindowPointer = this; + WData->WindowID = ContactUID; - wxCommandEvent delevent(WINDOW_CLOSE); - delevent.SetClientData(WData); - wxPostEvent(GetParent(), delevent); + wxCommandEvent delevent(WINDOW_CLOSE); + delevent.SetClientData(WData); + wxPostEvent(GetParent(), delevent); + } + Destroy(); } - - bool frmContact::SetupContactData(vCard *vCardObj){ + // Setup the contact information. + wxFileSystem::AddHandler(new wxMemoryFSHandler); for (std::map::iterator striter = MemoryFSListPtr->begin(); @@ -112,38 +121,85 @@ bool frmContact::SetupContactData(vCard *vCardObj){ OldSessionID = SessionID; SessionID = wxString::Format(wxT("%i"), rand() % 32768); - LoadContactData(vCardObj, htmContactData, SessionID, OldSessionID, MemoryFSListPtr); - SetTitle(vCardObj->Get(wxT("FN"))); + wxColour formattedBackgroundColour; + if (backgroundColour.IsEmpty()) + { + + formattedBackgroundColour = wxTransparentColour; + + } + else + { + + formattedBackgroundColour.Set(backgroundColour); + + } + + + LoadContactData(vCardObj, htmContactData, SessionID, OldSessionID, MemoryFSListPtr, formattedBackgroundColour); + ArrayvCardOutData FNList; + FNList = vCardObj->GetByPartial(wxT("FN")); + + if (FNList.PropCount > 0){ + FNList.PropValues[0].Trim(); + SetTitle(FNList.PropValues[0]); + } + + if (StartupMode == false){ + + WindowData *WData = new WindowData; - WindowData *WData = new WindowData; + vCardFilename = vCardObj->GetFilename(); - vCardFilename = vCardObj->GetFilename(); + WData->DataType = 0; + WData->WindowPointer = this; + WData->WindowID = ContactUID; + + wxCommandEvent editevent(WINDOW_EDIT); + editevent.SetClientData(WData); + wxPostEvent(GetParent(), editevent); + + } - WData->DataType = 0; - WData->WindowPointer = this; - WData->WindowID = ContactUID; + return TRUE; +} - wxCommandEvent editevent(WINDOW_EDIT); - editevent.SetClientData(WData); - wxPostEvent(GetParent(), editevent); +void frmContact::SetMode(bool StartupModeIn){ - return TRUE; + // Set the mode which frmContact will be operating. + + StartupMode = StartupModeIn; + } void frmContact::SetupPointers(std::map *MemoryFSListIncPtr){ + // Set the pointer for the Memory Filesystem map. + MemoryFSListPtr = MemoryFSListIncPtr; } void frmContact::SetUID(int UID){ + // Set the UID of the contact window. + ContactUID = UID; } wxString frmContact::GetFilename(){ + // Get the filename of the contact being displayed. + return vCardFilename; +} + +void frmContact::SetBackgroundColour(wxString backgroundColour){ + + // Set the background colour. + + this->backgroundColour = backgroundColour; + } \ No newline at end of file