summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/irserver.cpp37
-rw-r--r--core/launcher/irserver.h27
2 files changed, 53 insertions, 11 deletions
diff --git a/core/launcher/irserver.cpp b/core/launcher/irserver.cpp
index 625cb60..579c78c 100644
--- a/core/launcher/irserver.cpp
+++ b/core/launcher/irserver.cpp
@@ -1,52 +1,73 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21
1#include "irserver.h" 22#include "irserver.h"
2 23
3#include <qpe/qlibrary.h> 24#include <qtopia/qlibrary.h>
4#include <qpe/qpeapplication.h> 25#include <qtopia/qpeapplication.h>
5 26
6#include <qtranslator.h> 27#include <qtranslator.h>
7#include <stdlib.h>
8 28
9#include "obexinterface.h" 29#include "obexinterface.h"
10 30
11#include <qdir.h> 31#include <qdir.h>
12 32
13IrServer::IrServer( QObject *parent, const char *name ) 33IrServer::IrServer( QObject *parent, const char *name )
14 : QObject( parent, name ) 34 : QObject( parent, name ), obexIface(0)
15{ 35{
16 lib = 0; 36 lib = 0;
17 iface = 0; 37 obexIface = 0;
18 QString path = QPEApplication::qpeDir() + "/plugins/obex/"; 38 QString path = QPEApplication::qpeDir() + "/plugins/obex/";
19 QDir dir( path, "lib*.so" ); 39 QDir dir( path, "lib*.so" );
20 QStringList list = dir.entryList(); 40 QStringList list = dir.entryList();
21 QStringList::Iterator it; 41 QStringList::Iterator it;
22 for ( it = list.begin(); it != list.end(); ++it ) { 42 for ( it = list.begin(); it != list.end(); ++it ) {
23 QLibrary *trylib = new QLibrary( path + *it ); 43 QLibrary *trylib = new QLibrary( path + *it );
24 //qDebug("trying lib %s", (path + (*it)).latin1() ); 44 //qDebug("trying lib %s", (path + (*it)).latin1() );
25 if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&iface ) == QS_OK ) { 45 if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&obexIface ) == QS_OK ) {
26 lib = trylib; 46 lib = trylib;
27 //qDebug("found obex lib" ); 47 //qDebug("found obex lib" );
28 QString lang = getenv( "LANG" ); 48 QString lang = getenv( "LANG" );
29 QTranslator * trans = new QTranslator(qApp); 49 QTranslator * trans = new QTranslator(qApp);
30 QString type = (*it).left( (*it).find(".") ); 50 QString type = (*it).left( (*it).find(".") );
31 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; 51 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
32 //qDebug("tr fpr obex: %s", tfn.latin1() ); 52 //qDebug("tr fpr obex: %s", tfn.latin1() );
33 if ( trans->load( tfn )) 53 if ( trans->load( tfn ))
34 qApp->installTranslator( trans ); 54 qApp->installTranslator( trans );
35 else 55 else
36 delete trans; 56 delete trans;
37 57
38 break; 58 break;
39 } else { 59 } else {
40 delete lib; 60 delete lib;
41 } 61 }
42 } 62 }
43 if ( !lib ) 63 if ( !lib )
44 qDebug("could not load IR plugin" ); 64 qDebug("could not load IR plugin" );
45} 65}
46 66
47IrServer::~IrServer() 67IrServer::~IrServer()
48{ 68{
49 if ( iface ) 69 if ( obexIface )
50 iface->release(); 70 obexIface->release();
51 delete lib; 71 delete lib;
52} 72}
73
diff --git a/core/launcher/irserver.h b/core/launcher/irserver.h
index b3434dd..a20f5e9 100644
--- a/core/launcher/irserver.h
+++ b/core/launcher/irserver.h
@@ -1,22 +1,43 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
1#ifndef IRSERVER_H 21#ifndef IRSERVER_H
2#define IRSERVER_H 22#define IRSERVER_H
3 23
24#include <qtopia/global.h>
4#include <qobject.h> 25#include <qobject.h>
5 26
6class QCopChannel; 27class QCopChannel;
7class QLibrary;
8struct ObexInterface; 28struct ObexInterface;
29class QLibrary;
9 30
10class IrServer : public QObject 31class IrServer : public QObject
11{ 32{
12 Q_OBJECT 33 Q_OBJECT
13public: 34public:
14 IrServer( QObject *parent = 0, const char *name = 0 ); 35 IrServer( QObject *parent = 0, const char *name = 0 );
15 ~IrServer(); 36 ~IrServer();
16 37
17private: 38private:
18 QLibrary *lib; 39 QLibrary* lib;
19 ObexInterface *iface; 40 ObexInterface *obexIface;
20}; 41};
21 42
22#endif 43#endif