-rw-r--r-- | library/qpeapplication.cpp | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 35f433c..c6d9cfd 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -96,14 +96,13 @@ #include <sys/soundcard.h> #endif #include "qt_override_p.h" -#include <qpe/rohfeedback.h> +#include <backend/rohfeedback.h> static bool useBigPixmaps = 0; - class HackWidget : public QWidget { public: bool needsOk() @@ -115,10 +114,10 @@ public: class QPEApplicationData { public: - QPEApplicationData ( ) - : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), + QPEApplicationData ( ) : + presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), keep_running( true ), qcopQok( false ), fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), bigIconSize( 32 ), qpe_main_widget( 0 ) @@ -129,17 +128,17 @@ public: fontFamily = cfg.readEntry( "FontFamily", "Vera" ); fontSize = cfg.readNumEntry( "FontSize", 10 ); smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); -#ifdef OPIE_ROHFEEDBACK +#ifdef OPIE_WITHROHFEEDBACK RoH = 0; #endif } int presstimer; QWidget* presswidget; QPoint presspos; -#ifdef OPIE_ROHFEEDBACK +#ifdef OPIE_WITHROHFEEDBACK Opie::Internal::RoHFeedback *RoH; #endif bool rightpressed : 1; @@ -501,8 +500,9 @@ static void qpe_show_dialog( QDialog* d, bool nomax ) delete lib; } } } + }; class ResourceMimeFactory : public QMimeSourceFactory { @@ -1214,10 +1214,12 @@ QPEApplication::~QPEApplication() // be gone by the time we get to ~QObject(). delete sysChannel; delete pidChannel; #endif -#ifdef OPIE_ROHFEEDBACK - delete d->RoH; + +#ifdef OPIE_WITHROHFEEDBACK + if( d->RoH ) + delete d->RoH; #endif delete d; } @@ -2034,46 +2036,45 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) case RightOnHold: switch ( me->type() ) { case QEvent::MouseButtonPress: if ( me->button() == LeftButton ) { + static long Pref = 500; // #### pref. d->presswidget = (QWidget*)o; d->presspos = me->pos(); d->rightpressed = FALSE; - // just for the time being - static int pref = 500; -#ifdef OPIE_ROHFEEDBACK +#ifdef OPIE_WITHROHFEEDBACK if( ! d->RoH ) d->RoH = new Opie::Internal::RoHFeedback; d->RoH->init( me->globalPos(), d->presswidget ); - pref = d->RoH->delay(); + Pref = d->RoH->delay(); + #endif if (!d->presstimer ) - d->presstimer = startTimer( pref ); // #### pref. + d->presstimer = startTimer( Pref ); // #### pref. } break; case QEvent::MouseMove: if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { killTimer(d->presstimer); -#ifdef OPIE_ROHFEEDBACK - if( d->RoH ) - d->RoH->stop( ); +#ifdef OPIE_WITHROHFEEDBACK + d->RoH->stop(); #endif d->presstimer = 0; } break; case QEvent::MouseButtonRelease: if ( me->button() == LeftButton ) { if ( d->presstimer ) { killTimer(d->presstimer); -#ifdef OPIE_ROHFEEDBACK - if( d->RoH ) - d->RoH->stop( ); +#ifdef OPIE_WITHROHFEEDBACK + d->RoH->stop( ); #endif d->presstimer = 0; } if ( d->rightpressed && d->presswidget ) { + printf( "Send ButtonRelease\n" ); // Right released postEvent( d->presswidget, new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), RightButton, LeftButton + RightButton ) ); @@ -2115,17 +2116,18 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) */ 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; - d->rightpressed = TRUE; -#ifdef OPIE_ROHFEEDBACK - d->RoH->stop(); + + // Right pressed + postEvent( d->presswidget, + new QMouseEvent( QEvent::MouseButtonPress, d->presspos, + RightButton, LeftButton ) ); + killTimer( d->presstimer ); + d->presstimer = 0; + d->rightpressed = TRUE; +#ifdef OPIE_WITHROHFEEDBACK + d->RoH->stop(); #endif } } |