summaryrefslogtreecommitdiff
path: root/core/applets/cardmon/cardmon.cpp
Side-by-side diff
Diffstat (limited to 'core/applets/cardmon/cardmon.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/applets/cardmon/cardmon.cpp20
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
@@ -10,55 +10,51 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "cardmon.h"
/* OPIE */
+#include <opie2/odebug.h>
#include <opie2/odevice.h>
#include <opie2/otaskbarapplet.h>
#include <qpe/applnk.h>
#include <qpe/resource.h>
+using namespace Opie::Core;
+using namespace Opie::Ui;
/* QT */
#include <qcopchannel_qws.h>
#include <qpainter.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qsound.h>
#include <qtimer.h>
/* STD */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
-
#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
#include <sys/vfs.h>
#include <mntent.h>
#endif
-using namespace Opie;
-
-using namespace Opie::Ui;
-using namespace Opie::Ui;
-using namespace Opie::Core;
-
CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ),
pm( Resource::loadPixmap( "cardmon/pcmcia" ) )
{
QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this );
connect( pcmciaChannel,
SIGNAL( received(const QCString&,const QByteArray&) ), this,
SLOT( cardMessage(const QCString&,const QByteArray&) ) );
QCopChannel *sdChannel = new QCopChannel( "QPE/Card", this );
connect( sdChannel,
SIGNAL( received(const QCString&,const QByteArray&) ), this,
@@ -188,30 +184,30 @@ void CardMonitor::mousePressEvent( QMouseEvent * )
err );
popUp( tr( "CF/PCMCIA card eject failed!" ) );
}
}
delete menu;
}
void CardMonitor::cardMessage( const QCString & msg, const QByteArray & )
{
if ( msg == "stabChanged()" )
{
- // qDebug("Pcmcia: stabchanged");
+ // odebug << "Pcmcia: stabchanged" << oendl;
getStatusPcmcia();
}
else if ( msg == "mtabChanged()" )
{
- // qDebug("CARDMONAPPLET: mtabchanged");
+ // odebug << "CARDMONAPPLET: mtabchanged" << oendl;
getStatusSd();
}
}
bool CardMonitor::getStatusPcmcia( int showPopUp )
{
bool cardWas0 = cardInPcmcia0; // remember last state
bool cardWas1 = cardInPcmcia1;
QString fileName;
@@ -322,25 +318,25 @@ bool CardMonitor::getStatusPcmcia( int showPopUp )
text += cardInPcmcia1Name;
popUp( text, "cardmon/" + cardInPcmcia1Type );
}
#ifndef QT_NO_SOUND
QSound::play( Resource::findSound( "cardmon/card" + what ) );
#endif
}
}
else
{
// no file found
- qDebug( "no file found" );
+ odebug << "no file found" << oendl;
cardInPcmcia0 = FALSE;
cardInPcmcia1 = FALSE;
}
repaint( FALSE );
return ( ( cardWas0 == cardInPcmcia0
&& cardWas1 == cardInPcmcia1 ) ? FALSE : TRUE );
}
bool CardMonitor::getStatusSd( int showPopUp )
{
@@ -348,25 +344,25 @@ bool CardMonitor::getStatusSd( int showPopUp )
bool cardWas = cardInSd; // remember last state
cardInSd = FALSE;
#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
struct mntent *me;
FILE *mntfp = setmntent( "/etc/mtab", "r" );
if ( mntfp )
{
while ( ( me = getmntent( mntfp ) ) != 0 )
{
QString fs = me->mnt_fsname;
- //qDebug( fs );
+ //odebug << fs << oendl;
if ( fs.left( 14 ) == "/dev/mmc/part1" || fs.left( 7 ) == "/dev/sd"
|| fs.left( 9 ) == "/dev/mmcd" )
{
cardInSd = TRUE;
show();
}
// else {
// cardInSd = FALSE;
// }
}
endmntent( mntfp );
}
@@ -376,25 +372,25 @@ bool CardMonitor::getStatusSd( int showPopUp )
QString text = QString::null;
QString what = QString::null;
if ( cardInSd )
{
text += "New card: SD/MMC";
what = "on";
}
else
{
text += "Ejected: SD/MMC";
what = "off";
}
- //qDebug("TEXT: " + text );
+ //odebug << "TEXT: " + text << oendl;
#ifndef QT_NO_SOUND
QSound::play( Resource::findSound( "cardmon/card" + what ) );
#endif
popUp( text, "cardmon/ide" ); // XX add SD pic
}
#else
#error "Not on Linux"
#endif
repaint( FALSE );
return ( ( cardWas == cardInSd ) ? FALSE : TRUE );
}