5 #include <wx/mstream.h>
6 #include <wx/cmdline.h>
8 #include <wx/filename.h>
11 #include "contacteditor/frmContactEditor.h"
15 #include "frmActivityMgr.h"
16 #include "common/timers.h"
17 #include "common/defaults.h"
19 class XestiaABApp: public wxApp
21 virtual bool OnInit();
24 IMPLEMENT_APP(XestiaABApp);
26 bool XestiaABApp::OnInit()
32 locale.Init(wxLANGUAGE_DEFAULT, wxLOCALE_LOAD_DEFAULT);
34 #if defined(__WIN32__)
36 // Check that the minimum version of Xestia Common Components is installed on the system.
38 #include <xestiaccdll.h>
40 if (!CheckXCCVersion(1, 0, 0)){
41 MessageBox(0, L"The version of Xestia Common Components installed is an older version not supported by this version of Xestia Address Book.\n\nPlease visit http://xestia.co.uk/commoncomponents and follow the page instructions to download the version required.", L"Older version of Xestia Common Components installed", MB_OK|MB_ICONSTOP);
47 static const wxCmdLineEntryDesc g_cmdLineDesc [] =
49 { wxCMD_LINE_SWITCH, wxT_2("h"), wxT_2("help"), wxTRANSLATE("Displays help on command line parameters"),
50 wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
51 /*{ wxCMD_LINE_OPTION, wxT_2("e"), wxT_2("edit"), wxTRANSLATE("Edit a vCard 4.0 formatted contact"),
52 wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
53 { wxCMD_LINE_SWITCH, wxT_2("s"), wxT_2("search"), wxTRANSLATE("Display the search window instead of starting normally"),
54 wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },*/
55 { wxCMD_LINE_SWITCH, wxT_2("v"), wxT_2("version"), wxTRANSLATE("Displays version number"),
56 wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
60 wxString wxSContactFilename;
61 wxCmdLineParser XABArgs (g_cmdLineDesc, argc, argv);
64 if (XABArgs.Found(wxT("h"))){
70 if (XABArgs.Found(wxT("v"))){
76 wxInitAllImageHandlers();
78 /*if (XABArgs.Found(wxT("e"), &wxSContactFilename)){
80 // Check if the filename exists.
82 //wxImage::AddHandler(new wxPNGHandler);
84 wxFileName contactfile(wxSContactFilename);
86 if (!contactfile.FileExists()){
92 curl_global_init(CURL_GLOBAL_ALL);
94 wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png));
95 wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG);
96 wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1);
98 contacticon.CopyFromBitmap(contacticonbmp);
100 // Get the filename of the selected contact.
102 frmContactEditor *ContactEditor = new frmContactEditor( NULL );
103 ContactEditor->SetupHeaders();
104 ContactEditor->LoadContact(wxSContactFilename);
105 //ContactEditor->SetupContact(ActiveAccount);
106 ContactEditor->SetIcon(contacticon);
107 ContactEditor->Show(true);
109 SetTopWindow(ContactEditor);
115 // Setup default settings and accounts if they don't exist.
118 SetupDefaultSettings();
119 SetupDefaultAddressBook();
121 //wxImage::AddHandler(new wxPNGHandler);
122 wxMemoryInputStream istream(bigimgs_appicon48_png, sizeof(bigimgs_appicon_png));
123 wxImage bigimgs_appicon48i(istream, wxBITMAP_TYPE_PNG);
124 wxBitmap appiconbmp(bigimgs_appicon48i, -1);
127 appicon.CopyFromBitmap(appiconbmp);
128 frmMain *frame = new frmMain( NULL );
130 frmActivityMgr *frameActMgr = new frmActivityMgr ( frame );
131 frame->SetupPointers(frameActMgr);
133 frame->SetIcon(appicon);