diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-19 18:18:13 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-19 18:18:13 +0000 |
commit | bf37d6655a27cc3ea5af5412c9717596c9d1c30f (patch) | |
tree | 9a537b8cd5cd85b27b5a296f77a972a0ae0c3863 /plugins/UserInfoEx | |
parent | d55f17dea8734cfb458fd8fcbac684d141b181af (diff) |
timezone api migrated to mir_core
git-svn-id: http://svn.miranda-ng.org/main/trunk@14266 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/UserInfoEx')
-rw-r--r-- | plugins/UserInfoEx/src/commonheaders.cpp | 7 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ctrl_tzcombo.cpp | 82 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/init.cpp | 5 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/psp_options.cpp | 14 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_contactinfo.cpp | 29 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_timezone.cpp | 4 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_timezone_old.cpp | 13 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_timezone_old.h | 1 |
8 files changed, 29 insertions, 126 deletions
diff --git a/plugins/UserInfoEx/src/commonheaders.cpp b/plugins/UserInfoEx/src/commonheaders.cpp index 8eb7699f3a..9b4d77bff0 100644 --- a/plugins/UserInfoEx/src/commonheaders.cpp +++ b/plugins/UserInfoEx/src/commonheaders.cpp @@ -22,10 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h"
// global:
-HINSTANCE ghInst = NULL;
-TIME_API tmi; //timezone interface
-FI_INTERFACE *FIP = NULL; //freeimage interface
-CLIST_INTERFACE *pcli = NULL;
+HINSTANCE ghInst = NULL;
+FI_INTERFACE *FIP = NULL; //freeimage interface
+CLIST_INTERFACE *pcli = NULL;
MGLOBAL myGlobals;
pfnDwmIsCompositionEnabled dwmIsCompositionEnabled;
diff --git a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp index 7159718a51..52dd6b0d1b 100644 --- a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp +++ b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp @@ -49,27 +49,14 @@ static INT_PTR EnumNamesProc(CTimeZone *pTimeZone, int index, LPARAM lParam) **/
CBaseCtrl* CTzCombo::CreateObj(HWND hDlg, WORD idCtrl, LPCSTR pszSetting)
{
- CTzCombo *ctrl = NULL;
HWND hCtrl = GetDlgItem(hDlg, idCtrl);
- ctrl = new CTzCombo(hDlg, idCtrl, pszSetting);
+ CTzCombo *ctrl = new CTzCombo(hDlg, idCtrl, pszSetting);
if (ctrl) {
- //use new core tz interface
- if (tmi.prepareList) {
- //set the adress of our timezone handle as itemdata
- //caller can obtain the handle htz to extract all relevant information
- ctrl->_curSel = 0;
- tmi.prepareList(NULL, NULL, hCtrl, TZF_PLF_CB);
- }
- //fallback use old UIEX method
- else {
- ctrl->_curSel = ComboBox_AddString(hCtrl, TranslateT("<Unspecified>"));
- if (SUCCEEDED(ctrl->_curSel)) {
- ComboBox_SetItemData(hCtrl, ctrl->_curSel, NULL);
- }
- ComboBox_SetCurSel(hCtrl, ctrl->_curSel);
- EnumTimeZones(EnumNamesProc, (LPARAM)hCtrl);
- }
+ //set the adress of our timezone handle as itemdata
+ //caller can obtain the handle htz to extract all relevant information
+ ctrl->_curSel = 0;
+ TimeZone_PrepareList(NULL, NULL, hCtrl, TZF_PLF_CB);
}
return (ctrl);
}
@@ -130,7 +117,7 @@ int CTzCombo::Find(LPTIME_ZONE_INFORMATION pTimeZone) const int nItemCount = ComboBox_GetCount(_hwnd);
for (nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++) {
- if (pTimeZone == tmi.getTzi((HANDLE)ComboBox_GetItemData(_hwnd, nItemIndex)))
+ if (pTimeZone == TimeZone_GetInfo((HANDLE)ComboBox_GetItemData(_hwnd, nItemIndex)))
return nItemIndex;
}
return CB_ERR;
@@ -160,31 +147,10 @@ void CTzCombo::Release() BOOL CTzCombo::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto)
{
if (!_Flags.B.hasChanged) {
- //use new core tz interface to change the cbbox
- if (tmi.storeListResults) {
- _curSel = CB_ERR;
-// _curSel = tmi.selectListItem(hContact, _hwnd, TZF_PLF_CB);
- //dident work well, coz no fallback to proto setting.
- //we use saver way by getTziByContact
- LPTIME_ZONE_INFORMATION pTimeZone;
- pTimeZone = tmi.getTziByContact(hContact);
- ComboBox_SetCurSel(_hwnd, Find(pTimeZone));
- _curSel = ComboBox_GetCurSel(_hwnd);
- }
- //fallback use old UIEX method
- else {
- CTimeZone *pTimeZone;
- _curSel = CB_ERR;
- _Flags.W = GetContactTimeZoneCtrl(hContact, pszProto, &pTimeZone);
- if (_Flags.W) {
- ComboBox_SetCurSel(_hwnd, Find(pTimeZone));
- _curSel = ComboBox_GetCurSel(_hwnd);
- }
- if (_curSel == CB_ERR) {
- ComboBox_SetCurSel(_hwnd, NULL);
- _curSel = ComboBox_GetCurSel(_hwnd);
- }
- }
+ LPTIME_ZONE_INFORMATION pTimeZone;
+ pTimeZone = getTziByContact(hContact);
+ ComboBox_SetCurSel(_hwnd, Find(pTimeZone));
+ _curSel = ComboBox_GetCurSel(_hwnd);
SendMessage(GetParent(_hwnd), WM_TIMER, 0, 0);
}
return _Flags.B.hasChanged;
@@ -205,28 +171,12 @@ void CTzCombo::OnApply(MCONTACT hContact, LPCSTR pszProto) const char* pszModule = hContact ? USERINFO : pszProto;
if (_Flags.B.hasCustom || !hContact) {
//use new core tz interface
- if (tmi.storeListResults) {
- tmi.storeListResults(hContact, NULL, _hwnd, TZF_PLF_CB);
- if (!hContact) {
- _Flags.B.hasCustom = 0;
- _Flags.B.hasProto = 1;
- }
- _Flags.B.hasChanged = 0;
- }
- //fallback use old UIEX method
- else {
- const CTimeZone* pTimeZone = (CTimeZone*)ComboBox_GetItemData(_hwnd, _curSel);
- if (PtrIsValid(pTimeZone)) {
- db_set_ts(hContact, USERINFO, SET_CONTACT_TIMEZONENAME, pTimeZone->ptszName);
- db_set_b(hContact, pszModule, SET_CONTACT_TIMEZONE, pTimeZone->ToMirandaTimezone());
-
- if (!hContact) {
- _Flags.B.hasCustom = 0;
- _Flags.B.hasProto = 1;
- }
- _Flags.B.hasChanged = 0;
- }
+ TimeZone_StoreListResult(hContact, NULL, _hwnd, TZF_PLF_CB);
+ if (!hContact) {
+ _Flags.B.hasCustom = 0;
+ _Flags.B.hasProto = 1;
}
+ _Flags.B.hasChanged = 0;
}
if (_Flags.B.hasChanged)
@@ -275,5 +225,5 @@ void CTzCombo::OnChangedByUser(WORD wChangedMsg) **/
void CTzCombo::GetTime(LPTSTR szTime, int cchTime)
{
- tmi.printDateTime((HANDLE)ComboBox_GetItemData(_hwnd, _curSel), _T("t"), szTime, cchTime, 0);
+ TimeZone_PrintDateTime((HANDLE)ComboBox_GetItemData(_hwnd, _curSel), _T("t"), szTime, cchTime, 0);
}
diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp index ab35aa96e5..77324e2eee 100644 --- a/plugins/UserInfoEx/src/init.cpp +++ b/plugins/UserInfoEx/src/init.cpp @@ -170,9 +170,6 @@ extern "C" int __declspec(dllexport) Load(void) // init clist interface
mir_getCLI();
- // init new miranda timezone interface
- mir_getTMI(&tmi);
-
// init freeimage interface
INT_PTR result = CALLSERVICE_NOTFOUND;
if (ServiceExists(MS_IMG_GETINTERFACE))
@@ -196,7 +193,7 @@ extern "C" int __declspec(dllexport) Load(void) IcoLib_LoadModule();
SvcFlagsLoadModule();
- tmi.getTimeZoneTime ? SvcTimezoneLoadModule() : SvcTimezoneLoadModule_old();
+ SvcTimezoneLoadModule();
SvcContactInfoLoadModule();
SvcEMailLoadModule();
SvcRefreshContactInfoLoadModule();
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index 2d0b2c20c0..4c71f2c8e2 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -418,13 +418,8 @@ static INT_PTR CALLBACK DlgProc_AdvancedOpts(HWND hDlg, UINT uMsg, WPARAM wParam DBGetCheckBtn(hDlg, CHECK_OPT_BUTTONICONS, SET_ICONS_BUTTONS, TRUE);
DBGetCheckBtn(hDlg, CHECK_OPT_METASCAN, SET_META_SCAN, TRUE);
DBGetCheckBtn(hDlg, CHECK_OPT_SREMAIL_ENABLED, SET_EXTENDED_EMAILSERVICE, TRUE);
- if (tmi.getTimeZoneTime) {
- CheckDlgButton(hDlg, CHECK_OPT_AUTOTIMEZONE, BST_CHECKED);
- EnableWindow(GetDlgItem(hDlg, CHECK_OPT_AUTOTIMEZONE), FALSE);
- }
- else {
- DBGetCheckBtn(hDlg, CHECK_OPT_AUTOTIMEZONE, SET_OPT_AUTOTIMEZONE, TRUE);
- }
+ CheckDlgButton(hDlg, CHECK_OPT_AUTOTIMEZONE, BST_CHECKED);
+ EnableWindow(GetDlgItem(hDlg, CHECK_OPT_AUTOTIMEZONE), FALSE);
bInitialized = 1;
break;
@@ -435,11 +430,6 @@ static INT_PTR CALLBACK DlgProc_AdvancedOpts(HWND hDlg, UINT uMsg, WPARAM wParam DBWriteCheckBtn(hDlg, CHECK_OPT_METASCAN, SET_META_SCAN);
DBWriteCheckBtn(hDlg, CHECK_OPT_SREMAIL_ENABLED, SET_EXTENDED_EMAILSERVICE);
- if (!tmi.getTimeZoneTime) {
- DBWriteCheckBtn(hDlg, CHECK_OPT_AUTOTIMEZONE, SET_OPT_AUTOTIMEZONE);
- if (IsDlgButtonChecked(hDlg, CHECK_OPT_AUTOTIMEZONE))
- SvcTimezoneSyncWithWindows();
- }
}
break;
diff --git a/plugins/UserInfoEx/src/svc_contactinfo.cpp b/plugins/UserInfoEx/src/svc_contactinfo.cpp index 3c53c8e23e..662d300256 100644 --- a/plugins/UserInfoEx/src/svc_contactinfo.cpp +++ b/plugins/UserInfoEx/src/svc_contactinfo.cpp @@ -563,11 +563,10 @@ INT_PTR GetContactInfo(WPARAM wParam, LPARAM lParam) break;
case CNF_TIMEZONE:
- //use new core tz interface
- if (tmi.prepareList) {
- HANDLE hTz = tmi.createByContact(ci->hContact, 0, TZF_KNOWNONLY);
+ {
+ HANDLE hTz = TimeZone_CreateByContact(ci->hContact, 0, TZF_KNOWNONLY);
if (hTz) {
- LPTIME_ZONE_INFORMATION tzi = tmi.getTzi(hTz);
+ LPTIME_ZONE_INFORMATION tzi = TimeZone_GetInfo(hTz);
int offset = tzi->Bias + tzi->StandardBias;
char str[80];
@@ -577,27 +576,9 @@ INT_PTR GetContactInfo(WPARAM wParam, LPARAM lParam) return 0;
}
ci->pszVal = NULL;
+ ci->type = (ci->pszVal != NULL) ? CNFT_ASCIIZ : 0;
+ result = ci->type == 0;
}
- //fallback use old UIEX method
- else {
- CTimeZone* ptz = GetContactTimeZone(ci->hContact, ci->szProto);
- if (ptz) {
- if (ci->dwFlag & CNF_UNICODE)
- ci->pszVal = (LPTSTR)mir_t2u(ptz->ptszDisplay);
- else
- ci->pszVal = (LPTSTR)mir_t2a(ptz->ptszDisplay);
- }
- else {
- /* If a timezone does not exist in CTzMgr, it is a invalid timezone,
- because Windows and CTzMgr know all existing timezones and it
- would not be shown anywhere anyway as UserInfoEx displays only
- known windows timezones in the details dialog!
- */
- ci->pszVal = NULL;
- }
- }
- ci->type = (ci->pszVal != NULL) ? CNFT_ASCIIZ : 0;
- result = ci->type == 0;
break;
//
diff --git a/plugins/UserInfoEx/src/svc_timezone.cpp b/plugins/UserInfoEx/src/svc_timezone.cpp index 4b4ccd4053..29605c9c1d 100644 --- a/plugins/UserInfoEx/src/svc_timezone.cpp +++ b/plugins/UserInfoEx/src/svc_timezone.cpp @@ -42,7 +42,7 @@ INT_PTR GetContactTimeZoneInformation(WPARAM wParam, LPARAM lParam) if (lParam == NULL) return (1); //use new core tz interface - LPTIME_ZONE_INFORMATION pTimeZoneInformation = tmi.getTzi(tmi.createByContact(wParam, 0, 0)); + LPTIME_ZONE_INFORMATION pTimeZoneInformation = TimeZone_GetInfo(TimeZone_CreateByContact(wParam, 0, 0)); if (pTimeZoneInformation == NULL) return (1); memcpy((void *)lParam, pTimeZoneInformation, sizeof(TIME_ZONE_INFORMATION)); @@ -62,7 +62,7 @@ INT_PTR GetContactLocalTime(WPARAM wParam, LPARAM lParam) { //use new core tz interface LPSYSTEMTIME pSystemTime = (LPSYSTEMTIME)lParam; - return (INT_PTR)tmi.getTimeZoneTimeByContact(wParam, pSystemTime); + return (INT_PTR)getTimeZoneTimeByContact(wParam, pSystemTime); } /*********************************************************************************************************** diff --git a/plugins/UserInfoEx/src/svc_timezone_old.cpp b/plugins/UserInfoEx/src/svc_timezone_old.cpp index b859507240..05809e970b 100644 --- a/plugins/UserInfoEx/src/svc_timezone_old.cpp +++ b/plugins/UserInfoEx/src/svc_timezone_old.cpp @@ -590,16 +590,3 @@ INT_PTR GetContactLocalTime_old(WPARAM wParam, LPARAM lParam) /***********************************************************************************************************
* initialization
***********************************************************************************************************/
-
-/**
-* This function initially loads the module upon startup.
-**/
-
-void SvcTimezoneLoadModule_old()
-{
- TzMgr.Init();
- CreateServiceFunction(MS_USERINFO_TIMEZONEINFO, GetContactTimeZoneInformation);
- CreateServiceFunction(MS_USERINFO_LOCALTIME, GetContactLocalTime);
- if (db_get_b(NULL, MODNAME, SET_OPT_AUTOTIMEZONE, TRUE))
- SvcTimezoneSyncWithWindows();
-}
diff --git a/plugins/UserInfoEx/src/svc_timezone_old.h b/plugins/UserInfoEx/src/svc_timezone_old.h index 040f272ec6..a28e16a071 100644 --- a/plugins/UserInfoEx/src/svc_timezone_old.h +++ b/plugins/UserInfoEx/src/svc_timezone_old.h @@ -88,6 +88,5 @@ INT_PTR GetContactTimeZoneInformation_old(WPARAM wParam, LPARAM lParam); INT_PTR GetContactLocalTime_old(WPARAM wParam, LPARAM lParam);
void SvcTimezoneSyncWithWindows();
-void SvcTimezoneLoadModule_old();
#endif /* _SVC_TIMEZONE_H_OLD */
\ No newline at end of file |