Diffstat (limited to 'core/applets/cardmon/cardmon.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/applets/cardmon/cardmon.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp index 1ad8b55..3a6ad27 100644 --- a/core/applets/cardmon/cardmon.cpp +++ b/core/applets/cardmon/cardmon.cpp | |||
@@ -16,16 +16,19 @@ | |||
16 | * * | 16 | * * |
17 | ***************************************************************************/ | 17 | ***************************************************************************/ |
18 | 18 | ||
19 | #include "cardmon.h" | 19 | #include "cardmon.h" |
20 | 20 | ||
21 | /* OPIE */ | 21 | /* OPIE */ |
22 | #include <opie2/odebug.h> | ||
22 | #include <opie2/odevice.h> | 23 | #include <opie2/odevice.h> |
23 | #include <opie2/otaskbarapplet.h> | 24 | #include <opie2/otaskbarapplet.h> |
24 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
25 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | using namespace Opie::Core; | ||
28 | using namespace Opie::Ui; | ||
26 | 29 | ||
27 | /* QT */ | 30 | /* QT */ |
28 | #include <qcopchannel_qws.h> | 31 | #include <qcopchannel_qws.h> |
29 | #include <qpainter.h> | 32 | #include <qpainter.h> |
30 | #include <qfile.h> | 33 | #include <qfile.h> |
31 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
@@ -35,24 +38,17 @@ | |||
35 | /* STD */ | 38 | /* STD */ |
36 | #include <stdio.h> | 39 | #include <stdio.h> |
37 | #include <unistd.h> | 40 | #include <unistd.h> |
38 | #include <stdlib.h> | 41 | #include <stdlib.h> |
39 | #include <string.h> | 42 | #include <string.h> |
40 | #include <fcntl.h> | 43 | #include <fcntl.h> |
41 | |||
42 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 44 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
43 | #include <sys/vfs.h> | 45 | #include <sys/vfs.h> |
44 | #include <mntent.h> | 46 | #include <mntent.h> |
45 | #endif | 47 | #endif |
46 | 48 | ||
47 | using namespace Opie; | ||
48 | |||
49 | using namespace Opie::Ui; | ||
50 | using namespace Opie::Ui; | ||
51 | using namespace Opie::Core; | ||
52 | |||
53 | CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ), | 49 | CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ), |
54 | pm( Resource::loadPixmap( "cardmon/pcmcia" ) ) | 50 | pm( Resource::loadPixmap( "cardmon/pcmcia" ) ) |
55 | { | 51 | { |
56 | 52 | ||
57 | QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this ); | 53 | QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this ); |
58 | connect( pcmciaChannel, | 54 | connect( pcmciaChannel, |
@@ -194,18 +190,18 @@ void CardMonitor::mousePressEvent( QMouseEvent * ) | |||
194 | 190 | ||
195 | 191 | ||
196 | void CardMonitor::cardMessage( const QCString & msg, const QByteArray & ) | 192 | void CardMonitor::cardMessage( const QCString & msg, const QByteArray & ) |
197 | { | 193 | { |
198 | if ( msg == "stabChanged()" ) | 194 | if ( msg == "stabChanged()" ) |
199 | { | 195 | { |
200 | // qDebug("Pcmcia: stabchanged"); | 196 | // odebug << "Pcmcia: stabchanged" << oendl; |
201 | getStatusPcmcia(); | 197 | getStatusPcmcia(); |
202 | } | 198 | } |
203 | else if ( msg == "mtabChanged()" ) | 199 | else if ( msg == "mtabChanged()" ) |
204 | { | 200 | { |
205 | // qDebug("CARDMONAPPLET: mtabchanged"); | 201 | // odebug << "CARDMONAPPLET: mtabchanged" << oendl; |
206 | getStatusSd(); | 202 | getStatusSd(); |
207 | } | 203 | } |
208 | } | 204 | } |
209 | 205 | ||
210 | bool CardMonitor::getStatusPcmcia( int showPopUp ) | 206 | bool CardMonitor::getStatusPcmcia( int showPopUp ) |
211 | { | 207 | { |
@@ -328,13 +324,13 @@ bool CardMonitor::getStatusPcmcia( int showPopUp ) | |||
328 | 324 | ||
329 | } | 325 | } |
330 | } | 326 | } |
331 | else | 327 | else |
332 | { | 328 | { |
333 | // no file found | 329 | // no file found |
334 | qDebug( "no file found" ); | 330 | odebug << "no file found" << oendl; |
335 | cardInPcmcia0 = FALSE; | 331 | cardInPcmcia0 = FALSE; |
336 | cardInPcmcia1 = FALSE; | 332 | cardInPcmcia1 = FALSE; |
337 | } | 333 | } |
338 | repaint( FALSE ); | 334 | repaint( FALSE ); |
339 | return ( ( cardWas0 == cardInPcmcia0 | 335 | return ( ( cardWas0 == cardInPcmcia0 |
340 | && cardWas1 == cardInPcmcia1 ) ? FALSE : TRUE ); | 336 | && cardWas1 == cardInPcmcia1 ) ? FALSE : TRUE ); |
@@ -354,13 +350,13 @@ bool CardMonitor::getStatusSd( int showPopUp ) | |||
354 | 350 | ||
355 | if ( mntfp ) | 351 | if ( mntfp ) |
356 | { | 352 | { |
357 | while ( ( me = getmntent( mntfp ) ) != 0 ) | 353 | while ( ( me = getmntent( mntfp ) ) != 0 ) |
358 | { | 354 | { |
359 | QString fs = me->mnt_fsname; | 355 | QString fs = me->mnt_fsname; |
360 | //qDebug( fs ); | 356 | //odebug << fs << oendl; |
361 | if ( fs.left( 14 ) == "/dev/mmc/part1" || fs.left( 7 ) == "/dev/sd" | 357 | if ( fs.left( 14 ) == "/dev/mmc/part1" || fs.left( 7 ) == "/dev/sd" |
362 | || fs.left( 9 ) == "/dev/mmcd" ) | 358 | || fs.left( 9 ) == "/dev/mmcd" ) |
363 | { | 359 | { |
364 | cardInSd = TRUE; | 360 | cardInSd = TRUE; |
365 | show(); | 361 | show(); |
366 | } | 362 | } |
@@ -382,13 +378,13 @@ bool CardMonitor::getStatusSd( int showPopUp ) | |||
382 | } | 378 | } |
383 | else | 379 | else |
384 | { | 380 | { |
385 | text += "Ejected: SD/MMC"; | 381 | text += "Ejected: SD/MMC"; |
386 | what = "off"; | 382 | what = "off"; |
387 | } | 383 | } |
388 | //qDebug("TEXT: " + text ); | 384 | //odebug << "TEXT: " + text << oendl; |
389 | #ifndef QT_NO_SOUND | 385 | #ifndef QT_NO_SOUND |
390 | QSound::play( Resource::findSound( "cardmon/card" + what ) ); | 386 | QSound::play( Resource::findSound( "cardmon/card" + what ) ); |
391 | #endif | 387 | #endif |
392 | popUp( text, "cardmon/ide" );// XX add SD pic | 388 | popUp( text, "cardmon/ide" );// XX add SD pic |
393 | } | 389 | } |
394 | #else | 390 | #else |