-rw-r--r-- | libopie2/opiecore/oglobalsettings.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libopie2/opiecore/oglobalsettings.cpp b/libopie2/opiecore/oglobalsettings.cpp index f34c531..89c77d7 100644 --- a/libopie2/opiecore/oglobalsettings.cpp +++ b/libopie2/opiecore/oglobalsettings.cpp | |||
@@ -1,258 +1,259 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (C) 2003 Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> | 4 | Copyright (C) 2003 Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> |
5 | Inspired by the KDE globalsettings which are | 5 | Inspired by the KDE globalsettings which are |
6 | Copyright (C) 2000 David Faure <faure@kde.org> | 6 | Copyright (C) 2000 David Faure <faure@kde.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | */ | 31 | */ |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | 34 | ||
35 | #include <opie2/oglobalsettings.h> | 35 | #include <opie2/oglobalsettings.h> |
36 | #include <opie2/oconfig.h> | 36 | #include <opie2/oconfig.h> |
37 | #include <opie2/odebug.h> | ||
37 | #include <opie2/oglobal.h> | 38 | #include <opie2/oglobal.h> |
38 | 39 | ||
39 | /* QT */ | 40 | /* QT */ |
40 | 41 | ||
41 | #include <qdir.h> | 42 | #include <qdir.h> |
42 | 43 | ||
43 | /* UNIX */ | 44 | /* UNIX */ |
44 | 45 | ||
45 | #include <stdlib.h> | 46 | #include <stdlib.h> |
46 | 47 | ||
47 | 48 | ||
48 | using namespace Opie::Core; | 49 | using namespace Opie::Core; |
49 | 50 | ||
50 | QString* OGlobalSettings::s_desktopPath = 0; | 51 | QString* OGlobalSettings::s_desktopPath = 0; |
51 | QString* OGlobalSettings::s_autostartPath = 0; | 52 | QString* OGlobalSettings::s_autostartPath = 0; |
52 | QString* OGlobalSettings::s_trashPath = 0; | 53 | QString* OGlobalSettings::s_trashPath = 0; |
53 | QString* OGlobalSettings::s_documentPath = 0; | 54 | QString* OGlobalSettings::s_documentPath = 0; |
54 | QFont *OGlobalSettings::_generalFont = 0; | 55 | QFont *OGlobalSettings::_generalFont = 0; |
55 | QFont *OGlobalSettings::_fixedFont = 0; | 56 | QFont *OGlobalSettings::_fixedFont = 0; |
56 | QFont *OGlobalSettings::_toolBarFont = 0; | 57 | QFont *OGlobalSettings::_toolBarFont = 0; |
57 | QFont *OGlobalSettings::_menuFont = 0; | 58 | QFont *OGlobalSettings::_menuFont = 0; |
58 | QFont *OGlobalSettings::_windowTitleFont = 0; | 59 | QFont *OGlobalSettings::_windowTitleFont = 0; |
59 | QFont *OGlobalSettings::_taskbarFont = 0; | 60 | QFont *OGlobalSettings::_taskbarFont = 0; |
60 | 61 | ||
61 | QColor *OGlobalSettings::OpieGray = 0; | 62 | QColor *OGlobalSettings::OpieGray = 0; |
62 | QColor *OGlobalSettings::OpieHighlight = 0; | 63 | QColor *OGlobalSettings::OpieHighlight = 0; |
63 | QColor *OGlobalSettings::OpieAlternate = 0; | 64 | QColor *OGlobalSettings::OpieAlternate = 0; |
64 | 65 | ||
65 | OGlobalSettings::OMouseSettings *OGlobalSettings::s_mouseSettings = 0; | 66 | OGlobalSettings::OMouseSettings *OGlobalSettings::s_mouseSettings = 0; |
66 | 67 | ||
67 | //FIXME: Add manipulators to the accessors | 68 | //FIXME: Add manipulators to the accessors |
68 | 69 | ||
69 | int OGlobalSettings::dndEventDelay() | 70 | int OGlobalSettings::dndEventDelay() |
70 | { | 71 | { |
71 | OConfig *c = OGlobal::config(); | 72 | OConfig *c = OGlobal::config(); |
72 | OConfigGroupSaver cgs( c, "General" ); | 73 | OConfigGroupSaver cgs( c, "General" ); |
73 | return c->readNumEntry("DndDelay", 2); | 74 | return c->readNumEntry("DndDelay", 2); |
74 | } | 75 | } |
75 | 76 | ||
76 | bool OGlobalSettings::singleClick() | 77 | bool OGlobalSettings::singleClick() |
77 | { | 78 | { |
78 | OConfig *c = OGlobal::config(); | 79 | OConfig *c = OGlobal::config(); |
79 | OConfigGroupSaver cgs( c, "OPIE" ); | 80 | OConfigGroupSaver cgs( c, "OPIE" ); |
80 | return c->readBoolEntry("SingleClick", OPIE_DEFAULT_SINGLECLICK); | 81 | return c->readBoolEntry("SingleClick", OPIE_DEFAULT_SINGLECLICK); |
81 | } | 82 | } |
82 | 83 | ||
83 | bool OGlobalSettings::insertTearOffHandle() | 84 | bool OGlobalSettings::insertTearOffHandle() |
84 | { | 85 | { |
85 | OConfig *c = OGlobal::config(); | 86 | OConfig *c = OGlobal::config(); |
86 | OConfigGroupSaver cgs( c, "OPIE" ); | 87 | OConfigGroupSaver cgs( c, "OPIE" ); |
87 | return c->readBoolEntry("InsertTearOffHandle", OPIE_DEFAULT_INSERTTEAROFFHANDLES); | 88 | return c->readBoolEntry("InsertTearOffHandle", OPIE_DEFAULT_INSERTTEAROFFHANDLES); |
88 | } | 89 | } |
89 | 90 | ||
90 | bool OGlobalSettings::changeCursorOverIcon() | 91 | bool OGlobalSettings::changeCursorOverIcon() |
91 | { | 92 | { |
92 | OConfig *c = OGlobal::config(); | 93 | OConfig *c = OGlobal::config(); |
93 | OConfigGroupSaver cgs( c, "OPIE" ); | 94 | OConfigGroupSaver cgs( c, "OPIE" ); |
94 | return c->readBoolEntry("ChangeCursor", OPIE_DEFAULT_CHANGECURSOR); | 95 | return c->readBoolEntry("ChangeCursor", OPIE_DEFAULT_CHANGECURSOR); |
95 | } | 96 | } |
96 | 97 | ||
97 | bool OGlobalSettings::visualActivate() | 98 | bool OGlobalSettings::visualActivate() |
98 | { | 99 | { |
99 | OConfig *c = OGlobal::config(); | 100 | OConfig *c = OGlobal::config(); |
100 | OConfigGroupSaver cgs( c, "OPIE" ); | 101 | OConfigGroupSaver cgs( c, "OPIE" ); |
101 | return c->readBoolEntry("VisualActivate", OPIE_DEFAULT_VISUAL_ACTIVATE); | 102 | return c->readBoolEntry("VisualActivate", OPIE_DEFAULT_VISUAL_ACTIVATE); |
102 | } | 103 | } |
103 | 104 | ||
104 | unsigned int OGlobalSettings::visualActivateSpeed() | 105 | unsigned int OGlobalSettings::visualActivateSpeed() |
105 | { | 106 | { |
106 | OConfig *c = OGlobal::config(); | 107 | OConfig *c = OGlobal::config(); |
107 | OConfigGroupSaver cgs( c, "OPIE" ); | 108 | OConfigGroupSaver cgs( c, "OPIE" ); |
108 | return | 109 | return |
109 | c->readNumEntry( | 110 | c->readNumEntry( |
110 | "VisualActivateSpeed", | 111 | "VisualActivateSpeed", |
111 | OPIE_DEFAULT_VISUAL_ACTIVATE_SPEED | 112 | OPIE_DEFAULT_VISUAL_ACTIVATE_SPEED |
112 | ); | 113 | ); |
113 | } | 114 | } |
114 | 115 | ||
115 | int OGlobalSettings::autoSelectDelay() | 116 | int OGlobalSettings::autoSelectDelay() |
116 | { | 117 | { |
117 | OConfig *c = OGlobal::config(); | 118 | OConfig *c = OGlobal::config(); |
118 | OConfigGroupSaver cgs( c, "OPIE" ); | 119 | OConfigGroupSaver cgs( c, "OPIE" ); |
119 | return c->readNumEntry("AutoSelectDelay", OPIE_DEFAULT_AUTOSELECTDELAY); | 120 | return c->readNumEntry("AutoSelectDelay", OPIE_DEFAULT_AUTOSELECTDELAY); |
120 | } | 121 | } |
121 | 122 | ||
122 | OGlobalSettings::Completion OGlobalSettings::completionMode() | 123 | OGlobalSettings::Completion OGlobalSettings::completionMode() |
123 | { | 124 | { |
124 | int completion; | 125 | int completion; |
125 | OConfig *c = OGlobal::config(); | 126 | OConfig *c = OGlobal::config(); |
126 | OConfigGroupSaver cgs( c, "General" ); | 127 | OConfigGroupSaver cgs( c, "General" ); |
127 | completion = c->readNumEntry("completionMode", -1); | 128 | completion = c->readNumEntry("completionMode", -1); |
128 | if ((completion < (int) CompletionNone) || | 129 | if ((completion < (int) CompletionNone) || |
129 | (completion > (int) CompletionPopupAuto)) | 130 | (completion > (int) CompletionPopupAuto)) |
130 | { | 131 | { |
131 | completion = (int) CompletionPopup; // Default | 132 | completion = (int) CompletionPopup; // Default |
132 | } | 133 | } |
133 | return (Completion) completion; | 134 | return (Completion) completion; |
134 | } | 135 | } |
135 | 136 | ||
136 | 137 | ||
137 | bool OGlobalSettings::showContextMenusOnPress () | 138 | bool OGlobalSettings::showContextMenusOnPress () |
138 | { | 139 | { |
139 | OConfig *c = OGlobal::config(); | 140 | OConfig *c = OGlobal::config(); |
140 | OConfigGroupSaver cgs (c, "ContextMenus"); | 141 | OConfigGroupSaver cgs (c, "ContextMenus"); |
141 | 142 | ||
142 | return cgs.config()->readBoolEntry("ShowOnPress", true); | 143 | return cgs.config()->readBoolEntry("ShowOnPress", true); |
143 | } | 144 | } |
144 | 145 | ||
145 | 146 | ||
146 | int OGlobalSettings::contextMenuKey () | 147 | int OGlobalSettings::contextMenuKey () |
147 | { | 148 | { |
148 | OConfig *c = OGlobal::config(); | 149 | OConfig *c = OGlobal::config(); |
149 | OConfigGroupSaver cgs (c, "Shortcuts"); | 150 | OConfigGroupSaver cgs (c, "Shortcuts"); |
150 | 151 | ||
151 | //OShortcut cut (cgs.config()->readEntry ("PopupMenuContext", "Menu")); | 152 | //OShortcut cut (cgs.config()->readEntry ("PopupMenuContext", "Menu")); |
152 | //return cut.keyCodeQt(); | 153 | //return cut.keyCodeQt(); |
153 | 154 | ||
154 | return 0; // FIXME | 155 | return 0; // FIXME |
155 | } | 156 | } |
156 | 157 | ||
157 | 158 | ||
158 | OGlobalSettings::Debug OGlobalSettings::debugMode() | 159 | OGlobalSettings::Debug OGlobalSettings::debugMode() |
159 | { | 160 | { |
160 | OConfig *c = OGlobal::config(); | 161 | OConfig *c = OGlobal::config(); |
161 | OConfigGroupSaver cgs( c, "General" ); | 162 | OConfigGroupSaver cgs( c, "General" ); |
162 | int debug = c->readNumEntry( "debugMode", -1 ); | 163 | int debug = c->readNumEntry( "debugMode", ODEBUG_STDERR ); |
163 | if ( (debug < (int) DebugNone) || (debug > (int) DebugSocket) ) | 164 | if ( (debug < (int) DebugNone) || (debug > (int) DebugSocket) ) |
164 | { | 165 | { |
165 | debug = (int) DebugStdErr; // Default | 166 | debug = (int) DebugStdErr; // Default |
166 | } | 167 | } |
167 | return (Debug) debug; | 168 | return (Debug) debug; |
168 | } | 169 | } |
169 | 170 | ||
170 | 171 | ||
171 | QString OGlobalSettings::debugOutput() | 172 | QString OGlobalSettings::debugOutput() |
172 | { | 173 | { |
173 | OConfig *c = OGlobal::config(); | 174 | OConfig *c = OGlobal::config(); |
174 | OConfigGroupSaver cgs( c, "General" ); | 175 | OConfigGroupSaver cgs( c, "General" ); |
175 | QString deflt = QString::null; | 176 | QString deflt = QString::null; |
176 | switch( debugMode() ) | 177 | switch( debugMode() ) |
177 | { | 178 | { |
178 | case DebugNone: break; // no additional information needed | 179 | case DebugNone: break; // no additional information needed |
179 | case DebugFiles: deflt = "/var/log/opiedebug.log"; break; // file to save output in | 180 | case DebugFiles: deflt = "/var/log/opiedebug.log"; break; // file to save output in |
180 | case DebugMsgBox: break; // no additional information needed | 181 | case DebugMsgBox: break; // no additional information needed |
181 | case DebugStdErr: break; // no additional information needed | 182 | case DebugStdErr: break; // no additional information needed |
182 | case DebugSysLog: break; // no additional information needed | 183 | case DebugSysLog: break; // no additional information needed |
183 | case DebugSocket: deflt = "127.0.0.1:8913"; break; // address to send packets to | 184 | case DebugSocket: deflt = "127.0.0.1:8913"; break; // address to send packets to |
184 | } | 185 | } |
185 | 186 | ||
186 | return c->readEntry( "debugOutput"+ QString::number(debugMode()), deflt ); | 187 | return c->readEntry( "debugOutput"+ QString::number(debugMode()), deflt ); |
187 | } | 188 | } |
188 | 189 | ||
189 | 190 | ||
190 | QColor OGlobalSettings::toolBarHighlightColor() | 191 | QColor OGlobalSettings::toolBarHighlightColor() |
191 | { | 192 | { |
192 | initColors(); | 193 | initColors(); |
193 | OConfig *c = OGlobal::config(); | 194 | OConfig *c = OGlobal::config(); |
194 | OConfigGroupSaver cgs( c, QString::fromLatin1("Toolbar style") ); | 195 | OConfigGroupSaver cgs( c, QString::fromLatin1("Toolbar style") ); |
195 | return c->readColorEntry("HighlightColor", OpieHighlight); | 196 | return c->readColorEntry("HighlightColor", OpieHighlight); |
196 | } | 197 | } |
197 | 198 | ||
198 | QColor OGlobalSettings::inactiveTitleColor() | 199 | QColor OGlobalSettings::inactiveTitleColor() |
199 | { | 200 | { |
200 | if (!OpieGray) OpieGray = new QColor(220, 220, 220); | 201 | if (!OpieGray) OpieGray = new QColor(220, 220, 220); |
201 | OConfig *c = OGlobal::config(); | 202 | OConfig *c = OGlobal::config(); |
202 | OConfigGroupSaver cgs( c, QString::fromLatin1("WM") ); | 203 | OConfigGroupSaver cgs( c, QString::fromLatin1("WM") ); |
203 | return c->readColorEntry( "inactiveBackground", OpieGray ); | 204 | return c->readColorEntry( "inactiveBackground", OpieGray ); |
204 | } | 205 | } |
205 | 206 | ||
206 | QColor OGlobalSettings::inactiveTextColor() | 207 | QColor OGlobalSettings::inactiveTextColor() |
207 | { | 208 | { |
208 | OConfig *c = OGlobal::config(); | 209 | OConfig *c = OGlobal::config(); |
209 | OConfigGroupSaver cgs( c, QString::fromLatin1("WM") ); | 210 | OConfigGroupSaver cgs( c, QString::fromLatin1("WM") ); |
210 | return c->readColorEntry( "inactiveForeground", &Qt::darkGray ); | 211 | return c->readColorEntry( "inactiveForeground", &Qt::darkGray ); |
211 | } | 212 | } |
212 | 213 | ||
213 | QColor OGlobalSettings::activeTitleColor() | 214 | QColor OGlobalSettings::activeTitleColor() |
214 | { | 215 | { |
215 | initColors(); | 216 | initColors(); |
216 | OConfig *c = OGlobal::config(); | 217 | OConfig *c = OGlobal::config(); |
217 | OConfigGroupSaver cgs( c, QString::fromLatin1("WM") ); | 218 | OConfigGroupSaver cgs( c, QString::fromLatin1("WM") ); |
218 | return c->readColorEntry( "activeBackground", OpieHighlight); | 219 | return c->readColorEntry( "activeBackground", OpieHighlight); |
219 | } | 220 | } |
220 | 221 | ||
221 | QColor OGlobalSettings::activeTextColor() | 222 | QColor OGlobalSettings::activeTextColor() |
222 | { | 223 | { |
223 | OConfig *c = OGlobal::config(); | 224 | OConfig *c = OGlobal::config(); |
224 | OConfigGroupSaver cgs( c, QString::fromLatin1("WM") ); | 225 | OConfigGroupSaver cgs( c, QString::fromLatin1("WM") ); |
225 | return c->readColorEntry( "activeForeground", &Qt::white ); | 226 | return c->readColorEntry( "activeForeground", &Qt::white ); |
226 | } | 227 | } |
227 | 228 | ||
228 | int OGlobalSettings::contrast() | 229 | int OGlobalSettings::contrast() |
229 | { | 230 | { |
230 | OConfig *c = OGlobal::config(); | 231 | OConfig *c = OGlobal::config(); |
231 | OConfigGroupSaver cgs( c, QString::fromLatin1("OPIE") ); | 232 | OConfigGroupSaver cgs( c, QString::fromLatin1("OPIE") ); |
232 | return c->readNumEntry( "contrast", 7 ); | 233 | return c->readNumEntry( "contrast", 7 ); |
233 | } | 234 | } |
234 | 235 | ||
235 | // following functions should work in OPIE - how to sync with appearance changes? | 236 | // following functions should work in OPIE - how to sync with appearance changes? |
236 | 237 | ||
237 | QColor OGlobalSettings::baseColor() | 238 | QColor OGlobalSettings::baseColor() |
238 | { | 239 | { |
239 | OConfig *c = OGlobal::config(); | 240 | OConfig *c = OGlobal::config(); |
240 | OConfigGroupSaver cgs( c, QString::fromLatin1("Appearance") ); | 241 | OConfigGroupSaver cgs( c, QString::fromLatin1("Appearance") ); |
241 | return c->readColorEntry( "Base", &Qt::white ); | 242 | return c->readColorEntry( "Base", &Qt::white ); |
242 | } | 243 | } |
243 | 244 | ||
244 | QColor OGlobalSettings::textColor() | 245 | QColor OGlobalSettings::textColor() |
245 | { | 246 | { |
246 | OConfig *c = OGlobal::config(); | 247 | OConfig *c = OGlobal::config(); |
247 | OConfigGroupSaver cgs( c, QString::fromLatin1("Appearance") ); | 248 | OConfigGroupSaver cgs( c, QString::fromLatin1("Appearance") ); |
248 | return c->readColorEntry( "Text", &Qt::black ); | 249 | return c->readColorEntry( "Text", &Qt::black ); |
249 | } | 250 | } |
250 | 251 | ||
251 | QColor OGlobalSettings::highlightedTextColor() | 252 | QColor OGlobalSettings::highlightedTextColor() |
252 | { | 253 | { |
253 | OConfig *c = OGlobal::config(); | 254 | OConfig *c = OGlobal::config(); |
254 | OConfigGroupSaver cgs( c, QString::fromLatin1("Appearance") ); | 255 | OConfigGroupSaver cgs( c, QString::fromLatin1("Appearance") ); |
255 | return c->readColorEntry( "HighlightedText", &Qt::white ); | 256 | return c->readColorEntry( "HighlightedText", &Qt::white ); |
256 | } | 257 | } |
257 | 258 | ||
258 | QColor OGlobalSettings::highlightColor() | 259 | QColor OGlobalSettings::highlightColor() |