author | eilers <eilers> | 2004-07-27 13:26:12 (UTC) |
---|---|---|
committer | eilers <eilers> | 2004-07-27 13:26:12 (UTC) |
commit | fd0d353abb2fd89a91eca830dbb814984647c1f7 (patch) (unidiff) | |
tree | d5328db46863e4d3fbda5fe85fd3b1ddb1951f80 | |
parent | 2f332574ddbd31fe9709c1ec93049ecef9bd00a4 (diff) | |
download | opie-fd0d353abb2fd89a91eca830dbb814984647c1f7.zip opie-fd0d353abb2fd89a91eca830dbb814984647c1f7.tar.gz opie-fd0d353abb2fd89a91eca830dbb814984647c1f7.tar.bz2 |
Replacing an ugly QString.sprintf() with QString().arg() which fixes wrong format handling.
This is a reason, why we have odebug instead of qDebug..
Thanks to mickeyl for code review!
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp index 5d32901..60736a1 100644 --- a/libopie2/opiecore/device/odevice_jornada.cpp +++ b/libopie2/opiecore/device/odevice_jornada.cpp | |||
@@ -138,71 +138,71 @@ void Jornada::initButtons() | |||
138 | 138 | ||
139 | d->m_buttons->append ( b ); | 139 | d->m_buttons->append ( b ); |
140 | } | 140 | } |
141 | } | 141 | } |
142 | reloadButtonMapping(); | 142 | reloadButtonMapping(); |
143 | 143 | ||
144 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 144 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
145 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); | 145 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
146 | } | 146 | } |
147 | 147 | ||
148 | int Jornada::displayBrightnessResolution() const | 148 | int Jornada::displayBrightnessResolution() const |
149 | { | 149 | { |
150 | return 255; | 150 | return 255; |
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | bool Jornada::setDisplayBrightness( int bright ) | 154 | bool Jornada::setDisplayBrightness( int bright ) |
155 | { | 155 | { |
156 | bool res = false; | 156 | bool res = false; |
157 | 157 | ||
158 | if ( bright > 255 ) | 158 | if ( bright > 255 ) |
159 | bright = 255; | 159 | bright = 255; |
160 | if ( bright < 0 ) | 160 | if ( bright < 0 ) |
161 | bright = 0; | 161 | bright = 0; |
162 | 162 | ||
163 | QString cmdline; | 163 | QString cmdline; |
164 | 164 | ||
165 | int value = 255 - bright; | 165 | int value = 255 - bright; |
166 | if ( !bright ) | 166 | if ( !bright ) |
167 | cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power"); | 167 | cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power"); |
168 | else | 168 | else |
169 | cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", value ); | 169 | cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", value ); |
170 | 170 | ||
171 | res = ( ::system( (const char*) cmdline ) == 0 ); | 171 | res = ( ::system( (const char*) cmdline ) == 0 ); |
172 | 172 | ||
173 | return res; | 173 | return res; |
174 | } | 174 | } |
175 | 175 | ||
176 | 176 | ||
177 | bool Jornada::suspend( ) | 177 | bool Jornada::suspend( ) |
178 | { | 178 | { |
179 | qDebug("ODevice::suspend"); | 179 | qDebug("ODevice::suspend"); |
180 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 180 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
181 | return false; | 181 | return false; |
182 | 182 | ||
183 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 183 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
184 | return false; | 184 | return false; |
185 | 185 | ||
186 | bool res = false; | 186 | bool res = false; |
187 | ODevice::sendSuspendmsg(); | 187 | ODevice::sendSuspendmsg(); |
188 | 188 | ||
189 | struct timeval tvs; | 189 | struct timeval tvs; |
190 | ::gettimeofday ( &tvs, 0 ); | 190 | ::gettimeofday ( &tvs, 0 ); |
191 | 191 | ||
192 | ::sync(); // flush fs caches | 192 | ::sync(); // flush fs caches |
193 | res = ( ::system ( "apm --suspend" ) == 0 ); | 193 | res = ( ::system ( "apm --suspend" ) == 0 ); |
194 | 194 | ||
195 | return res; | 195 | return res; |
196 | } | 196 | } |
197 | 197 | ||
198 | bool Jornada::setDisplayStatus ( bool on ) | 198 | bool Jornada::setDisplayStatus ( bool on ) |
199 | { | 199 | { |
200 | bool res = false; | 200 | bool res = false; |
201 | 201 | ||
202 | QString cmdline = QString().sprintf( "echo %d > /sys/class/lcd/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/power", on ? "0" : "4", on? "0" : "4" ); | 202 | QString cmdline = QString( "echo %1 > /sys/class/lcd/sa1100fb/power; echo %2 > /sys/class/backlight/sa1100fb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); |
203 | 203 | ||
204 | res = ( ::system( (const char*) cmdline ) == 0 ); | 204 | res = ( ::system( (const char*) cmdline ) == 0 ); |
205 | 205 | ||
206 | return res; | 206 | return res; |
207 | } | 207 | } |
208 | 208 | ||