Exemplo n.º 1
0
BOOL CImportOptionsDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	NewGUI_TranslateCWnd(this);
	EnumChildWindows(this->m_hWnd, NewGUI_TranslateWindowCb, 0);

	NewGUI_XPButton(m_btOK, IDB_OK, IDB_OK);
	NewGUI_XPButton(m_btCancel, IDB_CANCEL, IDB_CANCEL);

	NewGUI_ConfigSideBanner(&m_banner, this);
	m_banner.SetIcon(AfxGetApp()->LoadIcon(IDI_ICONPIC),
		KCSB_ICON_LEFT | KCSB_ICON_VCENTER);
	m_banner.SetTitle(TRL("Options"));
	m_banner.SetCaption(_T(" "));

	CFontUtil::SetDefaultFontFrom(GetDlgItem(IDC_RADIO_CREATENEW));

	// m_fBold.CreateFont(-10, 0, 0, 0, FW_BOLD, FALSE, FALSE, 0,
	//	DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
	//	DEFAULT_QUALITY, DEFAULT_PITCH | FF_MODERN, _T("MS Shell Dlg"));

	// GetDlgItem(IDC_RADIO_CREATENEW)->SetFont(&m_fBold);
	// GetDlgItem(IDC_RADIO_OVERWRITE_ALWAYS)->SetFont(&m_fBold);
	// GetDlgItem(IDC_RADIO_OVERWRITE_TIMEBASED)->SetFont(&m_fBold);
	CFontUtil::AssignBold(GetDlgItem(IDC_RADIO_CREATENEW), this);
	CFontUtil::AssignBold(GetDlgItem(IDC_RADIO_OVERWRITE_ALWAYS), this);
	CFontUtil::AssignBold(GetDlgItem(IDC_RADIO_OVERWRITE_TIMEBASED), this);

	return TRUE;
}
Exemplo n.º 2
0
BOOL CPluginsDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	NewGUI_TranslateCWnd(this);
	EnumChildWindows(this->m_hWnd, NewGUI_TranslateWindowCb, 0);

	ASSERT(m_pPiMgr != NULL);
	ASSERT(m_pImgList != NULL);

	NewGUI_XPButton(m_btClose, IDB_OK, IDB_OK);
	NewGUI_XPButton(m_btHelp, IDB_HELP_SMALL, IDB_HELP_SMALL);

	NewGUI_ConfigSideBanner(&m_banner, this);
	m_banner.SetIcon(AfxGetApp()->LoadIcon(IDI_PLUGINS),
		KCSB_ICON_LEFT | KCSB_ICON_VCENTER);
	m_banner.SetTitle(TRL("Plugins"));
	m_banner.SetCaption(TRL("Here you can configure all installed KeePass plugins."));

	NewGUI_MakeHyperLink(&m_hlGetPlugins);
	m_hlGetPlugins.EnableTooltip(FALSE);
	m_hlGetPlugins.SetNotifyParent(TRUE);
	m_hlGetPlugins.EnableURL(FALSE);

	m_cList.SetImageList(m_pImgList, LVSIL_SMALL);

	// m_cList.PostMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_SI_REPORT |
	//	LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_ONECLICKACTIVATE |
	//	LVS_EX_UNDERLINEHOT | LVS_EX_INFOTIP);
	m_cList.PostMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_SI_REPORT |
		LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_INFOTIP);

	RECT rect;
	m_cList.GetWindowRect(&rect);
	const int nWidth = (rect.right - rect.left - GetSystemMetrics(SM_CXVSCROLL) - 8) / 7;
	m_cList.InsertColumn(0, TRL("Plugin"), LVCFMT_LEFT, nWidth * 3, 0);
	m_cList.InsertColumn(1, TRL("Version"), LVCFMT_LEFT, nWidth, 1);
	m_cList.InsertColumn(2, TRL("Author"), LVCFMT_LEFT, nWidth * 3, 2);
	m_cList.InsertColumn(3, TRL("ID"), LVCFMT_LEFT, 0, 3);

	// TCHAR tszBase[MAX_PATH]; tszBase[0] = 0; tszBase[1] = 0;
	// GetModuleFileName(NULL, tszBase, MAX_PATH - 2);
	// int jj;
	// for(jj = (int)_tcslen(tszBase) - 1; jj > 0; jj--)
	//	if(tszBase[jj] == _T('\\'))
	//	{
	//		tszBase[jj + 1] = 0;
	//		break;
	//	}
	// std_string strBase = Executable::instance().getPathOnly();
	// VERIFY(m_pPiMgr->AddAllPlugins(strBase.c_str(), _T("*.dll"), FALSE)); // Updates existing list

	UpdateGUI();

	return TRUE;
}
Exemplo n.º 3
0
BOOL CSingleLineEditDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	NewGUI_XPButton(m_btnOK, IDB_OK, IDB_OK);
	NewGUI_XPButton(m_btnCancel, IDB_CANCEL, IDB_CANCEL);

	NewGUI_TranslateCWnd(this);
	EnumChildWindows(this->m_hWnd, NewGUI_TranslateWindowCb, 0);

	SetWindowText(m_strTitle);

	NewGUI_ConfigSideBanner(&m_banner, this);
	m_banner.SetIcon(AfxGetApp()->LoadIcon(IDI_KEYHOLE),
		KCSB_ICON_LEFT | KCSB_ICON_VCENTER);
	m_banner.SetTitle(m_strTitle);
	m_banner.SetCaption(m_strDesc);

	m_stcPrompt.SetWindowText(m_strPrompt);

	if(m_vSelectable.size() == 0)
	{
		m_cmbInput.EnableWindow(FALSE);
		m_cmbInput.ShowWindow(SW_HIDE);

		if(m_dwMaxInputLen != DWORD_MAX)
			m_tbInput.LimitText(m_dwMaxInputLen);

		m_tbInput.SetWindowText(m_strDefaultValue);
		m_tbInput.SetFocus();
	}
	else // Use combo box
	{
		m_tbInput.EnableWindow(FALSE);
		m_tbInput.ShowWindow(SW_HIDE);

		if(m_dwMaxInputLen != DWORD_MAX)
			m_cmbInput.LimitText(m_dwMaxInputLen);

		m_cmbInput.SetWindowText(m_strDefaultValue);

		for(DWORD dwPre = 0; dwPre < m_vSelectable.size(); ++dwPre)
			m_cmbInput.AddString(m_vSelectable[dwPre].c_str());

		m_cmbInput.SetFocus();
	}

	this->Invalidate();
	return FALSE;
}
Exemplo n.º 4
0
BOOL CCheckOptionsDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	ASSERT(m_dwNumParams != 0); ASSERT(m_pParams != NULL);
	
	// Translate all windows
	EnumChildWindows(this->m_hWnd, NewGUI_TranslateWindowCb, 0);

	NewGUI_XPButton(m_btOK, IDB_OK, IDB_OK);
	NewGUI_XPButton(m_btCancel, IDB_CANCEL, IDB_CANCEL);

	// Configure banner control
	NewGUI_ConfigSideBanner(&m_banner, this);
	m_banner.SetIcon(AfxGetApp()->LoadIcon(IDI_OPTIONS), KCSB_ICON_LEFT | KCSB_ICON_VCENTER);

	m_banner.SetTitle(m_strTitle);
	m_banner.SetCaption(m_strDescription);
	SetWindowText(m_strTitle);

	// m_ilOptionIcons.Create(IDB_OPTIONICONS_EX, 16, 1, RGB(255,0,255));
	CPwSafeApp::CreateHiColorImageList(&m_ilOptionIcons, IDB_OPTIONICONS_EX, 16);
	m_olOptions.InitOptionListEx(&m_ilOptionIcons, m_bTwoColumns);

	DWORD i = 0;
	for(i = 0; i < m_dwNumParams; i++)
	{
		if(m_pParams[i].pbValue == NULL)
			m_olOptions.AddGroupText(m_pParams[i].lpString, m_pParams[i].nIcon);
		else if(m_bTwoColumns)
		{
			ASSERT(m_pParams[i].lpSubString != NULL);
			m_olOptions.AddCheckItemEx(m_pParams[i].lpString, m_pParams[i].lpSubString, m_pParams[i].pbValue, NULL, OL_LINK_NULL);
		}
		else
		{
			ASSERT(m_pParams[i].lpSubString == NULL);
			m_olOptions.AddCheckItem(m_pParams[i].lpString, m_pParams[i].pbValue, NULL, OL_LINK_NULL);
		}
	}

	if(m_bForceForeground == TRUE)
		SetForegroundWindow();

	return TRUE;
}
Exemplo n.º 5
0
BOOL CPwGeneratorAdvDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	ASSERT(m_pOpt != NULL); if(m_pOpt == NULL) return TRUE;

	NewGUI_TranslateCWnd(this);
	EnumChildWindows(this->m_hWnd, NewGUI_TranslateWindowCb, 0);

	NewGUI_XPButton(m_btOK, IDB_OK, IDB_OK);
	NewGUI_XPButton(m_btCancel, IDB_CANCEL, IDB_CANCEL);
	NewGUI_XPButton(m_btHelp, IDB_HELP_SMALL, IDB_HELP_SMALL);

	NewGUI_ConfigSideBanner(&m_banner, this);
	m_banner.SetIcon(AfxGetApp()->LoadIcon(IDI_KEY),
		KCSB_ICON_LEFT | KCSB_ICON_VCENTER);
	m_banner.SetTitle(TRL("Options"));
	m_banner.SetCaption(TRL("Advanced Password Generator Options"));

	CString str;
	GetDlgItem(IDC_CHECK_EXCLUDE_LOOKALIKE)->GetWindowText(str);
	GetDlgItem(IDC_CHECK_EXCLUDE_LOOKALIKE)->SetWindowText(str + _T(" (l|1I, O0) *"));

	GetDlgItem(IDC_CHECK_NO_REPEAT)->GetWindowText(str);
	GetDlgItem(IDC_CHECK_NO_REPEAT)->SetWindowText(str + _T(" *"));

	GetDlgItem(IDC_STATIC_EXCLUDECHARS)->GetWindowText(str);
	GetDlgItem(IDC_STATIC_EXCLUDECHARS)->SetWindowText(str + _T(" *"));

	GetDlgItem(IDC_STATIC_SECREDUCINFO)->GetWindowText(str);
	GetDlgItem(IDC_STATIC_SECREDUCINFO)->SetWindowText(_T("* ") + str);

	m_bNoConfusing = m_pOpt->bNoConfusing;
	m_bNoRepeat = m_pOpt->bNoRepeat;

#ifdef _UNICODE
	m_strExcludeChars = m_pOpt->strExcludeChars.c_str();
#else
	char *pExcl = _StringToAnsi(m_pOpt->strExcludeChars.c_str());
	m_strExcludeChars = pExcl;
	SAFE_DELETE_ARRAY(pExcl);
#endif

	UpdateData(FALSE);
	return TRUE;
}
Exemplo n.º 6
0
BOOL CTanWizardDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	NewGUI_TranslateCWnd(this);
	EnumChildWindows(this->m_hWnd, NewGUI_TranslateWindowCb, 0);

	NewGUI_XPButton(m_btOK, IDB_OK, IDB_OK);
	NewGUI_XPButton(m_btCancel, IDB_CANCEL, IDB_CANCEL);
	NewGUI_XPButton(m_btHelp, IDB_HELP_SMALL, IDB_HELP_SMALL);

	NewGUI_ConfigSideBanner(&m_banner, this);
	m_banner.SetIcon(AfxGetApp()->LoadIcon(IDI_OPTIONS),
		KCSB_ICON_LEFT | KCSB_ICON_VCENTER);
	m_banner.SetTitle(TRL("TAN Wizard"));
	m_banner.SetCaption(TRL("Using this wizard you can easily add TAN entries."));

	GetDlgItem(IDC_EDIT_NUMBERING_START)->EnableWindow(FALSE);

	CString strToGroup;
	GetDlgItem(IDC_STATIC_TOGROUP)->GetWindowText(strToGroup);
	if(m_strGroupName.GetLength() > 0)
	{
		strToGroup += _T(": ");
		strToGroup += m_strGroupName;
	}
	strToGroup += _T(".");
	GetDlgItem(IDC_STATIC_TOGROUP)->SetWindowText(strToGroup);

	TCHAR lpTANChars[SI_REGSIZE + 1];
	CPrivateConfigEx cfg(FALSE);
	if(cfg.Get(PWMKEY_TANCHARS, lpTANChars) == TRUE) m_strTANChars = lpTANChars;
	else m_strTANChars = TW_DEFAULTCHARS;

	UpdateData(FALSE);

	GetDlgItem(IDC_EDIT_TANS)->SetFocus();
	return FALSE;
}
Exemplo n.º 7
0
BOOL CAddGroupDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	ASSERT(m_pParentImageList != NULL);

	EnumChildWindows(this->m_hWnd, NewGUI_TranslateWindowCb, 0);

	NewGUI_XPButton(m_btSetIcon, -1, -1);
	NewGUI_XPButton(m_btOK, IDB_OK, IDB_OK);
	NewGUI_XPButton(m_btCancel, IDB_CANCEL, IDB_CANCEL);

	m_btSetIcon.SetTooltipText(TRL("Choose an icon."), TRUE);
	if((m_nIconId >= 0) && (m_pParentImageList != NULL))
		m_btSetIcon.SetIcon(m_pParentImageList->ExtractIcon(m_nIconId));

	NewGUI_ConfigSideBanner(&m_banner, this);
	m_banner.SetIcon(AfxGetApp()->LoadIcon(IDI_KEY),
		KCSB_ICON_LEFT | KCSB_ICON_VCENTER);

	if(m_bEditMode == FALSE)
	{
		m_banner.SetTitle(TRL("Add Group"));
		m_banner.SetCaption(TRL("Create a new password group."));
		SetWindowText(TRL("Add Group"));
	}
	else
	{
		m_banner.SetTitle(TRL("Edit Group"));
		m_banner.SetCaption(TRL("Modify existing password group."));
		SetWindowText(TRL("Edit Group"));
	}

	m_strInitialName = m_strGroupName;

	UpdateData(FALSE);
	GetDlgItem(IDC_EDIT_GROUPNAME)->SetFocus();
	return FALSE; // Return TRUE unless you set the focus to a control
}
Exemplo n.º 8
0
BOOL CHelpSourceDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	NewGUI_TranslateCWnd(this);
	EnumChildWindows(this->m_hWnd, NewGUI_TranslateWindowCb, 0);

	NewGUI_XPButton(m_btnOK, IDB_OK, IDB_OK);
	NewGUI_XPButton(m_btnCancel, IDB_CANCEL, IDB_CANCEL);

	NewGUI_ConfigSideBanner(&m_banner, this);
	m_banner.SetIcon(AfxGetApp()->LoadIcon(IDI_OPTIONS),
		KCSB_ICON_LEFT | KCSB_ICON_VCENTER);
	m_banner.SetTitle(TRL("Help Source"));
	m_banner.SetCaption(TRL("Choose between local help and online help center."));

	if(WU_GetAppHelpSource() == APPHS_LOCAL)
		m_rbLocalHelp.SetCheck(BST_CHECKED);
	else
		m_rbOnlineHelp.SetCheck(BST_CHECKED);

	CFontUtil::SetDefaultFontFrom(&m_rbLocalHelp);

	// CFont* pFont = m_rbLocalHelp.GetFont();
	// if(pFont != NULL)
	// {
	//	LOGFONT lf;
	//	pFont->GetLogFont(&lf);
	//	lf.lfWeight = FW_BOLD;
	//	m_pBoldFont = new CFont();
	//	VERIFY(m_pBoldFont->CreateFontIndirect(&lf));
	//	m_rbLocalHelp.SetFont(m_pBoldFont);
	//	m_rbOnlineHelp.SetFont(m_pBoldFont);
	// }
	CFontUtil::AssignBold(&m_rbLocalHelp, this);
	CFontUtil::AssignBold(&m_rbOnlineHelp, this);

	return TRUE;
}
Exemplo n.º 9
0
BOOL CIconPickerDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	ASSERT(m_pImageList != NULL);
	ASSERT(m_uNumIcons != 0);

	NewGUI_TranslateCWnd(this);
	EnumChildWindows(this->m_hWnd, NewGUI_TranslateWindowCb, 0);

	m_cList.SetImageList(m_pImageList, LVSIL_SMALL);

	ASSERT(LVM_SETEXTENDEDLISTVIEWSTYLE == (0x1000 + 54));
	// m_cList.PostMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_SI_REPORT |
	//	LVS_EX_ONECLICKACTIVATE | LVS_EX_UNDERLINEHOT);

	for(UINT i = 0; i < m_uNumIcons; ++i)
	{
		CString str;
		str.Format(_T("%u"), i);
		m_cList.InsertItem(LVIF_IMAGE | LVIF_TEXT, static_cast<int>(i), str, 0, 0, i, 0);
	}

	if((m_nSelectedIcon >= 0) && (m_nSelectedIcon < m_cList.GetItemCount()))
		m_cList.SetItemState(m_nSelectedIcon, LVIS_SELECTED, LVIS_SELECTED);

	NewGUI_XPButton(m_btOK, IDB_OK, IDB_OK);
	NewGUI_XPButton(m_btCancel, IDB_CANCEL, IDB_CANCEL);

	NewGUI_ConfigSideBanner(&m_banner, this);
	m_banner.SetIcon(AfxGetApp()->LoadIcon(IDI_ICONPIC),
		KCSB_ICON_LEFT | KCSB_ICON_VCENTER);
	m_banner.SetTitle(TRL("Pick an Icon"));
	m_banner.SetCaption(TRL("Choose an icon from the list of available entry and group icons."));

	return TRUE; // Return TRUE unless you set the focus to a control
}
Exemplo n.º 10
0
BOOL CUpdateInfoDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	NewGUI_TranslateCWnd(this);
	EnumChildWindows(this->m_hWnd, NewGUI_TranslateWindowCb, 0);

	CFontUtil::SetDefaultFontFrom(&m_lblStatus);

	// CFont* pDialogFont = m_lblStatus.GetFont();
	// LOGFONT lf;
	// pDialogFont->GetLogFont(&lf);
	// m_fBold.CreateFont(lf.lfHeight, lf.lfWidth, lf.lfEscapement, lf.lfOrientation,
	//	FW_BOLD, lf.lfItalic, lf.lfUnderline, lf.lfStrikeOut,
	//	lf.lfCharSet, lf.lfOutPrecision, lf.lfClipPrecision, lf.lfQuality,
	//	lf.lfPitchAndFamily, lf.lfFaceName);
	// m_lblStatus.SetFont(&m_fBold);
	CFontUtil::AssignBold(&m_lblStatus, this);

	NewGUI_XPButton(m_btClose, IDB_CANCEL, IDB_CANCEL);

	NewGUI_MakeHyperLink(&m_hlVisitWebsite);
	m_hlVisitWebsite.EnableTooltip(FALSE);
	m_hlVisitWebsite.SetNotifyParent(TRUE);
	m_hlVisitWebsite.EnableURL(FALSE);

	ASSERT(m_pImgList != NULL);
	m_cList.SetImageList(m_pImgList, LVSIL_SMALL);

	// m_cList.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_SI_REPORT |
	//	LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_ONECLICKACTIVATE |
	//	LVS_EX_UNDERLINEHOT | LVS_EX_INFOTIP);
	m_cList.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_SI_REPORT |
		LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_INFOTIP);

	RECT rect;
	m_cList.GetWindowRect(&rect);
	const int nWidth = (rect.right - rect.left - GetSystemMetrics(SM_CXVSCROLL) - 8) / 6;
	m_cList.InsertColumn(0, TRL("Component"), LVCFMT_LEFT, nWidth * 2, 0);
	m_cList.InsertColumn(1, TRL("Status"), LVCFMT_LEFT, nWidth * 2, 1);
	m_cList.InsertColumn(2, TRL("Installed"), LVCFMT_LEFT, nWidth, 2);
	m_cList.InsertColumn(3, TRL("Available"), LVCFMT_LEFT, nWidth, 3);

	FillComponentList();

	UpdateData(FALSE);
	return TRUE;
}
Exemplo n.º 11
0
BOOL CLanguagesDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	NewGUI_TranslateCWnd(this);
	EnumChildWindows(this->m_hWnd, NewGUI_TranslateWindowCb, 0);
	
	NewGUI_XPButton(m_btClose, IDB_CANCEL, IDB_CANCEL);
	NewGUI_XPButton(m_btGetLang, IDB_LANGUAGE, IDB_LANGUAGE);
	NewGUI_XPButton(m_btOpenFolder, IDB_TB_OPEN, IDB_TB_OPEN);

	NewGUI_ConfigSideBanner(&m_banner, this);
	m_banner.SetIcon(AfxGetApp()->LoadIcon(IDI_WORLD),
		KCSB_ICON_LEFT | KCSB_ICON_VCENTER);
	m_banner.SetTitle(TRL("Select Language"));
	m_banner.SetCaption(TRL("Here you can change the user interface language."));

	RECT rcList;
	m_listLang.GetClientRect(&rcList);
	const int wList = rcList.right - rcList.left - GetSystemMetrics(SM_CXVSCROLL);
	const int w2 = (wList * 2) / 20;
	const int w3 = (wList * 3) / 20;
	const int w5 = (wList * 5) / 20;
	m_listLang.InsertColumn(0, TRL("Installed Languages"), LVCFMT_LEFT, w5, 0);
	m_listLang.InsertColumn(1, TRL("Version"), LVCFMT_LEFT, w2, 1);
	m_listLang.InsertColumn(2, TRL("Author"), LVCFMT_LEFT, w5, 2);
	m_listLang.InsertColumn(3, TRL("Contact"), LVCFMT_LEFT, w5, 3);
	m_listLang.InsertColumn(4, TRL("File"), LVCFMT_LEFT, w3, 4);

	// m_ilIcons.Create(CPwSafeApp::GetClientIconsResourceID(), 16, 1, RGB(255,0,255));
	CPwSafeApp::CreateHiColorImageList(&m_ilIcons, IDB_CLIENTICONS_EX, 16);
	m_listLang.SetImageList(&m_ilIcons, LVSIL_SMALL);

	m_listLang.PostMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_SI_REPORT |
		LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_ONECLICKACTIVATE |
		LVS_EX_UNDERLINEHOT | LVS_EX_INFOTIP);

	m_listLang.DeleteAllItems();

	LV_ITEM lvi;
	ZeroMemory(&lvi, sizeof(LV_ITEM));
	lvi.iItem = m_listLang.InsertItem(LVIF_TEXT | LVIF_IMAGE, m_listLang.GetItemCount(),
		_T("English"), 0, 0, 1, NULL);

	CString strTemp;
	
	strTemp = PWM_VERSION_STR;
	lvi.iSubItem = 1; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	strTemp = PWMX_ENGLISH_AUTHOR;
	lvi.iSubItem = 2; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	strTemp = PWMX_ENGLISH_CONTACT;
	lvi.iSubItem = 3; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	strTemp = TRL("Built-in");
	lvi.iSubItem = 4; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	const std_string strActive = GetCurrentTranslationTable();

	std_string strFilter = SU_DriveLetterToUpper(Executable::instance().getPathOnly());
	strFilter += PWM_DIR_LANGUAGES;
	strFilter += _T("\\*.lng");

	CFileFind ff;
	BOOL bMore = ff.FindFile(strFilter.c_str(), 0);
	while(bMore != FALSE)
	{
		bMore = ff.FindNextFile();

		// Ignore KeePass 2.x LNGX files (these are found even though
		// "*.lng" is specified as file mask)
		CString strFileName = ff.GetFileName();
		strFileName = strFileName.MakeLower();
		if((strFileName.GetLength() >= 5) && (strFileName.Right(5) == _T(".lngx")))
			continue;

		CString strID = ff.GetFileTitle();
		strID = strID.MakeLower();
		if((strID != _T("standard")) && (strID != _T("english")))
		{
			VERIFY(LoadTranslationTable((LPCTSTR)ff.GetFileTitle()));

			strTemp = (LPCTSTR)ff.GetFileTitle();
			// strTemp += _T(" - "); // Name is used as identifier
			// strTemp += TRL("~LANGUAGENAME");

			lvi.iItem = m_listLang.InsertItem(LVIF_TEXT | LVIF_IMAGE,
				m_listLang.GetItemCount(), strTemp, 0, 0, 1, NULL);

			strTemp = TRL("~LANGUAGEVERSION");
			if(strTemp == _T("~LANGUAGEVERSION")) strTemp.Empty();
			lvi.iSubItem = 1; lvi.mask = LVIF_TEXT;
			lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
			m_listLang.SetItem(&lvi);

			strTemp = TRL("~LANGUAGEAUTHOR");
			if(strTemp == _T("~LANGUAGEAUTHOR")) strTemp.Empty();
			lvi.iSubItem = 2; lvi.mask = LVIF_TEXT;
			lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
			m_listLang.SetItem(&lvi);

			strTemp = TRL("~LANGUAGEAUTHOREMAIL");
			if(strTemp == _T("~LANGUAGEAUTHOREMAIL")) strTemp.Empty();
			lvi.iSubItem = 3; lvi.mask = LVIF_TEXT;
			lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
			m_listLang.SetItem(&lvi);

			strTemp = ff.GetFilePath();
			lvi.iSubItem = 4; lvi.mask = LVIF_TEXT;
			lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
			m_listLang.SetItem(&lvi);
		}
	}

	ff.Close();

	VERIFY(LoadTranslationTable(strActive.c_str()));
	return TRUE;
}
Exemplo n.º 12
0
BOOL CLanguagesDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	NewGUI_TranslateCWnd(this);
	EnumChildWindows(this->m_hWnd, NewGUI_TranslateWindowCb, 0);
	
	NewGUI_XPButton(m_btClose, IDB_CANCEL, IDB_CANCEL);
	NewGUI_XPButton(m_btGetLang, IDB_LANGUAGE, IDB_LANGUAGE);

	NewGUI_ConfigSideBanner(&m_banner, this);
	m_banner.SetIcon(AfxGetApp()->LoadIcon(IDI_WORLD),
		KCSB_ICON_LEFT | KCSB_ICON_VCENTER);
	m_banner.SetTitle(TRL("Load a Language File"));
	m_banner.SetCaption(TRL("Select one of the languages in the list below."));

	RECT rcList;
	m_listLang.GetWindowRect(&rcList);
	const int nColSize = (rcList.right - rcList.left - GetSystemMetrics(SM_CXVSCROLL) - 8) / 4;
	m_listLang.InsertColumn(0, TRL("Available Languages"), LVCFMT_LEFT, nColSize, 0);
	m_listLang.InsertColumn(1, TRL("Language File Version"), LVCFMT_LEFT, nColSize, 1);
	m_listLang.InsertColumn(2, TRL("Author"), LVCFMT_LEFT, nColSize, 2);
	m_listLang.InsertColumn(3, TRL("Translation Author Contact"), LVCFMT_LEFT, nColSize, 3);

	// m_ilIcons.Create(CPwSafeApp::GetClientIconsResourceID(), 16, 1, RGB(255,0,255));
	CPwSafeApp::CreateHiColorImageList(&m_ilIcons, IDB_CLIENTICONS_EX, 16);
	m_listLang.SetImageList(&m_ilIcons, LVSIL_SMALL);

	m_listLang.PostMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_SI_REPORT |
		LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_ONECLICKACTIVATE |
		LVS_EX_UNDERLINEHOT | LVS_EX_INFOTIP);

	m_listLang.DeleteAllItems();

	LV_ITEM lvi;
	ZeroMemory(&lvi, sizeof(LV_ITEM));
	lvi.iItem = m_listLang.InsertItem(LVIF_TEXT | LVIF_IMAGE, m_listLang.GetItemCount(),
		_T("English"), 0, 0, 1, NULL);

	CString strTemp;
	
	strTemp = PWM_VERSION_STR;
	lvi.iSubItem = 1; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	strTemp = PWMX_ENGLISH_AUTHOR;
	lvi.iSubItem = 2; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	strTemp = PWMX_ENGLISH_CONTACT;
	lvi.iSubItem = 3; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	CFileFind ff;
	CString csTmp;
	BOOL chk_w = FALSE;
	TCHAR szCurrentlyLoaded[MAX_PATH * 2];

	_tcscpy_s(szCurrentlyLoaded, _countof(szCurrentlyLoaded), GetCurrentTranslationTable());

	std_string strFilter = Executable::instance().getPathOnly();
	strFilter += _T("*.lng");

	chk_w = ff.FindFile(strFilter.c_str(), 0);
	while(chk_w == TRUE)
	{
		chk_w = ff.FindNextFile();

		csTmp = ff.GetFileTitle();
		csTmp = csTmp.MakeLower();
		if((csTmp != _T("standard")) && (csTmp != _T("english")))
		{
			VERIFY(LoadTranslationTable((LPCTSTR)ff.GetFileTitle()));

			strTemp = (LPCTSTR)ff.GetFileTitle();
			// strTemp += _T(" - ");
			// strTemp += TRL("~LANGUAGENAME");

			lvi.iItem = m_listLang.InsertItem(LVIF_TEXT | LVIF_IMAGE,
				m_listLang.GetItemCount(), strTemp, 0, 0, 1, NULL);

			strTemp = TRL("~LANGUAGEVERSION");
			if(strTemp == _T("~LANGUAGEVERSION")) strTemp.Empty();
			lvi.iSubItem = 1; lvi.mask = LVIF_TEXT;
			lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
			m_listLang.SetItem(&lvi);

			strTemp = TRL("~LANGUAGEAUTHOR");
			if(strTemp == _T("~LANGUAGEAUTHOR")) strTemp.Empty();
			lvi.iSubItem = 2; lvi.mask = LVIF_TEXT;
			lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
			m_listLang.SetItem(&lvi);

			strTemp = TRL("~LANGUAGEAUTHOREMAIL");
			if(strTemp == _T("~LANGUAGEAUTHOREMAIL")) strTemp.Empty();
			lvi.iSubItem = 3; lvi.mask = LVIF_TEXT;
			lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
			m_listLang.SetItem(&lvi);
		}
	}

	ff.Close();

	VERIFY(LoadTranslationTable(szCurrentlyLoaded));
	return TRUE;
}
Exemplo n.º 13
-1
BOOL CFindInDbDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	NewGUI_TranslateCWnd(this);
	EnumChildWindows(this->m_hWnd, NewGUI_TranslateWindowCb, 0);

	NewGUI_XPButton(m_btOK, IDB_OK, IDB_OK);
	NewGUI_XPButton(m_btCancel, IDB_CANCEL, IDB_CANCEL);

	NewGUI_ConfigSideBanner(&m_banner, this);
	m_banner.SetIcon(AfxGetApp()->LoadIcon(IDI_SEARCH),
		KCSB_ICON_LEFT | KCSB_ICON_VCENTER);
	m_banner.SetTitle(TRL("Find"));
	m_banner.SetCaption(TRL("Find a string in the entry list."));

	if(m_lpGroupName != NULL)
	{
		CString str;

		str = TRL("Find"); str += _T(" - "); str += TRL("Group:");
		str += _T(" "); str += m_lpGroupName;
		m_banner.SetTitle(str);

		GetDlgItem(IDC_CHECK_GROUPNAME)->EnableWindow(FALSE);
		GetDlgItem(IDC_CHECK_EXCLUDEBACKUPS)->EnableWindow(FALSE);
	}

	GetDlgItem(IDC_EDIT_FINDTEXT)->SetFocus();
	return FALSE; // Return TRUE unless you set the focus to a control
}