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>
45 #include "common/timers.h"
46 #include "common/events.h"
47 #include "common/etag.h"
49 #include "common/sslcertstructs.h"
50 #include "widgets/XABContactMenu.h"
51 #include "widgets/XABAccountView.h"
53 //// end generated include
55 DECLARE_EVENT_TYPE(CE_UPDATECONTACTLIST, wxID_ANY)
56 DECLARE_EVENT_TYPE(CE_UPDATEACCOUNTLIST, wxID_ANY)
57 DECLARE_EVENT_TYPE(SE_UPDATECONTACTNOTIF, wxID_ANY)
58 DECLARE_EVENT_TYPE(CE_OPENCONTACT, wxID_ANY)
59 DECLARE_EVENT_TYPE(CE_OPENCONTACTLIST, wxID_ANY)
60 DECLARE_EVENT_TYPE(CE_NEWCONTACT, wxID_ANY)
61 DECLARE_EVENT_TYPE(CE_EDITCONTACT, wxID_ANY)
62 DECLARE_EVENT_TYPE(CE_DELETECONTACT, wxID_ANY)
63 DECLARE_EVENT_TYPE(CE_REVEALCONTACT, wxID_ANY)
64 DECLARE_EVENT_TYPE(CE_REMOVESEARCH, wxID_ANY)
65 DECLARE_EVENT_TYPE(CE_REMOVECONTACT, wxID_ANY)
66 DECLARE_EVENT_TYPE(SYNC_EMPTYSERVER, wxID_ANY)
67 DECLARE_EVENT_TYPE(ACTMGR_START, wxID_ANY);
68 DECLARE_EVENT_TYPE(ACTMGR_SHUFFLE, wxID_ANY);
69 DECLARE_EVENT_TYPE(ACTMGR_STOP, wxID_ANY);
70 DECLARE_EVENT_TYPE(WINDOW_ADD, wxID_ANY);
71 DECLARE_EVENT_TYPE(WINDOW_EDIT, wxID_ANY);
72 //DECLARE_EVENT_TYPE(WINDOW_DELETE, wxID_ANY);
73 DECLARE_EVENT_TYPE(WINDOW_CLOSE, wxID_ANY);
74 DECLARE_EVENT_TYPE(CONNSTAT_UPDATE, wxID_ANY);
75 DECLARE_EVENT_TYPE(INVALIDSSLCERT, wxID_ANY);
76 DECLARE_EVENT_TYPE(GETSELECTEDLIST, wxID_ANY);
77 DECLARE_EVENT_TYPE(SYNCACCOUNT, wxID_ANY);
78 DECLARE_EVENT_TYPE(IMPORT_RESULTSSHOW, wxID_ANY);
79 DECLARE_EVENT_TYPE(RELOADCONTACTLIST, wxID_ANY);
80 DECLARE_EVENT_TYPE(REFRESHADDRESSBOOK, wxID_ANY);
82 #if defined(__APPLE__)
83 DECLARE_EVENT_TYPE(INVALIDSSLTRUST, wxID_ANY);
87 wxString ContactAccount;
88 wxString ContactFilename;
90 wxString ContactNameField;
91 wxString ContactNickname;
92 vCardName ContactNameArray;
119 /** Implementing frmMainADT */
120 class frmMain : public frmMainADT
123 XABPrefAccounts prefaccounts;
124 wxArrayString ContactsFileIndex;
125 std::map<wxString, bool> WindowList;
126 std::map<int, wxTimer> AccountRefreshList;
127 std::map<int, wxString> AccountAccDirList;
128 #if defined(__APPLE__)
129 std::map<int, SecTrustRef> AccountTrustData;
131 std::map<int, SSLCertCollection> 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 //std::map<int,int> WindowListType;
151 wxMenuItem *mnuContactWindows;
152 wxMenuItem *mnuContactEditorWindows;
153 wxMenuItem *mnuSearchWindows;
154 wxToolTip *SSLToolTip;
155 bool RevealWait = FALSE;
157 wxString OldSessionID;
160 //wxComboCtrl* AccControl = new wxGenericComboCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize);
161 //wxComboCtrl* AccControl = new wxComboCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxCB_READONLY|wxEXPAND|wxCC_STD_BUTTON);
162 //wxStaticBitmap* AccIcon = new wxStaticBitmap(this, wxID_ANY, IconEmp, wxDefaultPosition, wxSize(16,16), wxALL|wxEXPAND, wxStaticBitmapNameStr);
163 XABAccountView* treAccounts = new XABAccountView();
164 wxImageList *AccImgList = new wxImageList(16,16,true);
165 wxImageList *ActMgrImgList = new wxImageList(16,16,true);
171 bool ReloadAccounts = FALSE;
172 bool AscendingMode = FALSE;
174 wxStaticBitmap *imgConnStatus = NULL;
175 wxStaticBitmap *imgSSLStatus = NULL;
176 wxStaticBitmap *imgActivityStatus = NULL;
177 wxBitmap *imgActIcon1 = NULL;
178 wxBitmap *imgActIcon2 = NULL;
179 wxBitmap *imgActIcon3 = NULL;
180 wxBitmap *imgActIcon4 = NULL;
181 wxBitmap *imgActIconSleep = NULL;
182 wxBitmap *imgSSL = NULL;
183 wxBitmap *imgNoSSL = NULL;
184 wxBitmap *imgSSLWarning = NULL;
185 wxBitmap *imgOnline = NULL;
186 wxBitmap *imgOffline = NULL;
187 int ActivityIconStatus = 0;
190 int ContactEditorUID = 0;
191 int WindowMenuItemID = 0;
192 XABContactMenu *ContactMenu = new XABContactMenu(XABCONTACTMENU_MAIN);
193 void ResetContactInfo();
194 #if defined(__APPLE__)
195 void DisplayCertificate(SecTrustRef SecurityTrustObject);
196 void DisplayTrustPanel( wxCommandEvent& event );
199 // Handlers for frmMainADT events.
200 void QuitApp( wxCloseEvent& event );
201 void QuitApp( wxCommandEvent& event );
203 void ShowAboutWindow( wxCommandEvent& event );
204 void OpenPreferences( wxCommandEvent& event );
205 void OpenNewABDialog( wxCommandEvent& event );
206 void LoadPreferences( wxActivateEvent& event );
207 void LoadPreferences();
208 void ShowContactInfo( wxListEvent& event );
209 void OpenContactInfoList( wxListEvent& event );
210 void OpenContactInfoList( wxCommandEvent& event );
211 void OpenContactInfo( wxCommandEvent& event );
212 void ShowContactEditorNew( wxCommandEvent& event );
213 void ShowContactEditorEdit( wxCommandEvent& event );
214 void RefreshAddressBook( wxCommandEvent& event );
215 void ShowActivityWindow( wxCommandEvent& event );
216 void LoadContactList( wxTreeEvent& event );
217 wxTreeItemId FindItemNamed(wxTreeCtrl &tree,
218 const std::wstring &name);
219 void ConflictResolution( wxCommandEvent& event );
220 void UpdateContactList( wxCommandEvent& event );
221 void UpdateAccountList( wxCommandEvent& event );
222 void UpdateSearchContactLists( wxCommandEvent& event );
223 void OpenFindContactsWindow(wxCommandEvent& event);
224 void RevealContact( wxCommandEvent& event );
225 void RemoveContactsWindowPointer(wxCommandEvent& event);
226 void RemoveContactEditorWindowPointer(wxCommandEvent& event);
227 void RemoveContactSearchWindows(wxCommandEvent& event);
228 void DeleteContact(wxCommandEvent& event);
229 void EmptyServerDialog(wxCommandEvent& event);
230 void DeleteContactSync(wxString &Account, wxString &Filename);
231 void SortFNLN( wxCommandEvent& event );
232 void SortLNFN( wxCommandEvent& event );
233 void SortNickname( wxCommandEvent& event );
234 void SortDisplayAs( wxCommandEvent& event );
235 void SortAscending( wxCommandEvent& event );
236 void SortDescending( wxCommandEvent& event );
237 void ToggleStatusBar( wxCommandEvent& event );
238 void UpdateSBIconPlacement( wxSizeEvent& event );
239 void WindowAdd( wxCommandEvent& event );
240 void WindowEdit( wxCommandEvent& event );
241 void WindowDelete( wxCommandEvent& event );
242 void ShowContactWindow( wxCommandEvent& event );
243 void ShowContactEditorWindow( wxCommandEvent& event );
244 void ShowSearchWindow( wxCommandEvent& event );
245 void ToggleConnectionStatus( wxCommandEvent& event );
246 void ShowSSLCertificates( wxCommandEvent& event );
247 void ShowSSLInfo( wxCommandEvent& event );
248 void HideSSLInfo( wxCommandEvent& event );
249 void UpdateConnectionStatus( wxCommandEvent& event );
250 void SetupSSLStatus( int AccountID );
251 void InvalidSSLCertificate( wxCommandEvent& event );
252 void CheckUpdates( wxCommandEvent& event );
253 void OpenImportDialog( wxCommandEvent& event );
254 void OpenExportDialog( wxCommandEvent& event );
255 void GetSelectedList( wxCommandEvent& event );
256 void SyncAccount( wxCommandEvent& event );
257 void ShowHelp( wxCommandEvent& event );
258 void ShowContactMenu( wxMouseEvent& event );
259 void ProcessMenuItemClick( wxCommandEvent &event );
262 frmMain( wxWindow* parent );
263 int ShowConflictDialog(vCard *LocalObj, vCard *ServerObj);
264 void SetupPointers(void *ActMgr);
266 void ActivityIconStart( wxCommandEvent& event );
267 void ActivityIconShuffle( wxCommandEvent& event );
268 void ActivityIconStop( wxCommandEvent& event );
269 void PauseAllTimers();
270 void ResumeAllTimers();
271 void GetListControl(wxListCtrl *lstContactsPtr, wxArrayString *ContactsFileIndexPtr);
272 void ShowImportResults( wxCommandEvent& event );
273 void ReloadContactList( wxCommandEvent& event );
274 XABViewMode GetViewMode();
275 #if defined(__APPLE__)
276 void UpdateSSLAccountStatus(int AccountID, int SSLStatus, SecTrustRef SecurityTrustObject);
278 void UpdateSSLAccountStatus(int AccountID, int SSLStatus, SSLCertCollection SSLCertInc);
280 DECLARE_EVENT_TABLE()
282 //// end generated class members
286 #endif // __frmMain__