From ae85d18a1f8a63323ad47631724516f3aa355a75 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Tue, 21 Jun 2005 14:11:55 +0000 Subject: - prepare methods to execute the preferred actions on insertion and suspend - intercept QPE/System channel to listen for 'resumeFromSuspend()' --- (limited to 'noncore/applets') diff --git a/noncore/applets/pcmcia/pcmcia.cpp b/noncore/applets/pcmcia/pcmcia.cpp index 186dfea..0787c3c 100644 --- a/noncore/applets/pcmcia/pcmcia.cpp +++ b/noncore/applets/pcmcia/pcmcia.cpp @@ -78,6 +78,10 @@ PcmciaManager::PcmciaManager( QWidget * parent ) : QWidget( parent ) setFixedHeight ( AppLnk::smallIconSize() ); pm = Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon ); configuring = false; + + QCopChannel *channel = new QCopChannel( "QPE/System", this ); + connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), + this, SLOT(handleSystemChannel(const QCString&,const QByteArray&)) ); } @@ -85,6 +89,25 @@ PcmciaManager::~PcmciaManager() { } +void PcmciaManager::handleSystemChannel( const QCString&msg, const QByteArray& ) +{ + if ( msg == "returnFromSuspend()" ) + { + if ( !OPcmciaSystem::instance()->cardCount() ) return; + OPcmciaSystem* sys = OPcmciaSystem::instance(); + OPcmciaSystem::CardIterator it = sys->iterator(); + OPcmciaSocket* theCard = 0; + + while ( it.current() ) + { + if ( it.current()->isEmpty() ) + { + executeResumeAction( theCard ); + } + ++it; + } + } +} void PcmciaManager::popUp( QString message, QString icon ) { @@ -197,6 +220,8 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) if ( cardName == name ) { newCard = false; + odebug << "pcmcia: we have seen this card before" << oendl; + executeInsertAction( theCard ); break; } } @@ -344,6 +369,16 @@ bool PcmciaManager::configure( OPcmciaSocket* card, QString& insertAction, QStri return configresult; } +void PcmciaManager::executeInsertAction( Opie::Core::OPcmciaSocket* card ) +{ + odebug << "pcmcia: execute insert action" << oendl; +} + +void PcmciaManager::executeResumeAction( Opie::Core::OPcmciaSocket* card ) +{ + odebug << "pcmcia: execute resume action" << oendl; +} + EXPORT_OPIE_APPLET_v1( PcmciaManager ) diff --git a/noncore/applets/pcmcia/pcmcia.h b/noncore/applets/pcmcia/pcmcia.h index 94203d3..6567cd7 100644 --- a/noncore/applets/pcmcia/pcmcia.h +++ b/noncore/applets/pcmcia/pcmcia.h @@ -45,7 +45,8 @@ class PcmciaManager : public QWidget static int position(); private slots: - void cardMessage( const QCString& msg, const QByteArray& ); + void handleSystemChannel( const QCString&, const QByteArray& ); + void cardMessage( const QCString&, const QByteArray& ); void userCardAction( int action ); void popupTimeout(); @@ -56,6 +57,8 @@ class PcmciaManager : public QWidget private: bool configure( Opie::Core::OPcmciaSocket*, QString&, QString&, QString&, QString& ); void execCommand( const QStringList &command ); + void executeInsertAction( Opie::Core::OPcmciaSocket* ); + void executeResumeAction( Opie::Core::OPcmciaSocket* ); void popUp(QString message, QString icon = QString::null ); private: -- cgit v0.9.0.2