-rw-r--r-- | core/pim/addressbook/abconfig.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/pim/addressbook/abconfig.cpp b/core/pim/addressbook/abconfig.cpp index 703faac..e58fa76 100644 --- a/core/pim/addressbook/abconfig.cpp +++ b/core/pim/addressbook/abconfig.cpp | |||
@@ -1,184 +1,184 @@ | |||
1 | #include "abconfig.h" | 1 | #include "abconfig.h" |
2 | #include "version.h" | 2 | #include "version.h" |
3 | 3 | ||
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | #include <qpe/recordfields.h> | 5 | #include <qpe/recordfields.h> |
6 | 6 | ||
7 | AbConfig::AbConfig( ): | 7 | AbConfig::AbConfig( ): |
8 | m_useQtMail( true ), | 8 | m_useQtMail( true ), |
9 | m_useOpieMail( false ), | 9 | m_useOpieMail( false ), |
10 | m_useRegExp( false ), | 10 | m_useRegExp( false ), |
11 | m_beCaseSensitive( false ), | 11 | m_beCaseSensitive( false ), |
12 | m_fontSize( 1 ), | 12 | m_fontSize( 1 ), |
13 | m_barPos( QMainWindow::Top ), | 13 | m_barPos( QMainWindow::Top ), |
14 | m_changed( false ) | 14 | m_changed( false ) |
15 | { | 15 | { |
16 | } | 16 | } |
17 | 17 | ||
18 | AbConfig::~AbConfig() | 18 | AbConfig::~AbConfig() |
19 | { | 19 | { |
20 | } | 20 | } |
21 | 21 | ||
22 | bool AbConfig::useRegExp() const | 22 | bool AbConfig::useRegExp() const |
23 | { | 23 | { |
24 | return m_useRegExp; | 24 | return m_useRegExp; |
25 | } | 25 | } |
26 | bool AbConfig::useWildCards() const | 26 | bool AbConfig::useWildCards() const |
27 | { | 27 | { |
28 | return !m_useRegExp; | 28 | return !m_useRegExp; |
29 | } | 29 | } |
30 | bool AbConfig::useQtMail() const | 30 | bool AbConfig::useQtMail() const |
31 | { | 31 | { |
32 | return m_useQtMail; | 32 | return m_useQtMail; |
33 | } | 33 | } |
34 | bool AbConfig::useOpieMail() const | 34 | bool AbConfig::useOpieMail() const |
35 | { | 35 | { |
36 | return m_useOpieMail; | 36 | return m_useOpieMail; |
37 | } | 37 | } |
38 | bool AbConfig::beCaseSensitive() const | 38 | bool AbConfig::beCaseSensitive() const |
39 | { | 39 | { |
40 | return m_beCaseSensitive; | 40 | return m_beCaseSensitive; |
41 | } | 41 | } |
42 | int AbConfig::fontSize() const | 42 | int AbConfig::fontSize() const |
43 | { | 43 | { |
44 | return m_fontSize; | 44 | return m_fontSize; |
45 | } | 45 | } |
46 | 46 | ||
47 | QValueList<int> AbConfig::orderList() const | 47 | QValueList<int> AbConfig::orderList() const |
48 | { | 48 | { |
49 | return m_ordered; | 49 | return m_ordered; |
50 | } | 50 | } |
51 | 51 | ||
52 | QMainWindow::ToolBarDock AbConfig::getToolBarPos() const | 52 | QMainWindow::ToolBarDock AbConfig::getToolBarPos() const |
53 | { | 53 | { |
54 | return (QMainWindow::ToolBarDock) m_barPos; | 54 | return (QMainWindow::ToolBarDock) m_barPos; |
55 | } | 55 | } |
56 | 56 | ||
57 | 57 | ||
58 | void AbConfig::setUseRegExp( bool v ) | 58 | void AbConfig::setUseRegExp( bool v ) |
59 | { | 59 | { |
60 | m_useRegExp = v ; | 60 | m_useRegExp = v ; |
61 | m_changed = true; | 61 | m_changed = true; |
62 | } | 62 | } |
63 | void AbConfig::setUseWildCards( bool v ) | 63 | void AbConfig::setUseWildCards( bool v ) |
64 | { | 64 | { |
65 | m_useRegExp = !v; | 65 | m_useRegExp = !v; |
66 | m_changed = true; | 66 | m_changed = true; |
67 | } | 67 | } |
68 | void AbConfig::setBeCaseSensitive( bool v ) | 68 | void AbConfig::setBeCaseSensitive( bool v ) |
69 | { | 69 | { |
70 | m_beCaseSensitive = v; | 70 | m_beCaseSensitive = v; |
71 | m_changed = true; | 71 | m_changed = true; |
72 | } | 72 | } |
73 | void AbConfig::setUseQtMail( bool v ) | 73 | void AbConfig::setUseQtMail( bool v ) |
74 | { | 74 | { |
75 | m_useQtMail = v; | 75 | m_useQtMail = v; |
76 | m_changed = true; | 76 | m_changed = true; |
77 | } | 77 | } |
78 | void AbConfig::setUseOpieMail( bool v ) | 78 | void AbConfig::setUseOpieMail( bool v ) |
79 | { | 79 | { |
80 | m_useOpieMail = v; | 80 | m_useOpieMail = v; |
81 | m_changed = true; | 81 | m_changed = true; |
82 | } | 82 | } |
83 | void AbConfig::setFontSize( int v ) | 83 | void AbConfig::setFontSize( int v ) |
84 | { | 84 | { |
85 | m_fontSize = v; | 85 | m_fontSize = v; |
86 | m_changed = true; | 86 | m_changed = true; |
87 | } | 87 | } |
88 | 88 | ||
89 | void AbConfig::setOrderList( const QValueList<int>& list ) | 89 | void AbConfig::setOrderList( const QValueList<int>& list ) |
90 | { | 90 | { |
91 | m_ordered = list; | 91 | m_ordered = list; |
92 | m_changed = true; | 92 | m_changed = true; |
93 | } | 93 | } |
94 | 94 | ||
95 | void AbConfig::setToolBarDock( const QMainWindow::ToolBarDock v ) | 95 | void AbConfig::setToolBarDock( const QMainWindow::ToolBarDock v ) |
96 | { | 96 | { |
97 | m_barPos = v; | 97 | m_barPos = v; |
98 | m_changed = true; | 98 | m_changed = true; |
99 | } | 99 | } |
100 | 100 | ||
101 | void AbConfig::load() | 101 | void AbConfig::load() |
102 | { | 102 | { |
103 | // Read Config settings | 103 | // Read Config settings |
104 | Config cfg("AddressBook"); | 104 | Config cfg("AddressBook"); |
105 | 105 | ||
106 | cfg.setGroup("Font"); | 106 | cfg.setGroup("Font"); |
107 | m_fontSize = cfg.readNumEntry( "fontSize", 1 ); | 107 | m_fontSize = cfg.readNumEntry( "fontSize", 1 ); |
108 | 108 | ||
109 | cfg.setGroup("Search"); | 109 | cfg.setGroup("Search"); |
110 | m_useRegExp = cfg.readBoolEntry( "useRegExp" ); | 110 | m_useRegExp = cfg.readBoolEntry( "useRegExp" ); |
111 | m_beCaseSensitive = cfg.readBoolEntry( "caseSensitive" ); | 111 | m_beCaseSensitive = cfg.readBoolEntry( "caseSensitive" ); |
112 | 112 | ||
113 | cfg.setGroup("Mail"); | 113 | cfg.setGroup("Mail"); |
114 | m_useQtMail = cfg.readBoolEntry( "useQtMail", true ); | 114 | m_useQtMail = cfg.readBoolEntry( "useQtMail", true ); |
115 | m_useOpieMail=cfg.readBoolEntry( "useOpieMail" ); | 115 | m_useOpieMail=cfg.readBoolEntry( "useOpieMail" ); |
116 | 116 | ||
117 | cfg.setGroup("ContactOrder"); | 117 | cfg.setGroup("ContactOrder"); |
118 | int ID = 0; | 118 | int ID = 0; |
119 | int i = 0; | 119 | int i = 0; |
120 | ID = cfg.readNumEntry( "ContactID_"+QString::number(i++), 0 ); | 120 | ID = cfg.readNumEntry( "ContactID_"+QString::number(i++), 0 ); |
121 | while ( ID != 0 ){ | 121 | while ( ID != 0 ){ |
122 | m_ordered.append( ID ); | 122 | m_ordered.append( ID ); |
123 | ID = cfg.readNumEntry( "ContactID_"+QString::number(i++), 0 ); | 123 | ID = cfg.readNumEntry( "ContactID_"+QString::number(i++), 0 ); |
124 | } | 124 | } |
125 | 125 | ||
126 | // If no contact order is defined, we set the default | 126 | // If no contact order is defined, we set the default |
127 | if ( m_ordered.count() == 0 ) { | 127 | if ( m_ordered.count() == 0 ) { |
128 | m_ordered.append( Qtopia::DefaultEmail ); | 128 | m_ordered.append( Qtopia::DefaultEmail ); |
129 | m_ordered.append( Qtopia::HomePhone); | 129 | m_ordered.append( Qtopia::HomePhone); |
130 | m_ordered.append( Qtopia::HomeMobile); | 130 | m_ordered.append( Qtopia::HomeMobile); |
131 | m_ordered.append( Qtopia::BusinessPhone); | 131 | m_ordered.append( Qtopia::BusinessPhone); |
132 | } | 132 | } |
133 | 133 | ||
134 | cfg.setGroup("ToolBar"); | 134 | cfg.setGroup("ToolBar"); |
135 | m_barPos = cfg.readNumEntry( "Position", QMainWindow::Top ); | 135 | m_barPos = cfg.readNumEntry( "Position", QMainWindow::Top ); |
136 | 136 | ||
137 | m_changed = false; | 137 | m_changed = false; |
138 | } | 138 | } |
139 | 139 | ||
140 | void AbConfig::save() | 140 | void AbConfig::save() |
141 | { | 141 | { |
142 | if ( m_changed ){ | 142 | if ( m_changed ){ |
143 | Config cfg("AddressBook"); | 143 | Config cfg("AddressBook"); |
144 | cfg.setGroup("Font"); | 144 | cfg.setGroup("Font"); |
145 | cfg.writeEntry("fontSize", m_fontSize); | 145 | cfg.writeEntry("fontSize", m_fontSize); |
146 | 146 | ||
147 | cfg.setGroup("Search"); | 147 | cfg.setGroup("Search"); |
148 | cfg.writeEntry("useRegExp", m_useRegExp); | 148 | cfg.writeEntry("useRegExp", m_useRegExp); |
149 | cfg.writeEntry("caseSensitive", m_beCaseSensitive); | 149 | cfg.writeEntry("caseSensitive", m_beCaseSensitive); |
150 | 150 | ||
151 | cfg.setGroup("Mail"); | 151 | cfg.setGroup("Mail"); |
152 | cfg.writeEntry( "useQtMail", m_useQtMail ); | 152 | cfg.writeEntry( "useQtMail", m_useQtMail ); |
153 | cfg.writeEntry( "useOpieMail", m_useOpieMail); | 153 | cfg.writeEntry( "useOpieMail", m_useOpieMail); |
154 | 154 | ||
155 | cfg.setGroup("ContactOrder"); | 155 | cfg.setGroup("ContactOrder"); |
156 | cfg.clearGroup(); | 156 | cfg.clearGroup(); |
157 | for ( uint i = 0; i < m_ordered.count(); i++ ){ | 157 | for ( uint i = 0; i < m_ordered.count(); i++ ){ |
158 | cfg.writeEntry( "ContactID_"+QString::number(i), m_ordered[i] ); | 158 | cfg.writeEntry( "ContactID_"+QString::number(i), m_ordered[i] ); |
159 | } | 159 | } |
160 | 160 | ||
161 | cfg.setGroup("ToolBar"); | 161 | cfg.setGroup("ToolBar"); |
162 | cfg.writeEntry( "Position", m_barPos ); | 162 | cfg.writeEntry( "Position", m_barPos ); |
163 | 163 | ||
164 | cfg.setGroup("Version"); | 164 | cfg.setGroup("Version"); |
165 | cfg.writeEntry( "AppName", APPNAME + QString(" V" ) + MAINVERSION + QString(".") + SUBVERSION + QString(".") + PATCHVERSION); | 165 | cfg.writeEntry( "AppName", APPNAME + QString(" V" ) + MAINVERSION + QString(".") + SUBVERSION + QString(".") + PATCHVERSION); |
166 | cfg.writeEntry( "Mainversion", MAINVERSION ); | 166 | cfg.writeEntry( "Mainversion", MAINVERSION ); |
167 | cfg.writeEntry( "SubVersion", SUBVERSION ); | 167 | cfg.writeEntry( "SubVersion", SUBVERSION ); |
168 | cfg.writeEntry( "PatchVersion", PATCHVERSION ); | 168 | cfg.writeEntry( "PatchVersion", PATCHVERSION ); |
169 | 169 | ||
170 | } | 170 | } |
171 | 171 | ||
172 | } | 172 | } |
173 | 173 | ||
174 | void AbConfig::operator= ( const AbConfig& cnf ) | 174 | void AbConfig::operator= ( const AbConfig& cnf ) |
175 | { | 175 | { |
176 | m_useQtMail = cnf.m_useQtMail; | 176 | m_useQtMail = cnf.m_useQtMail; |
177 | m_useOpieMail = cnf.m_useOpieMail; | 177 | m_useOpieMail = cnf.m_useOpieMail; |
178 | m_useRegExp = cnf.m_useRegExp; | 178 | m_useRegExp = cnf.m_useRegExp; |
179 | m_beCaseSensitive = cnf.m_beCaseSensitive; | 179 | m_beCaseSensitive = cnf.m_beCaseSensitive; |
180 | m_fontSize = cnf.m_fontSize; | 180 | m_fontSize = cnf.m_fontSize; |
181 | m_ordered = cnf.m_ordered; | 181 | m_ordered = cnf.m_ordered; |
182 | 182 | m_barPos = cnf.m_barPos; | |
183 | } | 183 | } |
184 | 184 | ||