当前位置: 首页>>代码示例>>C++>>正文


C++ PWSprefs::GetPref方法代码示例

本文整理汇总了C++中PWSprefs::GetPref方法的典型用法代码示例。如果您正苦于以下问题:C++ PWSprefs::GetPref方法的具体用法?C++ PWSprefs::GetPref怎么用?C++ PWSprefs::GetPref使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PWSprefs的用法示例。


在下文中一共展示了PWSprefs::GetPref方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnPreferencesClick

void PasswordSafeFrame::OnPreferencesClick( wxCommandEvent& /* evt */ )
{
  PWSprefs* prefs = PWSprefs::GetInstance();
  const StringX sxOldDBPrefsString(prefs->Store());
  COptions *window = new COptions(this);
  if (window->ShowModal() == wxID_OK) {
    StringX sxNewDBPrefsString(prefs->Store(true));
    // Update system tray icon if visible so changes show up immediately
    if (m_sysTray && prefs->GetPref(PWSprefs::UseSystemTray))
        m_sysTray->ShowIcon();

    if (!m_core.GetCurFile().empty() && !m_core.IsReadOnly() &&
        m_core.GetReadFileVersion() == PWSfile::VCURRENT) {
      if (sxOldDBPrefsString != sxNewDBPrefsString) {
        Command *pcmd = DBPrefsCommand::Create(&m_core, sxNewDBPrefsString);
        if (pcmd) {
            //I don't know why notifications should ever be suspended, but that's how
            //things were before I messed with them, so I want to limit the damage by
            //enabling notifications only as long as required and no more
            m_core.ResumeOnDBNotification();
            Execute(pcmd);  //deleted automatically
            m_core.SuspendOnDBNotification();
        }
      }
    }
  }
  window->Destroy();
}
开发者ID:Sp1l,项目名称:pwsafe,代码行数:28,代码来源:mainManage.cpp

示例2: UpdateItemField

//Just update the item's text, don't move it into its sorted position
void PWSTreeCtrl::UpdateItemField(const CItemData &item, CItemData::FieldType ft)
{
  PWSprefs* prefs = PWSprefs::GetInstance();
  if (ft == CItemData::GROUP) {
    //remove & add again
    UpdateItem(item);
  }
  //these are the only items ever shown in the tree
  else if (ft == CItemData::TITLE || ft == CItemData::START ||
       (ft == CItemData::USER && prefs->GetPref(PWSprefs::ShowUsernameInTree)) ||
       (ft == CItemData::PASSWORD && prefs->GetPref(PWSprefs::ShowPasswordInTree))) {
    wxRect rc;
    wxTreeItemId ti = Find(item);
    if (ti.IsOk()) {
      SetItemText(ti, ItemDisplayString(item));
    }
  }
}
开发者ID:NonPlayerCharactor,项目名称:PasswordSafeFork,代码行数:19,代码来源:PWStree.cpp

示例3: LoadAString

CAddEdit_Basic::CAddEdit_Basic(CWnd *pParent, st_AE_master_data *pAEMD)
    : CAddEdit_PropertyPage(pParent,
                            CAddEdit_Basic::IDD, CAddEdit_Basic::IDD_SHORT,
                            pAEMD),
      m_bInitdone(false), m_thread(NULL), m_isNotesHidden(false)
{
    if (CS_SHOW.IsEmpty()) { // one-time initializations
        HIDDEN_NOTES.LoadString(IDS_HIDDENNOTES);
        CS_SHOW.LoadString(IDS_SHOWPASSWORDTXT);
        CS_HIDE.LoadString(IDS_HIDEPASSWORDTXT);
    }

    PWSprefs *prefs = PWSprefs::GetInstance();

    // Setup
    m_bWordWrap = prefs->GetPref(PWSprefs::NotesWordWrap);

    m_password = m_password2 = M_realpassword();
    m_notes = M_realnotes().Left(MAXTEXTCHARS);

    // Set up right-click Notes context menu additions
    std::vector<st_context_menu> vmenu_items;

    st_context_menu st_cm;
    std::wstring cs_menu_string;

    LoadAString(cs_menu_string, IDS_WORD_WRAP);
    st_cm.menu_string = cs_menu_string;
    st_cm.message_number = PWS_MSG_EDIT_WORDWRAP;
    st_cm.flags = m_bWordWrap ? MF_CHECKED : MF_UNCHECKED;
    vmenu_items.push_back(st_cm);

    st_cm.Empty();
    LoadAString(cs_menu_string, IDS_NOTESZOOMIN);
    st_cm.menu_string = cs_menu_string;
    st_cm.message_number = PWS_MSG_CALL_NOTESZOOMIN;
    st_cm.flags = 0;
    st_cm.lParam = 1;
    vmenu_items.push_back(st_cm);

    st_cm.Empty();
    LoadAString(cs_menu_string, IDS_NOTESZOOMOUT);
    st_cm.menu_string = cs_menu_string;
    st_cm.message_number = PWS_MSG_CALL_NOTESZOOMOUT;
    st_cm.flags = 0;
    st_cm.lParam = -1;
    vmenu_items.push_back(st_cm);

    st_cm.Empty();
    LoadAString(cs_menu_string, IDS_EDITEXTERNALLY);
    st_cm.menu_string = cs_menu_string;
    st_cm.message_number = PWS_MSG_CALL_EXTERNAL_EDITOR;
    st_cm.flags = 0;
    vmenu_items.push_back(st_cm);

    m_ex_notes.SetContextMenu(vmenu_items);
}
开发者ID:ronys,项目名称:pwsafe-test,代码行数:57,代码来源:AddEdit_Basic.cpp

示例4: ItemDisplayString

wxString PWSTreeCtrl::ItemDisplayString(const CItemData &item) const
{
  PWSprefs *prefs = PWSprefs::GetInstance();
  const wxString title = item.GetTitle().c_str();
  wxString disp = title;

  if (prefs->GetPref(PWSprefs::ShowUsernameInTree)) {
    const wxString user = item.GetUser().c_str();
    if (!user.empty())
      disp += wxT(" [") + user + wxT("]");
  }

  if (prefs->GetPref(PWSprefs::ShowPasswordInTree)) {
    const wxString passwd = item.GetPassword().c_str();
    if (!passwd.empty())
      disp += wxT(" {") + passwd + wxT("}");
  }

  return disp;
}
开发者ID:NonPlayerCharactor,项目名称:PasswordSafeFork,代码行数:20,代码来源:PWStree.cpp

示例5: OnBackupSafe

//////////////////////////////////////////
// Backup and Restore
//
void PasswordSafeFrame::OnBackupSafe(wxCommandEvent& /*evt*/)
{
  PWSprefs *prefs = PWSprefs::GetInstance();
  const wxFileName currbackup(towxstring(prefs->GetPref(PWSprefs::CurrentBackup)));

  const wxString title(_("Please Choose a Name for this Backup:"));

  wxString dir;
  if (m_core.GetCurFile().empty())
    dir = towxstring(PWSdirs::GetSafeDir());
  else {
    wxFileName::SplitPath(towxstring(m_core.GetCurFile()), &dir, NULL, NULL);
    wxCHECK_RET(!dir.IsEmpty(), _("Could not parse current file path"));
  }

  //returns empty string if user cancels
  wxString wxbf = wxFileSelector(title,
                                 dir,
                                 currbackup.GetFullName(),
                                 wxT("bak"),
                                 _("Password Safe Backups (*.bak)|*.bak"),
                                 wxFD_SAVE|wxFD_OVERWRITE_PROMPT,
                                 this);
  /*
  The wxFileSelector code says it appends the default extension if user
  doesn't type one, but it actually doesn't and I don't see the purported
  code in 2.8.10.  And doing it ourselves after the dialog has returned is
  risky because we might silently overwrite an existing file
  */

  //create a copy to avoid multiple conversions to StringX
  const StringX backupfile(tostringx(wxbf));

#ifdef NOT_YET
  if (m_inExit) {
    // If U3ExitNow called while in CPWFileDialog,
    // PostQuitMessage makes us return here instead
    // of exiting the app. Try resignalling
    PostQuitMessage(0);
    return PWScore::USER_CANCEL;
  }
#endif

  if (!backupfile.empty()) {  //i.e. if user didn't cancel
    if (m_core.WriteFile(backupfile, m_core.GetReadFileVersion(),
                         false) == PWScore::CANT_OPEN_FILE) {
      wxMessageBox( wxbf << wxT("\n\n") << _("Could not open file for writing!"),
                    _("Write Error"), wxOK|wxICON_ERROR, this);
    }

    prefs->SetPref(PWSprefs::CurrentBackup, backupfile);
  }
}
开发者ID:Sp1l,项目名称:pwsafe,代码行数:56,代码来源:mainManage.cpp

示例6: ReadList

void CPWSRecentFileList::ReadList()
{
  PWSprefs *pref = PWSprefs::GetInstance();
  // reads from registry or config file
  if (pref->IsUsingRegistry()) {
    CRecentFileList::ReadList();
  } else {
    const int nMRUItems = pref->GetPref(PWSprefs::MaxMRUItems);
    ASSERT(nMRUItems == m_nSize);
    std::wstring *arrNames = new std::wstring[nMRUItems];
    pref->GetMRUList(arrNames);
    for (int i = 0; i < nMRUItems; i++) {
      std::wstring path = arrNames[i].c_str();
      pws_os::AddDrive(path);
      m_arrNames[i] = path.c_str();
    }
    delete[] arrNames;
  }
}
开发者ID:macduff,项目名称:passwordsafe,代码行数:19,代码来源:PWSRecentFileList.cpp

示例7: OnInit

bool PwsafeApp::OnInit()
{
    //Used by help subsystem
    wxFileSystem::AddHandler(new wxArchiveFSHandler);

    SetAppName(pwsafeAppName);
    m_core.SetApplicationNameAndVersion(tostdstring(pwsafeAppName),
                                        DWORD((MINORVERSION << 16) | MAJORVERSION));
    PWSprefs::SetReporter(&aReporter);
    PWScore::SetReporter(&aReporter);
    PWScore::SetAsker(&anAsker);

#if wxUSE_XPM
    wxImage::AddHandler(new wxXPMHandler);
#endif
#if wxUSE_LIBPNG
    wxImage::AddHandler(new wxPNGHandler);
#endif
#if wxUSE_LIBJPEG
    wxImage::AddHandler(new wxJPEGHandler);
#endif
#if wxUSE_GIF
    wxImage::AddHandler(new wxGIFHandler);
#endif
    // Get progname
    wxString progName(argv[0]);
    progName = progName.AfterLast(wxChar('/'));
    // Parse command line
    wxCmdLineParser cmdParser(cmdLineDesc, argc, argv);
    int res = cmdParser.Parse();
    if (res != 0)
        return false;

    // Don't allow ptrace or gdump on release build
    if (!pws_os::DisableDumpAttach())
        return false;

    // Parse command line options:
    wxString filename, user, host, cfg_file;
    bool cmd_ro = cmdParser.Found(wxT("r"));
    // Next variable currently not referenced
    bool cmd_encrypt = cmdParser.Found(wxT("e"), &filename);
    bool cmd_decrypt = cmdParser.Found(wxT("d"), &filename);
    bool cmd_closed = cmdParser.Found(wxT("c"));
    bool cmd_silent = cmdParser.Found(wxT("s"));
    bool cmd_minimized = cmdParser.Found(wxT("m"));
    bool cmd_user = cmdParser.Found(wxT("u"), &user);
    bool cmd_host = cmdParser.Found(wxT("h"), &host);
    bool cmd_cfg = cmdParser.Found(wxT("g"), &cfg_file);
    bool file_in_cmd = false;
    size_t count = cmdParser.GetParamCount();
    if (count == 1) {
        filename = cmdParser.GetParam();
        file_in_cmd = true;
    }
    else if (count > 1) {
        cmdParser.Usage();
        return false;
    }
    // check for mutually exclusive options
    if (((cmd_encrypt + cmd_decrypt) > 1) ||
            ((cmd_closed + cmd_silent + cmd_minimized) > 1)) {
        cmdParser.Usage();
        return false;
    }

    if (cmd_user)
        SysInfo::GetInstance()->SetEffectiveUser(tostdstring(user));
    if (cmd_host)
        SysInfo::GetInstance()->SetEffectiveHost(tostdstring(host));
    if (cmd_cfg)
        PWSprefs::SetConfigFile(tostdstring(cfg_file));

    m_core.SetReadOnly(cmd_ro);
    // OK to load prefs now
    PWSprefs *prefs = PWSprefs::GetInstance();

    // Initialize language only after parsing cmd_cfg and instantiating prefs,
    // otherwise GetSelectedLanguage()&Co will instantiate prefs singleton and it
    // will ignore config file parameter
    wxLanguage selectedLang = GetSelectedLanguage();
    m_locale->Init(selectedLang);
    ActivateLanguage(selectedLang, false);

    // if filename passed in command line, it takes precedence
    // over that in preference:
    if (filename.empty()) {
        filename =  prefs->GetPref(PWSprefs::CurrentFile).c_str();
    } else {
        recentDatabases().AddFileToHistory(filename);
    }
    m_core.SetCurFile(tostringx(filename));
    m_core.SetApplicationNameAndVersion(tostdstring(progName),
                                        MAKEWORD(MINORVERSION, MAJORVERSION));

    static wxSingleInstanceChecker appInstance;
    if (!prefs->GetPref(PWSprefs::MultipleInstances) &&
            (appInstance.Create(wxT("pwsafe.lck"), towxstring(pws_os::getuserprefsdir())) &&
             appInstance.IsAnotherRunning()))
    {
//.........这里部分代码省略.........
开发者ID:bwilcox,项目名称:pwsafe,代码行数:101,代码来源:pwsafeapp.cpp

示例8: OnInitDialog

BOOL CAddEdit_Basic::OnInitDialog()
{
    CAddEdit_PropertyPage::OnInitDialog();

    ModifyStyleEx(0, WS_EX_CONTROLPARENT);

    Fonts *pFonts = Fonts::GetInstance();
    pFonts->ApplyPasswordFont(GetDlgItem(IDC_PASSWORD));
    pFonts->ApplyPasswordFont(GetDlgItem(IDC_PASSWORD2));

    // Need to get change notifcations
    m_ex_notes.SetEventMask(ENM_CHANGE | m_ex_notes.GetEventMask());

    // Set plain text - not that it seems to do much!
    m_ex_notes.SetTextMode(TM_PLAINTEXT);

    PWSprefs *prefs = PWSprefs::GetInstance();

    // Set Notes font!
    if (prefs->GetPref(PWSprefs::NotesFont).empty()) {
        m_ex_notes.SetFont(pFonts->GetCurrentFont());
    } else {
        m_ex_notes.SetFont(pFonts->GetNotesFont());
    }

    if (M_uicaller() == IDS_EDITENTRY && M_protected() != 0) {
        GetDlgItem(IDC_STATIC_PROTECTED)->ShowWindow(SW_SHOW);
        m_stc_protected.SetColour(RGB(255,0,0));
    }

    if (M_uicaller() != IDS_ADDENTRY) {
        InitToolTip();

        AddTool(IDC_STATIC_GROUP,    IDS_CLICKTOCOPY);
        AddTool(IDC_STATIC_TITLE,    IDS_CLICKTOCOPY);
        AddTool(IDC_STATIC_USERNAME, IDS_CLICKTOCOPY);
        AddTool(IDC_STATIC_PASSWORD, IDS_CLICKTOCOPY);
        AddTool(IDC_STATIC_NOTES,    IDS_CLICKTOCOPY);
        AddTool(IDC_STATIC_URL,      IDS_CLICKTOCOPY);
        AddTool(IDC_STATIC_EMAIL,    IDS_CLICKTOCOPYPLUS1);
        AddTool(IDC_LAUNCH,          IDS_CLICKTOGOPLUS);
        AddTool(IDC_SENDEMAIL,       IDS_CLICKTOSEND);

        if (M_uicaller() == IDS_EDITENTRY && M_protected() != 0) {
            AddTool(IDC_STATIC_PROTECTED, IDS_UNPROTECT);
        }

        ActivateToolTip();

        m_stc_group.SetHighlight(true, CAddEdit_PropertyPage::crefWhite);
        m_stc_title.SetHighlight(true, CAddEdit_PropertyPage::crefWhite);
        m_stc_username.SetHighlight(true, CAddEdit_PropertyPage::crefWhite);
        m_stc_password.SetHighlight(true, CAddEdit_PropertyPage::crefWhite);
        m_stc_notes.SetHighlight(true, CAddEdit_PropertyPage::crefWhite);
        m_stc_URL.SetHighlight(true, CAddEdit_PropertyPage::crefWhite);
        m_stc_email.SetHighlight(true, CAddEdit_PropertyPage::crefWhite);
    }

    m_ex_group.ChangeColour();
    GetDlgItem(IDC_LAUNCH)->EnableWindow(M_URL().IsEmpty() ? FALSE : TRUE);
    GetDlgItem(IDC_SENDEMAIL)->EnableWindow(M_email().IsEmpty() ? FALSE : TRUE);

    if (M_uicaller() == IDS_VIEWENTRY ||
            (M_uicaller() == IDS_EDITENTRY && M_protected() != 0)) {
        // Change 'OK' to 'Close' and disable 'Cancel'
        // "CancelToClose" disables the System Command SC_CLOSE
        // from clicking X on PropertySheet so have implemented
        // CAddEdit_PropertySheet::OnSysCommand to deal with it.
        CancelToClose();

        // Disable Group Combo
        GetDlgItem(IDC_GROUP)->EnableWindow(FALSE);

        // Disable normal Edit controls
        GetDlgItem(IDC_TITLE)->SendMessage(EM_SETREADONLY, TRUE, 0);
        GetDlgItem(IDC_USERNAME)->SendMessage(EM_SETREADONLY, TRUE, 0);
        GetDlgItem(IDC_PASSWORD)->SendMessage(EM_SETREADONLY, TRUE, 0);
        GetDlgItem(IDC_PASSWORD2)->SendMessage(EM_SETREADONLY, TRUE, 0);
        GetDlgItem(IDC_NOTES)->SendMessage(EM_SETREADONLY, TRUE, 0);
        GetDlgItem(IDC_URL)->SendMessage(EM_SETREADONLY, TRUE, 0);
        GetDlgItem(IDC_EMAIL)->SendMessage(EM_SETREADONLY, TRUE, 0);

        // Disable Button
        GetDlgItem(IDC_GENERATEPASSWORD)->EnableWindow(FALSE);
    }

    // Populate the combo box
    m_ex_group.ResetContent(); // groups might be from a previous DB (BR 3062758)

    // The core function "GetUniqueGroups(vGroups)" returns the group list by
    // going through the entries in the database. This will not include empty
    // groups.  However, we already maintain this list in the UI to save the
    // display status, so use this instead.
    std::vector<std::wstring> vGroups;
    GetMainDlg()->GetAllGroups(vGroups);

    for (std::vector<std::wstring>::iterator iter = vGroups.begin();
            iter != vGroups.end(); ++iter) {
        m_ex_group.AddString(iter->c_str());
    }
//.........这里部分代码省略.........
开发者ID:ronys,项目名称:pwsafe-test,代码行数:101,代码来源:AddEdit_Basic.cpp

示例9: CPWPropertySheet

CAddEdit_PropertySheet::CAddEdit_PropertySheet(UINT nID, CWnd* pParent,
                                               PWScore *pcore,
                                               CItemData *pci_original, CItemData *pci,
                                               const bool bLongPPs,
                                               const StringX currentDB)
  : CPWPropertySheet(nID, pParent, bLongPPs), m_bIsModified(false), m_bChanged(false),
  m_bNotesChanged(false), m_bSymbolsChanged(false)
{
  m_AEMD.bLongPPs = bLongPPs;
  m_AEMD.uicaller = nID;

  ASSERT(pParent != NULL);
  ASSERT(pcore != NULL);
  ASSERT(pci != NULL);

  m_AEMD.pcore = pcore;
  m_AEMD.pci_original = pci_original;
  m_AEMD.pci = pci;

  m_AEMD.currentDB = currentDB;

  PWSprefs *prefs = PWSprefs::GetInstance();

  m_AEMD.default_pwp = prefs->GetDefaultPolicy();
  m_AEMD.default_symbols = prefs->GetPref(PWSprefs::DefaultSymbols);

  // Set up data used by all Property Pages, as appropriate
  if (m_AEMD.uicaller == IDS_ADDENTRY) {
    // Basic initialisation
    m_AEMD.group = L"";
    m_AEMD.title = L"";
    m_AEMD.username = L"";
    m_AEMD.realpassword = L"";
    m_AEMD.realnotes = m_AEMD.originalrealnotesTRC = L"";
    m_AEMD.URL = L"";
    m_AEMD.email = L"";
    m_AEMD.symbols = m_AEMD.oldsymbols = L"";
    m_AEMD.num_dependents = 0;

    // Entry type initialisation
    m_AEMD.original_entrytype = CItemData::ET_NORMAL;

    // Additional initialisation
    m_AEMD.autotype = L"";
    m_AEMD.runcommand = L"";
    m_AEMD.oldDCA = m_AEMD.DCA = m_AEMD.oldShiftDCA = m_AEMD.ShiftDCA = -1;

    // Date & Time initialisation
    m_AEMD.locCTime.LoadString(IDS_NA);
    m_AEMD.locXTime = m_AEMD.locATime = m_AEMD.locRMTime = m_AEMD.locPMTime =
          m_AEMD.oldlocXTime = m_AEMD.locCTime;
    m_AEMD.tttXTime = m_AEMD.tttCPMTime = (time_t)0;
    m_AEMD.oldXTimeInt = m_AEMD.XTimeInt = 0;

    // PWHistory initialisation
    m_AEMD.SavePWHistory = m_AEMD.oldSavePWHistory =
            PWSprefs::GetInstance()->GetPref(PWSprefs::SavePasswordHistory) ? TRUE : FALSE;
    m_AEMD.MaxPWHistory = m_AEMD.oldMaxPWHistory =
            PWSprefs::GetInstance()->GetPref(PWSprefs::NumPWHistoryDefault);
    m_AEMD.NumPWHistory = m_AEMD.oldNumPWHistory = 0;

    // PWPolicy fields
    m_AEMD.pwp = m_AEMD.oldpwp = m_AEMD.default_pwp;
    m_AEMD.ipolicy = m_AEMD.oldipolicy = DEFAULT_POLICY;
    m_AEMD.iownsymbols = m_AEMD.ioldownsymbols = DEFAULT_SYMBOLS;
    m_AEMD.symbols = L"";
    m_AEMD.policyname = m_AEMD.oldpolicyname = L"";

    // Protected
    m_AEMD.ucprotected = 0;
    
    // Entry Keyboard shortcut
    m_AEMD.oldKBShortcut = m_AEMD.KBShortcut = 0;
  } else {
    SetupInitialValues();
  }
  // Only now allocate the PropertyPages - after all data there
  // to be used by their c'tors
  m_pp_basic      = new CAddEdit_Basic(this, &m_AEMD);
  m_pp_additional = new CAddEdit_Additional(this, &m_AEMD);
  m_pp_datetimes  = new CAddEdit_DateTimes(this, &m_AEMD);
  m_pp_pwpolicy   = new CAddEdit_PasswordPolicy(this, &m_AEMD);
  if (pcore->GetReadFileVersion() == PWSfile::V40)
    m_pp_attachment = new CAddEdit_Attachment(this, &m_AEMD);
  else
    m_pp_attachment = NULL;

  AddPage(m_pp_basic);
  AddPage(m_pp_additional);
  AddPage(m_pp_datetimes);
  AddPage(m_pp_pwpolicy);
  if (pcore->GetReadFileVersion() == PWSfile::V40)
    AddPage(m_pp_attachment);
}
开发者ID:bwilcox,项目名称:pwsafe,代码行数:94,代码来源:AddEdit_PropertySheet.cpp

示例10: SetupInitialValues

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 =
//.........这里部分代码省略.........
开发者ID:bwilcox,项目名称:pwsafe,代码行数:101,代码来源:Options_PropertySheet.cpp


注:本文中的PWSprefs::GetPref方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。