예제 #1
0
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;
  }
}
예제 #2
0
void CPWSRecentFileList::WriteList()
{
  extern void RelativizePath(stringT &);
  PWSprefs *pref = PWSprefs::GetInstance();
  // writes to registry or config file
  if (pref->IsUsingRegistry()) {
    CRecentFileList::WriteList();
  } else {
    const int num_MRU = GetSize();
    const int max_MRU = ID_FILE_MRU_ENTRYMAX - ID_FILE_MRU_ENTRY1;
    std::wstring *csMRUFiles = new std::wstring[num_MRU];

    for (int i = 0; i < num_MRU; i++) {
      csMRUFiles[i] = (*this)[i];
      if (!csMRUFiles[i].empty()) {
        Trim(csMRUFiles[i]);
        RelativizePath(csMRUFiles[i]);
      }
    }

    pref->SetMRUList(csMRUFiles, num_MRU, max_MRU);
    delete[] csMRUFiles;
  }
}