author | zecke <zecke> | 2005-02-18 00:06:17 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-02-18 00:06:17 (UTC) |
commit | 86b6f28a90bd18eea89366498a59c44685077ddc (patch) (unidiff) | |
tree | d5a232617655b7a0453eff07f9fc0ab3e2c14f0b | |
parent | 9bf35a9978c8a9e8b9c2100abf9137ffefc73e17 (diff) | |
download | opie-86b6f28a90bd18eea89366498a59c44685077ddc.zip opie-86b6f28a90bd18eea89366498a59c44685077ddc.tar.gz opie-86b6f28a90bd18eea89366498a59c44685077ddc.tar.bz2 |
-Check if the string is safe (omitted Global::shellQuote as we construct
the string)
-Use QFile::encodeName and avoid ascii constructors
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp index 5f95e42..7d080ba 100644 --- a/libopie2/opiecore/device/odevice_jornada.cpp +++ b/libopie2/opiecore/device/odevice_jornada.cpp | |||
@@ -131,53 +131,54 @@ void Jornada::initButtons() | |||
131 | 131 | ||
132 | if (( ib->model & d->m_model ) == d->m_model ) { | 132 | if (( ib->model & d->m_model ) == d->m_model ) { |
133 | b. setKeycode ( ib->code ); | 133 | b. setKeycode ( ib->code ); |
134 | b. setUserText ( QObject::tr ( "Button", ib->utext )); | 134 | b. setUserText ( QObject::tr ( "Button", ib->utext )); |
135 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); | 135 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); |
136 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); | 136 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); |
137 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); | 137 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); |
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 | 144 | ||
145 | int Jornada::displayBrightnessResolution() const | 145 | int Jornada::displayBrightnessResolution() const |
146 | { | 146 | { |
147 | return 255; | 147 | return 255; |
148 | } | 148 | } |
149 | 149 | ||
150 | 150 | ||
151 | bool Jornada::setDisplayBrightness( int bright ) | 151 | bool Jornada::setDisplayBrightness( int bright ) |
152 | { | 152 | { |
153 | bool res = false; | 153 | bool res = false; |
154 | 154 | ||
155 | if ( bright > 255 ) | 155 | if ( bright > 255 ) |
156 | bright = 255; | 156 | bright = 255; |
157 | if ( bright < 0 ) | 157 | if ( bright < 0 ) |
158 | bright = 0; | 158 | bright = 0; |
159 | 159 | ||
160 | QString cmdline; | 160 | QString cmdline; |
161 | 161 | ||
162 | if ( !bright ) | 162 | if ( !bright ) |
163 | cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power"); | 163 | cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/sa1100fb/power"); |
164 | else | 164 | else |
165 | cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", bright ); | 165 | cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %1 > /sys/class/backlight/sa1100fb/brightness" ).arg( bright ); |
166 | 166 | ||
167 | res = ( ::system( (const char*) cmdline ) == 0 ); | 167 | // No Global::shellQuote as we gurantee it to be sane |
168 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); | ||
168 | 169 | ||
169 | return res; | 170 | return res; |
170 | } | 171 | } |
171 | 172 | ||
172 | 173 | ||
173 | bool Jornada::setDisplayStatus ( bool on ) | 174 | bool Jornada::setDisplayStatus ( bool on ) |
174 | { | 175 | { |
175 | bool res = false; | 176 | bool res = false; |
176 | 177 | ||
177 | 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" ); | 178 | QString cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/sa1100fb/power; echo %2 > /sys/class/backlight/sa1100fb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); |
178 | 179 | ||
179 | res = ( ::system( (const char*) cmdline ) == 0 ); | 180 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); |
180 | 181 | ||
181 | return res; | 182 | return res; |
182 | } | 183 | } |
183 | 184 | ||