-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 @@ | |||
1 | #include "irserver.h" | 1 | #include "irserver.h" |
2 | 2 | ||
3 | #include <qpe/qlibrary.h> | 3 | #include <qpe/qlibrary.h> |
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | 5 | ||
6 | #include <qtranslator.h> | 6 | #include <qtranslator.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | 8 | ||
9 | #include "obexinterface.h" | 9 | #include "obexinterface.h" |
10 | 10 | ||
11 | #include <qdir.h> | 11 | #include <qdir.h> |
12 | 12 | ||
13 | IrServer::IrServer( QObject *parent, const char *name ) | 13 | IrServer::IrServer( QObject *parent, const char *name ) |
14 | : QObject( parent, name ) | 14 | : QObject( parent, name ) |
15 | { | 15 | { |
16 | lib = 0; | 16 | lib = 0; |
17 | iface = 0; | ||
17 | QString path = QPEApplication::qpeDir() + "/plugins/obex/"; | 18 | QString path = QPEApplication::qpeDir() + "/plugins/obex/"; |
18 | QDir dir( path, "lib*.so" ); | 19 | QDir dir( path, "lib*.so" ); |
19 | QStringList list = dir.entryList(); | 20 | QStringList list = dir.entryList(); |
20 | QStringList::Iterator it; | 21 | QStringList::Iterator it; |
21 | for ( it = list.begin(); it != list.end(); ++it ) { | 22 | for ( it = list.begin(); it != list.end(); ++it ) { |
22 | ObexInterface *iface = 0; | ||
23 | QLibrary *trylib = new QLibrary( path + *it ); | 23 | QLibrary *trylib = new QLibrary( path + *it ); |
24 | qDebug("trying lib %s", (path + (*it)).latin1() ); | 24 | qDebug("trying lib %s", (path + (*it)).latin1() ); |
25 | if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&iface ) == QS_OK ) { | 25 | if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&iface ) == QS_OK ) { |
26 | lib = trylib; | 26 | lib = trylib; |
27 | qDebug("found obex lib" ); | 27 | qDebug("found obex lib" ); |
28 | QString lang = getenv( "LANG" ); | 28 | QString lang = getenv( "LANG" ); |
29 | QTranslator * trans = new QTranslator(qApp); | 29 | QTranslator * trans = new QTranslator(qApp); |
30 | QString type = (*it).left( (*it).find(".") ); | 30 | QString type = (*it).left( (*it).find(".") ); |
31 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; | 31 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; |
32 | qDebug("tr fpr obex: %s", tfn.latin1() ); | 32 | qDebug("tr fpr obex: %s", tfn.latin1() ); |
33 | if ( trans->load( tfn )) | 33 | if ( trans->load( tfn )) |
34 | qApp->installTranslator( trans ); | 34 | qApp->installTranslator( trans ); |
35 | else | 35 | else |
36 | delete trans; | 36 | delete trans; |
37 | 37 | ||
38 | break; | 38 | break; |
39 | } else { | 39 | } else { |
40 | delete lib; | 40 | delete lib; |
41 | } | 41 | } |
42 | } | 42 | } |
43 | if ( !lib ) | 43 | if ( !lib ) |
44 | qDebug("could not load IR plugin" ); | 44 | qDebug("could not load IR plugin" ); |
45 | } | 45 | } |
46 | 46 | ||
47 | IrServer::~IrServer() | 47 | IrServer::~IrServer() |
48 | { | 48 | { |
49 | if ( iface ) | ||
50 | iface->release(); | ||
49 | delete lib; | 51 | delete lib; |
50 | } | 52 | } |
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 @@ | |||
1 | #ifndef IRSERVER_H | 1 | #ifndef IRSERVER_H |
2 | #define IRSERVER_H | 2 | #define IRSERVER_H |
3 | 3 | ||
4 | #include <qobject.h> | 4 | #include <qobject.h> |
5 | 5 | ||
6 | class QCopChannel; | 6 | class QCopChannel; |
7 | class QLibrary; | 7 | class QLibrary; |
8 | struct ObexInterface; | ||
8 | 9 | ||
9 | class IrServer : public QObject | 10 | class IrServer : public QObject |
10 | { | 11 | { |
11 | Q_OBJECT | 12 | Q_OBJECT |
12 | public: | 13 | public: |
13 | IrServer( QObject *parent = 0, const char *name = 0 ); | 14 | IrServer( QObject *parent = 0, const char *name = 0 ); |
14 | ~IrServer(); | 15 | ~IrServer(); |
15 | 16 | ||
16 | private: | 17 | private: |
17 | QLibrary *lib; | 18 | QLibrary *lib; |
19 | ObexInterface *iface; | ||
18 | }; | 20 | }; |
19 | 21 | ||
20 | #endif | 22 | #endif |