Diffstat (limited to 'libopie2/opiecore/oconfig.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/oconfig.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libopie2/opiecore/oconfig.cpp b/libopie2/opiecore/oconfig.cpp index 05d8070..6b57729 100644 --- a/libopie2/opiecore/oconfig.cpp +++ b/libopie2/opiecore/oconfig.cpp | |||
@@ -68,96 +68,98 @@ QColor OConfig::readColorEntry( const QString& key, const QColor* pDefault ) con | |||
68 | bool bOK; | 68 | bool bOK; |
69 | 69 | ||
70 | // find first part (red) | 70 | // find first part (red) |
71 | int nIndex = aValue.find( ',' ); | 71 | int nIndex = aValue.find( ',' ); |
72 | 72 | ||
73 | if( nIndex == -1 ) | 73 | if( nIndex == -1 ) |
74 | { | 74 | { |
75 | // return a sensible default -- Bernd | 75 | // return a sensible default -- Bernd |
76 | if( pDefault ) | 76 | if( pDefault ) |
77 | aRetColor = *pDefault; | 77 | aRetColor = *pDefault; |
78 | return aRetColor; | 78 | return aRetColor; |
79 | } | 79 | } |
80 | 80 | ||
81 | nRed = aValue.left( nIndex ).toInt( &bOK ); | 81 | nRed = aValue.left( nIndex ).toInt( &bOK ); |
82 | 82 | ||
83 | // find second part (green) | 83 | // find second part (green) |
84 | int nOldIndex = nIndex; | 84 | int nOldIndex = nIndex; |
85 | nIndex = aValue.find( ',', nOldIndex+1 ); | 85 | nIndex = aValue.find( ',', nOldIndex+1 ); |
86 | 86 | ||
87 | if( nIndex == -1 ) | 87 | if( nIndex == -1 ) |
88 | { | 88 | { |
89 | // return a sensible default -- Bernd | 89 | // return a sensible default -- Bernd |
90 | if( pDefault ) | 90 | if( pDefault ) |
91 | aRetColor = *pDefault; | 91 | aRetColor = *pDefault; |
92 | return aRetColor; | 92 | return aRetColor; |
93 | } | 93 | } |
94 | nGreen = aValue.mid( nOldIndex+1, | 94 | nGreen = aValue.mid( nOldIndex+1, |
95 | nIndex-nOldIndex-1 ).toInt( &bOK ); | 95 | nIndex-nOldIndex-1 ).toInt( &bOK ); |
96 | 96 | ||
97 | // find third part (blue) | 97 | // find third part (blue) |
98 | nBlue = aValue.right( aValue.length()-nIndex-1 ).toInt( &bOK ); | 98 | nBlue = aValue.right( aValue.length()-nIndex-1 ).toInt( &bOK ); |
99 | 99 | ||
100 | aRetColor.setRgb( nRed, nGreen, nBlue ); | 100 | aRetColor.setRgb( nRed, nGreen, nBlue ); |
101 | } | 101 | } |
102 | } | 102 | } |
103 | else { | 103 | else { |
104 | 104 | ||
105 | if( pDefault ) | 105 | if( pDefault ) |
106 | aRetColor = *pDefault; | 106 | aRetColor = *pDefault; |
107 | } | 107 | } |
108 | 108 | ||
109 | return aRetColor; | 109 | return aRetColor; |
110 | } | 110 | } |
111 | 111 | ||
112 | // FIXME: The whole font handling has to be revised for Opie | 112 | // FIXME: The whole font handling has to be revised for Opie |
113 | 113 | ||
114 | QFont OConfig::readFontEntry( const QString& key, const QFont* pDefault ) const | 114 | QFont OConfig::readFontEntry( const QString& key, const QFont* pDefault ) const |
115 | { | 115 | { |
116 | Q_CONST_UNUSED( key ) | ||
117 | Q_CONST_UNUSED( pDefault ) | ||
116 | /* | 118 | /* |
117 | QFont aRetFont; | 119 | QFont aRetFont; |
118 | 120 | ||
119 | QString aValue = readEntry( key ); | 121 | QString aValue = readEntry( key ); |
120 | if( !aValue.isNull() ) { | 122 | if( !aValue.isNull() ) { |
121 | if ( aValue.contains( ',' ) > 5 ) { | 123 | if ( aValue.contains( ',' ) > 5 ) { |
122 | // KDE3 and upwards entry | 124 | // KDE3 and upwards entry |
123 | if ( !aRetFont.fromString( aValue ) && pDefault ) | 125 | if ( !aRetFont.fromString( aValue ) && pDefault ) |
124 | aRetFont = *pDefault; | 126 | aRetFont = *pDefault; |
125 | } | 127 | } |
126 | else { | 128 | else { |
127 | // backward compatibility with older font formats | 129 | // backward compatibility with older font formats |
128 | // ### remove KDE 3.1 ? | 130 | // ### remove KDE 3.1 ? |
129 | // find first part (font family) | 131 | // find first part (font family) |
130 | int nIndex = aValue.find( ',' ); | 132 | int nIndex = aValue.find( ',' ); |
131 | if( nIndex == -1 ){ | 133 | if( nIndex == -1 ){ |
132 | if( pDefault ) | 134 | if( pDefault ) |
133 | aRetFont = *pDefault; | 135 | aRetFont = *pDefault; |
134 | return aRetFont; | 136 | return aRetFont; |
135 | } | 137 | } |
136 | aRetFont.setFamily( aValue.left( nIndex ) ); | 138 | aRetFont.setFamily( aValue.left( nIndex ) ); |
137 | 139 | ||
138 | // find second part (point size) | 140 | // find second part (point size) |
139 | int nOldIndex = nIndex; | 141 | int nOldIndex = nIndex; |
140 | nIndex = aValue.find( ',', nOldIndex+1 ); | 142 | nIndex = aValue.find( ',', nOldIndex+1 ); |
141 | if( nIndex == -1 ){ | 143 | if( nIndex == -1 ){ |
142 | if( pDefault ) | 144 | if( pDefault ) |
143 | aRetFont = *pDefault; | 145 | aRetFont = *pDefault; |
144 | return aRetFont; | 146 | return aRetFont; |
145 | } | 147 | } |
146 | 148 | ||
147 | aRetFont.setPointSize( aValue.mid( nOldIndex+1, | 149 | aRetFont.setPointSize( aValue.mid( nOldIndex+1, |
148 | nIndex-nOldIndex-1 ).toInt() ); | 150 | nIndex-nOldIndex-1 ).toInt() ); |
149 | 151 | ||
150 | // find third part (style hint) | 152 | // find third part (style hint) |
151 | nOldIndex = nIndex; | 153 | nOldIndex = nIndex; |
152 | nIndex = aValue.find( ',', nOldIndex+1 ); | 154 | nIndex = aValue.find( ',', nOldIndex+1 ); |
153 | 155 | ||
154 | if( nIndex == -1 ){ | 156 | if( nIndex == -1 ){ |
155 | if( pDefault ) | 157 | if( pDefault ) |
156 | aRetFont = *pDefault; | 158 | aRetFont = *pDefault; |
157 | return aRetFont; | 159 | return aRetFont; |
158 | } | 160 | } |
159 | 161 | ||
160 | aRetFont.setStyleHint( (QFont::StyleHint)aValue.mid( nOldIndex+1, nIndex-nOldIndex-1 ).toUInt() ); | 162 | aRetFont.setStyleHint( (QFont::StyleHint)aValue.mid( nOldIndex+1, nIndex-nOldIndex-1 ).toUInt() ); |
161 | 163 | ||
162 | // find fourth part (char set) | 164 | // find fourth part (char set) |
163 | nOldIndex = nIndex; | 165 | nOldIndex = nIndex; |