BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / apps / deskcalc / CalcOptions.cpp
blob1c93e300f6a1842ab12d470e4efc9a5e77c9b1a7
1 /*
2 * Copyright 2006-2012 Haiku, Inc. All Rights Reserved.
3 * Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
4 * Distributed under the terms of the MIT License.
6 * Authors:
7 * Stephan Aßmus, superstippi@gmx.de
8 * John Scipione, jscipione@gmail.com
9 * Timothy Wayper, timmy@wunderbear.com
13 #include "CalcOptions.h"
15 #include <stdlib.h>
16 #include <stdio.h>
18 #include <Message.h>
21 CalcOptions::CalcOptions()
23 auto_num_lock(false),
24 audio_feedback(false),
25 degree_mode(false),
26 keypad_mode(KEYPAD_MODE_BASIC)
31 void
32 CalcOptions::LoadSettings(const BMessage* archive)
34 bool option;
35 uint8 keypad_mode_option;
37 if (archive->FindBool("auto num lock", &option) == B_OK)
38 auto_num_lock = option;
40 if (archive->FindBool("audio feedback", &option) == B_OK)
41 audio_feedback = option;
43 if (archive->FindBool("degree mode", &option) == B_OK)
44 degree_mode = option;
46 if (archive->FindUInt8("keypad mode", &keypad_mode_option) == B_OK)
47 keypad_mode = keypad_mode_option;
51 status_t
52 CalcOptions::SaveSettings(BMessage* archive) const
54 status_t ret = archive->AddBool("auto num lock", auto_num_lock);
56 if (ret == B_OK)
57 ret = archive->AddBool("audio feedback", audio_feedback);
59 if (ret == B_OK)
60 ret = archive->AddBool("degree mode", degree_mode);
62 if (ret == B_OK)
63 ret = archive->AddUInt8("keypad mode", keypad_mode);
65 return ret;