Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmMain: Close all windows when opening preferences
[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 "bitmaps.h"
51 #include "common/sslcertstructs.h"
52 #include "widgets/XABContactMenu.h"
53 #include "widgets/XABAccountView.h"
55 //// end generated include
57 DECLARE_EVENT_TYPE(CE_UPDATECONTACTLIST, wxID_ANY)
58 DECLARE_EVENT_TYPE(CE_UPDATEACCOUNTLIST, 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 QRNotif{
103         int *QResponse;
104         bool *PausePtr;
105 };
107 struct XABViewMode{
109         int SortMode;
110         bool AscendingMode;
112 };
114 struct WindowData{
116         int DataType;
117         void *WindowPointer;
118         int WindowID;
120 };
122 /** Implementing frmMainADT */
123 class frmMain : public frmMainADT
125         private:
126                 XABPrefAccounts prefaccounts;
127                 wxArrayString ContactsFileIndex;
128                 std::map<wxString, bool> WindowList;
129                 std::map<int, wxTimer> AccountRefreshList;
130                 std::map<int, wxString> AccountAccDirList;
131 #if defined(__APPLE__)
132                 std::map<int, SecTrustRef> AccountTrustData;
133 #elif defined(__WIN32__)
134                 std::map<int, PCCERT_CONTEXT> AccountCertificateData;
135 #else
136                 std::map<int, SSLCertCollectionString> AccountSSLData;
137 #endif
138                 std::map<int, int> AccountSSLResult;
139                 std::multimap<int, int> AccountGroupList;
140                 std::multimap<int, wxString> AccountGroupFilename;
141                 std::multimap<wxTreeItemId, int> AccountGroupTreeId;
142                 std::map<wxString, wxAccountSyncTimer*> AccountSyncTimers;
143                 void *ActMgrPtr;
144                 wxString ActiveAccount;
145                 wxString ActiveAccountType;
146                 wxString ActiveFilename;
147                 wxETagProcessTimer ETagProcTimer;
148                 std::map<wxString,wxString> MemoryFileList;
149                 std::map<void*,wxString> ContactWindowList;
150                 std::map<void*,wxString> ContactEditorWindowList;
151                 std::map<void*,wxString> SearchWindowList;
152                 std::map<int,wxMenuItem*> WindowListPointersMenu;
153                 std::map<int,void*> WindowListPointers;
154                 std::map<int,int> WindowListType;
155                 wxMenuItem *mnuContactWindows;
156                 wxMenuItem *mnuContactEditorWindows;
157                 wxMenuItem *mnuSearchWindows;
158                 wxToolTip *SSLToolTip;
159                 bool RevealWait = FALSE;
160                 wxString SessionID;
161                 wxString OldSessionID;
162                 wxColour ContactBackgroundColour;
163                 wxIcon IconEmp;
164                 XABAccountView* treAccounts = new XABAccountView();
165                 wxImageList *AccImgList =  new wxImageList(16,16,true);
166                 wxImageList *ActMgrImgList = new wxImageList(16,16,true);
167                 int AccountID;
168                 int AccountNetID;
169                 int AccountGrpID;
170                 int AccountUnsupportedID;
171                 int AccountNoneID;
172                 bool ReloadAccounts = FALSE;
173                 bool AscendingMode = FALSE;
174                 int SortMode = 1;
175                 wxStaticBitmap *imgConnStatus = NULL;
176                 wxStaticBitmap *imgSSLStatus = NULL;
177                 wxStaticBitmap *imgActivityStatus = NULL;
178                 wxBitmap *imgActIcon1 = NULL;
179                 wxBitmap *imgActIcon2 = NULL;
180                 wxBitmap *imgActIcon3 = NULL;
181                 wxBitmap *imgActIcon4 = NULL;
182                 wxBitmap *imgActIconSleep = NULL;
183                 wxBitmap *imgSSL = NULL;
184                 wxBitmap *imgNoSSL = NULL;
185                 wxBitmap *imgSSLWarning = NULL;
186                 wxBitmap *imgOnline = NULL;
187                 wxBitmap *imgOffline = NULL;
188                 wxBitmap *imgAddAddressBook = NULL;
189                 wxBitmap *imgPreferences = NULL;
190                 wxBitmap *imgSearchContacts = NULL;
191                 wxBitmap *imgAddContact = NULL;
192                 wxBitmap *imgEditContact = NULL;
193                 wxBitmap *imgDeleteContact = NULL;
194                 int ActivityIconStatus = 0;
195                 int SearchUID = 0;
196                 int ContactUID = 0;
197                 int ContactEditorUID = 0;
198                 int WindowMenuItemID = 0;
199                 XABContactMenu *ContactMenu = new XABContactMenu(XABCONTACTMENU_MAIN); 
200                 void ResetContactInfo();
201 #if defined(__APPLE__)
202                 void DisplayCertificate(SecTrustRef SecurityTrustObject);
203                 void DisplayTrustPanel( wxCommandEvent& event );
204 #endif
205         protected:
206                 // Handlers for frmMainADT events.
207                 void QuitApp( wxCloseEvent& event );
208                 void QuitApp( wxCommandEvent& event );
209                 void QuitApp();
210                 void ShowAboutWindow( wxCommandEvent& event );
211                 void OpenPreferences( wxCommandEvent& event );
212                 void OpenNewABDialog( wxCommandEvent& event );
213                 void LoadPreferences( wxActivateEvent& event );
214                 void LoadPreferences();
215                 void ShowContactInfo( wxListEvent& event );
216                 void OpenContactInfoList( wxListEvent& event );
217                 void OpenContactInfoList( wxCommandEvent& event );
218                 void OpenContactInfo( wxCommandEvent& event );
219                 void ShowContactEditorNew( wxCommandEvent& event );             
220                 void ShowContactEditorEdit( wxCommandEvent& event );
221                 void RefreshAddressBook( wxCommandEvent& event );
222                 void ShowActivityWindow( wxCommandEvent& event );
223                 void LoadContactList( wxTreeEvent& event );             
224                 wxTreeItemId FindItemNamed(wxTreeCtrl &tree, 
225                               const std::wstring &name);
226                 void ConflictResolution( wxCommandEvent& event );
227                 void UpdateContactList( wxCommandEvent& event );
228                 void UpdateAccountList( wxCommandEvent& event );
229                 void UpdateSearchContactLists( wxCommandEvent& event );
230                 void OpenFindContactsWindow(wxCommandEvent& event);
231                 void RevealContact( wxCommandEvent& event );
232                 void RemoveContactsWindowPointer(wxCommandEvent& event);
233                 void RemoveContactEditorWindowPointer(wxCommandEvent& event);
234                 void RemoveContactSearchWindows(wxCommandEvent& event);
235                 void DeleteContact(wxCommandEvent& event);
236                 void EmptyServerDialog(wxCommandEvent& event);
237                 void DeleteContactSync(wxString &Account, wxString &Filename);
238                 void SortFNLN( wxCommandEvent& event );
239                 void SortLNFN( wxCommandEvent& event );
240                 void SortNickname( wxCommandEvent& event );
241                 void SortDisplayAs( wxCommandEvent& event );
242                 void SortAscending( wxCommandEvent& event );
243                 void SortDescending( wxCommandEvent& event );
244                 void ToggleStatusBar( wxCommandEvent& event );
245                 void UpdateSBIconPlacement( wxSizeEvent& event );
246                 void WindowAdd( wxCommandEvent& event );
247                 void WindowEdit( wxCommandEvent& event );
248                 void WindowDelete( wxCommandEvent& event );
249                 void ShowContactWindow( wxCommandEvent& event );
250                 void ShowContactEditorWindow( wxCommandEvent& event );
251                 void ShowSearchWindow( wxCommandEvent& event );
252                 void ToggleConnectionStatus( wxCommandEvent& event );
253                 void ShowSSLCertificates( wxCommandEvent& event );
254                 void ShowSSLInfo( wxCommandEvent& event );
255                 void HideSSLInfo( wxCommandEvent& event );
256                 void UpdateConnectionStatus( wxCommandEvent& event );
257                 void SetupSSLStatus( int AccountID );
258                 void InvalidSSLCertificate( wxCommandEvent& event );
259                 void InvalidSSLCertificateString( wxCommandEvent& event );
260                 void CheckUpdates( wxCommandEvent& event );
261                 void OpenImportDialog( wxCommandEvent& event );
262                 void OpenExportDialog( wxCommandEvent& event );
263                 void GetSelectedList( wxCommandEvent& event );
264                 void SyncAccount( wxCommandEvent& event );
265                 void ShowHelp( wxCommandEvent& event );
266                 void ShowContactMenu( wxMouseEvent& event );
267                 void ProcessMenuItemClick( wxCommandEvent &event );
268         public:
269                 /** Constructor */
270                 frmMain( wxWindow* parent );
271                 int ShowConflictDialog(vCard *LocalObj, vCard *ServerObj);
272                 void SetupPointers(void *ActMgr);
273                 void SetupForm();
274                 void ActivityIconStart( wxCommandEvent& event );
275                 void ActivityIconShuffle( wxCommandEvent& event );
276                 void ActivityIconStop( wxCommandEvent& event );
277                 void PauseAllTimers();
278                 void ResumeAllTimers();
279                 void GetListControl(wxListCtrl *lstContactsPtr, wxArrayString *ContactsFileIndexPtr);
280                 void ShowImportResults( wxCommandEvent& event );
281                 void ReloadContactList( wxCommandEvent& event );
282                 XABViewMode GetViewMode();
283 #if defined(__APPLE__)
284                 void UpdateSSLAccountStatus(int AccountID, int SSLStatus, SecTrustRef SecurityTrustObject);
285 #elif defined(__WIN32__)
286                 void UpdateSSLAccountStatus(int AccountID, int SSLStatus, PCCERT_CONTEXT CertificateContext);
287 #else
288                 void UpdateSSLAccountStatus(int AccountID, int SSLStatus, SSLCertCollectionString SSLCertInc);
289 #endif
290                 bool CloseAllWindows();
291                 DECLARE_EVENT_TABLE()
293         //// end generated class members
294         
295 };
297 #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