Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added source code, header and unit testing for the EMAIL vCard property for the Conta...
[xestiaab/.git] / source / search / frmSearchAccounts.cpp
1 // frmSearchAccounts.cpp - frmSearchAccounts form.
2 //
3 // (c) 2012-2015 Xestia Software Development.
4 //
5 // This file is part of Xestia Address Book.
6 //
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
10 //
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "frmSearchAccounts.h"
20 #include "../frmMain.h"
22 frmSearchAccounts::frmSearchAccounts( wxWindow* parent )
23 :
24 frmSearchAccountsADT( parent )
25 {
27 }
29 frmSearchAccounts::~frmSearchAccounts(){        
31 }
33 void frmSearchAccounts::LoadSearchAccounts(std::map<wxString, bool> *SearchAccounts,
34         std::map<wxString, wxString> *SearchAccountsList)
35 {
37         SAPtr = SearchAccounts;
38         SALPtr = SearchAccountsList;
39         std::map<wxString, wxString>::iterator SALiter;
40         wxString AccDir;
41         
42         // Load the search accounts into the Checklist.
43         
44         wxArrayString AccList;
45         
46         for (std::map<wxString, bool>::iterator iter = SAPtr->begin(); 
47                 iter != SAPtr->end(); ++iter){
48                 
49                 SALiter = SALPtr->find(iter->first);
50                 
51                 AccList.Add(SALiter->second, 1);
52                 
53         }
55         chlAccounts->Append(AccList);
56         //chlAccounts->SetSelection(wxNOT_FOUND);
58         // Check if each account is selected.
59         
60         for (int i = 0; i < chlAccounts->GetCount(); i++){
61         
62                 AccDir = chlAccounts->GetString(i);
63                 
64                 for (std::map<wxString, bool>::iterator iter = SAPtr->begin(); 
65                         iter != SAPtr->end(); ++iter){
66                 
67                         SALiter = SALPtr->find(iter->first);
69                         if (AccDir == SALiter->second){
70                         
71                                 chlAccounts->Check(i, iter->second);
72                         
73                         }
74                 
75                 }
76         
77         }
79 }
81 void frmSearchAccounts::UpdateSelectedAccounts( wxCommandEvent& event )
82 {
84         // Process each of the items in the Checklist box.
85         // Compare each with the ones in the std::map
86         // and adjust the bool value accordingly.
87         
88         wxString AccDir;
89         std::map<wxString, wxString>::iterator SALiter;
90         
91         for (int i = 0; i < chlAccounts->GetCount(); i++){
92         
93                 AccDir = chlAccounts->GetString(i);
94                 
95                 for (std::map<wxString, bool>::iterator iter = SAPtr->begin(); 
96                         iter != SAPtr->end(); ++iter){
97                 
98                         SALiter = SALPtr->find(iter->first);
100                         if (AccDir == SALiter->second){
101                         
102                                 iter->second = chlAccounts->IsChecked(i);
103                         
104                         }
105                 
106                 }
107         
108         }
109         
110         this->Close();
114 void frmSearchAccounts::CloseWindow( wxCommandEvent& event )
116         this->Close();
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