From: Steve Brokenshire Date: Thu, 13 Aug 2015 10:22:26 +0000 (+0100) Subject: Merge branch 'master' of ssh://digit.mahou.co.uk/home/kirinji/repos/xestiaab X-Git-Tag: release-0.05~84 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=899eb279e0d6219ff58df7cd91ad2be164c5d76f;hp=3a7d121a69ea5df27eec54756bb9a8f9053f832f;p=xestiaab%2F.git Merge branch 'master' of ssh://digit.mahou.co.uk/home/kirinji/repos/xestiaab --- diff --git a/source/common/mime.cpp b/source/common/mime.cpp index 5db593c..8c59be2 100644 --- a/source/common/mime.cpp +++ b/source/common/mime.cpp @@ -19,7 +19,7 @@ wxString GetMIME(wxString FilenameInc){ // TODO: Sort out Win32. -#elif defined(__APPLE__) +#else #include @@ -50,7 +50,9 @@ wxString GetMIME(wxString FilenameInc){ MIMEResult.Trim(); -#else +#endif + +/*#else #include @@ -76,7 +78,7 @@ wxString GetMIME(wxString FilenameInc){ MIMEResult = wxString::FromUTF8(MIMEType); magic_close(MagicCookie); -#endif +#endif*/ return MIMEResult; diff --git a/source/common/mime.h b/source/common/mime.h index 60481d5..4fc0cb5 100644 --- a/source/common/mime.h +++ b/source/common/mime.h @@ -1,7 +1,7 @@ #include -#ifndef MIME_H -#define MIME_H +#ifndef MIMEGEN_H +#define MIMEGEN_H wxString GetMIME(wxString FilenameInc); diff --git a/source/common/uuid.cpp b/source/common/uuid.cpp index 4ff8d1d..f3603b1 100644 --- a/source/common/uuid.cpp +++ b/source/common/uuid.cpp @@ -2,7 +2,7 @@ wxString GenerateUUID() { - + #if defined(__WIN32__) UUID UUIDData; UuidCreate(&UUIDData); @@ -11,35 +11,35 @@ wxString GenerateUUID() wxString Result(UUIDStr); #elif defined(__HAIKU__) -#elif defined(__APPLE__) - - wxString Result; - #else -#include +#include + + 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) diff --git a/source/frmMain.cpp b/source/frmMain.cpp index 8e6ec60..c062c15 100644 --- a/source/frmMain.cpp +++ b/source/frmMain.cpp @@ -1210,15 +1210,26 @@ void frmMain::ShowContactEditorEdit( wxCommandEvent& event ) } 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(ActMgrPtr); - frameActMgr->AddTask(3, wxT(""), ActiveAccount, - wxT(""), wxT(""), wxT(""), wxT("")); - + + if (ActiveAccountType != wxT("Local")){ + + // Account type is not local. + + frmActivityMgr *frameActMgr = static_cast(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")); + + } + } } diff --git a/source/main.cpp b/source/main.cpp index ed4e656..249c5a7 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -26,19 +26,18 @@ IMPLEMENT_APP(XestiaABApp); 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 +#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 - 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(); }