summaryrefslogtreecommitdiff
path: root/x11/libqpe-x11
Side-by-side diff
Diffstat (limited to 'x11/libqpe-x11') (more/less context) (ignore whitespace changes)
-rw-r--r--x11/libqpe-x11/qpe/qpeapplication.cpp26
-rw-r--r--x11/libqpe-x11/qpe/qpeapplication.h9
-rw-r--r--x11/libqpe-x11/qt/qwindowsystem_qws.h19
3 files changed, 53 insertions, 1 deletions
diff --git a/x11/libqpe-x11/qpe/qpeapplication.cpp b/x11/libqpe-x11/qpe/qpeapplication.cpp
index 6e4a96c..8785c74 100644
--- a/x11/libqpe-x11/qpe/qpeapplication.cpp
+++ b/x11/libqpe-x11/qpe/qpeapplication.cpp
@@ -443,230 +443,256 @@ int QPEApplication::exec() {
qWarning("going to exec");
int a = QApplication::exec();
qWarning("left");
return a;
}
{
QCopEnvelope e( "QPE/System", "closing(QString)" );
e << d->appName;
}
qWarning("processing events!");
processEvents();
return 0;
}
void QPEApplication::internalSetStyle( const QString& ) {
}
void QPEApplication::systemMessage( const QCString&, const QByteArray& ) {
}
void QPEApplication::pidMessage( const QCString&, const QByteArray& ) {
}
void QPEApplication::timerEvent( QTimerEvent* e ) {
if ( e->timerId() == d->presstimer && d->presswidget ) {
// Right pressed
postEvent( d->presswidget,
new QMouseEvent( QEvent::MouseButtonPress, d->presspos,
RightButton, LeftButton ) );
killTimer( d->presstimer );
d->presstimer = 0;
}
}
// InputMethods Hints
namespace {
static QPtrDict<void>* inputMethodDict = 0;
static void createInputMethodDict(){
if ( !inputMethodDict )
inputMethodDict = new QPtrDict<void>;
}
static QPtrDict<void>* stylusDict = 0;
static void createDict() {
if ( !stylusDict )
stylusDict = new QPtrDict<void>;
}
};
void QPEApplication::setInputMethodHint( QWidget* w, InputMethodHint mode ) {
createInputMethodDict();
if ( mode == Normal ) {
inputMethodDict->remove
( w );
}else {
inputMethodDict->insert( w, ( void* ) mode );
}
}
QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget* w) {
if ( inputMethodDict && w )
return ( InputMethodHint ) ( int ) inputMethodDict->find( w );
return Normal;
}
void QPEApplication::removeSenderFromStylusDict() {
stylusDict->remove( ( void* ) sender() );
if ( d->presswidget == sender() )
d->presswidget = 0;
}
void QPEApplication::setStylusOperation( QWidget* w, StylusMode mode) {
createDict();
if ( mode == LeftOnly ) {
stylusDict->remove
( w );
w->removeEventFilter( qApp );
}else {
stylusDict->insert( w, ( void* ) mode );
connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) );
w->installEventFilter( qApp );
}
}
QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w) {
if ( stylusDict )
return ( StylusMode ) ( int ) stylusDict->find( w );
return LeftOnly;
}
// eventFilter......
bool QPEApplication::eventFilter( QObject* o, QEvent* e ) {
if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) {
QMouseEvent * me = ( QMouseEvent* ) e;
StylusMode mode = (StylusMode)(int)stylusDict->find(o);
switch (mode) {
case RightOnHold:
switch ( me->type() ) {
case QEvent::MouseButtonPress:
if ( me->button() == LeftButton ) {
d->presstimer = startTimer(500); // #### pref.
d->presswidget = (QWidget*)o;
d->presspos = me->pos();
d->rightpressed = FALSE;
}
break;
case QEvent::MouseMove:
if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) {
killTimer(d->presstimer);
d->presstimer = 0;
}
break;
case QEvent::MouseButtonRelease:
if ( me->button() == LeftButton ) {
if ( d->presstimer ) {
killTimer(d->presstimer);
d->presstimer = 0;
}
if ( d->rightpressed && d->presswidget ) {
// Right released
postEvent( d->presswidget,
new QMouseEvent( QEvent::MouseButtonRelease, me->pos(),
RightButton, LeftButton + RightButton ) );
// Left released, off-widget
postEvent( d->presswidget,
new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1),
LeftButton, LeftButton ) );
postEvent( d->presswidget,
new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1),
LeftButton, LeftButton ) );
d->rightpressed = FALSE;
return TRUE; // don't send the real Left release
}
}
break;
default:
break;
}
break;
default:
;
}
}
else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
QKeyEvent *ke = (QKeyEvent *)e;
if ( ke->key() == Key_Enter ) {
if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) {
postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ',
ke->state(), " ", ke->isAutoRepeat(), ke->count() ) );
return TRUE;
}
}
}
return FALSE;
}
// Quit stuff
void QPEApplication::restart() {
}
void QPEApplication::shutdown() {
}
void QPEApplication::tryQuit() {
qWarning("TryQuit!!");
if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 )
return ; // Inside modal loop or konsole. Too hard to save state.
{
QCopEnvelope e( "QPE/System", "closing(QString)" );
e << d->appName;
}
processEvents();
quit();
}
void QPEApplication::hideOrQuit() {
qWarning("hide or close");
processEvents();
qWarning("past processing");
// If we are a preloaded application we don't actually quit, so emit
// a System message indicating we're quasi-closing.
if ( d->preloaded && d->qpe_main_widget )
{
qWarning("hiding");
QCopEnvelope e("QPE/System", "fastAppHiding(QString)" );
e << d->appName;
d->qpe_main_widget->hide();
}
else
quit();
}
+/*!
+ \internal
+*/
+void QPEApplication::prepareForTermination( bool willrestart )
+{
+ if ( willrestart ) {
+ // Draw a big wait icon, the image can be altered in later revisions
+ // QWidget *d = QApplication::desktop();
+ QImage img = Resource::loadImage( "launcher/new_wait" );
+ QPixmap pix;
+ pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) );
+ QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize |
+ QWidget::WStyle_NoBorder | QWidget::WStyle_Tool );
+ lblWait->setPixmap( pix );
+ lblWait->setAlignment( QWidget::AlignCenter );
+ lblWait->show();
+ lblWait->showMaximized();
+ }
+#ifndef SINGLE_APP
+ { QCopEnvelope envelope( "QPE/System", "forceQuit()" );
+ }
+ processEvents(); // ensure the message goes out.
+ sleep( 1 ); // You have 1 second to comply.
+#endif
+}
+
#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
// 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 )
{
return malloc( size );
}
void* operator new( size_t size )
{
return malloc( size );
}
void operator delete[]( void* p )
{
free( p );
}
void operator delete[]( void* p, size_t /*size*/ )
{
free( p );
}
void operator delete( void* p )
{
free( p );
}
void operator delete( void* p, size_t /*size*/ )
{
free( p );
}
#endif
diff --git a/x11/libqpe-x11/qpe/qpeapplication.h b/x11/libqpe-x11/qpe/qpeapplication.h
index 2af1c66..333f331 100644
--- a/x11/libqpe-x11/qpe/qpeapplication.h
+++ b/x11/libqpe-x11/qpe/qpeapplication.h
@@ -1,93 +1,102 @@
#ifndef OPIE_QPE_APPLICATION_H
#define OPIE_QPE_APPLICATION_H
/**
* LGPLed
*/
#include <qapplication.h>
#include <qevent.h>
#include <qpe/timestring.h>
class QCopChannel;
class QPEApplication : public QApplication {
Q_OBJECT
public:
QPEApplication(int& argc, char** argv, Type=GuiClient );
~QPEApplication();
static QString qpeDir();
static QString documentDir();
void applyStyle();
static int defaultRotation();
static void setDefaultRotation( int r );
static void grabKeyboard();
static void ungrabKeyboard();
enum StylusMode {
LeftOnly,
RightOnHold
};
static void setStylusOperation( QWidget*, StylusMode );
static StylusMode stylusOperation( QWidget* );
enum InputMethodHint {
Normal,
AlwaysOff,
AlwaysOn
};
static void setInputMethodHint( QWidget*, InputMethodHint );
static InputMethodHint inputMethodHint( QWidget* );
void showMainWidget( QWidget*, bool nomax = FALSE );
void showMainDocumentWidget( QWidget*, bool nomax = FALSE );
static void showDialog( QDialog*, bool nomax = FALSE );
static int execDialog( QDialog*, bool nomax = FALSE );
static void setKeepRunning();
bool keepRunning()const;
bool keyboardGrabbed()const;
int exec();
+// QWS bits
+ enum screenSaverHint {
+ Disable = 0,
+ DisableLightOff = 1,
+ DisableSuspend = 2,
+ Enable = 100
+ };
+
signals:
void clientMoused();
void timeChanged();
void clockChanged( bool pm );
void micChanged( bool muted );
void volumeChanged( bool muted );
void appMessage( const QCString& msg, const QByteArray& data);
void weekChanged( bool startOnMonday );
void dateFormatChanged( DateFormat );
void flush();
void reload();
private:
void initTranslations();
void internalSetStyle(const QString&);
private slots:
void hideOrQuit();
void systemMessage( const QCString&, const QByteArray& );
void pidMessage( const QCString&, const QByteArray& );
void removeSenderFromStylusDict();
protected:
virtual void restart();
virtual void shutdown();
+ void prepareForTermination(bool willrestart);
bool eventFilter( QObject*, QEvent* );
void timerEvent( QTimerEvent* );
void raiseAppropriateWindow();
virtual void tryQuit();
private:
class Private;
Private* d;
QCopChannel *m_sys;
QCopChannel *m_pid;
};
#endif
diff --git a/x11/libqpe-x11/qt/qwindowsystem_qws.h b/x11/libqpe-x11/qt/qwindowsystem_qws.h
index 7bc43c5..2652f5f 100644
--- a/x11/libqpe-x11/qt/qwindowsystem_qws.h
+++ b/x11/libqpe-x11/qt/qwindowsystem_qws.h
@@ -1,18 +1,35 @@
#ifndef OPIE_QWINDOWSYSTEM_H
#define OPIE_QWINDOWSYSTEM_H
+class QWSScreenSaver;
class QWSServer {
public:
QWSServer(){}
~QWSServer(){}
static void sendKeyEvent(int, int, int, bool, bool ) { }
struct KeyboardFilter {
};
static void setKeyboardFilter( KeyboardFilter* ) {
}
+ static void setScreenSaver( QWSScreenSaver* ) {
-};
+ }
+ static void setScreenSaverInterval( int ) {
+
+ }
+ static void setScreenSaverIntervals( int[] ) {
+
+ }
+ static void screenSaverActivate( bool ) {
+ }
+ static void setDesktopBackground( const QImage& ) {
+
+ }
+
+};
+struct QWSScreenSaver {
+};
#endif