// TODO: Sort out Win32.
-#elif defined(__APPLE__)
+#else
#include <stdio.h>
MIMEResult.Trim();
-#else
+#endif
+
+/*#else
#include <magic.h>
MIMEResult = wxString::FromUTF8(MIMEType);
magic_close(MagicCookie);
-#endif
+#endif*/
return MIMEResult;
#include <wx/wx.h>
-#ifndef MIME_H
-#define MIME_H
+#ifndef MIMEGEN_H
+#define MIMEGEN_H
wxString GetMIME(wxString FilenameInc);
wxString GenerateUUID()
{
-
+
#if defined(__WIN32__)
UUID UUIDData;
UuidCreate(&UUIDData);
wxString Result(UUIDStr);
#elif defined(__HAIKU__)
-#elif defined(__APPLE__)
-
- wxString Result;
-
#else
-#include <ossp/uuid++.hh>
+#include <stdio.h>
+
+ wxString Result;
- uuid_t *uuid;
- uuid_create(&uuid);
- char *strdata;
+ FILE *uuid_hdl = popen("uuidgen", "r");
- //strdata = ;
+ if (uuid_hdl == NULL) {
+ return Result;
+ }
- strdata = NULL;
+ char strdata[64];
+ std::string uuidout;
- uuid_make(uuid, UUID_MAKE_V4);
- uuid_export(uuid, UUID_FMT_STR, &strdata, NULL);
- uuid_destroy(uuid);
+ size_t readsize;
+ int size = 0;
+ int maxsize = 63;
- wxString Result = wxString::FromUTF8(strdata);
+ while (fgets(strdata, sizeof(strdata), uuid_hdl) != NULL){
+ uuidout.append(strdata);
+ }
- delete strdata;
- strdata = NULL;
+ pclose(uuid_hdl);
#endif
return Result;
-
+
}
bool CheckUUID(wxString UUIDInc)
}
void frmMain::RefreshAddressBook( wxCommandEvent& event ){
-
- // TODO: Check Account Type.
+
+ // Check if ActiveAccount is empty. If not then check if
+ // account type is not local otherwise continue.
if (!ActiveAccount.IsEmpty()){
-
- frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
- frameActMgr->AddTask(3, wxT(""), ActiveAccount,
- wxT(""), wxT(""), wxT(""), wxT(""));
-
+
+ if (ActiveAccountType != wxT("Local")){
+
+ // Account type is not local.
+
+ frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
+ frameActMgr->AddTask(3, wxT(""), ActiveAccount,
+ wxT(""), wxT(""), wxT(""), wxT(""));
+
+ } else {
+
+ wxMessageBox(_("The refresh address book command is not supported with this type of account."), wxT("Not supported for this type of account"));
+
+ }
+
}
}
bool XestiaABApp::OnInit()
{
- // Check that on Win32 systems that.
+ // Setup the locale.
-#if defined(__WIN32__)
+ wxLocale locale;
+ locale.Init(wxLANGUAGE_DEFAULT, wxLOCALE_LOAD_DEFAULT);
-#include <xestiacc.h>
+#if defined(__WIN32__)
- XCCVer XCCRequiredVer;
- XCCRequiredVer.MajorVer = 1;
- XCCRequiredVer.MinorVer = 0;
+ // Check that the minimum version of Xestia Common Components is installed on the system.
- XCCVer XCCRetrievedVer = GetXCCLibraryVersion();
+#include <xestiaccdll.h>
- if (XCCRetrievedVer < XCCRequiredVer){
+ if (!CheckXCCVersion(1, 0, 0)){
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);
this->Exit();
}