Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Move INSTALL, LICENSE, README, THANKS and TODO into root directory
[xestiaab/.git] / source / frmMain.h
1 // frmMain.h - Main window header 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 #ifndef __frmMain__
20 #define __frmMain__
22 /**
23 @file
24 Subclass of frmMainADT, which is generated by wxFormBuilder.
25 */
27 #include "AppXestiaAddrBk.h"
28 #include "common/preferences.h"
29 #include <map>
30 #include <utility>
31 #include <wx/timer.h>
32 #include <wx/filesys.h>
33 #include <wx/combo.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"
45 #endif
47 #include "common/timers.h"
48 #include "common/events.h"
49 #include "common/etag.h"
50 #include "common/structs.h"
51 #include "bitmaps.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);
87 #endif
89 struct UCNotif{
90         wxString ContactAccount;
91         wxString ContactFilename;
92         wxString ContactName;
93         wxString ContactNameField;
94         wxString ContactNickname;
95         vCardName ContactNameArray;
96 };
98 struct SWCloseNotif{
99         void *SCHWinPtr;
100 };
102 struct XABViewMode{
104         int SortMode;
105         bool AscendingMode;
107 };
109 struct WindowData{
111         int DataType;
112         void *WindowPointer;
113         int WindowID;
115 };
117 /** Implementing frmMainADT */
118 class frmMain : public frmMainADT
120         private:
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                 NSRunningApplication *helpBrowserProcess;
129 #elif defined(__WIN32__)
130                 std::map<int, PCCERT_CONTEXT> AccountCertificateData;
131 #else
132                 std::map<int, SSLCertCollectionString> AccountSSLData;
133 #endif
134                 std::map<int, int> AccountSSLResult;
135                 std::multimap<int, int> AccountGroupList;
136                 std::multimap<int, wxString> AccountGroupFilename;
137                 std::multimap<wxTreeItemId, int> AccountGroupTreeId;
138                 std::map<wxString, wxAccountSyncTimer*> AccountSyncTimers;
139                 void *ActMgrPtr;
140                 wxString ActiveAccount;
141                 wxString ActiveAccountType;
142                 wxString ActiveFilename;
143                 wxETagProcessTimer ETagProcTimer;
144                 std::map<wxString,wxString> MemoryFileList;
145                 std::map<void*,wxString> ContactWindowList;
146                 std::map<void*,wxString> ContactEditorWindowList;
147                 std::map<void*,wxString> SearchWindowList;
148                 std::map<int,wxMenuItem*> WindowListPointersMenu;
149                 std::map<int,void*> WindowListPointers;
150                 std::map<int,int> WindowListType;
151                 wxMenuItem *mnuContactWindows;
152                 wxMenuItem *mnuContactEditorWindows;
153                 wxMenuItem *mnuSearchWindows;
154                 wxToolTip *SSLToolTip;
155                 bool RevealWait = FALSE;
156                 wxString SessionID;
157                 wxString OldSessionID;
158                 wxColour ContactBackgroundColour;
159                 wxIcon IconEmp;
160                 XABAccountView* treAccounts = new XABAccountView();
161                 wxImageList *AccImgList =  new wxImageList(16,16,true);
162                 wxImageList *ActMgrImgList = new wxImageList(16,16,true);
163                 int AccountID;
164                 int AccountNetID;
165                 int AccountGrpID;
166                 int AccountUnsupportedID;
167                 int AccountNoneID;
168                 bool ReloadAccounts = FALSE;
169                 bool AscendingMode = FALSE;
170                 int SortMode = 1;
171                 wxStaticBitmap *imgConnStatus = NULL;
172                 wxStaticBitmap *imgSSLStatus = NULL;
173                 wxStaticBitmap *imgActivityStatus = NULL;
174                 wxBitmap *imgActIcon1 = NULL;
175                 wxBitmap *imgActIcon2 = NULL;
176                 wxBitmap *imgActIcon3 = NULL;
177                 wxBitmap *imgActIcon4 = NULL;
178                 wxBitmap *imgActIconSleep = NULL;
179                 wxBitmap *imgSSL = NULL;
180                 wxBitmap *imgNoSSL = NULL;
181                 wxBitmap *imgSSLWarning = NULL;
182                 wxBitmap *imgOnline = NULL;
183                 wxBitmap *imgOffline = NULL;
184                 wxBitmap *imgAddAddressBook = NULL;
185                 wxBitmap *imgPreferences = NULL;
186                 wxBitmap *imgSearchContacts = NULL;
187                 wxBitmap *imgAddContact = NULL;
188                 wxBitmap *imgEditContact = NULL;
189                 wxBitmap *imgDeleteContact = NULL;
190                 int ActivityIconStatus = 0;
191                 int SearchUID = 0;
192                 int ContactUID = 0;
193                 int ContactEditorUID = 0;
194                 int WindowMenuItemID = 0;
195                 XABContactMenu *ContactMenu = new XABContactMenu(XABCONTACTMENU_MAIN); 
196                 void ResetContactInfo();
197 #if defined(__APPLE__)
198                 void DisplayCertificate(SecTrustRef SecurityTrustObject);
199                 void DisplayTrustPanel( wxCommandEvent& event );
200                 void DisplayHelpBrowser();
201                 void TerminateHelpBrowserProcess();
202 #endif
203         protected:
204                 // Handlers for frmMainADT events.
205                 void QuitApp( wxCloseEvent& event );
206                 void QuitApp( wxCommandEvent& event );
207                 void QuitApp();
208                 void ShowAboutWindow( wxCommandEvent& event );
209                 void OpenPreferences( wxCommandEvent& event );
210                 void OpenNewABDialog( wxCommandEvent& event );
211                 void LoadPreferences( wxActivateEvent& event );
212                 void LoadPreferences(bool skipWindowSizeReload);
213                 void ShowContactInfo( wxListEvent& event );
214                 void OpenContactInfoList( wxListEvent& event );
215                 void OpenContactInfoList( wxCommandEvent& event );
216                 void OpenContactInfo( wxCommandEvent& event );
217                 void ShowContactEditorNew( wxCommandEvent& event );             
218                 void ShowContactEditorEdit( wxCommandEvent& event );
219                 void RefreshAddressBook( wxCommandEvent& event );
220                 void ShowActivityWindow( wxCommandEvent& event );
221                 void LoadContactList( wxTreeEvent& event );             
222                 wxTreeItemId FindItemNamed(wxTreeCtrl &tree, 
223                               const std::wstring &name);
224                 void ConflictResolution( wxCommandEvent& event );
225                 void UpdateContactList( wxCommandEvent& event );
226                 void UpdateSearchContactLists( wxCommandEvent& event );
227                 void OpenFindContactsWindow(wxCommandEvent& event);
228                 void RevealContact( wxCommandEvent& event );
229                 void RemoveContactsWindowPointer(wxCommandEvent& event);
230                 void RemoveContactEditorWindowPointer(wxCommandEvent& event);
231                 void RemoveContactSearchWindows(wxCommandEvent& event);
232                 void DeleteContact(wxCommandEvent& event);
233                 void EmptyServerDialog(wxCommandEvent& event);
234                 void DeleteContactSync(wxString &Account, wxString &Filename);
235                 void SortFNLN( wxCommandEvent& event );
236                 void SortLNFN( wxCommandEvent& event );
237                 void SortNickname( wxCommandEvent& event );
238                 void SortDisplayAs( wxCommandEvent& event );
239                 void SortAscending( wxCommandEvent& event );
240                 void SortDescending( wxCommandEvent& event );
241                 void ToggleStatusBar( wxCommandEvent& event );
242                 void UpdateSBIconPlacement( wxSizeEvent& event );
243                 void WindowAdd( wxCommandEvent& event );
244                 void WindowEdit( wxCommandEvent& event );
245                 void WindowDelete( wxCommandEvent& event );
246                 void ShowContactWindow( wxCommandEvent& event );
247                 void ShowContactEditorWindow( wxCommandEvent& event );
248                 void ShowSearchWindow( wxCommandEvent& event );
249                 void ToggleConnectionStatus( wxCommandEvent& event );
250                 void ShowSSLCertificates( wxCommandEvent& event );
251                 void ShowSSLInfo( wxCommandEvent& event );
252                 void HideSSLInfo( wxCommandEvent& event );
253                 void UpdateConnectionStatus( wxCommandEvent& event );
254                 void SetupSSLStatus( int AccountID );
255                 void InvalidSSLCertificate( wxCommandEvent& event );
256                 void InvalidSSLCertificateString( wxCommandEvent& event );
257                 void CheckUpdates( wxCommandEvent& event );
258                 void OpenImportDialog( wxCommandEvent& event );
259                 void OpenExportDialog( wxCommandEvent& event );
260                 void GetSelectedList( wxCommandEvent& event );
261                 void SyncAccount( wxCommandEvent& event );
262                 void ShowHelp( wxCommandEvent& event );
263                 void ShowContactMenu( wxMouseEvent& event );
264                 void ProcessMenuItemClick( wxCommandEvent &event );
265         public:
266                 /** Constructor */
267                 frmMain( wxWindow* parent );
268                 int ShowConflictDialog(vCard *LocalObj, vCard *ServerObj);
269                 void SetupPointers(void *ActMgr);
270                 void SetupForm();
271                 void ActivityIconStart( wxCommandEvent& event );
272                 void ActivityIconShuffle( wxCommandEvent& event );
273                 void ActivityIconStop( wxCommandEvent& event );
274                 void PauseAllTimers();
275                 void ResumeAllTimers();
276                 void GetListControl(wxListCtrl *lstContactsPtr, wxArrayString *ContactsFileIndexPtr);
277                 void ShowImportResults( wxCommandEvent& event );
278                 void ReloadContactList( wxCommandEvent& event );
279                 XABViewMode GetViewMode();
280 #if defined(__APPLE__)
281                 void UpdateSSLAccountStatus(int AccountID, int SSLStatus, SecTrustRef SecurityTrustObject);
282 #elif defined(__WIN32__)
283                 void UpdateSSLAccountStatus(int AccountID, int SSLStatus, PCCERT_CONTEXT CertificateContext);
284 #else
285                 void UpdateSSLAccountStatus(int AccountID, int SSLStatus, SSLCertCollectionString SSLCertInc);
286 #endif
287                 bool CloseAllWindows();
288                 DECLARE_EVENT_TABLE()
290         //// end generated class members
291         
292 };
294 #endif // __frmMain__
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