summaryrefslogtreecommitdiff
path: root/library/qpedecoration_qws.cpp
Side-by-side diff
Diffstat (limited to 'library/qpedecoration_qws.cpp') (more/less context) (show whitespace changes)
-rw-r--r--library/qpedecoration_qws.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp
index 5e0c32a..933542d 100644
--- a/library/qpedecoration_qws.cpp
+++ b/library/qpedecoration_qws.cpp
@@ -168,60 +168,60 @@ int QPEManager::pointInQpeRegion( QWidget *w, const QPoint &p )
for (int i = QWSDecoration::LastRegion; i >= QWSDecoration::Title; i--) {
if (decoration->region(w, rect, (QWSDecoration::Region)i).contains(p))
return (QWSDecoration::Region)i;
}
return QWSDecoration::None;
}
bool QPEManager::eventFilter( QObject *o, QEvent *e )
{
QWSManager *mgr = (QWSManager *)o;
QWidget *w = mgr->widget();
switch ( e->type() ) {
case QEvent::MouseButtonPress:
{
pressTime = QTime::currentTime();
QPoint p = ((QMouseEvent*)e)->globalPos();
int inRegion = pointInQpeRegion( w, p );
#ifdef WHATSTHIS_MODE
if ( !w->geometry().contains(p) && QWhatsThis::inWhatsThisMode() ) {
QString text;
switch ( inRegion ) {
case QWSDecoration::Close:
if ( ((HackWidget*)w)->needsOk() )
- text = tr("Click to close this window, discarding changes.");
+ text = QObject::tr("Click to close this window, discarding changes.");
else
- text = tr("Click to close this window.");
+ text = QObject::tr("Click to close this window.");
break;
case QWSDecoration::Minimize:
- text = tr("Click to close this window and apply changes.");
+ text = QObject::tr("Click to close this window and apply changes.");
break;
case QWSDecoration::Maximize:
if ( w->isMaximized() )
- text = tr("Click to make this window moveable.");
+ text = QObject::tr("Click to make this window moveable.");
else
- text = tr("Click to make this window use all available screen area.");
+ text = QObject::tr("Click to make this window use all available screen area.");
break;
default:
break;
}
QWhatsThis::leaveWhatsThisMode( text );
whatsThisTimeout();
helpState = 0;
return true;
}
#endif
if ( inRegion == QPEDecoration::Help ) {
#ifdef WHATSTHIS_MODE
wtTimer->start( 400, TRUE );
#endif
helpState = QWSButton::Clicked|QWSButton::MouseOver;
drawButton( w, QPEDecoration::Help, helpState );
return true;
}
}
break;
case QEvent::MouseButtonRelease:
if ( helpState & QWSButton::Clicked ) {
wtTimer->stop();
helpState = 0;
@@ -489,50 +489,58 @@ QPEDecoration::QPEDecoration()
{
init ( libname );
}
QPEDecoration::QPEDecoration( const QString &plugin )
: QWSDefaultDecoration()
{
init ( plugin );
}
void QPEDecoration::init ( const QString &plugin )
{
libname = plugin;
if ( wdlib ) {
wdiface->release();
wdlib->unload();
delete wdlib;
wdlib = 0;
} else {
delete wdiface;
}
WindowDecorationInterface *iface = 0;
- QString path = QPEApplication::qpeDir() + "/plugins/decorations";
- QLibrary *lib = new QLibrary( path + "/" + plugin );
+ QString path = QPEApplication::qpeDir() + "/plugins/decorations/";
+
+ if ( plugin.find( ".so" ) > 0 ) {
+ // full library name supplied
+ path += plugin;
+ } else {
+ path += "lib" + plugin.lower() + ".so"; // compatibility
+ }
+
+ QLibrary *lib = new QLibrary( path );
if ( lib->queryInterface( IID_WindowDecoration, (QUnknownInterface**)&iface ) == QS_OK && iface ) {
wdiface = iface;
wdlib = lib;
} else {
delete lib;
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 );
// Qtopia 1.5 compatibility
imageOk = *okImage ( 15 );
imageClose = *closeImage ( 15 );
imageHelp = *helpImage ( 15 );
}
QPEDecoration::~QPEDecoration()
@@ -849,62 +857,62 @@ public:
void QPEDecoration::minimize( QWidget *widget )
{
#ifndef QT_NO_DIALOG
// We use the minimize button as an "accept" button.
if ( widget->inherits( "QDialog" ) ) {
HackDialog *d = (HackDialog *)widget;
d->acceptIt();
}
#endif
else if ( ((HackWidget *)widget)->needsOk() ) {
QSignal s;
s.connect( widget, SLOT( accept() ) );
s.activate();
} else {
help( widget );
}
}
void QPEDecoration::help( QWidget *w )
{
if ( helpExists ) {
Global::execute( "helpbrowser", helpFile );
} else if ( w && w->testWFlags(Qt::WStyle_ContextHelp) ) {
QWhatsThis::enterWhatsThisMode();
- QWhatsThis::leaveWhatsThisMode( qApp->tr(
+ QWhatsThis::leaveWhatsThisMode( QObject::tr(
"<Qt>Comprehensive help is not available for this application, "
"however there is context-sensitive help.<p>To use context-sensitive help:<p>"
"<ol><li>click and hold the help button."
"<li>when the title bar shows <b>What's this...</b>, "
"click on any control.</ol></Qt>" ) );
}
}
void QPEDecoration::windowData( const QWidget *w, WindowDecorationInterface::WindowData &wd ) const
{
wd.rect = w->rect();
if ( qpeManager->whatsThisWidget() == w )
- wd.caption = qApp->tr("What's this..." );
+ wd.caption = QObject::tr("What's this..." );
else
wd.caption = w->caption();
wd.palette = qApp->palette();
wd.flags = 0;
wd.flags |= w->isMaximized() ? WindowDecorationInterface::WindowData::Maximized : 0;
wd.flags |= w->testWFlags(Qt::WStyle_Dialog) ? WindowDecorationInterface::WindowData::Dialog : 0;
const QWidget *active = qpeManager->activeWidget();
wd.flags |= w == active ? WindowDecorationInterface::WindowData::Active : 0;
wd.reserved = 1;
}
/*
#ifndef QT_NO_POPUPMENU
QPopupMenu *QPEDecoration::menu(QWSManager*, const QWidget*, const QPoint&)
{
return 0;
}
#endif
*/
#endif // QT_NO_QWS_QPE_WM_STYLE