1 /* 2 * Copyright 2006-2009 Haiku, Inc. All Rights Reserved. 3 * Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved. 4 * Distributed under the terms of the MIT License. 5 * 6 * Authors: 7 * Timothy Wayper <timmy@wunderbear.com> 8 * Stephan Aßmus <superstippi@gmx.de> 9 */ 10 11 #include "CalcOptions.h" 12 13 #include <stdlib.h> 14 #include <stdio.h> 15 16 #include <Message.h> 17 18 19 CalcOptions::CalcOptions() 20 : 21 auto_num_lock(false), 22 audio_feedback(false), 23 keypad_mode(KEYPAD_MODE_BASIC) 24 { 25 } 26 27 28 void 29 CalcOptions::LoadSettings(const BMessage* archive) 30 { 31 bool option; 32 uint8 keypad_mode_option; 33 34 if (archive->FindBool("auto num lock", &option) == B_OK) 35 auto_num_lock = option; 36 37 if (archive->FindBool("audio feedback", &option) == B_OK) 38 audio_feedback = option; 39 40 if (archive->FindUInt8("keypad mode", &keypad_mode_option) == B_OK) 41 keypad_mode = keypad_mode_option; 42 } 43 44 45 status_t 46 CalcOptions::SaveSettings(BMessage* archive) const 47 { 48 status_t ret = archive->AddBool("auto num lock", auto_num_lock); 49 50 if (ret == B_OK) 51 ret = archive->AddBool("audio feedback", audio_feedback); 52 53 if (ret == B_OK) 54 ret = archive->AddUInt8("keypad mode", keypad_mode); 55 56 return ret; 57 } 58 59