Пример #1
0
INT_PTR CALLBACK CSkypeProto::AccountSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	const unsigned long iPageId = 3;
	CSkypeProto *ppro = (CSkypeProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);

	switch (msg) {
	case WM_INITDIALOG:
		if (lParam) {
			ppro = (CSkypeProto *)lParam;
			::TranslateDialogDefault(hwndDlg);

			::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
		}
		break;

	case WM_COMMAND:
		if (((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE))
		{
			ppro->NeedUpdate = 1;
			SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
		}
		break;

	case WM_NOTIFY:
		if (((LPNMHDR)lParam)->idFrom == 0) {
			switch (((LPNMHDR)lParam)->code) {
			case PSN_PARAMCHANGED:
				SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY *)lParam)->lParam);
				break;
			case PSN_APPLY:
				if (ppro->IsOnline() && ppro->NeedUpdate)
					ppro->SaveOwnInfoToServer(hwndDlg, iPageId);
				else if ( !ppro->IsOnline())
					ppro->ShowNotification(::TranslateT("You are not currently connected to the Skype network. You must be online in order to update your information on the server."));
				break;
			}
		}
		break;
	}
	return FALSE;
}
Пример #2
0
INT_PTR CALLBACK CSkypeProto::ContactSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	const unsigned long iPageId = 1;
	CSkypeProto *ppro = (CSkypeProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);

	switch (msg) {
	case WM_INITDIALOG:
		if (lParam) {
			ppro = (CSkypeProto *)lParam;
			::TranslateDialogDefault(hwndDlg);

			::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);

			DBVARIANT dbv;
			if ( !ppro->getTString("Cellular", &dbv)) {
				::SetDlgItemText(hwndDlg, IDC_MOBPHONE, dbv.ptszVal);
				::db_free(&dbv);
			}
			else
				::SetDlgItemText(hwndDlg, IDC_MOBPHONE, _T(""));

			if ( !ppro->getTString("Phone", &dbv)) {
				::SetDlgItemText(hwndDlg, IDC_HOMEPHONE, dbv.ptszVal);
				::db_free(&dbv);
			}
			else
				::SetDlgItemText(hwndDlg, IDC_HOMEPHONE, _T(""));

			if ( !ppro->getTString("CompanyPhone", &dbv)) {
				::SetDlgItemText(hwndDlg, IDC_OFFICEPHONE, dbv.ptszVal);
				::db_free(&dbv);
			}
			else
				::SetDlgItemText(hwndDlg, IDC_OFFICEPHONE, _T(""));

			if ( !ppro->getTString("e-mail0", &dbv)) {
				::SetDlgItemText(hwndDlg, IDC_EMAIL1, dbv.ptszVal);
				::db_free(&dbv);
			}
			else
				::SetDlgItemText(hwndDlg, IDC_EMAIL1, _T(""));

			if ( !ppro->getTString("e-mail1", &dbv)) {
				::SetDlgItemText(hwndDlg, IDC_EMAIL2, dbv.ptszVal);
				::db_free(&dbv);
			}
			else
				::SetDlgItemText(hwndDlg, IDC_EMAIL2, _T(""));

			if ( !ppro->getTString("e-mail2", &dbv)) {
				::SetDlgItemText(hwndDlg, IDC_EMAIL3, dbv.ptszVal);
				::db_free(&dbv);
			}
			else
				::SetDlgItemText(hwndDlg, IDC_EMAIL3, _T(""));
		}
		break;

	case WM_COMMAND:
		if ((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE)
		{
			ppro->NeedUpdate = 1;
			::SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
		}
		break;

	case WM_NOTIFY:
		if (((LPNMHDR)lParam)->idFrom == 0) {
			switch (((LPNMHDR)lParam)->code) {
			case PSN_PARAMCHANGED:
				::SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY *)lParam)->lParam);
				break;
			case PSN_APPLY:
				if (ppro->IsOnline() && ppro->NeedUpdate)
					ppro->SaveOwnInfoToServer(hwndDlg, iPageId);
				else if ( !ppro->IsOnline())
					ppro->ShowNotification(::TranslateT("You are not currently connected to the Skype network. You must be online in order to update your information on the server."));
				break;
			}
		}
		break;
	}
	return FALSE;
}
Пример #3
0
INT_PTR CALLBACK CSkypeProto::HomeSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	const unsigned long iPageId = 2;
	CSkypeProto *ppro = (CSkypeProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);

	switch (msg) {
	case WM_INITDIALOG:
		if (lParam) {
			ppro = (CSkypeProto *)lParam;
			::TranslateDialogDefault(hwndDlg);

			::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);

			DBVARIANT dbv;
			if ( !ppro->getTString("City", &dbv)) {
				::SetDlgItemText(hwndDlg, IDC_CITY, dbv.ptszVal);
				::db_free(&dbv);
			}
			else ::SetDlgItemText(hwndDlg, IDC_CITY, _T(""));

			if ( !ppro->getTString("State", &dbv)) {
				::SetDlgItemText(hwndDlg, IDC_STATE, dbv.ptszVal);
				::db_free(&dbv);
			}
			else ::SetDlgItemText(hwndDlg, IDC_STATE, _T(""));

			ptrW countr(::db_get_wsa(NULL, ppro->m_szModuleName, "Country"));
			for (int i = 0; i < g_cbCountries; i++)
			{
				if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0)
				{
					ptrT country( mir_a2t(g_countries[i].szName));
					int nItem = ::SendMessage(
						::GetDlgItem(hwndDlg, IDC_COUNTRY), 
						CB_ADDSTRING, 
						0, 
						(LPARAM)::TranslateTS(country));
					
					::SendMessage(
						::GetDlgItem(hwndDlg, IDC_COUNTRY), 
						CB_SETITEMDATA, 
						nItem, 
						(LPARAM)&g_countries[i].ISOcode);

					if (countr && ::wcscmp(country, countr) == 0)
						::SendMessage(GetDlgItem(hwndDlg, IDC_COUNTRY), CB_SETCURSEL, nItem, 0);
				}
			}

			tmi.prepareList((HANDLE)lParam, ::GetDlgItem(hwndDlg, IDC_TIMEZONE), TZF_PLF_CB);
			HANDLE hTimeZone = tmi.createByContact ? tmi.createByContact(NULL, 0) : 0;
			LPCTSTR TzDescr = tmi.getTzDescription(tmi.getTzName(hTimeZone));
			::SetDlgItemText(hwndDlg, IDC_TIMEZONE, TzDescr);
		}
		break;

	case WM_COMMAND:
		if (((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE) ||
			(((HWND)lParam == GetDlgItem(hwndDlg, IDC_COUNTRY) || (HWND)lParam == GetDlgItem(hwndDlg, IDC_TIMEZONE)) &&
			(HIWORD(wParam) == CBN_EDITCHANGE || HIWORD(wParam) == CBN_SELCHANGE)))
		{
			ppro->NeedUpdate = 1;
			SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
		}
		break;

	case WM_NOTIFY:
		if (((LPNMHDR)lParam)->idFrom == 0) {
			switch (((LPNMHDR)lParam)->code) {
			case PSN_PARAMCHANGED:
				SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY *)lParam)->lParam);
				break;
			case PSN_APPLY:
				if (ppro->IsOnline() && ppro->NeedUpdate)
					ppro->SaveOwnInfoToServer(hwndDlg, iPageId);
				else if ( !ppro->IsOnline())
					ppro->ShowNotification(::TranslateT("You are not currently connected to the Skype network. You must be online in order to update your information on the server."));
				break;
			}
		}
		break;
	}
	return FALSE;
}
Пример #4
0
INT_PTR CALLBACK CSkypeProto::PersonalSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	const unsigned long iPageId = 0;
	CSkypeProto *ppro = (CSkypeProto *)::GetWindowLongPtr(hwndDlg, GWLP_USERDATA);

	switch (msg)
	{
	case WM_INITDIALOG:
		if (lParam)
		{
			ppro = (CSkypeProto *)lParam;
			::TranslateDialogDefault(hwndDlg);

			::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);

			// gender
			::SendMessage(::GetDlgItem(hwndDlg, IDC_GENDER), CB_ADDSTRING, 0, (LPARAM)L"");
			::SendMessage(::GetDlgItem(hwndDlg, IDC_GENDER), CB_ADDSTRING, 0, (LPARAM)::TranslateT("Male"));
			::SendMessage(::GetDlgItem(hwndDlg, IDC_GENDER), CB_ADDSTRING, 0, (LPARAM)::TranslateT("Female"));
			
			BYTE b = ::db_get_b(NULL, ppro->m_szModuleName, "Gender", 0);
			switch (b)
			{
			case 0:
				::SetDlgItemText(hwndDlg, IDC_GENDER, _T(""));
				break;
			case 'M':
				::SetDlgItemText(hwndDlg, IDC_GENDER, TranslateT("Male"));
				break;
			case 'F':
				SetDlgItemText(hwndDlg, IDC_GENDER, TranslateT("Female"));
				break;
			}				

			// birthday
			wchar_t date[5];

			for (int i = 1; i < 32; i++)
			{
				::mir_sntprintf(date, 3, L"%02d", i);
				::SendMessage(GetDlgItem(hwndDlg, IDC_BIRTH_DAY), CB_ADDSTRING, 0, (LPARAM)date);
			}
			BYTE bday = ::db_get_b(NULL, ppro->m_szModuleName, "BirthDay", 0);
			if (bday > 0 && bday < 32)
			{
				::mir_sntprintf(date, 3, L"%02d", bday);
				::SetDlgItemText(hwndDlg, IDC_BIRTH_DAY, date);
			}

			for (int i = 1; i < 13; i++)
			{
				::mir_sntprintf(date, 3, L"%02d", i);
				::SendMessage(::GetDlgItem(hwndDlg, IDC_BIRTH_MONTH), CB_ADDSTRING, 0, (LPARAM)date);
			}
			BYTE bmon = ::db_get_b(NULL, ppro->m_szModuleName, "BirthMonth", 0);
			if (bmon > 0 && bmon < 13)
			{
				::mir_sntprintf(date, 3, L"%02d", bmon);
				::SetDlgItemText(hwndDlg, IDC_BIRTH_MONTH, date);
			}
			SYSTEMTIME sToday = {0};
			::GetLocalTime(&sToday);
			// ages from 10 to 50 is need more?
			for (WORD i = sToday.wYear - 50; i < sToday.wYear - 10; i++)
			{
				::_itow(i, date, 10);
				::SendMessage(::GetDlgItem(hwndDlg, IDC_BIRTH_YEAR), CB_ADDSTRING, 0, (LPARAM)date);
			}
			WORD byear = ::db_get_w(NULL, ppro->m_szModuleName, "BirthYear", 0);
			if (byear > 1900 && bmon < 2214)
				::SetDlgItemInt(hwndDlg, IDC_BIRTH_YEAR, byear, false);

			// language
			int i = 0;
			ptrW lang( ::db_get_wsa(NULL, ppro->m_szModuleName, "Language1"));
			for (auto it = CSkypeProto::languages.begin(); it != CSkypeProto::languages.end(); ++it)
			{
				::SendMessage(
					::GetDlgItem(hwndDlg, IDC_LANGUAGE), 
					CB_ADDSTRING, 
					0, 
					(LPARAM)::TranslateTS(it->second.c_str()));
				
				::SendMessage(
					::GetDlgItem(hwndDlg, IDC_LANGUAGE), 
					CB_SETITEMDATA, 
					i, 
					(LPARAM)&it->first);

				if (lang && it->second.compare(lang) == 0)
					::SendMessage(GetDlgItem(hwndDlg, IDC_LANGUAGE), CB_SETCURSEL, i, 0);
				i++;
			}
			
			// nick
			DBVARIANT dbv;
			if ( !ppro->getTString("Nick", &dbv))
			{
				::SetDlgItemText(hwndDlg, IDC_FULLNAME, dbv.ptszVal);
				::db_free(&dbv);
			}
			else
				::SetDlgItemText(hwndDlg, IDC_FULLNAME, _T(""));

			// homepage
			if ( !ppro->getTString("Homepage", &dbv))
			{
				::SetDlgItemText(hwndDlg, IDC_HOMEPAGE, dbv.ptszVal);
				::db_free(&dbv);
			}
			else
				::SetDlgItemText(hwndDlg, IDC_HOMEPAGE, _T(""));

			// about
			if ( !ppro->getTString("About", &dbv)) {
				::SetDlgItemText(hwndDlg, IDC_ABOUT, dbv.ptszVal);
				::db_free(&dbv);
			}
			else
				::SetDlgItemText(hwndDlg, IDC_ABOUT, _T(""));

			// mood
			if ( !ppro->getTString("XStatusMsg", &dbv)) {
				::SetDlgItemText(hwndDlg, IDC_MOOD, dbv.ptszVal);
				::db_free(&dbv);
			}
			else
				::SetDlgItemText(hwndDlg, IDC_MOOD, _T(""));
		}
		break;

	case WM_COMMAND:
		if (((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE) ||
			(((HWND)lParam == GetDlgItem(hwndDlg, IDC_GENDER) || (HWND)lParam == GetDlgItem(hwndDlg, IDC_BIRTH_DAY) ||
			(HWND)lParam == GetDlgItem(hwndDlg, IDC_BIRTH_MONTH) || (HWND)lParam == GetDlgItem(hwndDlg, IDC_BIRTH_YEAR) ||
			(HWND)lParam == GetDlgItem(hwndDlg, IDC_LANGUAGE)) && (HIWORD(wParam) == CBN_EDITCHANGE || HIWORD(wParam) == CBN_SELCHANGE)))
		{
			ppro->NeedUpdate = 1;
			::SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
		}
		break;

	case WM_NOTIFY:
		if (((LPNMHDR)lParam)->idFrom == 0) {
			switch (((LPNMHDR)lParam)->code) {
			case PSN_PARAMCHANGED:
				::SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY *)lParam)->lParam);
				break;
			case PSN_APPLY:
				if (ppro->IsOnline() && ppro->NeedUpdate)
					ppro->SaveOwnInfoToServer(hwndDlg, iPageId);
				else if ( !ppro->IsOnline())
					ppro->ShowNotification(::TranslateT("You are not currently connected to the Skype network. You must be online in order to update your information on the server."));
				break;
			}
		}
		break;
	}
	return FALSE;
}