From 4e6b2585987290f874697cbec7c289b4df29f82b Mon Sep 17 00:00:00 2001 From: sandman Date: Mon, 25 Nov 2002 22:12:18 +0000 Subject: Some changes to the QPEDecoration c'tor internals: Since the current deco plugin is unloaded, when a new Deco is created via new (even if this new deco is never used or deleted immediatly afer- wards), we have to remember the plugin name, in case someone calls the default c'tor (without supplying a plugin name) --- (limited to 'library') diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index a54fb20..c8e6e74 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -899,7 +899,7 @@ void QPEApplication::setDefaultRotation( int r ) } // exported to libpreload.so -bool opie_block_style = false; +int opie_block_style = 0; /*! \internal @@ -910,7 +910,7 @@ void QPEApplication::applyStyle() config.setGroup( "Appearance" ); // don't block ourselves ... - opie_block_style = false; + opie_block_style = 0; static QString appname; @@ -975,6 +975,8 @@ void QPEApplication::applyStyle() if ( nostyle & 0x04 ) 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; @@ -993,7 +995,8 @@ void QPEApplication::applyStyle() setFont( QFont(ff, fs) ); // revert to global blocking policy ... - opie_block_style = config. readBoolEntry ( "ForceStyle", false ); + opie_block_style = config. readBoolEntry ( "ForceStyle", false ) ? 0xff : 0x00; + opie_block_style -= nostyle; } void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp index 6221f5b..5e0c32a 100644 --- a/library/qpedecoration_qws.cpp +++ b/library/qpedecoration_qws.cpp @@ -480,40 +480,26 @@ private: static WindowDecorationInterface *wdiface = 0; static QLibrary *wdlib = 0; +static QString libname; //=========================================================================== QPEDecoration::QPEDecoration() : QWSDefaultDecoration() { - if ( wdlib ) { - wdiface->release(); - wdlib->unload(); - delete wdlib; - wdlib = 0; - } else { - delete wdiface; - } - wdiface = new DefaultWindowDecoration; - - helpFile = QString(qApp->argv()[0]) + ".html"; - QStringList helpPath = Global::helpPath(); - helpExists = FALSE; - for (QStringList::ConstIterator it=helpPath.begin(); it!=helpPath.end() && !helpExists; ++it) { - helpExists = QFile::exists( *it + "/" + helpFile ); - qDebug ( "Checking %s/%s for help: %d", (*it).latin1(), helpFile.latin1(),helpExists); - } - qpeManager = new QPEManager( this ); - - // for backward compatibility: - imageOk = *okImage ( 15 ); - imageClose = *closeImage ( 15 ); - imageHelp = *helpImage ( 15 ); + init ( libname ); } QPEDecoration::QPEDecoration( const QString &plugin ) : QWSDefaultDecoration() { + init ( plugin ); +} + +void QPEDecoration::init ( const QString &plugin ) +{ + libname = plugin; + if ( wdlib ) { wdiface->release(); wdlib->unload(); @@ -522,6 +508,7 @@ QPEDecoration::QPEDecoration( const QString &plugin ) } else { delete wdiface; } + WindowDecorationInterface *iface = 0; QString path = QPEApplication::qpeDir() + "/plugins/decorations"; QLibrary *lib = new QLibrary( path + "/" + plugin ); @@ -538,8 +525,14 @@ QPEDecoration::QPEDecoration( const QString &plugin ) helpExists = FALSE; for (QStringList::ConstIterator it=helpPath.begin(); it!=helpPath.end() && !helpExists; ++it) { helpExists = QFile::exists( *it + "/" + helpFile ); - qDebug ( "Checking %s/%s for help: %d", (*it).latin1(), helpFile.latin1(),helpExists); } + //qDebug ( "Checking %s/%s for help: %d", (*it).latin1(), helpFile.latin1(),helpExists); + } qpeManager = new QPEManager( this ); + + // Qtopia 1.5 compatibility + imageOk = *okImage ( 15 ); + imageClose = *closeImage ( 15 ); + imageHelp = *helpImage ( 15 ); } QPEDecoration::~QPEDecoration() diff --git a/library/qpedecoration_qws.h b/library/qpedecoration_qws.h index 691c6f6..6628ba2 100644 --- a/library/qpedecoration_qws.h +++ b/library/qpedecoration_qws.h @@ -63,6 +63,8 @@ protected: private: void windowData( const QWidget *w, WindowDecorationInterface::WindowData &wd ) const; + void init ( const QString & ); + protected: QImage imageOk; QImage imageClose; -- cgit v0.9.0.2