-rw-r--r-- | library/qpeapplication.cpp | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 7cbda92..4c93111 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -81,16 +81,18 @@ #include "textcodecinterface.h" #include "imagecodecinterface.h" #include <unistd.h> #include <sys/file.h> #include <sys/ioctl.h> #include <sys/soundcard.h> +#include "qt_override_p.h" + class QPEApplicationData { public: QPEApplicationData() : presstimer( 0 ), presswidget( 0 ), rightpressed( FALSE ), kbgrabber( 0 ), kbregrab( FALSE ), notbusysent( FALSE ), preloaded( FALSE ), forceshow( FALSE ), nomaximize( FALSE ), qpe_main_widget( 0 ), keep_running( TRUE ) @@ -894,62 +896,44 @@ void QPEApplication::setDefaultRotation( int r ) { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); e << r; } #endif } } -// exported to libpreload.so -int opie_block_style = 0; /*! \internal */ void QPEApplication::applyStyle() { Config config( "qpe" ); config.setGroup( "Appearance" ); // don't block ourselves ... - opie_block_style = 0; - - - 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 = ""; - } + Opie::force_appearance = 0; + static QString appname = Opie::binaryName ( ); 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 ) + if ( nostyle & Opie::Force_Style ) style = "Light"; internalSetStyle ( style ); // Colors QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); QPalette pal( btncolor, bgcolor ); @@ -968,41 +952,41 @@ 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 ) + if ( nostyle & Opie::Force_Decoration ) dec = ""; //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); 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 ) { + if ( nostyle & Opie::Force_Font ) { ff = "Helvetica"; fs = 10; } setFont ( QFont ( ff, fs ), true ); // revert to global blocking policy ... - opie_block_style = config. readBoolEntry ( "ForceStyle", false ) ? 0xff : 0x00; - opie_block_style -= nostyle; + Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; + Opie::force_appearance &= ~nostyle; } void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) { #ifdef Q_WS_QWS QDataStream stream( data, IO_ReadOnly ); if ( msg == "applyStyle()" ) { applyStyle(); @@ -1688,16 +1672,20 @@ void QPEApplication::hideOrQuit() e << d->appName; d->qpe_main_widget->hide(); } #endif else quit(); } + +// These 6 stubs below need 1.5K in the binary and besides that - +// we are not using ancient toolchains anymore - sandman + #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SHARP) // The libraries with the skiff package (and possibly others) have // completely useless implementations of builtin new and delete that // use about 50% of your CPU. Here we revert to the simple libc // functions. void* operator new[]( size_t size ) |