summaryrefslogtreecommitdiff
path: root/library
authorllornkcor <llornkcor>2002-09-25 16:26:19 (UTC)
committer llornkcor <llornkcor>2002-09-25 16:26:19 (UTC)
commitd44c455b86d6cccbc497e3e8d8aa399096eff7db (patch) (side-by-side diff)
tree8dd582c828f21ff11a99800159df2b982dbfcc48 /library
parenta546a6ea143da9244a06f1e40829254e8bf4dc8f (diff)
downloadopie-d44c455b86d6cccbc497e3e8d8aa399096eff7db.zip
opie-d44c455b86d6cccbc497e3e8d8aa399096eff7db.tar.gz
opie-d44c455b86d6cccbc497e3e8d8aa399096eff7db.tar.bz2
fix qpeDir() to return users dir, not qpeDir.. duh
Diffstat (limited to 'library') (more/less context) (show whitespace changes)
-rw-r--r--library/qpeapplication.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index c107a08..bdf67b9 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -711,196 +711,197 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e )
// Use special "select" key to do whatever default action a widget has
mapToDefaultAction( ke, Qt::Key_Space );
}
else if ( ke->simpleData.keycode == Qt::Key_Escape &&
ke->simpleData.is_press ) {
// Escape key closes app if focus on toplevel
QWidget * active = activeWindow();
if ( active && active->testWFlags( WType_TopLevel ) &&
( int ) active->winId() == ke->simpleData.window &&
!active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) {
if ( active->inherits( "QDialog" ) ) {
HackDialog * d = ( HackDialog * ) active;
d->rejectIt();
return TRUE;
}
else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) {
active->close();
}
}
}
#if QT_VERSION < 231
// Filter out the F4/Launcher key from apps
// ### The launcher key may not always be F4 on all devices
if ( ( ( QWSKeyEvent * ) e ) ->simpleData.keycode == Qt::Key_F4 )
return TRUE;
#endif
}
if ( e->type == QWSEvent::Focus ) {
QWSFocusEvent * fe = ( QWSFocusEvent* ) e;
QWidget* nfw = QWidget::find( e->window() );
if ( !fe->simpleData.get_focus ) {
QWidget * active = activeWindow();
while ( active && active->isPopup() ) {
active->close();
active = activeWindow();
}
if ( !nfw && d->kbgrabber == 2 ) {
ungrabKeyboard();
d->kbregrab = TRUE; // want kb back when we're active
}
}
else {
// make sure our modal widget is ALWAYS on top
QWidget *topm = activeModalWidget();
if ( topm ) {
topm->raise();
}
if ( d->kbregrab ) {
grabKeyboard();
d->kbregrab = FALSE;
}
}
if ( fe->simpleData.get_focus && inputMethodDict ) {
InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) );
if ( m == AlwaysOff )
Global::hideInputMethod();
if ( m == AlwaysOn )
Global::showInputMethod();
}
}
return QApplication::qwsEventFilter( e );
}
#endif
/*!
Destroys the QPEApplication.
*/
QPEApplication::~QPEApplication()
{
ungrabKeyboard();
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
// Need to delete QCopChannels early, since the display will
// be gone by the time we get to ~QObject().
delete sysChannel;
delete pidChannel;
#endif
delete d;
}
/*!
Returns <tt>$OPIEDIR/</tt>.
*/
QString QPEApplication::qpeDir()
{
const char * base = getenv( "OPIEDIR" );
if ( base )
return QString( base ) + "/";
return QString( "../" );
}
/*!
Returns the user's current Document directory. There is a trailing "/".
+ .. well, it does now,, and there's no trailing '/'
*/
QString QPEApplication::documentDir()
{
- return QString( qpeDir() + "Documents");
+ return QString( QDir::homeDirPath() + "/Documents");
}
static int deforient = -1;
/*!
\internal
*/
int QPEApplication::defaultRotation()
{
if ( deforient < 0 ) {
QString d = getenv( "QWS_DISPLAY" );
if ( d.contains( "Rot90" ) ) {
deforient = 90;
}
else if ( d.contains( "Rot180" ) ) {
deforient = 180;
}
else if ( d.contains( "Rot270" ) ) {
deforient = 270;
}
else {
deforient = 0;
}
}
return deforient;
}
/*!
\internal
*/
void QPEApplication::setDefaultRotation( int r )
{
if ( qApp->type() == GuiServer ) {
deforient = r;
setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
Config config("qpe");
config.setGroup( "Rotation" );
config.writeEntry( "Screen", getenv("QWS_DISPLAY") );
} else {
#ifndef QT_NO_COP
{ QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); e << r; }
#endif
}
}
/*!
\internal
*/
void QPEApplication::applyStyle()
{
Config config( "qpe" );
config.setGroup( "Appearance" );
// Widget style
QString style = config.readEntry( "Style", "Light" );
internalSetStyle( style );
// Colors
QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) );
QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) );
QPalette pal( btncolor, bgcolor );
QString color = config.readEntry( "Highlight", "#800000" );
pal.setColor( QColorGroup::Highlight, QColor( color ) );
color = config.readEntry( "HighlightedText", "#FFFFFF" );
pal.setColor( QColorGroup::HighlightedText, QColor( color ) );
color = config.readEntry( "Text", "#000000" );
pal.setColor( QColorGroup::Text, QColor( color ) );
color = config.readEntry( "ButtonText", "#000000" );
pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) );
color = config.readEntry( "Base", "#FFFFFF" );
pal.setColor( QColorGroup::Base, QColor( color ) );
pal.setColor( QPalette::Disabled, QColorGroup::Text,
pal.color( QPalette::Active, QColorGroup::Background ).dark() );
setPalette( pal, TRUE );
// Window Decoration
QString dec = config.readEntry( "Decoration", "Qtopia" );
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() );
setFont( QFont(ff,fs) );
}
void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data )
{
#ifdef Q_WS_QWS
QDataStream stream( data, IO_ReadOnly );
if ( msg == "applyStyle()" ) {