-rw-r--r-- | library/qpeapplication.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 3efba20..0b6d56d 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -368,78 +368,78 @@ public: void show(QWidget* mw, bool nomax) { setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" ); nomaximize = nomax; qpe_main_widget = mw; qcopQok = TRUE; #ifndef QT_NO_COP sendQCopQ(); #endif if ( preloaded ) { if (forceshow) show_mx(mw, nomax, appName); } else if ( keep_running ) { show_mx(mw, nomax, appName); } } void loadTextCodecs() { - QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; + QString path = QPEApplication::qpeDir() + "plugins/textcodecs"; #ifdef Q_OS_MACX QDir dir( path, "lib*.dylib" ); #else QDir dir( path, "lib*.so" ); #endif QStringList list; if ( dir. exists ( )) list = dir.entryList(); QStringList::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { TextCodecInterface *iface = 0; QLibrary *lib = new QLibrary( path + "/" + *it ); if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { QValueList<int> mibs = iface->mibEnums(); for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { (void)iface->createForMib(*i); // ### it exists now; need to remember if we can delete it } } else { lib->unload(); delete lib; } } } void loadImageCodecs() { - QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; + QString path = QPEApplication::qpeDir() + "plugins/imagecodecs"; #ifdef Q_OS_MACX QDir dir( path, "lib*.dylib" ); #else QDir dir( path, "lib*.so" ); #endif QStringList list; if ( dir. exists ( )) list = dir.entryList(); QStringList::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { ImageCodecInterface *iface = 0; QLibrary *lib = new QLibrary( path + "/" + *it ); if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { QStringList formats = iface->keys(); for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { (void)iface->installIOHandler(*i); // ### it exists now; need to remember if we can delete it } } else { lib->unload(); delete lib; } } @@ -1166,53 +1166,66 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e ) Destroys the QPEApplication. */ QPEApplication::~QPEApplication() { ungrabKeyboard(); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) // Need to delete QCopChannels early, since the display will // be gone by the time we get to ~QObject(). delete sysChannel; delete pidChannel; #endif #ifdef OPIE_WITHROHFEEDBACK if( d->RoH ) delete d->RoH; #endif delete d; } /*! Returns <tt>$OPIEDIR/</tt>. */ QString QPEApplication::qpeDir() { - const char * base = getenv( "OPIEDIR" ); - if ( base ) - return QString( base ) + "/"; + QString base, dir; + + if (getenv( "OPIEDIR" )) + base = QString(getenv("OPIEDIR")).stripWhiteSpace(); + if ( !base.isNull() && (base.length() > 0 )){ +#ifdef Q_OS_WIN32 + QString temp(base); + if (temp[(int)temp.length()-1] != QDir::separator()) + temp.append(QDir::separator()); + dir = temp; +#else + dir = QString( base ) + "/"; +#endif + }else{ + dir = QString( ".." ) + QDir::separator(); + } - return QString( "../" ); + return dir; } /*! Returns the user's current Document directory. There is a trailing "/". .. well, it does now,, and there's no trailing '/' */ QString QPEApplication::documentDir() { const char* base = getenv( "HOME"); if ( base ) return QString( base ) + "/Documents"; return QString( "../Documents" ); } static int deforient = -1; /*! \internal */ int QPEApplication::defaultRotation() { if ( deforient < 0 ) { QString d = getenv( "QWS_DISPLAY" ); @@ -1814,49 +1827,49 @@ void QPEApplication::internalSetStyle( const QString &style ) else if ( style == "QPE" ) { setStyle( new QPEStyle ); } else if ( style == "Light" ) { setStyle( new LightStyle ); } #ifndef QT_NO_STYLE_PLATINUM else if ( style == "Platinum" ) { setStyle( new QPlatinumStyle ); } #endif #ifndef QT_NO_STYLE_MOTIF else if ( style == "Motif" ) { setStyle( new QMotifStyle ); } #endif #ifndef QT_NO_STYLE_MOTIFPLUS else if ( style == "MotifPlus" ) { setStyle( new QMotifPlusStyle ); } #endif else { QStyle *sty = 0; - QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; + QString path = QPEApplication::qpeDir ( ) + "plugins/styles/"; #ifdef Q_OS_MACX if ( style. find ( ".dylib" ) > 0 ) path += style; else path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility #else if ( style. find ( ".so" ) > 0 ) path += style; else path = path + "lib" + style. lower ( ) + ".so"; // compatibility #endif static QLibrary *lastlib = 0; static StyleInterface *lastiface = 0; QLibrary *lib = new QLibrary ( path ); StyleInterface *iface = 0; if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) sty = iface-> style ( ); if ( sty ) { setStyle ( sty ); |