-rw-r--r-- | libopie/oapplicationfactory.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libopie/oapplicationfactory.h b/libopie/oapplicationfactory.h index 418a82e..ab88d80 100644 --- a/libopie/oapplicationfactory.h +++ b/libopie/oapplicationfactory.h | |||
@@ -201,62 +201,64 @@ struct OPrivate< Opie::Typelist<Product, ProductListTail> > { | |||
201 | template<class Product, class ProductListTail> | 201 | template<class Product, class ProductListTail> |
202 | struct OApplicationFactory< Opie::Typelist<Product, ProductListTail > > | 202 | struct OApplicationFactory< Opie::Typelist<Product, ProductListTail > > |
203 | : ApplicationInterface { | 203 | : ApplicationInterface { |
204 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { | 204 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { |
205 | *iface = 0; | 205 | *iface = 0; |
206 | if ( uuid == IID_QUnknown ) *iface = this; | 206 | if ( uuid == IID_QUnknown ) *iface = this; |
207 | else if ( uuid ==IID_QtopiaApplication ) *iface = this; | 207 | else if ( uuid ==IID_QtopiaApplication ) *iface = this; |
208 | else return QS_FALSE; | 208 | else return QS_FALSE; |
209 | (*iface)->addRef(); | 209 | (*iface)->addRef(); |
210 | return QS_OK; | 210 | return QS_OK; |
211 | } | 211 | } |
212 | 212 | ||
213 | QWidget* createMainWindow ( const QString& appName, QWidget* parent, | 213 | QWidget* createMainWindow ( const QString& appName, QWidget* parent, |
214 | const char* name, Qt::WFlags fl ) { | 214 | const char* name, Qt::WFlags fl ) { |
215 | qWarning("StringList is %s", applications().join(":").latin1() ); | 215 | qWarning("StringList is %s", applications().join(":").latin1() ); |
216 | return OPrivate< Opie::Typelist<Product, ProductListTail > >::multiFactory( appName, parent, name, fl ); | 216 | return OPrivate< Opie::Typelist<Product, ProductListTail > >::multiFactory( appName, parent, name, fl ); |
217 | } | 217 | } |
218 | 218 | ||
219 | QStringList applications()const { | 219 | QStringList applications()const { |
220 | QStringList _list; | 220 | QStringList _list; |
221 | return OPrivate< Opie::Typelist<Product, ProductListTail> >::multiString( _list ); | 221 | return OPrivate< Opie::Typelist<Product, ProductListTail> >::multiString( _list ); |
222 | } | 222 | } |
223 | 223 | ||
224 | Q_REFCOUNT | 224 | Q_REFCOUNT |
225 | }; | 225 | }; |
226 | 226 | ||
227 | 227 | ||
228 | /* If the library version should be build */ | 228 | /* If the library version should be build */ |
229 | #ifdef OPIE_APP_INTERFACE | 229 | #ifdef OPIE_APP_INTERFACE |
230 | #define OPIE_EXPORT_APP( factory ) Q_EXPORT_INTERFACE() { Q_CREATE_INSTANCE( factory ) } | 230 | #define OPIE_EXPORT_APP( factory ) Q_EXPORT_INTERFACE() { Q_CREATE_INSTANCE( factory ) } |
231 | #else | 231 | #else |
232 | 232 | ||
233 | #include <qpe/qpeapplication.h> | ||
234 | |||
233 | #define OPIE_EXPORT_APP( Factory ) \ | 235 | #define OPIE_EXPORT_APP( Factory ) \ |
234 | int main( int argc, char **argv ) { \ | 236 | int main( int argc, char **argv ) { \ |
235 | QPEApplication a(argc, argv ); \ | 237 | QPEApplication a(argc, argv ); \ |
236 | QWidget *mw = 0;\ | 238 | QWidget *mw = 0;\ |
237 | \ | 239 | \ |
238 | /* method from TT */ \ | 240 | /* method from TT */ \ |
239 | QString executableName = QString::fromLatin1( argv[0] ); \ | 241 | QString executableName = QString::fromLatin1( argv[0] ); \ |
240 | executableName = executableName.right(executableName.length() \ | 242 | executableName = executableName.right(executableName.length() \ |
241 | - executableName.findRev('/') - 1); \ | 243 | - executableName.findRev('/') - 1); \ |
242 | \ | 244 | \ |
243 | Factory f; \ | 245 | Factory f; \ |
244 | QStringList list = f.applications(); \ | 246 | QStringList list = f.applications(); \ |
245 | if (list.contains(executableName) ) \ | 247 | if (list.contains(executableName) ) \ |
246 | mw = f.createMainWindow(executableName, 0, 0, 0 ); \ | 248 | mw = f.createMainWindow(executableName, 0, 0, 0 ); \ |
247 | else \ | 249 | else \ |
248 | mw = f.createMainWindow( list[0], 0, 0, 0 ); \ | 250 | mw = f.createMainWindow( list[0], 0, 0, 0 ); \ |
249 | \ | 251 | \ |
250 | if( mw ) { \ | 252 | if( mw ) { \ |
251 | if ( mw->metaObject()->slotNames().contains("setDocument(const QString&)" ) ) \ | 253 | if ( mw->metaObject()->slotNames().contains("setDocument(const QString&)" ) ) \ |
252 | a.showMainDocumentWidget( mw ); \ | 254 | a.showMainDocumentWidget( mw ); \ |
253 | else \ | 255 | else \ |
254 | a.showMainWidget( mw ); \ | 256 | a.showMainWidget( mw ); \ |
255 | \ | 257 | \ |
256 | int rv = a.exec(); \ | 258 | int rv = a.exec(); \ |
257 | delete mw; \ | 259 | delete mw; \ |
258 | return rv; \ | 260 | return rv; \ |
259 | }else \ | 261 | }else \ |
260 | return -1; \ | 262 | return -1; \ |
261 | } | 263 | } |
262 | #endif | 264 | #endif |