-rw-r--r-- | library/global.cpp | 16 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 56 |
2 files changed, 70 insertions, 2 deletions
diff --git a/library/global.cpp b/library/global.cpp index 9b3c51e..42c2729 100644 --- a/library/global.cpp +++ b/library/global.cpp @@ -601,21 +601,37 @@ void Global::invoke(const QString &c) if ( QFile::exists( libexe ) ) { qDebug("calling quickexec %s", libexe.latin1() ); quickexecv( libexe.utf8().data(), (const char **)args ); } else #endif { + char *oldpre = ::getenv ( "LD_PRELOAD" ); + + extern bool opie_block_style; + + QString newpre = QPEApplication::qpeDir ( ) + "/lib/libpreload.so"; + if ( opie_block_style && QFile::exists ( newpre )) { + if ( oldpre && oldpre [0] ) + newpre = newpre + ":" + oldpre; + ::setenv ( "LD_PRELOAD", newpre. latin1( ), 1 ); + qDebug ( "\nPRELOADING\n" ); + } + if ( !::vfork() ) { for ( int fd = 3; fd < 100; fd++ ) ::close( fd ); ::setpgid( ::getpid(), ::getppid() ); // Try bindir first, so that foo/bar works too ::execv( qpeDir()+"/bin/"+args[0], (char * const *)args ); ::execvp( args[0], (char * const *)args ); _exit( -1 ); } + if ( oldpre ) + ::setenv ( "LD_PRELOAD", oldpre, 1 ); + else + ::unsetenv ( "LD_PRELOAD" ); } StartingAppList::add( list[0] ); #endif //QT_NO_QWS_MULTIPROCESS } diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index efa65bc..a54fb20 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -895,23 +895,60 @@ void QPEApplication::setDefaultRotation( int r ) } #endif } } +// exported to libpreload.so +bool opie_block_style = false; + /*! \internal */ void QPEApplication::applyStyle() { Config config( "qpe" ); - config.setGroup( "Appearance" ); + // don't block ourselves ... + opie_block_style = false; + + + static QString appname; + + if ( appname. isNull ( )) { + char src [32]; + char dst [PATH_MAX + 1]; + ::sprintf ( src, "/proc/%d/exe", ::getpid ( )); + int l = ::readlink ( src, dst, PATH_MAX ); + if ( l > 0 ) { + dst [l] = 0; + const char *b = ::strrchr ( dst, '/' ); + appname = ( b ? b + 1 : dst ); + } + else + appname = ""; + } + + + QStringList ex = config. readListEntry ( "NoStyle", ';' ); + int nostyle = 0; + for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { + if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { + nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); + break; + } + } + // Widget style QString style = config.readEntry( "Style", "Light" ); + + // don't set a custom style + if ( nostyle & 0x01 ) + style = "Light"; + internalSetStyle( style ); // Colors QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); QPalette pal( btncolor, bgcolor ); @@ -930,21 +967,36 @@ void QPEApplication::applyStyle() pal.color( QPalette::Active, QColorGroup::Background ).dark() ); setPalette( pal, TRUE ); // Window Decoration QString dec = config.readEntry( "Decoration", "Qtopia" ); + + // don't set a custom deco + if ( nostyle & 0x04 ) + dec = ""; + if ( dec != d->decorationName ) { qwsSetDecoration( new QPEDecoration( dec ) ); d->decorationName = dec; } // Font QString ff = config.readEntry( "FontFamily", font().family() ); int fs = config.readNumEntry( "FontSize", font().pointSize() ); + + // don't set a custom font + if ( nostyle & 0x02 ) { + ff = "Helvetica"; + fs = 10; + } + setFont( QFont(ff, fs) ); + + // revert to global blocking policy ... + opie_block_style = config. readBoolEntry ( "ForceStyle", false ); } void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) { #ifdef Q_WS_QWS QDataStream stream( data, IO_ReadOnly ); @@ -1320,13 +1372,13 @@ void QPEApplication::internalSetStyle( const QString &style ) } else { if ( iface ) iface-> release ( ); delete lib; - setStyle ( new QPEStyle ( )); + setStyle ( new LightStyle ( )); } } #endif } /*! |