summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/oconfig.cpp
Unidiff
Diffstat (limited to 'libopie2/opiecore/oconfig.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/oconfig.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/libopie2/opiecore/oconfig.cpp b/libopie2/opiecore/oconfig.cpp
index fb5eabb..05d8070 100644
--- a/libopie2/opiecore/oconfig.cpp
+++ b/libopie2/opiecore/oconfig.cpp
@@ -1,88 +1,90 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 3
4 (C) 2003 Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> 4 (C) 2003 Michael Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 Inspired by the config classes from the KDE Project which are 5 Inspired by the config classes from the KDE Project which are
6 =. (C) 1997 Matthias Kalle Dalheimer <kalle@kde.org> 6 =. (C) 1997 Matthias Kalle Dalheimer <kalle@kde.org>
7 .=l. 7 .=l.
8           .>+-= 8           .>+-=
9 _;:,     .>    :=|. This program is free software; you can 9 _;:,     .>    :=|. This program is free software; you can
10.> <`_,   >  .   <= redistribute it and/or modify it under 10.> <`_,   >  .   <= redistribute it and/or modify it under
11:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 11:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
12.="- .-=="i,     .._ License as published by the Free Software 12.="- .-=="i,     .._ License as published by the Free Software
13 - .   .-<_>     .<> Foundation; either version 2 of the License, 13 - .   .-<_>     .<> Foundation; either version 2 of the License,
14     ._= =}       : or (at your option) any later version. 14     ._= =}       : or (at your option) any later version.
15    .%`+i>       _;_. 15    .%`+i>       _;_.
16    .i_,=:_.      -<s. This program is distributed in the hope that 16    .i_,=:_.      -<s. This program is distributed in the hope that
17     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 17     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
18    : ..    .:,     . . . without even the implied warranty of 18    : ..    .:,     . . . without even the implied warranty of
19    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 19    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
20  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 20  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
21..}^=.=       =       ; Library General Public License for more 21..}^=.=       =       ; Library General Public License for more
22++=   -.     .`     .: details. 22++=   -.     .`     .: details.
23 :     =  ...= . :.=- 23 :     =  ...= . :.=-
24 -.   .:....=;==+<; You should have received a copy of the GNU 24 -.   .:....=;==+<; You should have received a copy of the GNU
25  -_. . .   )=.  = Library General Public License along with 25  -_. . .   )=.  = Library General Public License along with
26    --        :-=` this library; see the file COPYING.LIB. 26    --        :-=` this library; see the file COPYING.LIB.
27 If not, write to the Free Software Foundation, 27 If not, write to the Free Software Foundation,
28 Inc., 59 Temple Place - Suite 330, 28 Inc., 59 Temple Place - Suite 330,
29 Boston, MA 02111-1307, USA. 29 Boston, MA 02111-1307, USA.
30*/ 30*/
31 31
32/* QT */ 32/* QT */
33 33
34#include <qfont.h> 34#include <qfont.h>
35#include <qcolor.h> 35#include <qcolor.h>
36 36
37/* OPIE */ 37/* OPIE */
38 38
39#include <opie2/oconfig.h> 39#include <opie2/oconfig.h>
40 40
41using namespace Opie::Core;
42
41OConfig::OConfig( const QString &name, Domain domain ) 43OConfig::OConfig( const QString &name, Domain domain )
42 :Config( name, domain ) 44 :Config( name, domain )
43{ 45{
44 qDebug( "OConfig::OConfig()" ); 46 qDebug( "OConfig::OConfig()" );
45} 47}
46 48
47OConfig::~OConfig() 49OConfig::~OConfig()
48{ 50{
49 qDebug( "OConfig::~OConfig()" ); 51 qDebug( "OConfig::~OConfig()" );
50} 52}
51 53
52QColor OConfig::readColorEntry( const QString& key, const QColor* pDefault ) const 54QColor OConfig::readColorEntry( const QString& key, const QColor* pDefault ) const
53{ 55{
54 QColor aRetColor; 56 QColor aRetColor;
55 int nRed = 0, nGreen = 0, nBlue = 0; 57 int nRed = 0, nGreen = 0, nBlue = 0;
56 58
57 QString aValue = readEntry( key ); 59 QString aValue = readEntry( key );
58 if( !aValue.isEmpty() ) 60 if( !aValue.isEmpty() )
59 { 61 {
60 if ( aValue.at(0) == '#' ) 62 if ( aValue.at(0) == '#' )
61 { 63 {
62 aRetColor.setNamedColor(aValue); 64 aRetColor.setNamedColor(aValue);
63 } 65 }
64 else 66 else
65 { 67 {
66 bool bOK; 68 bool bOK;
67 69
68 // find first part (red) 70 // find first part (red)
69 int nIndex = aValue.find( ',' ); 71 int nIndex = aValue.find( ',' );
70 72
71 if( nIndex == -1 ) 73 if( nIndex == -1 )
72 { 74 {
73 // return a sensible default -- Bernd 75 // return a sensible default -- Bernd
74 if( pDefault ) 76 if( pDefault )
75 aRetColor = *pDefault; 77 aRetColor = *pDefault;
76 return aRetColor; 78 return aRetColor;
77 } 79 }
78 80
79 nRed = aValue.left( nIndex ).toInt( &bOK ); 81 nRed = aValue.left( nIndex ).toInt( &bOK );
80 82
81 // find second part (green) 83 // find second part (green)
82 int nOldIndex = nIndex; 84 int nOldIndex = nIndex;
83 nIndex = aValue.find( ',', nOldIndex+1 ); 85 nIndex = aValue.find( ',', nOldIndex+1 );
84 86
85 if( nIndex == -1 ) 87 if( nIndex == -1 )
86 { 88 {
87 // return a sensible default -- Bernd 89 // return a sensible default -- Bernd
88 if( pDefault ) 90 if( pDefault )