-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 | |||
@@ -380,25 +380,25 @@ public: | |||
380 | 380 | ||
381 | if ( preloaded ) { | 381 | if ( preloaded ) { |
382 | if (forceshow) | 382 | if (forceshow) |
383 | show_mx(mw, nomax, appName); | 383 | show_mx(mw, nomax, appName); |
384 | } | 384 | } |
385 | else if ( keep_running ) { | 385 | else if ( keep_running ) { |
386 | show_mx(mw, nomax, appName); | 386 | show_mx(mw, nomax, appName); |
387 | } | 387 | } |
388 | } | 388 | } |
389 | 389 | ||
390 | void loadTextCodecs() | 390 | void loadTextCodecs() |
391 | { | 391 | { |
392 | QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; | 392 | QString path = QPEApplication::qpeDir() + "plugins/textcodecs"; |
393 | #ifdef Q_OS_MACX | 393 | #ifdef Q_OS_MACX |
394 | QDir dir( path, "lib*.dylib" ); | 394 | QDir dir( path, "lib*.dylib" ); |
395 | #else | 395 | #else |
396 | QDir dir( path, "lib*.so" ); | 396 | QDir dir( path, "lib*.so" ); |
397 | #endif | 397 | #endif |
398 | QStringList list; | 398 | QStringList list; |
399 | if ( dir. exists ( )) | 399 | if ( dir. exists ( )) |
400 | list = dir.entryList(); | 400 | list = dir.entryList(); |
401 | QStringList::Iterator it; | 401 | QStringList::Iterator it; |
402 | for ( it = list.begin(); it != list.end(); ++it ) { | 402 | for ( it = list.begin(); it != list.end(); ++it ) { |
403 | TextCodecInterface *iface = 0; | 403 | TextCodecInterface *iface = 0; |
404 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 404 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
@@ -409,25 +409,25 @@ public: | |||
409 | // ### it exists now; need to remember if we can delete it | 409 | // ### it exists now; need to remember if we can delete it |
410 | } | 410 | } |
411 | } | 411 | } |
412 | else { | 412 | else { |
413 | lib->unload(); | 413 | lib->unload(); |
414 | delete lib; | 414 | delete lib; |
415 | } | 415 | } |
416 | } | 416 | } |
417 | } | 417 | } |
418 | 418 | ||
419 | void loadImageCodecs() | 419 | void loadImageCodecs() |
420 | { | 420 | { |
421 | QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; | 421 | QString path = QPEApplication::qpeDir() + "plugins/imagecodecs"; |
422 | #ifdef Q_OS_MACX | 422 | #ifdef Q_OS_MACX |
423 | QDir dir( path, "lib*.dylib" ); | 423 | QDir dir( path, "lib*.dylib" ); |
424 | #else | 424 | #else |
425 | QDir dir( path, "lib*.so" ); | 425 | QDir dir( path, "lib*.so" ); |
426 | #endif | 426 | #endif |
427 | QStringList list; | 427 | QStringList list; |
428 | if ( dir. exists ( )) | 428 | if ( dir. exists ( )) |
429 | list = dir.entryList(); | 429 | list = dir.entryList(); |
430 | QStringList::Iterator it; | 430 | QStringList::Iterator it; |
431 | for ( it = list.begin(); it != list.end(); ++it ) { | 431 | for ( it = list.begin(); it != list.end(); ++it ) { |
432 | ImageCodecInterface *iface = 0; | 432 | ImageCodecInterface *iface = 0; |
433 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 433 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
@@ -1178,29 +1178,42 @@ QPEApplication::~QPEApplication() | |||
1178 | #ifdef OPIE_WITHROHFEEDBACK | 1178 | #ifdef OPIE_WITHROHFEEDBACK |
1179 | if( d->RoH ) | 1179 | if( d->RoH ) |
1180 | delete d->RoH; | 1180 | delete d->RoH; |
1181 | #endif | 1181 | #endif |
1182 | delete d; | 1182 | delete d; |
1183 | } | 1183 | } |
1184 | 1184 | ||
1185 | /*! | 1185 | /*! |
1186 | Returns <tt>$OPIEDIR/</tt>. | 1186 | Returns <tt>$OPIEDIR/</tt>. |
1187 | */ | 1187 | */ |
1188 | QString QPEApplication::qpeDir() | 1188 | QString QPEApplication::qpeDir() |
1189 | { | 1189 | { |
1190 | const char * base = getenv( "OPIEDIR" ); | 1190 | QString base, dir; |
1191 | if ( base ) | 1191 | |
1192 | return QString( base ) + "/"; | 1192 | if (getenv( "OPIEDIR" )) |
1193 | base = QString(getenv("OPIEDIR")).stripWhiteSpace(); | ||
1194 | if ( !base.isNull() && (base.length() > 0 )){ | ||
1195 | #ifdef Q_OS_WIN32 | ||
1196 | QString temp(base); | ||
1197 | if (temp[(int)temp.length()-1] != QDir::separator()) | ||
1198 | temp.append(QDir::separator()); | ||
1199 | dir = temp; | ||
1200 | #else | ||
1201 | dir = QString( base ) + "/"; | ||
1202 | #endif | ||
1203 | }else{ | ||
1204 | dir = QString( ".." ) + QDir::separator(); | ||
1205 | } | ||
1193 | 1206 | ||
1194 | return QString( "../" ); | 1207 | return dir; |
1195 | } | 1208 | } |
1196 | 1209 | ||
1197 | /*! | 1210 | /*! |
1198 | Returns the user's current Document directory. There is a trailing "/". | 1211 | Returns the user's current Document directory. There is a trailing "/". |
1199 | .. well, it does now,, and there's no trailing '/' | 1212 | .. well, it does now,, and there's no trailing '/' |
1200 | */ | 1213 | */ |
1201 | QString QPEApplication::documentDir() | 1214 | QString QPEApplication::documentDir() |
1202 | { | 1215 | { |
1203 | const char* base = getenv( "HOME"); | 1216 | const char* base = getenv( "HOME"); |
1204 | if ( base ) | 1217 | if ( base ) |
1205 | return QString( base ) + "/Documents"; | 1218 | return QString( base ) + "/Documents"; |
1206 | 1219 | ||
@@ -1826,25 +1839,25 @@ void QPEApplication::internalSetStyle( const QString &style ) | |||
1826 | else if ( style == "Motif" ) { | 1839 | else if ( style == "Motif" ) { |
1827 | setStyle( new QMotifStyle ); | 1840 | setStyle( new QMotifStyle ); |
1828 | } | 1841 | } |
1829 | #endif | 1842 | #endif |
1830 | #ifndef QT_NO_STYLE_MOTIFPLUS | 1843 | #ifndef QT_NO_STYLE_MOTIFPLUS |
1831 | else if ( style == "MotifPlus" ) { | 1844 | else if ( style == "MotifPlus" ) { |
1832 | setStyle( new QMotifPlusStyle ); | 1845 | setStyle( new QMotifPlusStyle ); |
1833 | } | 1846 | } |
1834 | #endif | 1847 | #endif |
1835 | 1848 | ||
1836 | else { | 1849 | else { |
1837 | QStyle *sty = 0; | 1850 | QStyle *sty = 0; |
1838 | QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; | 1851 | QString path = QPEApplication::qpeDir ( ) + "plugins/styles/"; |
1839 | 1852 | ||
1840 | #ifdef Q_OS_MACX | 1853 | #ifdef Q_OS_MACX |
1841 | if ( style. find ( ".dylib" ) > 0 ) | 1854 | if ( style. find ( ".dylib" ) > 0 ) |
1842 | path += style; | 1855 | path += style; |
1843 | else | 1856 | else |
1844 | path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility | 1857 | path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility |
1845 | #else | 1858 | #else |
1846 | if ( style. find ( ".so" ) > 0 ) | 1859 | if ( style. find ( ".so" ) > 0 ) |
1847 | path += style; | 1860 | path += style; |
1848 | else | 1861 | else |
1849 | path = path + "lib" + style. lower ( ) + ".so"; // compatibility | 1862 | path = path + "lib" + style. lower ( ) + ".so"; // compatibility |
1850 | #endif | 1863 | #endif |