summaryrefslogtreecommitdiff
authorsandman <sandman>2002-11-24 18:21:41 (UTC)
committer sandman <sandman>2002-11-24 18:21:41 (UTC)
commit89bf0723eefc1e66a104fe8135f1a5389f021442 (patch) (side-by-side diff)
treea7db1ba8fa34d8226fe9baa9e7c488c86ad95445
parentee62e73ddc29a5015c4a3e569be90dbfce4652c6 (diff)
downloadopie-89bf0723eefc1e66a104fe8135f1a5389f021442.zip
opie-89bf0723eefc1e66a104fe8135f1a5389f021442.tar.gz
opie-89bf0723eefc1e66a104fe8135f1a5389f021442.tar.bz2
- LD_PRELOADing of libpreload.so in case the user selected [x] Force style
settings in appearance - Some code to NOT style some applications, based on the binary name (also selectable in appearance)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/global.cpp16
-rw-r--r--library/qpeapplication.cpp60
2 files changed, 72 insertions, 4 deletions
diff --git a/library/global.cpp b/library/global.cpp
index 9b3c51e..42c2729 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -605,4 +605,16 @@ void Global::invoke(const QString &c)
#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++ )
@@ -614,4 +626,8 @@ void Global::invoke(const QString &c)
_exit( -1 );
}
+ if ( oldpre )
+ ::setenv ( "LD_PRELOAD", oldpre, 1 );
+ else
+ ::unsetenv ( "LD_PRELOAD" );
}
StartingAppList::add( list[0] );
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index efa65bc..a54fb20 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -899,4 +899,7 @@ void QPEApplication::setDefaultRotation( int r )
}
+// exported to libpreload.so
+bool opie_block_style = false;
+
/*!
\internal
@@ -905,10 +908,44 @@ 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" );
- internalSetStyle( style );
+
+ // don't set a custom style
+ if ( nostyle & 0x01 )
+ style = "Light";
+
+ internalSetStyle ( style );
// Colors
@@ -934,4 +971,9 @@ void QPEApplication::applyStyle()
// 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 ) );
@@ -942,5 +984,15 @@ void QPEApplication::applyStyle()
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 );
}
@@ -1324,5 +1376,5 @@ void QPEApplication::internalSetStyle( const QString &style )
delete lib;
- setStyle ( new QPEStyle ( ));
+ setStyle ( new LightStyle ( ));
}
}