-rw-r--r-- | core/launcher/irserver.cpp | 4 | ||||
-rw-r--r-- | core/launcher/irserver.h | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/core/launcher/irserver.cpp b/core/launcher/irserver.cpp index b22e064..2147d0a 100644 --- a/core/launcher/irserver.cpp +++ b/core/launcher/irserver.cpp @@ -1,50 +1,52 @@ #include "irserver.h" #include <qpe/qlibrary.h> #include <qpe/qpeapplication.h> #include <qtranslator.h> #include <stdlib.h> #include "obexinterface.h" #include <qdir.h> IrServer::IrServer( QObject *parent, const char *name ) : QObject( parent, name ) { lib = 0; + iface = 0; QString path = QPEApplication::qpeDir() + "/plugins/obex/"; QDir dir( path, "lib*.so" ); QStringList list = dir.entryList(); QStringList::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { - ObexInterface *iface = 0; QLibrary *trylib = new QLibrary( path + *it ); qDebug("trying lib %s", (path + (*it)).latin1() ); if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&iface ) == QS_OK ) { lib = trylib; qDebug("found obex lib" ); QString lang = getenv( "LANG" ); QTranslator * trans = new QTranslator(qApp); QString type = (*it).left( (*it).find(".") ); QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; qDebug("tr fpr obex: %s", tfn.latin1() ); if ( trans->load( tfn )) qApp->installTranslator( trans ); else delete trans; break; } else { delete lib; } } if ( !lib ) qDebug("could not load IR plugin" ); } IrServer::~IrServer() { + if ( iface ) + iface->release(); delete lib; } diff --git a/core/launcher/irserver.h b/core/launcher/irserver.h index f9f682f..b3434dd 100644 --- a/core/launcher/irserver.h +++ b/core/launcher/irserver.h @@ -1,20 +1,22 @@ #ifndef IRSERVER_H #define IRSERVER_H #include <qobject.h> class QCopChannel; class QLibrary; +struct ObexInterface; class IrServer : public QObject { Q_OBJECT public: IrServer( QObject *parent = 0, const char *name = 0 ); ~IrServer(); private: QLibrary *lib; + ObexInterface *iface; }; #endif |