BOOL CEditorPrefs::ApplyChanges() { // TODO: Need TrimLeft() and TrimRight() or just Trim() functions for CString PREF_SetCharPref("editor.author",LPCSTR(m_strAuthor)); PREF_SetCharPref("editor.html_editor",LPCSTR(m_strHTML_Editor)); PREF_SetCharPref("editor.image_editor",LPCSTR(m_strImageEditor)); if ( m_bAutoSave ){ PREF_SetIntPref("editor.auto_save_delay",m_iAutoSaveMinutes); } else { PREF_SetIntPref("editor.auto_save_delay",0); } PREF_SetIntPref("editor.fontsize_mode", (int32)m_iFontSizeMode); return TRUE; }
NS_IMETHODIMP nsPrefBranch::SetIntPref(const char *aPrefName, PRInt32 aValue) { const char *pref; nsresult rv; rv = getValidatedPrefName(aPrefName, &pref); if (NS_SUCCEEDED(rv)) { rv = PREF_SetIntPref(pref, aValue, mIsDefault); } return rv; }
nsresult pref_SetPrefTuple(const PrefTuple &aPref, bool set_default) { switch (aPref.type) { case PrefTuple::PREF_STRING: return PREF_SetCharPref(aPref.key.get(), aPref.stringVal.get(), set_default); case PrefTuple::PREF_INT: return PREF_SetIntPref(aPref.key.get(), aPref.intVal, set_default); case PrefTuple::PREF_BOOL: return PREF_SetBoolPref(aPref.key.get(), aPref.boolVal, set_default); } NS_NOTREACHED("Unknown type"); return NS_ERROR_INVALID_ARG; }
void CMessageFrame::OnClose() { int16 left, top, width, height; int32 prefInt; WINDOWPLACEMENT wp; wp.length = sizeof(WINDOWPLACEMENT); GetWindowPlacement(&wp); CRect rect(wp.rcNormalPosition); left = (int16) rect.left; top = (int16) rect.top; width = (int16) rect.Width(); height = (int16) rect.Height(); prefInt = wp.showCmd; PREF_SetRectPref("mailnews.message_window_rect", left, top, width, height); PREF_SetIntPref("mailnews.message_window_showwindow", prefInt); //I'm hardcoding because I don't want this translated m_pChrome->SaveToolbarConfiguration(ID_NAVIGATION_TOOLBAR, CString("Navigation_Toolbar")); m_pChrome->SaveToolbarConfiguration(ID_LOCATION_TOOLBAR, CString("Location_Toolbar")); CMailNewsFrame::OnClose(); }