Ejemplo n.º 1
0
void CPasswordPolicyDlg::OnCopyPassword()
{
  UpdateData(TRUE);

  GetMainDlg()->SetClipboardData(m_password);
  GetMainDlg()->UpdateLastClipboardAction(CItemData::PASSWORD);
}
void CPasskeyEntry::OnOpenFileBrowser()
{
  CString cs_text(MAKEINTRESOURCE(IDS_CHOOSEDATABASE));

  //Open-type dialog box
  CPWFileDialog fd(TRUE,
                   DEFAULT_SUFFIX,
                   NULL,
                   OFN_FILEMUSTEXIST | OFN_LONGNAMES,
                   CString(MAKEINTRESOURCE(IDS_FDF_DB_BU_ALL)),
                   this);

  fd.m_ofn.lpstrTitle = cs_text;

  if (!pws_os::IsWindowsVistaOrGreater()) {
    // Read-only checkbox only available up to Windows XP
    if (PWSprefs::GetInstance()->GetPref(PWSprefs::DefaultOpenRO))
      fd.m_ofn.Flags |= OFN_READONLY;
    else
      fd.m_ofn.Flags &= ~OFN_READONLY;
  }

  std::wstring dir;
  if (GetMainDlg()->GetCurFile().empty())
    dir = PWSdirs::GetSafeDir();
  else {
    std::wstring cdrive, cdir, dontCare;
    pws_os::splitpath(GetMainDlg()->GetCurFile().c_str(), cdrive, cdir, dontCare, dontCare);
    dir = cdrive + cdir;
  }

  if (!dir.empty())
    fd.m_ofn.lpstrInitialDir = dir.c_str();

  INT_PTR rc = fd.DoModal();

  if (((DboxMain*)GetParent())->ExitRequested()) {
    // If U3ExitNow called while in CPWFileDialog,
    // PostQuitMessage makes us return here instead
    // of exiting the app. Try resignalling
    PostQuitMessage(0);
    return;
  }
  if (rc == IDOK) {
    if (!pws_os::IsWindowsVistaOrGreater()) {
      // Read-only checkbox only available up to Windows XP
      // In XP, the checkbox setting overrides the main dialog checkbox
      // but the user can then change it in the main dialog if they want
      m_PKE_ReadOnly = fd.GetReadOnlyPref();
    }

    m_filespec = fd.GetPathName();
    m_MRU_combo.m_edit.SetWindowText(m_filespec);
    m_pctlPasskey->SetFocus();
    UpdateRO();
  } // rc == IDOK
}
Ejemplo n.º 3
0
LRESULT CPWPropertyPage::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
  if (GetMainDlg()->m_eye_catcher != NULL &&
      wcscmp(GetMainDlg()->m_eye_catcher, EYE_CATCHER) == 0) {
    GetMainDlg()->ResetIdleLockCounter(message);
  } else
    pws_os::Trace(L"CPWPropertyPage::WindowProc - couldn't find DboxMain ancestor\n");

  return CPropertyPage::WindowProc(message, wParam, lParam);
}
Ejemplo n.º 4
0
CManageFiltersDlg::CManageFiltersDlg(CWnd* pParent,
                               bool bFilterActive,
                               PWSFilters &mapfilters,
                               bool bCanHaveAttachments)
  : CPWDialog(CManageFiltersDlg::IDD, pParent),
  m_bMFFilterActive(bFilterActive), m_MapMFDFilters(mapfilters),
  m_selectedfilterpool(FPOOL_LAST), m_selectedfiltername(L""),
  m_activefilterpool(FPOOL_LAST), m_activefiltername(L""),
  m_selectedfilter(-1), m_activefilter(-1),
  m_bDBFiltersChanged(false),
  m_num_to_export(0), m_num_to_copy(0),
  m_pCheckImageList(NULL), m_pImageList(NULL),
  m_iSortColumn(-1), m_bSortAscending(-1), m_bDBReadOnly(false),
  m_bCanHaveAttachments(bCanHaveAttachments)
{
  PWSFilters::iterator mf_iter;

  for (mf_iter = m_MapMFDFilters.begin();
       mf_iter != m_MapMFDFilters.end();
       mf_iter++) {
    m_vcs_filters.push_back(mf_iter->first);
  }

  const COLORREF crTransparent = RGB(192, 192, 192);

  // Load all images as list in enum CheckImage and in the order specified in it
  CBitmap bitmap;
  BITMAP bm;
  bitmap.LoadBitmap(IDB_CHECKED);
  bitmap.GetBitmap(&bm); // should be 13 x 13

  m_pCheckImageList = new CImageList;
  BOOL status = m_pCheckImageList->Create(bm.bmWidth, bm.bmHeight,
                                     ILC_MASK | ILC_COLOR, 4, 0);
  ASSERT(status != 0);

  m_pCheckImageList->Add(&bitmap, crTransparent);
  bitmap.DeleteObject();
  bitmap.LoadBitmap(IDB_CHECKED_DISABLED);
  m_pCheckImageList->Add(&bitmap, crTransparent);
  bitmap.DeleteObject();
  bitmap.LoadBitmap(IDB_EMPTY);
  m_pCheckImageList->Add(&bitmap, crTransparent);
  bitmap.DeleteObject();
  bitmap.LoadBitmap(IDB_EMPTY_DISABLED);
  m_pCheckImageList->Add(&bitmap, crTransparent);
  bitmap.DeleteObject();

  if (m_bCanHaveAttachments) {
    m_sMediaTypes = GetMainDlg()->GetAllMediaTypes();
  }

  m_bDBReadOnly = GetMainDlg()->IsDBReadOnly();
}
Ejemplo n.º 5
0
void CPasswordPolicyDlg::OnGeneratePassword()
{
  UpdateData(TRUE);

  PWPolicy st_pp;

  if (m_UseNamedPolicy == BST_UNCHECKED) {
    // Use specific policy but validate it first
    if (Validate() == FALSE)
      return;

    if (m_PWUseLowercase == TRUE)
      st_pp.flags |= PWPolicy::UseLowercase;
    if (m_PWUseUppercase == TRUE)
      st_pp.flags |= PWPolicy::UseUppercase;
    if (m_PWUseDigits == TRUE)
      st_pp.flags |= PWPolicy::UseDigits;
    if (m_PWUseSymbols == TRUE)
      st_pp.flags |= PWPolicy::UseSymbols;
    if (m_PWUseHexdigits == TRUE)
      st_pp.flags |= PWPolicy::UseHexDigits;
    if (m_PWEasyVision == TRUE)
      st_pp.flags |= PWPolicy::UseEasyVision;
    if (m_PWMakePronounceable == TRUE)
      st_pp.flags |= PWPolicy::MakePronounceable;
    st_pp.length = m_PWDefaultLength;
    st_pp.digitminlength = m_PWDigitMinLength;
    st_pp.lowerminlength = m_PWLowerMinLength;
    st_pp.symbolminlength = m_PWSymbolMinLength;
    st_pp.upperminlength = m_PWUpperMinLength;

    m_SymbolsEdit.GetWindowText(m_Symbols);
    st_pp.symbols = LPCWSTR(m_Symbols);
  } else {
    // Use named policy
    if (m_PolicyNameEdit.IsWindowVisible()) {
      m_PolicyNameEdit.GetWindowText((CString &)m_policyname);
    } else {
      int index = m_cbxPolicyNames.GetCurSel();
      m_cbxPolicyNames.GetLBText(index, m_policyname);
    }
    StringX sxPolicyName(m_policyname);
    GetMainDlg()->GetPolicyFromName(sxPolicyName, st_pp);
  }

  StringX passwd;
  GetMainDlg()->MakeRandomPassword(passwd, st_pp);
  m_password = passwd.c_str();
  m_ex_password.SetWindowText(m_password);
  m_ex_password.Invalidate();

  UpdateData(FALSE);
}
Ejemplo n.º 6
0
void CManageFiltersDlg::OnFilterNew()
{
  st_filters filters;
  st_Filterkey flt_key;
  bool bJustDoIt(false), bCreated;

  flt_key.fpool = FPOOL_SESSION;

do_edit:
  bCreated = GetMainDlg()->EditFilter(&filters, false);

  flt_key.cs_filtername = filters.fname;

  if (bCreated) {
    PWSFilters::const_iterator mf_citer;
    mf_citer = m_MapMFDFilters.find(flt_key);

    // Check if already there (i.e. ask user if to replace)
    if (mf_citer != m_MapMFDFilters.end()) {
      CGeneralMsgBox gmb;
      CString cs_msg(MAKEINTRESOURCE(IDS_REPLACEFILTER));
      CString cs_title(MAKEINTRESOURCE(IDS_FILTEREXISTS));
      INT_PTR rc = gmb.MessageBox(cs_msg, cs_title, MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2);
      // If NO, go to edit again!  Not best practice to jump out of loop
      // to prior call!
      if (rc == IDNO)
        goto do_edit;

      m_MapMFDFilters.erase(flt_key);

      // If this was active, we need to clear it and re-apply
      if (m_bMFFilterActive &&
          m_activefilterpool == FPOOL_SESSION && 
          m_activefiltername == filters.fname.c_str()) {
        bJustDoIt = true;
      }
    }
    m_MapMFDFilters.insert(PWSFilters::Pair(flt_key, filters));

    // Update DboxMain
    GetMainDlg()->SetFilter(FPOOL_SESSION, filters.fname.c_str());
    if (bJustDoIt)
      GetMainDlg()->ApplyFilter(true);

    m_selectedfiltername = flt_key.cs_filtername.c_str();
    m_selectedfilterpool = flt_key.fpool;

    UpdateFilterList();
    DisplayFilterProperties(&filters);
  }
}
Ejemplo n.º 7
0
void CPasswordSubsetDlg::OnCopy()
{
  CSecString cs_data;

  int len = m_results.LineLength(m_results.LineIndex(0));
  m_results.GetLine(0, cs_data.GetBuffer(len), len);
  cs_data.ReleaseBuffer(len);

  // Remove blanks from between the characters
  // XXX - this breaks if a selected char happens to be a space...
  cs_data.Remove(_T(' '));
  GetMainDlg()->SetClipboardData(cs_data);
  GetMainDlg()->UpdateLastClipboardAction(CItemData::PASSWORD);
}
void CPasskeyEntry::ProcessPhrase()
{
  CGeneralMsgBox gmb;

  switch (GetMainDlg()->CheckPasskey(LPCWSTR(m_filespec), LPCWSTR(m_passkey))) {
  case PWScore::SUCCESS: {
    // OnOK clears the passkey, so we save it
    const CSecString save_passkey = m_passkey;
    // Try to change read-only state if user changed checkbox:
    // r/w -> r-o always succeeds
    // r-o -> r/w may fail
    // Note that if file is read-only, m_bForceReadOnly is true -> checkbox
    // is disabled -> don't need to worry about that.
    if ((m_index == GCP_RESTORE || m_index == GCP_WITHEXIT) && 
        (m_PKE_ReadOnly == TRUE) == pws_os::IsLockedFile(LPCWSTR(m_filespec))) {
      GetMainDlg()->ChangeMode(false); // false means
      //                           "don't prompt use for password", as we just got it.
    }
    CPWDialog::OnOK();
    m_passkey = save_passkey;
  }
    break;
  case PWScore::WRONG_PASSWORD:
    if (m_tries++ >= 2) { // too many tries
      CString cs_toomany;
      cs_toomany.Format(IDS_TOOMANYTRIES, m_tries);
      gmb.AfxMessageBox(cs_toomany);
    }
    else { // try again
      gmb.AfxMessageBox(m_index == GCP_CHANGEMODE ? IDS_BADPASSKEY : IDS_INCORRECTKEY);
    }
    m_pctlPasskey->SetSel(MAKEWORD(-1, 0));
    m_pctlPasskey->SetFocus();
    break;
  case PWScore::READ_FAIL:
    gmb.AfxMessageBox(IDSC_FILE_UNREADABLE);
    CPWDialog::OnCancel();
    break;
  case PWScore::TRUNCATED_FILE:
    gmb.AfxMessageBox(IDSC_FILE_TRUNCATED);
    CPWDialog::OnCancel();
    break;
  default:
    ASSERT(0);
    gmb.AfxMessageBox(IDSC_UNKNOWN_ERROR);
    CPWDialog::OnCancel();
    break;
  }
}
Ejemplo n.º 9
0
COptions_PropertySheet::COptions_PropertySheet(UINT nID, CWnd* pParent,
        const bool bLongPPs)
    : CPWPropertySheet(nID, pParent, bLongPPs),
      m_save_bSymbols(L""), m_save_iUseOwnSymbols(DEFAULT_SYMBOLS),
      m_save_iPreExpiryWarnDays(0),
      m_bIsModified(false), m_bChanged(false),
      m_bRefreshViews(false), m_bSaveGroupDisplayState(false), m_bUpdateShortcuts(false),
      m_bCheckExpired(false),
      m_save_bShowUsernameInTree(FALSE), m_save_bShowPasswordInTree(FALSE),
      m_save_bExplorerTypeTree(FALSE), m_save_bPreExpiryWarn(FALSE),
      m_save_bLockOnWindowLock(FALSE), m_bStartupShortcutExists(FALSE),
      m_save_bHighlightChanges(FALSE),
      m_pp_backup(NULL), m_pp_display(NULL), m_pp_misc(NULL),
      m_pp_passwordhistory(NULL), m_pp_security(NULL),
      m_pp_shortcuts(NULL), m_pp_system(NULL)
{
    ASSERT(pParent != NULL);

    // Set up initial values
    SetupInitialValues();

    // Only now allocate the PropertyPages - after all data there
    // to be used by their c'tors
    m_OPTMD.bLongPPs = bLongPPs; // chooseResource();

    m_pp_backup          = new COptionsBackup(this, &m_OPTMD);
    m_pp_display         = new COptionsDisplay(this, &m_OPTMD);
    m_pp_misc            = new COptionsMisc(this, &m_OPTMD);
    m_pp_passwordhistory = new COptionsPasswordHistory(this, &m_OPTMD);
    m_pp_security        = new COptionsSecurity(this, &m_OPTMD);
    m_pp_shortcuts       = new COptionsShortcuts(this, &m_OPTMD);
    m_pp_system          = new COptionsSystem(this, &m_OPTMD);

    m_pp_shortcuts->InitialSetup(GetMainDlg()->GetMapMenuShortcuts(),
                                 GetMainDlg()->GetExcludedMenuItems(),
                                 GetMainDlg()->GetReservedShortcuts());

    AddPage(m_pp_backup);
    AddPage(m_pp_display);
    AddPage(m_pp_misc);
    AddPage(m_pp_passwordhistory);
    AddPage(m_pp_security);
    AddPage(m_pp_shortcuts);
    AddPage(m_pp_system);

    CString cs_caption(MAKEINTRESOURCE(nID));
    m_psh.pszCaption = _wcsdup(cs_caption);
}
Ejemplo n.º 10
0
void CCreateShortcutDlg::OnOK() 
{
  if (UpdateData(TRUE) == FALSE)
    return;

  CGeneralMsgBox gmb;
  m_group.EmptyIfOnlyWhiteSpace();
  m_title.EmptyIfOnlyWhiteSpace();
  m_username.EmptyIfOnlyWhiteSpace();

  //Check that data is valid
  if (m_title.IsEmpty()) {
    gmb.AfxMessageBox(IDS_MUSTHAVETITLE);
    ((CEdit*)GetDlgItem(IDC_TITLE))->SetFocus();
    return;
  }

  if (!m_group.IsEmpty() && m_group[0] == '.') {
    gmb.AfxMessageBox(IDS_DOTINVALID);
    ((CEdit*)GetDlgItem(IDC_GROUP))->SetFocus();
    return;
  }

  // If there is a matching entry in our list, tell the user to try again.
  if (GetMainDlg()->Find(m_group, m_title, m_username) != app.GetMainDlg()->End()) {
    gmb.AfxMessageBox(IDS_ENTRYEXISTS, MB_OK | MB_ICONASTERISK);
    ((CEdit*)GetDlgItem(IDC_TITLE))->SetSel(MAKEWORD(-1, 0));
    ((CEdit*)GetDlgItem(IDC_TITLE))->SetFocus();
    return;
  }
  //End check

  CPWDialog::OnOK();
}
Ejemplo n.º 11
0
// CExpPWListDlg dialog
CExpPWListDlg::CExpPWListDlg(CWnd* pParent,
                             ExpiredList &expPWList,
                             const CString& a_filespec)
  : CPWDialog(CExpPWListDlg::IDD, pParent), m_expPWList(expPWList)
{
  m_Database = a_filespec; // Path Ellipsis=true, no length woes
  m_iSortedColumn = 4;
  m_bSortAscending = FALSE;
  m_idays = PWSprefs::GetInstance()->GetPref(PWSprefs::PreExpiryWarnDays);

  // Get all entries using core vector
  for (size_t i = 0; i < m_expPWList.size(); i++) {
    st_ExpLocalListEntry elle;
 
    // Find entry
    ItemListIter iter = GetMainDlg()->Find(m_expPWList[i].uuid);
    ASSERT(iter != GetMainDlg()->End());
    if (iter == GetMainDlg()->End())
      continue; // should not happen, but better than crashing as in Bug 1148
    const CItemData &ci = iter->second;
    
    // Get group/title/user values
    elle.sx_group = ci.GetGroup();
    elle.sx_title = ci.GetTitle();
    elle.sx_user  = ci.GetUser();
    if (ci.IsProtected())
      elle.sx_title += L" #";

    if (ci.HasAttRef())
      elle.sx_title += L" +";

    // Get XTime and string versions
    elle.expirytttXTime = m_expPWList[i].expirytttXTime;
    elle.sx_expirylocdate = PWSUtil::ConvertToDateTimeString(elle.expirytttXTime, PWSUtil::TMC_LOCALE);
    
    // Get entrytype (used for selecting image)
    elle.et = ci.GetEntryType();
    
    elle.uuid = m_expPWList[i].uuid;
    
    // Save in local vector
    m_vExpLocalListEntries.push_back(elle);
  }
}
Ejemplo n.º 12
0
void CDlgEnumList::OnBnClickedButtonMove()
{
	// TODO: 在此添加控件通知处理程序代码
	vector<UINT> MoveList;

	POSITION Pos=m_lvEnum.GetFirstSelectedItemPosition();
	while(Pos)
	{
		int Item=m_lvEnum.GetNextSelectedItem(Pos);
		UINT Index=(UINT)m_lvEnum.GetItemData(Item);
		if(Index<m_EnumDefineList.size())
		{
			MoveList.push_back(Index);		
		}
	}

	if(MoveList.size())
	{
		vector<CString> StructPacketList;
		GetMainDlg()->GetDataStructPacketList(DATA_STRUCT_ENUM,StructPacketList);
		CDlgListSelector Dlg;
		Dlg.Init("移动到...",StructPacketList);
		if(Dlg.DoModal()==IDOK)
		{
			for(size_t i=0;i<MoveList.size();i++)
			{
				UINT Index=MoveList[i];			

				if(!GetMainDlg()->MoveDataStruct(DATA_STRUCT_ENUM,m_ListName,Dlg.m_SelectedItem,m_EnumDefineList[Index].Name))				
				{
					AfxMessageBox("转移失败");
					return;
				}
			}
			for(int i=(int)MoveList.size()-1;i>=0;i--)
			{
				UINT Index=MoveList[i];			
				m_EnumDefineList.erase(m_EnumDefineList.begin()+Index);					
			}
		}
		FillList();
	}
}
BOOL COptionsBackup::OnInitDialog()
{
  COptions_PropertyPage::OnInitDialog();

  m_chkbox.SetTextColour(CR_DATABASE_OPTIONS);
  m_chkbox.ResetBkgColour(); //Use current window's background

  if (!GetMainDlg()->IsDBReadOnly())
    GetDlgItem(IDC_STATIC_DB_PREFS_RO_WARNING)->ShowWindow(SW_HIDE);

  if (m_backupsuffix_cbox.GetCount() == 0) {
    // add the strings in alphabetical order
    CString cs_text(MAKEINTRESOURCE(IDS_NONE));
    int nIndex;
    nIndex = m_backupsuffix_cbox.AddString(cs_text);
    m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_None);
    m_BKSFX_to_Index[PWSprefs::BKSFX_None] = nIndex;

    cs_text.LoadString(IDS_DATETIMESTRING);
    nIndex = m_backupsuffix_cbox.AddString(cs_text);
    m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_DateTime);
    m_BKSFX_to_Index[PWSprefs::BKSFX_DateTime] = nIndex;

    cs_text.LoadString(IDS_INCREMENTNUM);
    nIndex = m_backupsuffix_cbox.AddString(cs_text);
    m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_IncNumber);
    m_BKSFX_to_Index[PWSprefs::BKSFX_IncNumber] = nIndex;
  }

  m_backupsuffix_cbox.SetCurSel(m_BKSFX_to_Index[m_BackupSuffix]);

  GetDlgItem(IDC_BACKUPEXAMPLE)->SetWindowText(L"");

  CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_BKPMAXINCSPIN);

  pspin->SetBuddy(GetDlgItem(IDC_BACKUPMAXINC));
  pspin->SetRange(1, 999);
  pspin->SetBase(10);
  pspin->SetPos(m_MaxNumIncBackups);

  OnComboChanged();
  OnBackupBeforeSave();

  InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 4);
  // Note naming convention: string IDS_xxx corresponds to control IDC_xxx
  AddTool(IDC_BACKUPBEFORESAVE,        IDS_BACKUPBEFORESAVE);
  AddTool(IDC_USERBACKUPOTHERLOCATION, IDS_USERBACKUPOTHERLOCATION);
  ActivateToolTip();

  return TRUE;
}
Ejemplo n.º 14
0
void CManageFiltersDlg::ClearFilter()
{
  GetMainDlg()->ClearFilter();

  m_activefilterpool = FPOOL_LAST;
  m_activefiltername = L"";
  st_FilterItemData *pflt_idata = (st_FilterItemData *)m_FilterLC.GetItemData(m_activefilter);
  if (pflt_idata != NULL)
    pflt_idata->flt_flags &= ~MFLT_INUSE;
  m_activefilter = -1;
  m_bMFFilterActive = false;

  m_FilterLC.Invalidate();  // Ensure selected statement updated
}
Ejemplo n.º 15
0
void CManageFiltersDlg::OnFilterCopy()
{
  int numfilters = m_FilterLC.GetItemCount();
  bool bCopied(false);

  for (int i = 0; i < numfilters; i++) {
    st_FilterItemData *pflt_idata = (st_FilterItemData *)m_FilterLC.GetItemData(i);
    if ((pflt_idata->flt_flags & MFLT_REQUEST_COPY_TO_DB) != MFLT_REQUEST_COPY_TO_DB)
      continue;

    PWSFilters::iterator mf_iter;
    st_Filterkey flt_key;
    flt_key = pflt_idata->flt_key;

    mf_iter = m_MapMFDFilters.find(flt_key);
    if (mf_iter == m_MapMFDFilters.end())
      return;

    PWSFilters::const_iterator mf_citer;
    st_Filterkey flt_keydb;
    flt_keydb.fpool = FPOOL_DATABASE;
    flt_keydb.cs_filtername = flt_key.cs_filtername;
    mf_citer = m_MapMFDFilters.find(flt_keydb);

    // Check if already there (i.e. ask user if to replace)
    if (mf_citer != m_MapMFDFilters.end()) {
      CGeneralMsgBox gmb;
      CString cs_msg(MAKEINTRESOURCE(IDS_REPLACEFILTER));
      CString cs_title(MAKEINTRESOURCE(IDS_FILTEREXISTS));
      INT_PTR rc = gmb.MessageBox(cs_msg, cs_title, MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2);
      if (rc == IDNO)
        continue;  // skip this one

      // User agrees to replace
      m_MapMFDFilters.erase(flt_keydb);
    }
    m_MapMFDFilters.insert(PWSFilters::Pair(flt_keydb, mf_iter->second));

    // Turn off copy flag
    pflt_idata->flt_flags &= ~MFLT_REQUEST_COPY_TO_DB;
    m_num_to_copy--;
    bCopied = true;
  }
  if (bCopied) {
    m_bDBFiltersChanged = true;
    GetMainDlg()->ChangeOkUpdate();
  }

  UpdateFilterList();
}
Ejemplo n.º 16
0
void CManageFiltersDlg::SetFilter()
{
  GetMainDlg()->SetFilter(m_selectedfilterpool, m_selectedfiltername);
  if (!GetMainDlg()->ApplyFilter(true))
    return;

  m_activefilterpool = m_selectedfilterpool;
  m_activefiltername = m_selectedfiltername;

  st_FilterItemData *pflt_idata;
  // If the selected filter is not the current active one, remove flag
  // from old active filter
  if (m_selectedfilter != m_activefilter && m_activefilter != -1) {
    pflt_idata = (st_FilterItemData *)m_FilterLC.GetItemData(m_activefilter);
    pflt_idata->flt_flags &= ~MFLT_INUSE;
  }
  m_activefilter = m_selectedfilter;
  // Now add flag to new selected and active filter
  pflt_idata = (st_FilterItemData *)m_FilterLC.GetItemData(m_activefilter);
  pflt_idata->flt_flags |= MFLT_INUSE;
  m_bMFFilterActive = true;

  m_FilterLC.Invalidate();  // Ensure selected statement updated
}
Ejemplo n.º 17
0
BOOL CPWPropertySheet::OnInitDialog()
{
  CPropertySheet::OnInitDialog();

  // If started with Tall and won't fit - return to be called again with Wide
  if (m_bLongPPs && !GetMainDlg()->LongPPs(this)) {
    EndDialog(-1);
    return TRUE;
  }

  // It's OK - show it
  m_bKeepHidden = false;
  ShowWindow(SW_SHOW);
  return TRUE;
}
Ejemplo n.º 18
0
void CManageFiltersDlg::OnFilterExport()
{
  PWSFilters Filters;
  int numfilters = m_FilterLC.GetItemCount();

  for (int i = 0; i < numfilters; i++) {
    st_FilterItemData *pflt_idata = (st_FilterItemData *)m_FilterLC.GetItemData(i);
    if ((pflt_idata->flt_flags & MFLT_REQUEST_EXPORT) != MFLT_REQUEST_EXPORT)
      continue;

    PWSFilters::iterator mf_iter;
    mf_iter = m_MapMFDFilters.find(pflt_idata->flt_key);
    if (mf_iter == m_MapMFDFilters.end())
      continue;

    Filters.insert(PWSFilters::Pair(pflt_idata->flt_key, mf_iter->second));
  }
  if (!Filters.empty()) {
    GetMainDlg()->ExportFilters(Filters);
    Filters.clear();
  }
}
BOOL CCompareResultsDlg::OnInitDialog()
{
  std::vector<UINT> vibottombtns;
  vibottombtns.push_back(IDOK);

  AddMainCtrlID(IDC_RESULTLIST);
  AddBtnsCtrlIDs(vibottombtns);

  UINT statustext[1] = {IDS_STATCOMPANY};
  SetStatusBar(&statustext[0], 1);

  CPWResizeDialog::OnInitDialog();

  m_menuManager.Install(this);
  m_menuManager.SetImageList(&GetMainDlg()->m_MainToolBar);
  m_menuManager.SetMapping(&GetMainDlg()->m_MainToolBar);

  m_LCResults.GetHeaderCtrl()->SetDlgCtrlID(IDC_RESULTLISTHDR);

  DWORD dwExtendedStyle = m_LCResults.GetExtendedStyle();
  dwExtendedStyle |= (LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
  m_LCResults.SetExtendedStyle(dwExtendedStyle);

  CString cs_header;
  int i;

  for (i = 0; i < sizeof(FixedCols) / sizeof(FixedCols[0]); i++) {
    cs_header.LoadString(FixedCols[i]);
    m_LCResults.InsertColumn(i, cs_header);
  }

  for (i = 0; i < sizeof(OptCols) / sizeof(OptCols[0]); i++) {
    if (m_bsFields.test(OptCols[i].ft)) {
      cs_header.LoadString(OptCols[i].ids);
      // Add on the end
      int icol = m_LCResults.InsertColumn(LAST, cs_header, LVCFMT_CENTER);
      ASSERT(icol != -1);
    }
  }

  m_nCols = m_LCResults.GetHeaderCtrl()->GetItemCount();

  m_numOnlyInCurrent = m_OnlyInCurrent.size();
  m_numOnlyInComp = m_OnlyInComp.size();
  m_numConflicts = m_Conflicts.size();
  m_numIdentical = m_Identical.size();
  m_LCResults.SetItemCount((int)(m_numOnlyInCurrent + m_numOnlyInComp +
                           m_numConflicts + m_numIdentical));

  // Sort the entries first by group, title, user (not case sensitive)
  if (m_numOnlyInCurrent > 0)
    std::sort(m_OnlyInCurrent.begin(), m_OnlyInCurrent.end(), GTUCompare2);
  if (m_numOnlyInComp > 0)
    std::sort(m_OnlyInComp.begin(), m_OnlyInComp.end(), GTUCompare2);
  if (m_numConflicts > 0)
    std::sort(m_Conflicts.begin(), m_Conflicts.end(), GTUCompare2);
  if (m_numIdentical > 0)
    std::sort(m_Identical.begin(), m_Identical.end(), GTUCompare2);

  AddCompareEntries(false);
  m_LCResults.SetRedraw(FALSE);

  for (i = 0; i < m_nCols - 1; i++) {
    m_LCResults.SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER);
    int header_width = m_LCResults.GetColumnWidth(i);
    m_LCResults.SetColumnWidth(i, LVSCW_AUTOSIZE);
    int data_width = m_LCResults.GetColumnWidth(i);
    if (header_width > data_width)
      m_LCResults.SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER);
  }

  m_LCResults.SetColumnWidth(m_nCols - 1, LVSCW_AUTOSIZE_USEHEADER);
  m_LCResults.SetRedraw(TRUE);
  m_LCResults.Invalidate();

  int itotalwidth = 0;
  for (i = 0; i < m_nCols; i++) {
    itotalwidth += m_LCResults.GetColumnWidth(i);
  }

  int iMaxWidth = itotalwidth + 16;
  int iMaxHeight = 1024;
  SetMaxHeightWidth(iMaxHeight, iMaxWidth);

  GetDlgItem(IDC_COMPAREORIGINALDB)->SetWindowText(m_scFilename1);
  GetDlgItem(IDC_COMPARECOMPARISONDB)->SetWindowText(m_scFilename2);

  WriteReportData();
  UpdateStatusBar();
  return FALSE;
}
Ejemplo n.º 20
0
void CManageFiltersDlg::OnFilterImport()
{
  GetMainDlg()->ImportFilters();

  UpdateFilterList();
}
Ejemplo n.º 21
0
void CManageFiltersDlg::OnFilterDelete()
{
  if (m_selectedfilter < 0)
    return;

  CString cs_pool(L"");
  CString cs_selected = m_FilterLC.GetItemText(m_selectedfilter, 0);

  PWSFilters::iterator mf_iter;
  st_Filterkey flt_key;
  flt_key.fpool = m_selectedfilterpool;
  flt_key.cs_filtername = cs_selected;

  mf_iter = m_MapMFDFilters.find(flt_key);
  if (mf_iter == m_MapMFDFilters.end())
    return;

  cs_pool = GetFilterPoolName(flt_key.fpool);

  // Now to confirm with user:
  CString cs_msg;
  CGeneralMsgBox gmb;
  cs_msg.Format(IDS_CONFIRMFILTERDELETE, static_cast<LPCWSTR>(cs_pool),
                static_cast<LPCWSTR>(cs_selected));
  if (gmb.AfxMessageBox(cs_msg, NULL, MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) != IDYES)
    return;

  m_MapMFDFilters.erase(flt_key);
  if (m_selectedfilterpool == FPOOL_DATABASE) {
    m_bDBFiltersChanged = true;
    GetMainDlg()->ChangeOkUpdate();
  }

  st_FilterItemData *pflt_idata = (st_FilterItemData *)m_FilterLC.GetItemData(m_selectedfilter);
  if ((pflt_idata->flt_flags & MFLT_REQUEST_COPY_TO_DB) == MFLT_REQUEST_COPY_TO_DB)
    m_num_to_copy--;
  if ((pflt_idata->flt_flags & MFLT_REQUEST_EXPORT) == MFLT_REQUEST_EXPORT)
    m_num_to_export--;

  delete pflt_idata;
  m_FilterLC.DeleteItem(m_selectedfilter);
  m_FilterProperties.DeleteAllItems();
  if (m_selectedfilter == m_activefilter) {
    m_activefilter = -1;
    m_activefilterpool = FPOOL_LAST;
    m_activefiltername = L"";
    GetMainDlg()->ClearFilter();
  }

  m_selectedfilter = -1;
  m_selectedfilterpool = FPOOL_LAST;
  GetDlgItem(IDC_STATIC_FILTERNAME)->SetWindowText(L"");

  // Nothing selected
  GetDlgItem(IDC_FILTEREDIT)->EnableWindow(FALSE);
  GetDlgItem(IDC_FILTERDELETE)->EnableWindow(FALSE);

  // Update buttons
  GetDlgItem(IDC_FILTERCOPY)->EnableWindow(m_num_to_copy > 0 ? TRUE : FALSE);
  GetDlgItem(IDC_FILTEREXPORT)->EnableWindow(m_num_to_export > 0 ? TRUE : FALSE);
}
Ejemplo n.º 22
0
void CManageFiltersDlg::OnFilterEdit()
{
  bool bJustDoIt(false), bChanged, bReplacedOther(false);
  PWSFilters::iterator mf_iter;
  st_Filterkey flt_key, flt_otherkey;
  flt_key.fpool = m_selectedfilterpool;
  flt_key.cs_filtername = m_selectedfiltername;

  mf_iter = m_MapMFDFilters.find(flt_key);
  if (mf_iter == m_MapMFDFilters.end())
    return;

  // Pass a copy of (not reference to) of the current filter in case 
  // the user cancels the change and the current state is invalid and 
  // corrupts the copy in the map
  st_filters filters = mf_iter->second;

do_edit:
  bChanged = GetMainDlg()->EditFilter(&filters, false);
  if (bChanged) {
    // Has user changed the filter's name?
    // If so, check for conflict.
    if (m_selectedfiltername != filters.fname.c_str()) {
      PWSFilters::const_iterator mf_citer;

      flt_otherkey.fpool = m_selectedfilterpool;
      flt_otherkey.cs_filtername = filters.fname;

      mf_citer = m_MapMFDFilters.find(flt_otherkey);

      // Check if already there (i.e. ask user if to replace)
      if (mf_citer != m_MapMFDFilters.end()) {
        CGeneralMsgBox gmb;
        CString cs_msg(MAKEINTRESOURCE(IDS_REPLACEFILTER));
        CString cs_title(MAKEINTRESOURCE(IDS_FILTEREXISTS));
        INT_PTR rc = gmb.MessageBox(cs_msg, cs_title, MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2);
        // If NO, go to edit again!  Not best practice to jump out of loop
        // to prior call!
        if (rc == IDNO)
          goto do_edit;

        bReplacedOther = true;
      }
    }

    if (flt_key.fpool == FPOOL_DATABASE)
      m_bDBFiltersChanged = true;

    // If the original was active, we need to clear it and re-apply
    if (m_bMFFilterActive &&
        m_activefilterpool == flt_key.fpool && 
        m_activefiltername == m_selectedfiltername) {
      bJustDoIt = true;
    }

    // User may have changed name (and so key) - delete and add again
    // Have to anyway, even if name not changed.
    m_MapMFDFilters.erase(bReplacedOther ? flt_otherkey : flt_key);
    flt_key.cs_filtername = filters.fname;
    m_MapMFDFilters.insert(PWSFilters::Pair(flt_key, filters));
    m_selectedfiltername = flt_key.cs_filtername.c_str();

    // Update DboxMain's current filter
    GetMainDlg()->SetFilter(flt_key.fpool, filters.fname.c_str());
    if (bJustDoIt)
      GetMainDlg()->ApplyFilter(true);

    UpdateFilterList();
    DisplayFilterProperties(&filters);
  }
}
Ejemplo n.º 23
0
void COptions_PropertySheet::SetupInitialValues()
{
    PWSprefs *prefs = PWSprefs::GetInstance();

    // Set up a copy of the preferences
    prefs->SetupCopyPrefs();

    // Backup Data
    CString cs_backupPrefix, cs_backupDir;
    m_OPTMD.CurrentFile = GetMainDlg()->GetCurFile().c_str();
    m_OPTMD.SaveImmediately =
        prefs->GetPref(PWSprefs::SaveImmediately) ? TRUE : FALSE;
    m_OPTMD.BackupBeforeSave =
        prefs->GetPref(PWSprefs::BackupBeforeEverySave) ? TRUE : FALSE;
    cs_backupPrefix =
        prefs->GetPref(PWSprefs::BackupPrefixValue).c_str();
    m_OPTMD.BackupPrefix = cs_backupPrefix.IsEmpty() ? 0 : 1;
    m_OPTMD.UserBackupPrefix = (LPCWSTR)cs_backupPrefix;
    m_OPTMD.BackupSuffix =
        prefs->GetPref(PWSprefs::BackupSuffix);
    m_OPTMD.MaxNumIncBackups =
        prefs->GetPref(PWSprefs::BackupMaxIncremented);
    cs_backupDir =
        prefs->GetPref(PWSprefs::BackupDir).c_str();
    m_OPTMD.BackupLocation = cs_backupDir.IsEmpty() ? 0 : 1;
    m_OPTMD.UserBackupOtherLocation = (LPCWSTR)cs_backupDir;

    // Display Data
    m_OPTMD.AlwaysOnTop =
        prefs->GetPref(PWSprefs::AlwaysOnTop) ? TRUE : FALSE;
    m_OPTMD.ShowPasswordInEdit =
        prefs->GetPref(PWSprefs::ShowPWDefault) ? TRUE : FALSE;
    m_OPTMD.ShowUsernameInTree = m_save_bShowUsernameInTree =
                                     prefs->GetPref(PWSprefs::ShowUsernameInTree) ? TRUE : FALSE;
    m_OPTMD.ShowPasswordInTree = m_save_bShowPasswordInTree =
                                     prefs->GetPref(PWSprefs::ShowPasswordInTree) ? TRUE : FALSE;
    m_OPTMD.ShowNotesAsTipsInViews =
        prefs->GetPref(PWSprefs::ShowNotesAsTooltipsInViews) ? TRUE : FALSE;
    m_OPTMD.ExplorerTypeTree = m_save_bExplorerTypeTree =
                                   prefs->GetPref(PWSprefs::ExplorerTypeTree) ? TRUE : FALSE;
    m_OPTMD.EnableGrid =
        prefs->GetPref(PWSprefs::ListViewGridLines) ? TRUE : FALSE;
    m_OPTMD.NotesShowInEdit =
        prefs->GetPref(PWSprefs::ShowNotesDefault) ? TRUE : FALSE;
    m_OPTMD.WordWrapNotes =
        prefs->GetPref(PWSprefs::NotesWordWrap) ? TRUE : FALSE;
    m_OPTMD.PreExpiryWarn = m_save_bPreExpiryWarn =
                                prefs->GetPref(PWSprefs::PreExpiryWarn) ? TRUE : FALSE;
    m_OPTMD.PreExpiryWarnDays = m_save_iPreExpiryWarnDays =
                                    prefs->GetPref(PWSprefs::PreExpiryWarnDays);
    m_OPTMD.TreeDisplayStatusAtOpen =
        prefs->GetPref(PWSprefs::TreeDisplayStatusAtOpen);
    m_OPTMD.TrayIconColour =
        prefs->GetPref(PWSprefs::ClosedTrayIconColour);
    m_OPTMD.HighlightChanges = m_save_bHighlightChanges =
                                   prefs->GetPref(PWSprefs::HighlightChanges);

    // Misc Data
    m_OPTMD.ConfirmDelete =
        prefs->GetPref(PWSprefs::DeleteQuestion) ? FALSE : TRUE;
    m_OPTMD.MaintainDatetimeStamps =
        prefs->GetPref(PWSprefs::MaintainDateTimeStamps) ? TRUE : FALSE;
    m_OPTMD.EscExits =
        prefs->GetPref(PWSprefs::EscExits) ? TRUE : FALSE;
    m_OPTMD.DoubleClickAction =
        prefs->GetPref(PWSprefs::DoubleClickAction);
    m_OPTMD.ShiftDoubleClickAction =
        prefs->GetPref(PWSprefs::ShiftDoubleClickAction);

    m_OPTMD.UseDefuser =
        prefs->GetPref(PWSprefs::UseDefaultUser) ? TRUE : FALSE;
    m_OPTMD.DefUsername =
        prefs->GetPref(PWSprefs::DefaultUsername).c_str();
    m_OPTMD.QuerySetDef =
        prefs->GetPref(PWSprefs::QuerySetDef) ? TRUE : FALSE;
    m_OPTMD.OtherBrowserLocation =
        prefs->GetPref(PWSprefs::AltBrowser).c_str();
    m_OPTMD.BrowserCmdLineParms =
        prefs->GetPref(PWSprefs::AltBrowserCmdLineParms).c_str();
    m_OPTMD.OtherEditorLocation =
        prefs->GetPref(PWSprefs::AltNotesEditor).c_str();
    CString cs_dats =
        prefs->GetPref(PWSprefs::DefaultAutotypeString).c_str();
    if (cs_dats.IsEmpty())
        cs_dats = DEFAULT_AUTOTYPE;
    m_OPTMD.AutotypeText = (LPCWSTR)cs_dats;
    m_OPTMD.AutotypeDelay =
        prefs->GetPref(PWSprefs::DefaultAutotypeDelay);
    m_OPTMD.MinAuto =
        prefs->GetPref(PWSprefs::MinimizeOnAutotype) ? TRUE : FALSE;

    // Password History Data
    m_OPTMD.SavePWHistory =
        prefs->GetPref(PWSprefs::SavePasswordHistory) ? TRUE : FALSE;
    m_OPTMD.PWHistoryNumDefault =
        prefs->GetPref(PWSprefs::NumPWHistoryDefault);
    m_OPTMD.PWHAction = 0;

    // Security Data
    m_OPTMD.ClearClipboardOnMinimize =
        prefs->GetPref(PWSprefs::ClearClipboardOnMinimize) ? TRUE : FALSE;
    m_OPTMD.ClearClipboardOnExit =
        prefs->GetPref(PWSprefs::ClearClipboardOnExit) ? TRUE : FALSE;
    m_OPTMD.LockOnMinimize =
        prefs->GetPref(PWSprefs::DatabaseClear) ? TRUE : FALSE;
    m_OPTMD.ConfirmCopy =
        prefs->GetPref(PWSprefs::DontAskQuestion) ? FALSE : TRUE;
    m_OPTMD.LockOnWindowLock = m_save_bLockOnWindowLock =
                                   prefs->GetPref(PWSprefs::LockOnWindowLock) ? TRUE : FALSE;
    m_OPTMD.LockOnIdleTimeout =
        prefs->GetPref(PWSprefs::LockDBOnIdleTimeout) ? TRUE : FALSE;
    m_OPTMD.IdleTimeOut =
        prefs->GetPref(PWSprefs::IdleTimeout);
    m_OPTMD.HashIters = GetMainDlg()->GetHashIters();
    m_OPTMD.CopyPswdBrowseURL =
        prefs->GetPref(PWSprefs::CopyPasswordWhenBrowseToURL) ? TRUE : FALSE;

    // Shortcut Data
    m_OPTMD.AppHotKeyValue = int32(prefs->GetPref(PWSprefs::HotKey));
    // Can't be enabled if not set!
    if (m_OPTMD.AppHotKeyValue == 0)
        m_OPTMD.AppHotKeyEnabled = FALSE;
    else
        m_OPTMD.AppHotKeyEnabled =
            prefs->GetPref(PWSprefs::HotKeyEnabled) ? TRUE : FALSE;

    m_OPTMD.ColWidth =
        prefs->GetPref(PWSprefs::OptShortcutColumnWidth);
    m_OPTMD.DefColWidth =
        prefs->GetPrefDefVal(PWSprefs::OptShortcutColumnWidth);

    // System Data
    CShortcut pws_shortcut;
    m_OPTMD.MaxREItems =
        prefs->GetPref(PWSprefs::MaxREItems);
    m_OPTMD.UseSystemTray =
        prefs->GetPref(PWSprefs::UseSystemTray) ? TRUE : FALSE;
    m_OPTMD.HideSystemTray =
        prefs->GetPref(PWSprefs::HideSystemTray) ? TRUE : FALSE;
    m_OPTMD.MaxMRUItems =
        prefs->GetPref(PWSprefs::MaxMRUItems);
    m_OPTMD.MRUOnFileMenu =
        prefs->GetPref(PWSprefs::MRUOnFileMenu);
    const CString PWSLnkName(L"Password Safe"); // for startup shortcut
    m_OPTMD.Startup = m_bStartupShortcutExists =
                          pws_shortcut.isLinkExist(PWSLnkName, CSIDL_STARTUP);
    m_OPTMD.DefaultOpenRO = prefs->GetPref(PWSprefs::DefaultOpenRO) ? TRUE : FALSE;
    m_OPTMD.MultipleInstances =
        prefs->GetPref(PWSprefs::MultipleInstances) ? TRUE : FALSE;
}
void CViewReport::SendToClipboard()
{
  GetMainDlg()->SetClipboardData(m_pString);
}
void CCompareResultsDlg::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
{
  // Add pretty pictures to our menu
  GetMainDlg()->CPRInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
}
Ejemplo n.º 26
0
BOOL CPasswordPolicyDlg::OnInitDialog()
{
  CPWDialog::OnInitDialog();

  // If started with Tall and won't fit - return to be called again with Wide
  if (m_bLongPPs && !GetMainDlg()->LongPPs(this)) {
    EndDialog(-1);
    return FALSE;
  }
  
  if (m_bReadOnly && m_uicaller != IDS_GENERATEPASSWORD) {
    // Change OK button test
    CString cs_close(MAKEINTRESOURCE(IDS_CLOSE));
    GetDlgItem(IDOK)->SetWindowText(cs_close);

    // Hide the Cancel button
    GetDlgItem(IDCANCEL)->EnableWindow(FALSE);
    GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE);
  }

  CString cs_title;
  switch (m_uicaller) {
  case IDS_OPTIONS:
    // Set correct window title
    cs_title.LoadString(IDS_EDIT_DEFAULT_POLICY);
    SetWindowText(cs_title);

    // These are only used in Manage -> Generate Password or Add/Edit Policy names
    GetDlgItem(IDC_GENERATEPASSWORD)->EnableWindow(FALSE);
    GetDlgItem(IDC_GENERATEPASSWORD)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_COPYPASSWORD)->EnableWindow(FALSE);
    GetDlgItem(IDC_COPYPASSWORD)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_PASSWORD)->EnableWindow(FALSE);
    GetDlgItem(IDC_PASSWORD)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_POLICYNAME)->EnableWindow(FALSE);
    GetDlgItem(IDC_POLICYNAME)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_POLICYLIST)->EnableWindow(FALSE);
    GetDlgItem(IDC_POLICYLIST)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_USENAMED_POLICY)->EnableWindow(FALSE);
    GetDlgItem(IDC_USENAMED_POLICY)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_STATIC_NAMEDPOLICY)->ShowWindow(SW_HIDE);
    break;
  case IDS_GENERATEPASSWORD:
    {
      // Set correct window title
      cs_title.LoadString(IDS_GENERATEPASSWORD);
      SetWindowText(cs_title);

      // These are only used in Manage -> Add/Edit Policy names
      GetDlgItem(IDC_POLICYNAME)->EnableWindow(FALSE);
      GetDlgItem(IDC_POLICYNAME)->ShowWindow(SW_HIDE);

      // Used to generate passwords
      GetDlgItem(IDC_POLICYLIST)->ShowWindow(SW_SHOW);
      GetDlgItem(IDC_USENAMED_POLICY)->EnableWindow(TRUE);
      GetDlgItem(IDC_USENAMED_POLICY)->ShowWindow(SW_SHOW);
      GetDlgItem(IDC_STATIC_NAMEDPOLICY)->ShowWindow(SW_HIDE);

      // Populate the combo box
      m_cbxPolicyNames.ResetContent();

      // Get all password policy names
      std::vector<std::wstring> vNames;
      GetMainDlg()->GetPolicyNames(vNames);

      // Add Default
      const CString cs_default(MAKEINTRESOURCE(IDSC_DEFAULT_POLICY));
      m_cbxPolicyNames.AddString(cs_default);

      for (std::vector<std::wstring>::iterator iter = vNames.begin();
           iter != vNames.end(); ++iter) {
        m_cbxPolicyNames.AddString(iter->c_str());
      }

      // Select Default
      m_cbxPolicyNames.SelectString(-1, cs_default);

      // and check the box
      ((CButton *)GetDlgItem(IDC_USENAMED_POLICY))->SetCheck(BST_CHECKED);

      // Centre the OK button & change its text
      RECT rc, rcOK;
      CWnd *pOK = GetDlgItem(IDOK);

      GetClientRect(&rc);
      pOK->GetWindowRect(&rcOK);
      ScreenToClient(&rcOK);
      int top = rcOK.top;
      pOK->GetClientRect(&rcOK);
      int left = (rc.right - rcOK.right) / 2;
      pOK->MoveWindow(left, top, rcOK.right, rcOK.bottom);

      CString cs_close(MAKEINTRESOURCE(IDS_CLOSE));
      pOK->SetWindowText(cs_close);

      // Hide the Cancel & Help buttons
      GetDlgItem(IDCANCEL)->EnableWindow(FALSE);
      GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE);
      GetDlgItem(ID_HELP)->EnableWindow(FALSE);
      GetDlgItem(ID_HELP)->ShowWindow(SW_HIDE);

      Fonts::GetInstance()->ApplyPasswordFont(GetDlgItem(IDC_PASSWORD));
      m_ex_password.SetSecure(false);

      // Remove password character so that the password is displayed
      m_ex_password.SetPasswordChar(0);

      // Load bitmap
      UINT nImageID = PWSprefs::GetInstance()->GetPref(PWSprefs::UseNewToolbar) ?
        IDB_COPYPASSWORD_NEW : IDB_COPYPASSWORD_CLASSIC;
      BOOL brc = m_CopyPswdBitmap.Attach(::LoadImage(
                                                     ::AfxFindResourceHandle(MAKEINTRESOURCE(nImageID), RT_BITMAP),
                                                     MAKEINTRESOURCE(nImageID), IMAGE_BITMAP, 0, 0,
                                                     (LR_DEFAULTSIZE | LR_CREATEDIBSECTION | LR_SHARED)));
      ASSERT(brc);

      FixBitmapBackground(m_CopyPswdBitmap);
      CButton *pBtn = (CButton *)GetDlgItem(IDC_COPYPASSWORD);
      pBtn->SetBitmap(m_CopyPswdBitmap);

      break;
    }
  case IDS_PSWDPOLICY:
    // Set correct window title
    cs_title.LoadString(m_policyname.IsEmpty() ? IDS_ADD_NAMED_POLICY : IDS_EDIT_NAMED_POLICY);
    SetWindowText(cs_title);

    // These are only used in Manage -> Password Policy
    GetDlgItem(IDC_GENERATEPASSWORD)->EnableWindow(FALSE);
    GetDlgItem(IDC_GENERATEPASSWORD)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_COPYPASSWORD)->EnableWindow(FALSE);
    GetDlgItem(IDC_COPYPASSWORD)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_PASSWORD)->EnableWindow(FALSE);
    GetDlgItem(IDC_PASSWORD)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_POLICYLIST)->EnableWindow(FALSE);
    GetDlgItem(IDC_POLICYLIST)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_USENAMED_POLICY)->EnableWindow(FALSE);
    GetDlgItem(IDC_USENAMED_POLICY)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_STATIC_NAMEDPOLICY)->ShowWindow(SW_SHOW);

    if (!m_policyname.IsEmpty() && m_iter->second.usecount > 0) {
      // Cannot edit the policy 'Name' if it is present and use count > 0
      m_PolicyNameEdit.SetReadOnly(TRUE);
      m_PolicyNameEdit.EnableWindow(FALSE);
    }

    m_PolicyNameEdit.SetWindowText(m_policyname);
    // Max. length of policy name is 255 - only one byte used for length
    // in database header
    m_PolicyNameEdit.SetLimitText(255);
    break;
  }

  setupBuddy(this, IDC_PWLENSPIN, IDC_DEFPWLENGTH, m_PWDefaultLength, 4);
  setupBuddy(this, IDC_SPINDIGITS, IDC_MINDIGITLENGTH, m_PWDigitMinLength);
  setupBuddy(this, IDC_SPINLOWERCASE, IDC_MINLOWERLENGTH, m_PWLowerMinLength);
  setupBuddy(this, IDC_SPINUPPERCASE, IDC_MINUPPERLENGTH, m_PWUpperMinLength);
  setupBuddy(this, IDC_SPINSYMBOLS, IDC_MINSYMBOLLENGTH, m_PWSymbolMinLength);

  m_save[SAVE_LOWERCASE] = m_PWUseLowercase;
  m_save[SAVE_UPPERCASE] = m_PWUseUppercase;
  m_save[SAVE_DIGITS] = m_PWUseDigits;
  m_save[SAVE_SYMBOLS] = m_PWUseSymbols;
  m_save[SAVE_EASYVISION] = m_PWEasyVision;
  m_save[SAVE_PRONOUNCEABLE] = m_PWMakePronounceable;

  m_savelen[SAVE_LOWERCASE] = m_PWLowerMinLength;
  m_savelen[SAVE_UPPERCASE] = m_PWUpperMinLength;
  m_savelen[SAVE_DIGITS] = m_PWDigitMinLength;
  m_savelen[SAVE_SYMBOLS] = m_PWSymbolMinLength;

  // Set up the correct controls (enabled/disabled)
  do_hex(m_PWUseHexdigits == TRUE);

  int iSet = EVPR_NONE;
  if (m_PWEasyVision == TRUE)
    iSet = EVPR_EV;
  else
    if (m_PWMakePronounceable == TRUE)
      iSet = EVPR_PR;
  do_easyorpronounceable(iSet);

  GetDlgItem(IDC_OWNSYMBOLS)->EnableWindow(m_PWUseSymbols);
  GetDlgItem(IDC_RESET_SYMBOLS)->EnableWindow(m_PWUseSymbols);

  m_SymbolsEdit.SetWindowText(m_Symbols);

  if (m_uicaller == IDS_GENERATEPASSWORD) {
    // Disable Specific policy controls as default is to use a named policy (database default)
    SetSpecificPolicyControls(FALSE);

    m_pToolTipCtrl = new CToolTipCtrl;
    if (!m_pToolTipCtrl->Create(this, TTS_ALWAYSTIP | TTS_BALLOON | TTS_NOPREFIX)) {
      pws_os::Trace(L"Unable To create Advanced Dialog ToolTip\n");
      delete m_pToolTipCtrl;
      m_pToolTipCtrl = NULL;
      return TRUE;
    }

    // Tooltips
    EnableToolTips();

    // Activate the tooltip control.
    m_pToolTipCtrl->Activate(TRUE);
    m_pToolTipCtrl->SetMaxTipWidth(300);
    // Quadruple the time to allow reading by user
    int iTime = m_pToolTipCtrl->GetDelayTime(TTDT_AUTOPOP);
    m_pToolTipCtrl->SetDelayTime(TTDT_AUTOPOP, 4 * iTime);

    AddTool(IDC_COPYPASSWORD, IDS_CLICKTOCOPY);
  }

  // Set appropriate focus
  GetDlgItem(m_uicaller == IDS_GENERATEPASSWORD ? IDC_GENERATEPASSWORD : IDCANCEL)->SetFocus();
  return FALSE;
}
Ejemplo n.º 27
0
BOOL COptionsBackup::OnInitDialog()
{
  COptions_PropertyPage::OnInitDialog();

  m_chkbox.SetTextColour(CR_DATABASE_OPTIONS);
  m_chkbox.ResetBkgColour(); //Use current window's background

  if (GetMainDlg()->IsDBOpen() && !GetMainDlg()->IsDBReadOnly()) {
    GetDlgItem(IDC_STATIC_DB_PREFS_RO_WARNING)->ShowWindow(SW_HIDE);
  }

  // Database preferences - can't change in R/O mode of if no DB is open
  if (!GetMainDlg()->IsDBOpen() || GetMainDlg()->IsDBReadOnly()) {
    CString cs_Preference_Warning;
    CString cs_temp(MAKEINTRESOURCE(GetMainDlg()->IsDBOpen() ? IDS_DB_READ_ONLY : IDS_NO_DB));

    cs_Preference_Warning.Format(IDS_STATIC_DB_PREFS_RO_WARNING, static_cast<LPCWSTR>(cs_temp));
    GetDlgItem(IDC_STATIC_DB_PREFS_RO_WARNING)->SetWindowText(cs_Preference_Warning);

    GetDlgItem(IDC_SAVEIMMEDIATELY)->EnableWindow(FALSE);
  }

  if (m_backupsuffix_cbox.GetCount() == 0) {
    // add the strings in alphabetical order
    CString cs_text(MAKEINTRESOURCE(IDS_NONE));
    int nIndex;
    nIndex = m_backupsuffix_cbox.AddString(cs_text);
    m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_None);
    m_BKSFX_to_Index[PWSprefs::BKSFX_None] = nIndex;

    cs_text.LoadString(IDS_DATETIMESTRING);
    nIndex = m_backupsuffix_cbox.AddString(cs_text);
    m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_DateTime);
    m_BKSFX_to_Index[PWSprefs::BKSFX_DateTime] = nIndex;

    cs_text.LoadString(IDS_INCREMENTNUM);
    nIndex = m_backupsuffix_cbox.AddString(cs_text);
    m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_IncNumber);
    m_BKSFX_to_Index[PWSprefs::BKSFX_IncNumber] = nIndex;
  }

  m_backupsuffix_cbox.SetCurSel(m_BKSFX_to_Index[m_BackupSuffix]);

  GetDlgItem(IDC_BACKUPEXAMPLE)->SetWindowText(L"");

  CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_BKPMAXINCSPIN);

  pspin->SetBuddy(GetDlgItem(IDC_BACKUPMAXINC));
  pspin->SetRange(1, 999);
  pspin->SetBase(10);
  pspin->SetPos(m_MaxNumIncBackups);

  OnComboChanged();
  OnBackupBeforeSave();

  if (m_BackupLocation == 1) {
    ExpandBackupPath();
  }

  if (InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 0)) {
    m_Help1.Init(IDB_QUESTIONMARK);
    m_Help2.Init(IDB_QUESTIONMARK);
    m_Help3.Init(IDB_QUESTIONMARK);
    m_Help4.Init(IDB_QUESTIONMARK);

    // Note naming convention: string IDS_xxx corresponds to control IDC_xxx_HELP
    AddTool(IDC_BACKUPBEFORESAVEHELP, IDS_BACKUPBEFORESAVE);
    AddTool(IDC_USERBACKUPOTHERLOCATIONHELP, IDS_USERBACKUPOTHERLOCATION);
    AddTool(IDC_USERBACKUPOTHERLOCATIONHELP2, IDS_USERBACKUPOTHERLOCATION2);
    AddTool(IDC_SAVEIMMEDIATELYHELP, IDS_SAVEIMMEDIATELY);
    ActivateToolTip();
  } else {
    m_Help1.EnableWindow(FALSE);
    m_Help1.ShowWindow(SW_HIDE);
    m_Help2.EnableWindow(FALSE);
    m_Help2.ShowWindow(SW_HIDE);
    m_Help3.EnableWindow(FALSE);
    m_Help3.ShowWindow(SW_HIDE);
    m_Help4.EnableWindow(FALSE);
    m_Help4.ShowWindow(SW_HIDE);
  }

  return TRUE;
}
Ejemplo n.º 28
0
void COptions_PropertySheet::UpdateCopyPreferences()
{
    PWSprefs *prefs = PWSprefs::GetInstance();

    // Now update the Application preferences.
    // In PropertyPage alphabetic order
    // Note: Updating the copy values - especially important for DB preferences!!!

    // Backup
    prefs->SetPref(PWSprefs::BackupBeforeEverySave,
                   m_OPTMD.BackupBeforeSave == TRUE, true);
    prefs->SetPref(PWSprefs::BackupPrefixValue,
                   LPCWSTR(m_OPTMD.UserBackupPrefix), true);
    prefs->SetPref(PWSprefs::BackupSuffix,
                   (unsigned int)m_OPTMD.BackupSuffix, true);
    prefs->SetPref(PWSprefs::BackupMaxIncremented,
                   m_OPTMD.MaxNumIncBackups, true);
    if (!m_OPTMD.UserBackupOtherLocation.IsEmpty()) {
        // Make sure it ends in a slash!
        if (m_OPTMD.UserBackupOtherLocation.Right(1) != CSecString(L'\\'))
            m_OPTMD.UserBackupOtherLocation += L'\\';
    }
    prefs->SetPref(PWSprefs::BackupDir,
                   LPCWSTR(m_OPTMD.UserBackupOtherLocation), true);

    // Display
    prefs->SetPref(PWSprefs::AlwaysOnTop,
                   m_OPTMD.AlwaysOnTop == TRUE, true);
    prefs->SetPref(PWSprefs::ShowNotesAsTooltipsInViews,
                   m_OPTMD.ShowNotesAsTipsInViews == TRUE, true);
    prefs->SetPref(PWSprefs::ExplorerTypeTree,
                   m_OPTMD.ExplorerTypeTree == TRUE, true);
    prefs->SetPref(PWSprefs::ListViewGridLines,
                   m_OPTMD.EnableGrid == TRUE, true);
    prefs->SetPref(PWSprefs::NotesWordWrap,
                   m_OPTMD.WordWrapNotes == TRUE, true);
    prefs->SetPref(PWSprefs::PreExpiryWarn,
                   m_OPTMD.PreExpiryWarn == TRUE, true);
    prefs->SetPref(PWSprefs::PreExpiryWarnDays,
                   m_OPTMD.PreExpiryWarnDays, true);
    prefs->SetPref(PWSprefs::ClosedTrayIconColour,
                   m_OPTMD.TrayIconColour, true);
    if (m_save_bHighlightChanges != m_OPTMD.HighlightChanges) {
        prefs->SetPref(PWSprefs::HighlightChanges,
                       m_OPTMD.HighlightChanges == TRUE, true);
        m_bRefreshViews = true;
    }

    // Misc
    prefs->SetPref(PWSprefs::DeleteQuestion,
                   m_OPTMD.ConfirmDelete == FALSE, true);
    prefs->SetPref(PWSprefs::EscExits,
                   m_OPTMD.EscExits == TRUE, true);
    // by strange coincidence, the values of the enums match the indices
    // of the radio buttons in the following :-)
    prefs->SetPref(PWSprefs::DoubleClickAction,
                   (unsigned int)m_OPTMD.DoubleClickAction, true);
    prefs->SetPref(PWSprefs::ShiftDoubleClickAction,
                   (unsigned int)m_OPTMD.ShiftDoubleClickAction, true);

    prefs->SetPref(PWSprefs::QuerySetDef,
                   m_OPTMD.QuerySetDef == TRUE, true);
    prefs->SetPref(PWSprefs::AltBrowser,
                   LPCWSTR(m_OPTMD.OtherBrowserLocation), true);
    prefs->SetPref(PWSprefs::AltBrowserCmdLineParms,
                   LPCWSTR(m_OPTMD.BrowserCmdLineParms), true);
    prefs->SetPref(PWSprefs::AltNotesEditor,
                   LPCWSTR(m_OPTMD.OtherEditorLocation), true);
    prefs->SetPref(PWSprefs::MinimizeOnAutotype,
                   m_OPTMD.MinAuto == TRUE, true);

    prefs->SetPref(PWSprefs::ClearClipboardOnMinimize,
                   m_OPTMD.ClearClipboardOnMinimize == TRUE, true);
    prefs->SetPref(PWSprefs::ClearClipboardOnExit,
                   m_OPTMD.ClearClipboardOnExit == TRUE, true);
    prefs->SetPref(PWSprefs::DatabaseClear,
                   m_OPTMD.LockOnMinimize == TRUE, true);
    prefs->SetPref(PWSprefs::DontAskQuestion,
                   m_OPTMD.ConfirmCopy == FALSE, true);
    prefs->SetPref(PWSprefs::LockOnWindowLock,
                   m_OPTMD.LockOnWindowLock == TRUE, true);
    prefs->SetPref(PWSprefs::CopyPasswordWhenBrowseToURL,
                   m_OPTMD.CopyPswdBrowseURL == TRUE, true);

    prefs->SetPref(PWSprefs::UseSystemTray,
                   m_OPTMD.UseSystemTray == TRUE, true);
    prefs->SetPref(PWSprefs::HideSystemTray,
                   m_OPTMD.HideSystemTray == TRUE, true);

    prefs->SetPref(PWSprefs::MaxREItems,
                   m_OPTMD.MaxREItems, true);
    prefs->SetPref(PWSprefs::MaxMRUItems,
                   m_OPTMD.MaxMRUItems, true);
    if (m_OPTMD.MaxMRUItems == 0) {
        // Put them on File menu where they don't take up any room
        prefs->SetPref(PWSprefs::MRUOnFileMenu, true, true);
    } else {
        prefs->SetPref(PWSprefs::MRUOnFileMenu,
                       m_OPTMD.MRUOnFileMenu == TRUE, true);
    }
    prefs->SetPref(PWSprefs::DefaultOpenRO,
                   m_OPTMD.DefaultOpenRO == TRUE, true);
    prefs->SetPref(PWSprefs::MultipleInstances,
                   m_OPTMD.MultipleInstances == TRUE, true);

    // Now update database preferences
    // In PropertyPage alphabetic order
    prefs->SetPref(PWSprefs::SaveImmediately,
                   m_OPTMD.SaveImmediately == TRUE, true);

    prefs->SetPref(PWSprefs::ShowPWDefault,
                   m_OPTMD.ShowPasswordInEdit == TRUE, true);
    prefs->SetPref(PWSprefs::ShowUsernameInTree,
                   m_OPTMD.ShowUsernameInTree == TRUE, true);
    prefs->SetPref(PWSprefs::ShowPasswordInTree,
                   m_OPTMD.ShowPasswordInTree == TRUE, true);
    prefs->SetPref(PWSprefs::TreeDisplayStatusAtOpen,
                   m_OPTMD.TreeDisplayStatusAtOpen, true);
    prefs->SetPref(PWSprefs::ShowNotesDefault,
                   m_OPTMD.NotesShowInEdit == TRUE, true);

    prefs->SetPref(PWSprefs::MaintainDateTimeStamps,
                   m_OPTMD.MaintainDatetimeStamps == TRUE, true);

    prefs->SetPref(PWSprefs::UseDefaultUser,
                   m_OPTMD.UseDefuser == TRUE, true);
    prefs->SetPref(PWSprefs::DefaultUsername,
                   LPCWSTR(m_OPTMD.DefUsername), true);

    if (m_OPTMD.AutotypeText.IsEmpty() || m_OPTMD.AutotypeText == DEFAULT_AUTOTYPE)
        prefs->SetPref(PWSprefs::DefaultAutotypeString, L"", true);
    else if (m_OPTMD.AutotypeText != DEFAULT_AUTOTYPE)
        prefs->SetPref(PWSprefs::DefaultAutotypeString,
                       LPCWSTR(m_OPTMD.AutotypeText), true);
    prefs->SetPref(PWSprefs::DefaultAutotypeDelay,
                   m_OPTMD.AutotypeDelay,
                   true);

    prefs->SetPref(PWSprefs::SavePasswordHistory,
                   m_OPTMD.SavePWHistory == TRUE, true);
    if (m_OPTMD.SavePWHistory == TRUE)
        prefs->SetPref(PWSprefs::NumPWHistoryDefault,
                       m_OPTMD.PWHistoryNumDefault, true);

    prefs->SetPref(PWSprefs::LockDBOnIdleTimeout,
                   m_OPTMD.LockOnIdleTimeout == TRUE, true);
    prefs->SetPref(PWSprefs::IdleTimeout,
                   m_OPTMD.IdleTimeOut, true);

    GetMainDlg()->SetHashIters(m_OPTMD.HashIters);

    // Changing ExplorerTypeTree changes order of items,
    // which DisplayStatus implicitly depends upon
    if (m_save_bExplorerTypeTree != m_OPTMD.ExplorerTypeTree)
        m_bSaveGroupDisplayState = m_bRefreshViews = true;

    // If user has turned on/changed warnings of expired passwords - check now
    if (m_OPTMD.PreExpiryWarn      == TRUE   &&
            (m_save_bPreExpiryWarn     == FALSE  ||
             m_save_iPreExpiryWarnDays != m_OPTMD.PreExpiryWarnDays))
        m_bCheckExpired = m_bRefreshViews = true;

    // Deal with shortcuts
    prefs->SetPref(PWSprefs::HotKey,
                   m_OPTMD.AppHotKeyValue, true);
    prefs->SetPref(PWSprefs::HotKeyEnabled,
                   m_OPTMD.AppHotKeyEnabled == TRUE, true);

    if (m_pp_shortcuts->HaveShortcutsChanged())
        m_bUpdateShortcuts = true;

    // Now copy across application preferences
    // Any changes via Database preferences done via call to UpdateGUI from Command
    prefs->UpdateFromCopyPrefs(PWSprefs::ptApplication);

    // Keep prefs file updated
    prefs->SaveApplicationPreferences();
}
Ejemplo n.º 29
0
BOOL COptionsMisc::OnInitDialog() 
{
  COptions_PropertyPage::OnInitDialog();

  for (int i = 0; i < 2; i++) {
    m_chkbox[i].SetTextColour(CR_DATABASE_OPTIONS);
    m_chkbox[i].ResetBkgColour(); // Use current window's background
  }

  // Database preferences - can't change in R/O mode of if no DB is open
  if (!GetMainDlg()->IsDBOpen() || GetMainDlg()->IsDBReadOnly()) {
    GetDlgItem(IDC_DEFUSERNAME)->EnableWindow(FALSE);
    GetDlgItem(IDC_STATIC_USERNAME)->EnableWindow(FALSE);
    GetDlgItem(IDC_STATIC_DEFAUTOTYPE)->EnableWindow(FALSE);
    GetDlgItem(IDC_DB_DEF_AUTOTYPE_TEXT)->EnableWindow(FALSE);
    GetDlgItem(IDC_MAINTAINDATETIMESTAMPS)->EnableWindow(FALSE);
    GetDlgItem(IDC_USEDEFUSER)->EnableWindow(FALSE);
  }

  OnUseDefUser();

  // For some reason, MFC calls us twice when initializing.
  // Populate the combo box only once.
  if (m_dblclk_cbox.GetCount() == 0) {
    SetupCombo(&m_dblclk_cbox);
  }

  if (m_shiftdblclk_cbox.GetCount() == 0) {
    SetupCombo(&m_shiftdblclk_cbox);
  }

  m_dblclk_cbox.SetCurSel(m_DCA_to_Index[m_DoubleClickAction]);
  m_shiftdblclk_cbox.SetCurSel(m_DCA_to_Index[m_ShiftDoubleClickAction]);

  GetDlgItem(IDC_OTHERBROWSERLOCATION)->SetWindowText(m_OtherBrowserLocation);
  GetDlgItem(IDC_OTHEREDITORLOCATION)->SetWindowText(m_OtherEditorLocation);

  CSpinButtonCtrl *pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_DADSPIN);

  pspin->SetBuddy(GetDlgItem(IDC_DB_DEF_AUTOTYPE_DELAY));
  pspin->SetRange32(M_prefminAutotypeDelay(), M_prefmaxAutotypeDelay());
  pspin->SetBase(10);
  pspin->SetPos(m_AutotypeDelay);

  if (InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 0)) {
    m_Help1.Init(IDB_QUESTIONMARK);
    m_Help2.Init(IDB_QUESTIONMARK);
    m_Help3.Init(IDB_QUESTIONMARK);

    // Note naming convention: string IDS_xxx corresponds to control IDC_xxx_HELP
    AddTool(IDC_MAINTAINDATETIMESTAMPSHELP, IDS_MAINTAINDATETIMESTAMPS);
    AddTool(IDC_OTHERBROWSERLOCATIONHELP, IDS_OTHERBROWSERLOCATION);
    AddTool(IDC_OTHEREDITORLOCATIONHELP, IDS_OTHEREDITORLOCATION);
    ActivateToolTip();
  } else {
    m_Help1.EnableWindow(FALSE);
    m_Help1.ShowWindow(SW_HIDE);
    m_Help2.EnableWindow(FALSE);
    m_Help2.ShowWindow(SW_HIDE);
    m_Help3.EnableWindow(FALSE);
    m_Help3.ShowWindow(SW_HIDE);
  }

  return TRUE;  // return TRUE unless you set the focus to a control
}