COptionsBackup::COptionsBackup(CWnd *pParent, st_Opt_master_data *pOPTMD) : COptions_PropertyPage(pParent, COptionsBackup::IDD, COptionsBackup::IDD_SHORT, pOPTMD) { m_currentFile = (CString)M_CurrentFile(); m_UserBackupPrefix = M_UserBackupPrefix(); m_BackupSuffix = M_BackupSuffix(); m_BackupLocation = M_BackupLocation(); m_UserBackupOtherLocation = M_UserBackupOtherLocation(); m_SaveImmediately = M_SaveImmediately(); m_BackupBeforeSave = M_BackupBeforeSave(); m_BackupPrefix = M_BackupPrefix(); m_MaxNumIncBackups = M_MaxNumIncBackups(); if (m_BackupSuffix < PWSprefs::minBKSFX || m_BackupSuffix > PWSprefs::maxBKSFX) m_BackupSuffix = M_BackupPrefix() = PWSprefs::BKSFX_None; // derive current db's directory and basename: std::wstring path(m_currentFile); std::wstring drive, dir, base, ext; pws_os::splitpath(path, drive, dir, base, ext); path = pws_os::makepath(drive, dir, L"", L""); m_currentFileDir = path.c_str(); m_currentFileBasename = base.c_str(); }
LRESULT COptionsBackup::OnQuerySiblings(WPARAM wParam, LPARAM ) { UpdateData(TRUE); // Have any of my fields been changed? switch (wParam) { case PP_DATA_CHANGED: if (M_UserBackupPrefix() != m_UserBackupPrefix || M_UserBackupOtherLocation() != m_UserBackupOtherLocation || M_SaveImmediately() != m_SaveImmediately || M_BackupBeforeSave() != m_BackupBeforeSave || M_BackupPrefix() != m_BackupPrefix || M_BackupSuffix() != m_BackupSuffix || M_BackupLocation() != m_BackupLocation || M_MaxNumIncBackups() != m_MaxNumIncBackups) return 1L; break; case PP_UPDATE_VARIABLES: // Since OnOK calls OnApply after we need to verify and/or // copy data into the entry - we do it ourselfs here first if (OnApply() == FALSE) return 1L; } return 0L; }
void COptionsBackup::OnUserBkpLocationKillfocus() { // Windows getting the focus CWnd *pWnd = GetFocus(); // Don't bother verifying data if user is clicking on the other option // or browsing for a directory if (pWnd == GetDlgItem(IDC_DFLTBACKUPLOCATION) || pWnd == GetDlgItem(IDC_BROWSEFORLOCATION)) { return; } // Don't bother verifying data if user is cancelling the whole thing // Rather complicated!!!! if (pWnd == m_options_psh->GetDlgItem(IDCANCEL)) { // Reset value to last good one m_UserBackupOtherLocation = M_UserBackupOtherLocation(); // Now simulate the pressing of the cancel button WPARAM WParam = MAKEWPARAM(IDCANCEL, BN_CLICKED); m_options_psh->PostMessage(WM_COMMAND, WParam, NULL); return; } UpdateData(TRUE); ExpandBackupPath(); // If OnKillActive active - skip it again if (!m_bKillActiveInProgress) { VerifyFields(); } }
BOOL COptionsBackup::OnApply() { UpdateData(TRUE); M_UserBackupPrefix() = m_UserBackupPrefix; M_BackupSuffix() = m_BackupSuffix; M_BackupLocation() = m_BackupLocation; M_UserBackupOtherLocation() = m_UserBackupOtherLocation; M_SaveImmediately() = m_SaveImmediately; M_BackupBeforeSave() = m_BackupBeforeSave; M_BackupPrefix() = m_BackupPrefix; M_MaxNumIncBackups() = m_MaxNumIncBackups; return COptions_PropertyPage::OnApply(); }