Beispiel #1
0
/**
 * This method writes the combobox's item as the contact's timezone.
 *
 * @param		hContact	- HANDLE of the contact whose timezone to select
 * @param		pszProto	- the contact's protocol (not used by new core tz interface)
 *
 * @return	nothing
 **/
void CTzCombo::OnApply(MCONTACT hContact, LPCSTR pszProto)
{
    if (_Flags.B.hasChanged)
    {
        const char* pszModule = hContact ? USERINFO : pszProto;
        if (_Flags.B.hasCustom || !hContact) {
            //use new core tz interface
            TimeZone_StoreListResult(hContact, NULL, _hwnd, TZF_PLF_CB);
            if (!hContact) {
                _Flags.B.hasCustom = false;
                _Flags.B.hasProto = true;
            }
            _Flags.B.hasChanged = false;
        }

        if (_Flags.B.hasChanged)
        {
            db_unset(hContact, USERINFO, SET_CONTACT_TIMEZONENAME);
            db_unset(hContact, USERINFO, SET_CONTACT_TIMEZONEINDEX);
            db_unset(hContact, pszModule, SET_CONTACT_TIMEZONE);

            _Flags.B.hasChanged = false;
            OnInfoChanged(hContact, pszProto);
        }
        InvalidateRect(_hwnd, NULL, TRUE);
    }
}
Beispiel #2
0
/**
 * name:	CreateWnd
 * class:	CPsTreeItem
 * desc:	create the dialog for the propertysheet page
 * params:	pPs		- propertysheet's datastructure
 *			hDlg	- windowhandle of the propertysheet
 * return:	windowhandle of the dialog if successful
 **/
HWND CPsTreeItem::CreateWnd(LPPS pPs)
{
	if (pPs && !_hWnd && _pTemplate && _pfnDlgProc) {
		_hWnd = CreateDialogIndirectParam(_hInst, _pTemplate, pPs->hDlg, _pfnDlgProc, (LPARAM)_hContact);
		if (_hWnd != NULL) {
			PSHNOTIFY pshn;
			pshn.hdr.code = PSN_PARAMCHANGED;
			pshn.hdr.hwndFrom = _hWnd;
			pshn.hdr.idFrom = 0;
			pshn.lParam = (LPARAM)_initParam;
			SendMessage(_hWnd, WM_NOTIFY, 0, (LPARAM)&pshn);

			// force child window (mainly for AIM property page)
			SetWindowLongPtr(_hWnd, GWL_STYLE, (GetWindowLongPtr(_hWnd, GWL_STYLE) & ~(WS_POPUP|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME)) | WS_CHILD);
			SetWindowLongPtr(_hWnd, GWL_EXSTYLE, GetWindowLongPtr(_hWnd, GWL_EXSTYLE) & ~(WS_EX_APPWINDOW|WS_EX_STATICEDGE|WS_EX_CLIENTEDGE));
			SetParent(_hWnd, pPs->hDlg);

			// move dialog into the display area
			SetWindowPos(_hWnd, HWND_TOP, 
				pPs->rcDisplay.left,	pPs->rcDisplay.top,
				pPs->rcDisplay.right - pPs->rcDisplay.left,	
				pPs->rcDisplay.bottom - pPs->rcDisplay.top,	FALSE);
			// set bold titles
			if (_dwFlags & ODPF_BOLDGROUPS)
				EnumChildWindows(_hWnd, BoldGroupTitlesEnumChildren, (LPARAM)pPs->hBoldFont);
						
			// some initial notifications
			OnInfoChanged();
			OnPageIconsChanged();
			return _hWnd;
		}
	}
	return NULL;
}
//---------------------------------------------------------------------------
void __fastcall TEditLinkAttribFrame::CommitChanges()
{
	if(InLoading) return;

	if(EnableConditionCheckBox->Checked)
	{
		FLink.CondVar = CondVarComboBox->ItemIndex;
		FLink.RefValue = CondRefValueEdit->Text.ToInt();
		FLink.Condition = (tTVPWaveLoopLinkCondition)(ConditionComboBox->ItemIndex + 1);
	}
	else
	{
		FLink.Condition = llcNone;
	}

	if(OnInfoChanged) OnInfoChanged(this);
}
/**
 * This method writes the combobox's item
 *
 * @param		hContact		- HANDLE of the contact
 * @param		pszProto		- the contact's protocol
 *
 * @return	nothing
 **/
void CCombo::OnApply(HANDLE hContact, LPCSTR pszProto)
{
	if (_Flags.B.hasChanged)
	{
		LPCSTR pszModule = hContact ? USERINFO : pszProto;

		if ((_Flags.B.hasCustom || !hContact) && (_curSel != CB_ERR))
		{
			LPIDSTRLIST pd;

			pd = (LPIDSTRLIST)SendMessage(_hwnd, CB_GETITEMDATA, _curSel, 0);
			if (pd != NULL)
			{
				switch (_bDataType)
				{
				case DBVT_BYTE:
					db_set_b(hContact, pszModule, _pszSetting, pd->nID);
					break;
				case DBVT_WORD:
					db_set_w(hContact, pszModule, _pszSetting, pd->nID);
					break;
				case DBVT_DWORD:
					db_set_dw(hContact, pszModule, _pszSetting, pd->nID);
					break;
				case DBVT_ASCIIZ:
				case DBVT_WCHAR:
					db_set_s(hContact, pszModule, _pszSetting, (LPSTR)pd->pszText);
				}
				if (!hContact)
				{
					_Flags.B.hasCustom = 0;
					_Flags.B.hasProto = 1;
				}
				_Flags.B.hasChanged = 0;
			}
		}
		if (_Flags.B.hasChanged)
		{
			db_unset(hContact, pszModule, _pszSetting);
			_Flags.B.hasChanged = 0;
			OnInfoChanged(hContact, pszProto);
		}
		InvalidateRect(_hwnd, NULL, TRUE);
	}
}
/**
 * This method writes the combobox's item as the contact's timezone.
 *
 * @param		hContact	- HANDLE of the contact whose timezone to select
 * @param		pszProto	- the contact's protocol (not used by new core tz interface)
 *
 * @return	nothing
 **/
void CTzCombo::OnApply(HANDLE hContact, LPCSTR pszProto)
{
	if (_Flags.B.hasChanged)
	{
		const char* pszModule = hContact ? USERINFO : pszProto;
		if (_Flags.B.hasCustom || !hContact) {
			//use new core tz interface
			if (tmi.storeListResults) {
				tmi.storeListResults(hContact, _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;
				}
			}
		}

		if (_Flags.B.hasChanged)
		{
			db_unset(hContact, USERINFO, SET_CONTACT_TIMEZONENAME);
			db_unset(hContact, USERINFO, SET_CONTACT_TIMEZONEINDEX);
			db_unset(hContact, pszModule, SET_CONTACT_TIMEZONE);

			_Flags.B.hasChanged = 0;
			OnInfoChanged(hContact, pszProto);
		}
		InvalidateRect(_hwnd, NULL, TRUE);
	}
}
Beispiel #6
0
void CEditCtrl::OnApply(MCONTACT hContact, LPCSTR pszProto)
{
	if (_Flags.B.hasChanged) {
		const char* pszModule = hContact ? _pszModule : pszProto;

		if (_Flags.B.hasCustom || !hContact) {
			DWORD cch = GetWindowTextLength(_hwnd);

			if (cch > 0) {
				LPTSTR val = (LPTSTR)mir_alloc((cch + 1) * sizeof(TCHAR));

				if (GetWindowText(_hwnd, val, cch + 1) > 0) {
					DBVARIANT dbv;

					dbv.type = _dbType;
					switch (_dbType) {
					case DBVT_BYTE:
						dbv.bVal = (BYTE)_tcstol(val, NULL, 10);
						break;

					case DBVT_WORD:
						dbv.wVal = (WORD)_tcstol(val, NULL, 10);
						break;

					case DBVT_DWORD:
						dbv.dVal = (DWORD)_tcstol(val, NULL, 10);
						break;

					case DBVT_TCHAR:
						dbv.ptszVal = val;
						break;

					default:
						dbv.type = DBVT_DELETED;

					}
					if (dbv.type != DBVT_DELETED) {
						if (!db_set(hContact, pszModule, _pszSetting, &dbv)) {
							if (!hContact) {
								_Flags.B.hasCustom = 0;
								_Flags.B.hasProto = 1;
							}
							_Flags.B.hasChanged = 0;

							// save new value
							MIR_FREE(_pszValue);
							_pszValue = val;
							val = NULL;
						}
					}
				}
				MIR_FREE(val);
			}
		}
		if (_Flags.B.hasChanged) {
			db_unset(hContact, pszModule, _pszSetting);

			_Flags.B.hasChanged = 0;

			OnInfoChanged(hContact, pszProto);
		}
		InvalidateRect(_hwnd, NULL, TRUE);
	}
}