1 // frmMain.h - Main window header form.
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
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.
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.
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/>
24 Subclass of frmMainADT, which is generated by wxFormBuilder.
27 #include "AppXestiaAddrBk.h"
28 #include "common/preferences.h"
32 #include <wx/filesys.h>
34 #include <wx/treectrl.h>
35 #include <wx/treebase.h>
36 #include <wx/imaglist.h>
37 #include <wx/mstream.h>
38 #include <wx/tooltip.h>
40 #if defined(__APPLE__)
41 #import <Foundation/Foundation.h>
42 #import <SecurityInterface/SFCertificateTrustPanel.h>
43 #elif defined(__WIN32__)
44 #include "common/win32ssl.h"
47 #include "common/timers.h"
48 #include "common/events.h"
49 #include "common/etag.h"
50 #include "common/structs.h"
52 #include "common/sslcertstructs.h"
53 #include "widgets/XABContactMenu.h"
54 #include "widgets/XABAccountView.h"
56 //// end generated include
58 DECLARE_EVENT_TYPE(CE_UPDATECONTACTLIST, wxID_ANY)
59 DECLARE_EVENT_TYPE(SE_UPDATECONTACTNOTIF, wxID_ANY)
60 DECLARE_EVENT_TYPE(CE_OPENCONTACT, wxID_ANY)
61 DECLARE_EVENT_TYPE(CE_OPENCONTACTLIST, wxID_ANY)
62 DECLARE_EVENT_TYPE(CE_NEWCONTACT, wxID_ANY)
63 DECLARE_EVENT_TYPE(CE_EDITCONTACT, wxID_ANY)
64 DECLARE_EVENT_TYPE(CE_DELETECONTACT, wxID_ANY)
65 DECLARE_EVENT_TYPE(CE_REVEALCONTACT, wxID_ANY)
66 DECLARE_EVENT_TYPE(CE_REMOVESEARCH, wxID_ANY)
67 DECLARE_EVENT_TYPE(CE_REMOVECONTACT, wxID_ANY)
68 DECLARE_EVENT_TYPE(SYNC_EMPTYSERVER, wxID_ANY)
69 DECLARE_EVENT_TYPE(ACTMGR_START, wxID_ANY);
70 DECLARE_EVENT_TYPE(ACTMGR_SHUFFLE, wxID_ANY);
71 DECLARE_EVENT_TYPE(ACTMGR_STOP, wxID_ANY);
72 DECLARE_EVENT_TYPE(WINDOW_ADD, wxID_ANY);
73 DECLARE_EVENT_TYPE(WINDOW_EDIT, wxID_ANY);
74 //DECLARE_EVENT_TYPE(WINDOW_DELETE, wxID_ANY);
75 DECLARE_EVENT_TYPE(WINDOW_CLOSE, wxID_ANY);
76 DECLARE_EVENT_TYPE(CONNSTAT_UPDATE, wxID_ANY);
77 DECLARE_EVENT_TYPE(INVALIDSSLCERT, wxID_ANY);
78 DECLARE_EVENT_TYPE(INVALIDSSLCERTSTRING, wxID_ANY);
79 DECLARE_EVENT_TYPE(GETSELECTEDLIST, wxID_ANY);
80 DECLARE_EVENT_TYPE(SYNCACCOUNT, wxID_ANY);
81 DECLARE_EVENT_TYPE(IMPORT_RESULTSSHOW, wxID_ANY);
82 DECLARE_EVENT_TYPE(RELOADCONTACTLIST, wxID_ANY);
83 DECLARE_EVENT_TYPE(REFRESHADDRESSBOOK, wxID_ANY);
85 #if defined(__APPLE__)
86 DECLARE_EVENT_TYPE(INVALIDSSLTRUST, wxID_ANY);
90 wxString ContactAccount;
91 wxString ContactFilename;
93 wxString ContactNameField;
94 wxString ContactNickname;
95 vCardName ContactNameArray;
117 /** Implementing frmMainADT */
118 class frmMain : public frmMainADT
121 XABPrefAccounts prefaccounts;
122 wxArrayString ContactsFileIndex;
123 std::map<wxString, bool> WindowList;
124 std::map<int, wxTimer> AccountRefreshList;
125 std::map<int, wxString> AccountAccDirList;
126 #if defined(__APPLE__)
127 std::map<int, SecTrustRef> AccountTrustData;
128 #elif defined(__WIN32__)
129 std::map<int, PCCERT_CONTEXT> AccountCertificateData;
131 std::map<int, SSLCertCollectionString> AccountSSLData;
133 std::map<int, int> AccountSSLResult;
134 std::multimap<int, int> AccountGroupList;
135 std::multimap<int, wxString> AccountGroupFilename;
136 std::multimap<wxTreeItemId, int> AccountGroupTreeId;
137 std::map<wxString, wxAccountSyncTimer*> AccountSyncTimers;
139 wxString ActiveAccount;
140 wxString ActiveAccountType;
141 wxString ActiveFilename;
142 wxETagProcessTimer ETagProcTimer;
143 std::map<wxString,wxString> MemoryFileList;
144 std::map<void*,wxString> ContactWindowList;
145 std::map<void*,wxString> ContactEditorWindowList;
146 std::map<void*,wxString> SearchWindowList;
147 std::map<int,wxMenuItem*> WindowListPointersMenu;
148 std::map<int,void*> WindowListPointers;
149 std::map<int,int> WindowListType;
150 wxMenuItem *mnuContactWindows;
151 wxMenuItem *mnuContactEditorWindows;
152 wxMenuItem *mnuSearchWindows;
153 wxToolTip *SSLToolTip;
154 bool RevealWait = FALSE;
156 wxString OldSessionID;
157 wxColour ContactBackgroundColour;
159 XABAccountView* treAccounts = new XABAccountView();
160 wxImageList *AccImgList = new wxImageList(16,16,true);
161 wxImageList *ActMgrImgList = new wxImageList(16,16,true);
165 int AccountUnsupportedID;
167 bool ReloadAccounts = FALSE;
168 bool AscendingMode = FALSE;
170 wxStaticBitmap *imgConnStatus = NULL;
171 wxStaticBitmap *imgSSLStatus = NULL;
172 wxStaticBitmap *imgActivityStatus = NULL;
173 wxBitmap *imgActIcon1 = NULL;
174 wxBitmap *imgActIcon2 = NULL;
175 wxBitmap *imgActIcon3 = NULL;
176 wxBitmap *imgActIcon4 = NULL;
177 wxBitmap *imgActIconSleep = NULL;
178 wxBitmap *imgSSL = NULL;
179 wxBitmap *imgNoSSL = NULL;
180 wxBitmap *imgSSLWarning = NULL;
181 wxBitmap *imgOnline = NULL;
182 wxBitmap *imgOffline = NULL;
183 wxBitmap *imgAddAddressBook = NULL;
184 wxBitmap *imgPreferences = NULL;
185 wxBitmap *imgSearchContacts = NULL;
186 wxBitmap *imgAddContact = NULL;
187 wxBitmap *imgEditContact = NULL;
188 wxBitmap *imgDeleteContact = NULL;
189 int ActivityIconStatus = 0;
192 int ContactEditorUID = 0;
193 int WindowMenuItemID = 0;
194 XABContactMenu *ContactMenu = new XABContactMenu(XABCONTACTMENU_MAIN);
195 void ResetContactInfo();
196 #if defined(__APPLE__)
197 void DisplayCertificate(SecTrustRef SecurityTrustObject);
198 void DisplayTrustPanel( wxCommandEvent& event );
201 // Handlers for frmMainADT events.
202 void QuitApp( wxCloseEvent& event );
203 void QuitApp( wxCommandEvent& event );
205 void ShowAboutWindow( wxCommandEvent& event );
206 void OpenPreferences( wxCommandEvent& event );
207 void OpenNewABDialog( wxCommandEvent& event );
208 void LoadPreferences( wxActivateEvent& event );
209 void LoadPreferences();
210 void ShowContactInfo( wxListEvent& event );
211 void OpenContactInfoList( wxListEvent& event );
212 void OpenContactInfoList( wxCommandEvent& event );
213 void OpenContactInfo( wxCommandEvent& event );
214 void ShowContactEditorNew( wxCommandEvent& event );
215 void ShowContactEditorEdit( wxCommandEvent& event );
216 void RefreshAddressBook( wxCommandEvent& event );
217 void ShowActivityWindow( wxCommandEvent& event );
218 void LoadContactList( wxTreeEvent& event );
219 wxTreeItemId FindItemNamed(wxTreeCtrl &tree,
220 const std::wstring &name);
221 void ConflictResolution( wxCommandEvent& event );
222 void UpdateContactList( wxCommandEvent& event );
223 void UpdateSearchContactLists( wxCommandEvent& event );
224 void OpenFindContactsWindow(wxCommandEvent& event);
225 void RevealContact( wxCommandEvent& event );
226 void RemoveContactsWindowPointer(wxCommandEvent& event);
227 void RemoveContactEditorWindowPointer(wxCommandEvent& event);
228 void RemoveContactSearchWindows(wxCommandEvent& event);
229 void DeleteContact(wxCommandEvent& event);
230 void EmptyServerDialog(wxCommandEvent& event);
231 void DeleteContactSync(wxString &Account, wxString &Filename);
232 void SortFNLN( wxCommandEvent& event );
233 void SortLNFN( wxCommandEvent& event );
234 void SortNickname( wxCommandEvent& event );
235 void SortDisplayAs( wxCommandEvent& event );
236 void SortAscending( wxCommandEvent& event );
237 void SortDescending( wxCommandEvent& event );
238 void ToggleStatusBar( wxCommandEvent& event );
239 void UpdateSBIconPlacement( wxSizeEvent& event );
240 void WindowAdd( wxCommandEvent& event );
241 void WindowEdit( wxCommandEvent& event );
242 void WindowDelete( wxCommandEvent& event );
243 void ShowContactWindow( wxCommandEvent& event );
244 void ShowContactEditorWindow( wxCommandEvent& event );
245 void ShowSearchWindow( wxCommandEvent& event );
246 void ToggleConnectionStatus( wxCommandEvent& event );
247 void ShowSSLCertificates( wxCommandEvent& event );
248 void ShowSSLInfo( wxCommandEvent& event );
249 void HideSSLInfo( wxCommandEvent& event );
250 void UpdateConnectionStatus( wxCommandEvent& event );
251 void SetupSSLStatus( int AccountID );
252 void InvalidSSLCertificate( wxCommandEvent& event );
253 void InvalidSSLCertificateString( wxCommandEvent& event );
254 void CheckUpdates( wxCommandEvent& event );
255 void OpenImportDialog( wxCommandEvent& event );
256 void OpenExportDialog( wxCommandEvent& event );
257 void GetSelectedList( wxCommandEvent& event );
258 void SyncAccount( wxCommandEvent& event );
259 void ShowHelp( wxCommandEvent& event );
260 void ShowContactMenu( wxMouseEvent& event );
261 void ProcessMenuItemClick( wxCommandEvent &event );
264 frmMain( wxWindow* parent );
265 int ShowConflictDialog(vCard *LocalObj, vCard *ServerObj);
266 void SetupPointers(void *ActMgr);
268 void ActivityIconStart( wxCommandEvent& event );
269 void ActivityIconShuffle( wxCommandEvent& event );
270 void ActivityIconStop( wxCommandEvent& event );
271 void PauseAllTimers();
272 void ResumeAllTimers();
273 void GetListControl(wxListCtrl *lstContactsPtr, wxArrayString *ContactsFileIndexPtr);
274 void ShowImportResults( wxCommandEvent& event );
275 void ReloadContactList( wxCommandEvent& event );
276 XABViewMode GetViewMode();
277 #if defined(__APPLE__)
278 void UpdateSSLAccountStatus(int AccountID, int SSLStatus, SecTrustRef SecurityTrustObject);
279 #elif defined(__WIN32__)
280 void UpdateSSLAccountStatus(int AccountID, int SSLStatus, PCCERT_CONTEXT CertificateContext);
282 void UpdateSSLAccountStatus(int AccountID, int SSLStatus, SSLCertCollectionString SSLCertInc);
284 bool CloseAllWindows();
285 DECLARE_EVENT_TABLE()
287 //// end generated class members
291 #endif // __frmMain__