author | eilers <eilers> | 2003-11-17 16:02:31 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-11-17 16:02:31 (UTC) |
commit | 74a1afb21424a4f69c7a01fda2cc517daf69fd82 (patch) (unidiff) | |
tree | ff509880b5c14281bbb2bb05a6519bf081612525 | |
parent | e206333876a37ae188fe2889bb079158611cebe3 (diff) | |
download | opie-74a1afb21424a4f69c7a01fda2cc517daf69fd82.zip opie-74a1afb21424a4f69c7a01fda2cc517daf69fd82.tar.gz opie-74a1afb21424a4f69c7a01fda2cc517daf69fd82.tar.bz2 |
Fixing the ".so" stuff for MacOS-X .. Quicklauncher apps are now
loaded successfully..
-rw-r--r-- | core/tools/quicklauncher/dropins.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/tools/quicklauncher/dropins.h b/core/tools/quicklauncher/dropins.h index fe43ec2..3e2b5fd 100644 --- a/core/tools/quicklauncher/dropins.h +++ b/core/tools/quicklauncher/dropins.h | |||
@@ -1,61 +1,70 @@ | |||
1 | 1 | ||
2 | #include <qstring.h> | 2 | #include <qstring.h> |
3 | #include <qtopia/qcom.h> | 3 | #include <qtopia/qcom.h> |
4 | #include <qtopia/qlibrary.h> | 4 | #include <qtopia/qlibrary.h> |
5 | #include <qtopia/applicationinterface.h> | 5 | #include <qtopia/applicationinterface.h> |
6 | #include <qtopia/resource.h> | 6 | #include <qtopia/resource.h> |
7 | 7 | ||
8 | #include <opie/owait.h> | 8 | #include <opie/owait.h> |
9 | 9 | ||
10 | #include <qmetaobject.h> | 10 | #include <qmetaobject.h> |
11 | #include <qmap.h> | 11 | #include <qmap.h> |
12 | 12 | ||
13 | namespace Opie { | 13 | namespace Opie { |
14 | 14 | ||
15 | struct PluginLoader { | 15 | struct PluginLoader { |
16 | PluginLoader( const char* ) { | 16 | PluginLoader( const char* ) { |
17 | } | 17 | } |
18 | 18 | ||
19 | QRESULT queryInterface( const QString& app, const QUuid&, QUnknownInterface** ); | 19 | QRESULT queryInterface( const QString& app, const QUuid&, QUnknownInterface** ); |
20 | void releaseInterface( QUnknownInterface* ); | 20 | void releaseInterface( QUnknownInterface* ); |
21 | QMap<QUnknownInterface*, QLibrary*> libs; | 21 | QMap<QUnknownInterface*, QLibrary*> libs; |
22 | }; | 22 | }; |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * We can skip installing a Translator here because Opies QPEApplication | 25 | * We can skip installing a Translator here because Opies QPEApplication |
26 | * will do that in initApp for us as well | 26 | * will do that in initApp for us as well |
27 | */ | 27 | */ |
28 | QRESULT PluginLoader::queryInterface( const QString& libFile, const QUuid& uuid, QUnknownInterface** iface ) { | 28 | QRESULT PluginLoader::queryInterface( const QString& libFile, const QUuid& uuid, QUnknownInterface** iface ) { |
29 | QRESULT res = QS_FALSE; | 29 | QRESULT res = QS_FALSE; |
30 | *iface = 0; | 30 | *iface = 0; |
31 | 31 | ||
32 | // This code is very platform specific.. We should find better | ||
33 | // solutions to handle names.. Maybe one central function would be | ||
34 | // better than checking this ".so" stuff all around in the sources.. | ||
35 | // (eilers) | ||
36 | |||
32 | // Below lines from TT then mine again | 37 | // Below lines from TT then mine again |
33 | QString name = libFile; | 38 | QString name = libFile; |
34 | if ( libFile.findRev(".so") == (int)libFile.length()-3 ) { | 39 | if ( libFile.findRev(".so") == (int)libFile.length()-3 ) { |
35 | name = libFile.left( libFile.length()-3 ); | 40 | name = libFile.left( libFile.length()-3 ); |
36 | if ( name.find( "lib" ) == 0 ) | 41 | if ( name.find( "lib" ) == 0 ) |
37 | name = name.mid( 3 ); | 42 | name = name.mid( 3 ); |
38 | } | 43 | } |
44 | #ifdef Q_OS_MACX | ||
45 | QString path = QPEApplication::qpeDir() + "/plugins/application/lib"+name+".dylib"; | ||
46 | #else | ||
39 | QString path = QPEApplication::qpeDir() + "/plugins/application/lib"+name+".so"; | 47 | QString path = QPEApplication::qpeDir() + "/plugins/application/lib"+name+".so"; |
48 | #endif | ||
40 | 49 | ||
41 | QLibrary *lib = new QLibrary( path ); | 50 | QLibrary *lib = new QLibrary( path ); |
42 | if ( lib->queryInterface( uuid, iface ) == QS_OK && iface ) { | 51 | if ( lib->queryInterface( uuid, iface ) == QS_OK && iface ) { |
43 | libs.insert( *iface, lib ); | 52 | libs.insert( *iface, lib ); |
44 | res = QS_OK; | 53 | res = QS_OK; |
45 | } | 54 | } |
46 | 55 | ||
47 | return res; | 56 | return res; |
48 | } | 57 | } |
49 | 58 | ||
50 | void PluginLoader::releaseInterface( QUnknownInterface* iface ) { | 59 | void PluginLoader::releaseInterface( QUnknownInterface* iface ) { |
51 | if ( libs.contains( iface ) ) { | 60 | if ( libs.contains( iface ) ) { |
52 | iface->release(); | 61 | iface->release(); |
53 | delete libs[iface]; | 62 | delete libs[iface]; |
54 | libs.remove( iface ); // we only handle pointers so even if the object is not valid the address-space is | 63 | libs.remove( iface ); // we only handle pointers so even if the object is not valid the address-space is |
55 | } | 64 | } |
56 | } | 65 | } |
57 | 66 | ||
58 | } | 67 | } |
59 | 68 | ||
60 | /* small hack ;) */ | 69 | /* small hack ;) */ |
61 | using namespace Opie; | 70 | using namespace Opie; |