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 "frmSearch.h"
17 #include "common/timers.h"
18 #include "common/defaults.h"
20 class XestiaABApp: public wxApp
22 virtual bool OnInit();
25 IMPLEMENT_APP(XestiaABApp);
27 bool XestiaABApp::OnInit()
33 locale.Init(wxLANGUAGE_DEFAULT, wxLOCALE_LOAD_DEFAULT);
35 #if defined(__WIN32__)
37 // Check that the minimum version of Xestia Common Components is installed on the system.
39 #include <xestiaccdll.h>
41 if (!CheckXCCVersion(1, 0, 0)){
42 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);
48 static const wxCmdLineEntryDesc g_cmdLineDesc [] =
50 { wxCMD_LINE_SWITCH, wxT_2("h"), wxT_2("help"), wxTRANSLATE("Displays help on command line parameters"),
51 wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
52 /*{ wxCMD_LINE_OPTION, wxT_2("e"), wxT_2("edit"), wxTRANSLATE("Edit a vCard 4.0 formatted contact"),
53 wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },*/
54 { wxCMD_LINE_SWITCH, wxT_2("s"), wxT_2("search"), wxTRANSLATE("Display the search window instead of starting normally"),
55 wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
56 { wxCMD_LINE_SWITCH, wxT_2("v"), wxT_2("version"), wxTRANSLATE("Displays version number"),
57 wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
61 wxString wxSContactFilename;
62 wxCmdLineParser XABArgs (g_cmdLineDesc, argc, argv);
65 if (XABArgs.Found(wxT("h"))){
71 if (XABArgs.Found(wxT("v"))){
73 wxPuts(XSDAB_VERSION);
78 wxInitAllImageHandlers();
80 if (XABArgs.Found(wxT("s"))){
82 // Open up the search window.
84 frmSearch *frmSearchPtr = new frmSearch( NULL );
85 frmSearchPtr->Show(true);
86 frmSearchPtr->SetSearchMode(true);
91 /*if (XABArgs.Found(wxT("e"), &wxSContactFilename)){
92 Xestia Gelforn Project Repositories - xestiaab/.git/tree - source/vcard/
93 // Check if the filename exists.
95 //wxImage::AddHandler(new wxPNGHandler);
97 wxFileName contactfile(wxSContactFilename);
99 if (!contactfile.FileExists()){
105 curl_global_init(CURL_GLOBAL_ALL);
107 wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png));
108 wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG);
109 wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1);
111 contacticon.CopyFromBitmap(contacticonbmp);
113 // Get the filename of the selected contact.
115 frmContactEditor *ContactEditor = new frmContactEditor( NULL );
116 ContactEditor->SetupHeaders();
117 ContactEditor->LoadContact(wxSContactFilename);
118 //ContactEditor->SetupContact(ActiveAccount);
119 ContactEditor->SetIcon(contacticon);
120 ContactEditor->Show(true);
122 SetTopWindow(ContactEditor);
128 // Setup default settings and accounts if they don't exist.
131 SetupDefaultSettings();
132 SetupDefaultAddressBook();
134 //wxImage::AddHandler(new wxPNGHandler);
135 wxMemoryInputStream istream(bigimgs_appicon48_png, sizeof(bigimgs_appicon_png));
136 wxImage bigimgs_appicon48i(istream, wxBITMAP_TYPE_PNG);
137 wxBitmap appiconbmp(bigimgs_appicon48i, -1);
140 appicon.CopyFromBitmap(appiconbmp);
141 frmMain *frame = new frmMain( NULL );
143 frmActivityMgr *frameActMgr = new frmActivityMgr ( frame );
144 frame->SetupPointers(frameActMgr);
146 frame->SetIcon(appicon);