Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Updated TODO list. Splitted some files down, -s/-search support implemented.
[xestiaab/.git] / source / frmContact.cpp
1 #include "frmContact.h"
2 #include "common/getcontactinfo.h"
3 #include "frmMain.h"
4 #include <wx/fs_mem.h>
5 #include <wx/filesys.h>
6 #include <wx/app.h>
8 BEGIN_EVENT_TABLE(frmContact, wxFrame)
9 END_EVENT_TABLE()
11 frmContact::frmContact( wxWindow* parent )
12 :
13 frmContactADT( parent )
14 {
16 }
18 void frmContact::CloseWindowProcessing(){
20 }
22 void frmContact::CloseWindow( wxCommandEvent& event ){
23                 
24         this->Close();
26 }
28 void frmContact::CloseWindow( wxCloseEvent& event ){
30         // Off for peppermint tea. Better clean up first or
31         // we'll be in for it later.
33         wxFileSystem::AddHandler(new wxMemoryFSHandler);
35         if (MemoryFSListPtr->find(SessionID) == MemoryFSListPtr->end()){
37         } else {
39                 std::map<wxString, wxString>::iterator striter;
41                 for (striter = MemoryFSListPtr->begin(); striter != MemoryFSListPtr->end(); striter++){
43                         if (SessionID == striter->second){
45                                 // Delete the references from the wxMemoryFSHandler
46                                 // and the entry from the map.
48                                 wxMemoryFSHandler::RemoveFile(striter->first);
50                                 break;
52                         }
54                 }
56                 MemoryFSListPtr->erase(striter);
58         }
59         
60         WindowData *WData = new WindowData;
62         WData->DataType = 0;
63         WData->WindowPointer = this;
64         WData->WindowID = ContactUID;
66         wxCommandEvent delevent(WINDOW_CLOSE);
67         delevent.SetClientData(WData);
68         wxPostEvent(GetParent(), delevent);
69         
70         Destroy();
72 }
76 bool frmContact::SetupContactData(vCard *vCardObj){
78         wxFileSystem::AddHandler(new wxMemoryFSHandler);
79         
80         for (std::map<wxString, wxString>::iterator striter = MemoryFSListPtr->begin();
81         striter != MemoryFSListPtr->end(); striter++){
83                 if (SessionID == striter->second){
85                         // Delete the references from the wxMemoryFSHandler
86                         // and the entry from the map.
88                         wxMemoryFSHandler::RemoveFile(striter->first);
89                         MemoryFSListPtr->erase(striter);
91                 }
93         }
95         OldSessionID = SessionID;
96         SessionID = wxString::Format(wxT("%i"), rand() % 32768);
97         LoadContactData(vCardObj, htmContactData, SessionID, OldSessionID, MemoryFSListPtr);
98         SetTitle(vCardObj->Get(wxT("FN")));
100         WindowData *WData = new WindowData;
102         vCardFilename = vCardObj->GetFilename();
104         WData->DataType = 0;
105         WData->WindowPointer = this;
106         WData->WindowID = ContactUID;
108         wxCommandEvent editevent(WINDOW_EDIT);
109         editevent.SetClientData(WData);
110         wxPostEvent(GetParent(), editevent);
112         return TRUE;
115 void frmContact::SetupPointers(std::map<wxString,wxString> *MemoryFSListIncPtr){
117         MemoryFSListPtr = MemoryFSListIncPtr;
121 void frmContact::SetUID(int UID){
123         ContactUID = UID;
127 wxString frmContact::GetFilename(){
129         return vCardFilename;
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