-rw-r--r-- | core/applets/cardmon/cardmon.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp index b8c4553..4ed09b8 100644 --- a/core/applets/cardmon/cardmon.cpp +++ b/core/applets/cardmon/cardmon.cpp | |||
@@ -251,49 +251,51 @@ bool CardMonitor::getStatusPcmcia(int showPopUp) | |||
251 | QString what = QString::null; | 251 | QString what = QString::null; |
252 | if (cardWas0 != cardInPcmcia0) { | 252 | if (cardWas0 != cardInPcmcia0) { |
253 | if (cardInPcmcia0) { | 253 | if (cardInPcmcia0) { |
254 | text += tr("New card: "); | 254 | text += tr("New card: "); |
255 | what = "on"; | 255 | what = "on"; |
256 | } else { | 256 | } else { |
257 | text += tr("Ejected: "); | 257 | text += tr("Ejected: "); |
258 | what = "off"; | 258 | what = "off"; |
259 | } | 259 | } |
260 | text += cardInPcmcia0Name; | 260 | text += cardInPcmcia0Name; |
261 | popUp(text, "cardmon/" + cardInPcmcia0Type); | 261 | popUp(text, "cardmon/" + cardInPcmcia0Type); |
262 | } | 262 | } |
263 | 263 | ||
264 | if (cardWas1 != cardInPcmcia1) { | 264 | if (cardWas1 != cardInPcmcia1) { |
265 | if (cardInPcmcia1) { | 265 | if (cardInPcmcia1) { |
266 | text += tr("New card: "); | 266 | text += tr("New card: "); |
267 | what = "on"; | 267 | what = "on"; |
268 | } else { | 268 | } else { |
269 | text += tr("Ejected: "); | 269 | text += tr("Ejected: "); |
270 | what = "off"; | 270 | what = "off"; |
271 | } | 271 | } |
272 | text += cardInPcmcia1Name; | 272 | text += cardInPcmcia1Name; |
273 | popUp(text, "cardmon/" + cardInPcmcia1Type); | 273 | popUp(text, "cardmon/" + cardInPcmcia1Type); |
274 | } | 274 | } |
275 | #ifndef QT_NO_SOUND | ||
275 | QSound::play(Resource::findSound("cardmon/card" + what)); | 276 | QSound::play(Resource::findSound("cardmon/card" + what)); |
277 | #endif | ||
276 | } | 278 | } |
277 | } else { | 279 | } else { |
278 | // no file found | 280 | // no file found |
279 | qDebug("no file found"); | 281 | qDebug("no file found"); |
280 | cardInPcmcia0 = FALSE; | 282 | cardInPcmcia0 = FALSE; |
281 | cardInPcmcia1 = FALSE; | 283 | cardInPcmcia1 = FALSE; |
282 | } | 284 | } |
283 | repaint( FALSE ); | 285 | repaint( FALSE ); |
284 | return ((cardWas0 == cardInPcmcia0 | 286 | return ((cardWas0 == cardInPcmcia0 |
285 | && cardWas1 == cardInPcmcia1) ? FALSE : TRUE); | 287 | && cardWas1 == cardInPcmcia1) ? FALSE : TRUE); |
286 | 288 | ||
287 | } | 289 | } |
288 | 290 | ||
289 | 291 | ||
290 | bool CardMonitor::getStatusSd(int showPopUp) | 292 | bool CardMonitor::getStatusSd(int showPopUp) |
291 | { | 293 | { |
292 | 294 | ||
293 | bool cardWas = cardInSd;// remember last state | 295 | bool cardWas = cardInSd;// remember last state |
294 | cardInSd = FALSE; | 296 | cardInSd = FALSE; |
295 | 297 | ||
296 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 298 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
297 | struct mntent *me; | 299 | struct mntent *me; |
298 | FILE *mntfp = setmntent("/etc/mtab", "r"); | 300 | FILE *mntfp = setmntent("/etc/mtab", "r"); |
299 | 301 | ||
@@ -303,47 +305,49 @@ bool CardMonitor::getStatusSd(int showPopUp) | |||
303 | //qDebug( fs ); | 305 | //qDebug( fs ); |
304 | if (fs.left(14) == "/dev/mmc/part1" || fs.left(7) == "/dev/sd" | 306 | if (fs.left(14) == "/dev/mmc/part1" || fs.left(7) == "/dev/sd" |
305 | || fs.left(9) == "/dev/mmcd") { | 307 | || fs.left(9) == "/dev/mmcd") { |
306 | cardInSd = TRUE; | 308 | cardInSd = TRUE; |
307 | show(); | 309 | show(); |
308 | } | 310 | } |
309 | // else { | 311 | // else { |
310 | // cardInSd = FALSE; | 312 | // cardInSd = FALSE; |
311 | // } | 313 | // } |
312 | } | 314 | } |
313 | endmntent(mntfp); | 315 | endmntent(mntfp); |
314 | } | 316 | } |
315 | 317 | ||
316 | if (!showPopUp && cardWas != cardInSd) { | 318 | if (!showPopUp && cardWas != cardInSd) { |
317 | QString text = QString::null; | 319 | QString text = QString::null; |
318 | QString what = QString::null; | 320 | QString what = QString::null; |
319 | if (cardInSd) { | 321 | if (cardInSd) { |
320 | text += "New card: SD/MMC"; | 322 | text += "New card: SD/MMC"; |
321 | what = "on"; | 323 | what = "on"; |
322 | } else { | 324 | } else { |
323 | text += "Ejected: SD/MMC"; | 325 | text += "Ejected: SD/MMC"; |
324 | what = "off"; | 326 | what = "off"; |
325 | } | 327 | } |
326 | //qDebug("TEXT: " + text ); | 328 | //qDebug("TEXT: " + text ); |
329 | #ifndef QT_NO_SOUND | ||
327 | QSound::play(Resource::findSound("cardmon/card" + what)); | 330 | QSound::play(Resource::findSound("cardmon/card" + what)); |
331 | #endif | ||
328 | popUp(text, "cardmon/ide");// XX add SD pic | 332 | popUp(text, "cardmon/ide");// XX add SD pic |
329 | } | 333 | } |
330 | #else | 334 | #else |
331 | #error "Not on Linux" | 335 | #error "Not on Linux" |
332 | #endif | 336 | #endif |
333 | repaint( FALSE ); | 337 | repaint( FALSE ); |
334 | return ((cardWas == cardInSd) ? FALSE : TRUE); | 338 | return ((cardWas == cardInSd) ? FALSE : TRUE); |
335 | } | 339 | } |
336 | 340 | ||
337 | void CardMonitor::paintEvent(QPaintEvent *) | 341 | void CardMonitor::paintEvent(QPaintEvent *) |
338 | { | 342 | { |
339 | 343 | ||
340 | QPainter p(this); | 344 | QPainter p(this); |
341 | 345 | ||
342 | if ( cardInPcmcia0 || cardInPcmcia1 || cardInSd ) { | 346 | if ( cardInPcmcia0 || cardInPcmcia1 || cardInSd ) { |
343 | p.drawPixmap(0, 0, pm ); | 347 | p.drawPixmap(0, 0, pm ); |
344 | show(); | 348 | show(); |
345 | } else { | 349 | } else { |
346 | //p.eraseRect(rect()); | 350 | //p.eraseRect(rect()); |
347 | hide(); | 351 | hide(); |
348 | } | 352 | } |
349 | } | 353 | } |