Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Initial import of code already done for Xestia Address Book
[xestiaab/.git] / source / search / frmSearchAccounts.cpp
1 #include "frmSearchAccounts.h"
2 #include "../frmMain.h"
4 frmSearchAccounts::frmSearchAccounts( wxWindow* parent )
5 :
6 frmSearchAccountsADT( parent )
7 {
9 }
11 frmSearchAccounts::~frmSearchAccounts(){        
13 }
15 void frmSearchAccounts::LoadSearchAccounts(std::map<wxString, bool> *SearchAccounts,
16         std::map<wxString, wxString> *SearchAccountsList)
17 {
19         SAPtr = SearchAccounts;
20         SALPtr = SearchAccountsList;
21         std::map<wxString, wxString>::iterator SALiter;
22         wxString AccDir;
23         
24         // Load the search accounts into the Checklist.
25         
26         wxArrayString AccList;
27         
28         for (std::map<wxString, bool>::iterator iter = SAPtr->begin(); 
29                 iter != SAPtr->end(); ++iter){
30                 
31                 SALiter = SALPtr->find(iter->first);
32                 
33                 AccList.Add(SALiter->second, 1);
34                 
35         }
37         chlAccounts->Append(AccList);
38         //chlAccounts->SetSelection(wxNOT_FOUND);
40         // Check if each account is selected.
41         
42         for (int i = 0; i < chlAccounts->GetCount(); i++){
43         
44                 AccDir = chlAccounts->GetString(i);
45                 
46                 for (std::map<wxString, bool>::iterator iter = SAPtr->begin(); 
47                         iter != SAPtr->end(); ++iter){
48                 
49                         SALiter = SALPtr->find(iter->first);
51                         if (AccDir == SALiter->second){
52                         
53                                 chlAccounts->Check(i, iter->second);
54                         
55                         }
56                 
57                 }
58         
59         }
61 }
63 void frmSearchAccounts::UpdateSelectedAccounts( wxCommandEvent& event )
64 {
66         // Process each of the items in the Checklist box.
67         // Compare each with the ones in the std::map
68         // and adjust the bool value accordingly.
69         
70         wxString AccDir;
71         std::map<wxString, wxString>::iterator SALiter;
72         
73         for (int i = 0; i < chlAccounts->GetCount(); i++){
74         
75                 AccDir = chlAccounts->GetString(i);
76                 
77                 for (std::map<wxString, bool>::iterator iter = SAPtr->begin(); 
78                         iter != SAPtr->end(); ++iter){
79                 
80                         SALiter = SALPtr->find(iter->first);
82                         if (AccDir == SALiter->second){
83                         
84                                 iter->second = chlAccounts->IsChecked(i);
85                         
86                         }
87                 
88                 }
89         
90         }
91         
92         this->Close();
94 }
96 void frmSearchAccounts::CloseWindow( wxCommandEvent& event )
97 {
98         this->Close();
99 }
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