summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/applets/batteryapplet/batterystatus.cpp53
1 files changed, 35 insertions, 18 deletions
diff --git a/core/applets/batteryapplet/batterystatus.cpp b/core/applets/batteryapplet/batterystatus.cpp
index addb517..7f8de2c 100644
--- a/core/applets/batteryapplet/batterystatus.cpp
+++ b/core/applets/batteryapplet/batterystatus.cpp
@@ -99,7 +99,8 @@ bool BatteryStatus::getProcApmStatusIpaq() {
99 sec2 += " min"; 99 sec2 += " min";
100 } 100 }
101 101
102 jackStatus == (" ( " + jackStatus + " )"); 102 jackStatus.prepend( " ( " );
103 jackStatus.append( " )" );
103 return true; 104 return true;
104} 105}
105 106
@@ -139,45 +140,61 @@ QString BatteryStatus::statusText() const {
139 text = tr("Charging"); 140 text = tr("Charging");
140 } 141 }
141 } else if ( ps->batteryPercentAccurate() ) { 142 } else if ( ps->batteryPercentAccurate() ) {
142 text.sprintf( tr("Remaining Power") + ": %i%%", percent ); 143 text = tr( "Remaining Power: %1%" ).arg( percent );
144 //text.sprintf( tr("Remaining Power") + ": %i%%", percent );
143 } else { 145 } else {
144 text = tr("Battery status: "); 146 text = tr("Battery status: ");
145 switch ( ps->batteryStatus() ) { 147 switch ( ps->batteryStatus() ) {
146 case PowerStatus::High: 148 case PowerStatus::High:
147 text += tr("Good"); 149 text.append( tr( "Good" ) );
148 break; 150 break;
149 case PowerStatus::Low: 151 case PowerStatus::Low:
150 text += tr("Low"); 152 text.append( tr( "Low" ) );
151 break; 153 break;
152 case PowerStatus::VeryLow: 154 case PowerStatus::VeryLow:
153 text += tr("Very Low"); 155 text.append( tr( "Very Low" ) );
154 break; 156 break;
155 case PowerStatus::Critical: 157 case PowerStatus::Critical:
156 text += tr("Critical"); 158 text.append( tr( "Critical" ) );
157 break; 159 break;
158 default: // NotPresent, etc. 160 default: // NotPresent, etc.
159 text += tr("Unknown"); 161 text.append( tr( "Unknown" ) );
160 } 162 }
161 } 163 }
162 164
163 if ( ps->acStatus() == PowerStatus::Backup ) 165 if ( ps->acStatus() == PowerStatus::Backup )
164 text += "\n" + tr("On backup power"); 166 {
167 text.append( '\n' );
168 text.append( tr( "On backup power" ) );
169 }
165 else if ( ps->acStatus() == PowerStatus::Online ) 170 else if ( ps->acStatus() == PowerStatus::Online )
166 text += "\n" + tr("Power on-line"); 171 {
172 text.append( '\n' );
173 text.append( tr( "Power on-line" ) );
174 }
167 else if ( ps->acStatus() == PowerStatus::Offline ) 175 else if ( ps->acStatus() == PowerStatus::Offline )
168 text += "\n" + tr("External power disconnected"); 176 {
177 text.append( '\n' );
178 text.append( tr( "External power disconnected" ) );
179 }
169 180
170 if ( ps->batteryTimeRemaining() >= 0 ) { 181 if ( ps->batteryTimeRemaining() >= 0 )
171 text += "\n" + QString().sprintf( tr("Remaining Time") + ": %im %02is", 182 {
172 ps->batteryTimeRemaining() / 60, ps->batteryTimeRemaining() % 60 ); 183 text.append( '\n' );
184 text.append( tr("Remaining Time: %1m %2s" ).arg( ps->batteryTimeRemaining() / 60 )
185 .arg( ps->batteryTimeRemaining() % 60, 2 ) );
186/* text += "\n" + QString().sprintf( tr("Remaining Time") + ": %im %02is",
187 ps->batteryTimeRemaining() / 60, ps->batteryTimeRemaining() % 60 );*/
173 } 188 }
174 return text; 189 return text;
175} 190}
176 191
177QString BatteryStatus::statusTextIpaq() const { 192QString BatteryStatus::statusTextIpaq() const {
178 QString text; 193 QString text = tr( "Remaing Power: %1 %2\nRemaining Time: %3" ).arg( perc2 )
179 text += tr("Remaining Power: ") + perc2 + " " + jackStatus; 194 .arg( jackStatus )
180 text += "\n" + tr("Remaining Time: ") + sec2; 195 .arg( sec2 );
196/* QString text = tr("Remaining Power: ") + perc2 + " " + jackStatus;
197 text += "\n" + tr("Remaining Time: ") + sec2;*/
181 return text; 198 return text;
182} 199}
183 200
@@ -220,14 +237,14 @@ void BatteryStatus::paintEvent( QPaintEvent * ev ) {
220 237
221 if ( ODevice::inst ( )-> series ( ) == Model_iPAQ && bat2 ) { 238 if ( ODevice::inst ( )-> series ( ) == Model_iPAQ && bat2 ) {
222 239
223 p.drawText( 15, 30, tr ("Ipaq ") + ipaqChem ); 240 p.drawText( 15, 30, tr("Ipaq %1").arg( ipaqChem ) );
224 241
225 QString jacketMsg; 242 QString jacketMsg;
226 if (bat2) { 243 if (bat2) {
227 p.setPen(black); 244 p.setPen(black);
228 QString text = statusTextIpaq(); 245 QString text = statusTextIpaq();
229 p.drawText( 10, 150, text ); 246 p.drawText( 10, 150, text );
230 jacketMsg = tr("Jacket ") + jackChem; 247 jacketMsg = tr("Jacket ").arg( jackChem );
231 } else { 248 } else {
232 jackPercent = 0; 249 jackPercent = 0;
233 jacketMsg = tr("No jacket with battery inserted"); 250 jacketMsg = tr("No jacket with battery inserted");