summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--library/backend/rohfeedback.cpp26
-rw-r--r--library/backend/rohfeedback.h3
-rw-r--r--library/config.in4
-rw-r--r--library/library.pro6
-rw-r--r--library/qpeapplication.cpp36
-rw-r--r--library/qpeapplication.h2
6 files changed, 45 insertions, 32 deletions
diff --git a/library/backend/rohfeedback.cpp b/library/backend/rohfeedback.cpp
index ff76a36..21aad34 100644
--- a/library/backend/rohfeedback.cpp
+++ b/library/backend/rohfeedback.cpp
@@ -1,125 +1,125 @@
1#include <rohfeedback.h> 1#ifdef OPIE_WITHROHFEEDBACK
2
3 2
3#include <rohfeedback.h>
4#include <stdio.h> 4#include <stdio.h>
5#include <qpeapplication.h> 5#include <qpeapplication.h>
6#include <qevent.h> 6#include <qevent.h>
7#include <resource.h> 7#include <resource.h>
8#include <qpixmap.h> 8#include <qpixmap.h>
9#include <qbitmap.h> 9#include <qbitmap.h>
10 10
11#define SPEED 600 11#define SPEED 600
12#define DELAY 500 12#define DELAY 500
13 13
14namespace Opie { 14namespace Opie {
15namespace Internal { 15namespace Internal {
16/* 16/*
17 17
18 RightOnHold feedback 18 RightOnHold feedback
19 19
20*/ 20*/
21 21
22QPixmap * RoHFeedback::Imgs[NOOFICONS] = { 0, 0, 0, 0, 0 }; 22QPixmap * RoHFeedback::Imgs[NOOFICONS] = { 0, 0, 0, 0, 0 };
23QBitmap * RoHFeedback::Masks[NOOFICONS]; 23QBitmap * RoHFeedback::Masks[NOOFICONS];
24int RoHFeedback::IconWidth; 24int RoHFeedback::IconWidth;
25int RoHFeedback::IconHeight; 25int RoHFeedback::IconHeight;
26 26
27RoHFeedback::RoHFeedback() : 27RoHFeedback::RoHFeedback() :
28 QLabel( 0, 0, Qt::WType_Popup ), Timer() { 28 QLabel( 0, 0, Qt::WType_Popup ), Timer() {
29 29
30 Receiver = 0l; 30 Receiver = 0l;
31 connect( &Timer, SIGNAL( timeout() ), this, SLOT( iconShow() ) ); 31 connect( &Timer, SIGNAL( timeout() ), this, SLOT( iconShow() ) );
32 32
33 if( Imgs[0] == 0 ) { 33 if( Imgs[0] == 0 ) {
34 QString S; 34 QString S;
35 35
36 36
37 for( int i = 0; i < NOOFICONS ; i ++ ) { 37 for( int i = 0; i < NOOFICONS ; i ++ ) {
38 Imgs[i] = new QPixmap( Resource::loadPixmap("RoH/star/"+ 38 Imgs[i] = new QPixmap( Resource::loadPixmap(
39 QString::number(i+1) + 39 "RoH/star/"+ QString::number(i+1) + ".png" ));
40 ".png" ));
41 Masks[i] = new QBitmap(); 40 Masks[i] = new QBitmap();
42 (*Masks[i]) = Resource::loadPixmap("RoH/star/"+QString::number(i+1) + 41 (*Masks[i]) = Resource::loadPixmap(
43 ".png" ); 42 "RoH/star/"+QString::number(i+1) + "-mask.png" );
44 } 43 }
45 } 44 }
46 45
47 IconWidth = Imgs[0]->size().width(); 46 IconWidth = Imgs[0]->size().width();
48 IconHeight = Imgs[0]->size().height(); 47 IconHeight = Imgs[0]->size().height();
49 48
50 resize( IconWidth, IconHeight ); 49 resize( IconWidth, IconHeight );
51} 50}
52 51
53int RoHFeedback::delay( void ) { 52int RoHFeedback::delay( void ) {
54 return DELAY+SPEED+50; 53 return DELAY+SPEED+50;
55} 54}
56 55
57RoHFeedback::~RoHFeedback() { 56RoHFeedback::~RoHFeedback() {
58 for ( int i = 0; i < NOOFICONS; ++i ) { 57 for ( int i = 0; i < NOOFICONS; ++i ) {
59 delete Imgs [i]; 58 delete Imgs [i];
60 delete Masks[i]; 59 delete Masks[i];
61 } 60 }
62} 61}
63 62
64void RoHFeedback::init( const QPoint & P, QWidget* wid ) { 63void RoHFeedback::init( const QPoint & P, QWidget* wid ) {
65 if( ! IconWidth ) 64 if( ! IconWidth )
66 return; 65 return;
67 66
68 Receiver = wid; 67 Receiver = wid;
69 IconNr = -1; 68 IconNr = FeedbackTimerStart;
70 move( P.x()-IconWidth/2, P.y() - IconHeight/2 ); 69 move( P.x()-IconWidth/2, P.y() - IconHeight/2 );
71 // to initialize 70 // to initialize
72 Timer.start( DELAY - SPEED/NOOFICONS ); 71 Timer.start( DELAY );
73} 72}
74 73
75void RoHFeedback::stop( void ) { 74void RoHFeedback::stop( void ) {
76 IconNr = -2; // stop 75 IconNr = FeedbackStopped; // stop
77 hide();
78 Timer.stop();
79} 76}
80 77
81bool RoHFeedback::event( QEvent * E ) { 78bool RoHFeedback::event( QEvent * E ) {
82 79
83 if( E->type() >= QEvent::MouseButtonPress && 80 if( E->type() >= QEvent::MouseButtonPress &&
84 E->type() <= QEvent::MouseMove ) { 81 E->type() <= QEvent::MouseMove ) {
85 // pass the event to the receiver with translated coord 82 // pass the event to the receiver with translated coord
86 QMouseEvent QME( ((QMouseEvent *)E)->type(), 83 QMouseEvent QME( ((QMouseEvent *)E)->type(),
87 Receiver->mapFromGlobal( 84 Receiver->mapFromGlobal(
88 ((QMouseEvent *)E)->globalPos() ), 85 ((QMouseEvent *)E)->globalPos() ),
89 ((QMouseEvent *)E)->globalPos(), 86 ((QMouseEvent *)E)->globalPos(),
90 ((QMouseEvent *)E)->button(), 87 ((QMouseEvent *)E)->button(),
91 ((QMouseEvent *)E)->state() 88 ((QMouseEvent *)E)->state()
92 ); 89 );
93 return QPEApplication::sendEvent( Receiver, &QME ); 90 return QPEApplication::sendEvent( Receiver, &QME );
94 } 91 }
95 92
96 // first let the label treat the event 93 // first let the label treat the event
97 return QLabel::event( E ); 94 return QLabel::event( E );
98} 95}
99 96
100void RoHFeedback::iconShow( void ) { 97void RoHFeedback::iconShow( void ) {
101 switch( IconNr ) { 98 switch( IconNr ) {
102 case FeedbackTimerStart: 99 case FeedbackTimerStart:
103 IconNr = 0; 100 IconNr = FeedbackShow;
104 Timer.start( SPEED/NOOFICONS ); 101 Timer.start( SPEED/NOOFICONS );
105 break; 102 break;
106 case FeedbackStopped: 103 case FeedbackStopped:
107 // stopped 104 // stopped
108 IconNr = FeedbackTimerStart; 105 IconNr = FeedbackTimerStart;
109 hide(); 106 hide();
107 Timer.stop();
110 break; 108 break;
111 case FeedbackShow: // first 109 case FeedbackShow: // first
112 show(); 110 show();
113 // FT 111 // FT
114 default : 112 default :
115 // show 113 // show
116 114
117 setPixmap( *(Imgs[IconNr]) ); 115 setPixmap( *(Imgs[IconNr]) );
118 setMask( *(Masks[IconNr]) ); 116 setMask( *(Masks[IconNr]) );
119 IconNr = (IconNr+1)%NOOFICONS; // rotate 117 IconNr = (IconNr+1)%NOOFICONS; // rotate
120 break; 118 break;
121 } 119 }
122} 120}
123 121
124} 122}
125} \ No newline at end of file 123} \ No newline at end of file
124
125#endif
diff --git a/library/backend/rohfeedback.h b/library/backend/rohfeedback.h
index f38a095..9ffd35a 100644
--- a/library/backend/rohfeedback.h
+++ b/library/backend/rohfeedback.h
@@ -1,62 +1,65 @@
1#ifndef ROHFEEDBACK_H 1#ifndef ROHFEEDBACK_H
2#define ROHFEEDBACK_H 2#define ROHFEEDBACK_H
3 3
4#ifdef OPIE_WITHROHFEEDBACK
5
4/* 6/*
5 7
6 RightOnHold feedback show 8 RightOnHold feedback show
7 9
8*/ 10*/
9 11
10#define NOOFICONS 5 12#define NOOFICONS 5
11 13
12#include <qlabel.h> 14#include <qlabel.h>
13#include <qtimer.h> 15#include <qtimer.h>
14 16
15class QEvent; 17class QEvent;
16class QPixmap; 18class QPixmap;
17class QBitmap; 19class QBitmap;
18class QMouseEvent; 20class QMouseEvent;
19 21
20namespace Opie { 22namespace Opie {
21namespace Internal { 23namespace Internal {
22 24
23class RoHFeedback : public QLabel { 25class RoHFeedback : public QLabel {
24 26
25 Q_OBJECT 27 Q_OBJECT
26 28
27 enum Actions { 29 enum Actions {
28 FeedbackStopped = -2, 30 FeedbackStopped = -2,
29 FeedbackTimerStart = -1, 31 FeedbackTimerStart = -1,
30 FeedbackShow = 0 32 FeedbackShow = 0
31 }; 33 };
32public : 34public :
33 35
34 RoHFeedback(); 36 RoHFeedback();
35 ~RoHFeedback(); 37 ~RoHFeedback();
36 38
37 39
38 void init( const QPoint & P, QWidget* wid ); 40 void init( const QPoint & P, QWidget* wid );
39 void stop( void ); 41 void stop( void );
40 int delay( void ); 42 int delay( void );
41 43
42public slots : 44public slots :
43 45
44 void iconShow( void ); 46 void iconShow( void );
45 47
46protected : 48protected :
47 49
48 bool event( QEvent * E ); 50 bool event( QEvent * E );
49 51
50 QTimer Timer; 52 QTimer Timer;
51 int IconNr; 53 int IconNr;
52 QWidget * Receiver; 54 QWidget * Receiver;
53 55
54 static int IconWidth; 56 static int IconWidth;
55 static int IconHeight; 57 static int IconHeight;
56 static QPixmap * Imgs[NOOFICONS]; 58 static QPixmap * Imgs[NOOFICONS];
57 static QBitmap * Masks[NOOFICONS]; 59 static QBitmap * Masks[NOOFICONS];
58}; 60};
59} 61}
60} 62}
61 63
62#endif 64#endif
65#endif
diff --git a/library/config.in b/library/config.in
index ea69ccb..5273976 100644
--- a/library/config.in
+++ b/library/config.in
@@ -1,2 +1,6 @@
1config LIBQPE 1config LIBQPE
2 boolean "Qpe Library (Qt/Embedded version)" 2 boolean "Qpe Library (Qt/Embedded version)"
3
4config LIBQPE_WITHROHFEEDBACK
5 boolean "Give visual feedback for RightOnHold"
6 depends LIBQPE
diff --git a/library/library.pro b/library/library.pro
index eb4bde3..af07fa3 100644
--- a/library/library.pro
+++ b/library/library.pro
@@ -2,136 +2,142 @@ TEMPLATE = lib
2 #CONFIG += qt warn_on release 2 #CONFIG += qt warn_on release
3 CONFIG += qt warn_on debug 3 CONFIG += qt warn_on debug
4 HEADERS= calendar.h \ 4 HEADERS= calendar.h \
5 global.h \ 5 global.h \
6 resource.h \ 6 resource.h \
7 xmlreader.h \ 7 xmlreader.h \
8 mimetype.h \ 8 mimetype.h \
9 menubutton.h \ 9 menubutton.h \
10 network.h \ 10 network.h \
11 networkinterface.h \ 11 networkinterface.h \
12 filemanager.h \ 12 filemanager.h \
13 fontmanager.h \ 13 fontmanager.h \
14 qdawg.h \ 14 qdawg.h \
15 datebookmonth.h \ 15 datebookmonth.h \
16 fileselector.h \ 16 fileselector.h \
17 fileselector_p.h \ 17 fileselector_p.h \
18 imageedit.h \ 18 imageedit.h \
19 qcopenvelope_qws.h \ 19 qcopenvelope_qws.h \
20 qpedecoration_qws.h \ 20 qpedecoration_qws.h \
21 qpeapplication.h \ 21 qpeapplication.h \
22 qpestyle.h \ 22 qpestyle.h \
23 qpedialog.h \ 23 qpedialog.h \
24 lightstyle.h \ 24 lightstyle.h \
25 config.h \ 25 config.h \
26 applnk.h \ 26 applnk.h \
27 sound.h \ 27 sound.h \
28 tzselect.h \ 28 tzselect.h \
29 qmath.h \ 29 qmath.h \
30 datebookdb.h \ 30 datebookdb.h \
31 alarmserver.h \ 31 alarmserver.h \
32 process.h \ 32 process.h \
33 password.h \ 33 password.h \
34 timestring.h \ 34 timestring.h \
35 fontfactoryinterface.h \ 35 fontfactoryinterface.h \
36 fontdatabase.h \ 36 fontdatabase.h \
37 power.h \ 37 power.h \
38 storage.h \ 38 storage.h \
39 qpemessagebox.h \ 39 qpemessagebox.h \
40 timeconversion.h \ 40 timeconversion.h \
41 qpedebug.h \ 41 qpedebug.h \
42 qpemenubar.h \ 42 qpemenubar.h \
43 qpetoolbar.h \ 43 qpetoolbar.h \
44 backend/categories.h \ 44 backend/categories.h \
45 stringutil.h \ 45 stringutil.h \
46 backend/palmtoprecord.h \ 46 backend/palmtoprecord.h \
47 backend/task.h \ 47 backend/task.h \
48 backend/event.h \ 48 backend/event.h \
49 backend/contact.h\ 49 backend/contact.h\
50 backend/rohfeedback.h \
50 categorymenu.h \ 51 categorymenu.h \
51 categoryedit_p.h \ 52 categoryedit_p.h \
52 categoryselect.h \ 53 categoryselect.h \
53 categorywidget.h \ 54 categorywidget.h \
54 ir.h \ 55 ir.h \
55 backend/vobject_p.h \ 56 backend/vobject_p.h \
56 findwidget_p.h \ 57 findwidget_p.h \
57 finddialog.h \ 58 finddialog.h \
58 lnkproperties.h \ 59 lnkproperties.h \
59 windowdecorationinterface.h \ 60 windowdecorationinterface.h \
60 textcodecinterface.h \ 61 textcodecinterface.h \
61 imagecodecinterface.h \ 62 imagecodecinterface.h \
62 qt_override_p.h 63 qt_override_p.h
63 64
64 SOURCES= calendar.cpp \ 65 SOURCES= calendar.cpp \
65 global.cpp \ 66 global.cpp \
66 xmlreader.cpp \ 67 xmlreader.cpp \
67 mimetype.cpp \ 68 mimetype.cpp \
68 menubutton.cpp \ 69 menubutton.cpp \
69 network.cpp \ 70 network.cpp \
70 networkinterface.cpp \ 71 networkinterface.cpp \
71 filemanager.cpp \ 72 filemanager.cpp \
72 fontmanager.cpp \ 73 fontmanager.cpp \
73 qdawg.cpp \ 74 qdawg.cpp \
74 datebookmonth.cpp \ 75 datebookmonth.cpp \
75 fileselector.cpp \ 76 fileselector.cpp \
76 imageedit.cpp \ 77 imageedit.cpp \
77 resource.cpp \ 78 resource.cpp \
78 qpedecoration_qws.cpp \ 79 qpedecoration_qws.cpp \
79 qcopenvelope_qws.cpp \ 80 qcopenvelope_qws.cpp \
80 qpeapplication.cpp \ 81 qpeapplication.cpp \
81 qpestyle.cpp \ 82 qpestyle.cpp \
82 qpedialog.cpp \ 83 qpedialog.cpp \
83 lightstyle.cpp \ 84 lightstyle.cpp \
84 config.cpp \ 85 config.cpp \
85 applnk.cpp \ 86 applnk.cpp \
86 sound.cpp \ 87 sound.cpp \
87 tzselect.cpp \ 88 tzselect.cpp \
88 qmath.c \ 89 qmath.c \
89 datebookdb.cpp \ 90 datebookdb.cpp \
90 alarmserver.cpp \ 91 alarmserver.cpp \
91 password.cpp \ 92 password.cpp \
92 process.cpp \ 93 process.cpp \
93 process_unix.cpp \ 94 process_unix.cpp \
94 timestring.cpp \ 95 timestring.cpp \
95 fontdatabase.cpp \ 96 fontdatabase.cpp \
96 power.cpp \ 97 power.cpp \
97 storage.cpp \ 98 storage.cpp \
98 qpemessagebox.cpp \ 99 qpemessagebox.cpp \
99 backend/timeconversion.cpp \ 100 backend/timeconversion.cpp \
100 qpedebug.cpp \ 101 qpedebug.cpp \
101 qpemenubar.cpp \ 102 qpemenubar.cpp \
102 qpetoolbar.cpp \ 103 qpetoolbar.cpp \
103 backend/categories.cpp \ 104 backend/categories.cpp \
104 backend/stringutil.cpp \ 105 backend/stringutil.cpp \
105 backend/palmtoprecord.cpp \ 106 backend/palmtoprecord.cpp \
106 backend/task.cpp \ 107 backend/task.cpp \
107 backend/event.cpp \ 108 backend/event.cpp \
108 backend/contact.cpp \ 109 backend/contact.cpp \
110 backend/rohfeedback.cpp \
109 categorymenu.cpp \ 111 categorymenu.cpp \
110 categoryedit_p.cpp \ 112 categoryedit_p.cpp \
111 categoryselect.cpp \ 113 categoryselect.cpp \
112 categorywidget.cpp \ 114 categorywidget.cpp \
113 ir.cpp \ 115 ir.cpp \
114 backend/vcc_yacc.cpp \ 116 backend/vcc_yacc.cpp \
115 backend/vobject.cpp \ 117 backend/vobject.cpp \
116 findwidget_p.cpp \ 118 findwidget_p.cpp \
117 finddialog.cpp \ 119 finddialog.cpp \
118 lnkproperties.cpp \ 120 lnkproperties.cpp \
119 qt_override.cpp 121 qt_override.cpp
120 122
121 123
122 124
123# Qt 3 compatibility 125# Qt 3 compatibility
124HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h 126HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h
125SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp 127SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp
126INCLUDEPATH += $(OPIEDIR)/include backend 128INCLUDEPATH += $(OPIEDIR)/include backend
127 LIBS += -ldl -lcrypt -lm 129 LIBS += -ldl -lcrypt -lm
128INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui 130INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui
129 TARGET = qpe 131 TARGET = qpe
130 DESTDIR = $(OPIEDIR)/lib$(PROJMAK) 132 DESTDIR = $(OPIEDIR)/lib$(PROJMAK)
131 VERSION = 1.5.0.1 133 VERSION = 1.5.0.1
132 134
133include ( $(OPIEDIR)/include.pro ) 135include ( $(OPIEDIR)/include.pro )
134 136
135contains( CONFIG, no-override ){ 137contains( CONFIG, no-override ){
136 DEFINES += OPIE_NO_OVERRIDE_QT 138 DEFINES += OPIE_NO_OVERRIDE_QT
137} 139}
140
141contains( CONFIG, LIBQPE_WITHROHFEEDBACK ){
142 DEFINES += WITHROHFEEDBACK
143}
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 35f433c..c6d9cfd 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -52,138 +52,137 @@
52#include <qtooltip.h> 52#include <qtooltip.h>
53#include <qsignal.h> 53#include <qsignal.h>
54#include <qmainwindow.h> 54#include <qmainwindow.h>
55#include <qwidgetlist.h> 55#include <qwidgetlist.h>
56#include <qpixmapcache.h> 56#include <qpixmapcache.h>
57 57
58#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 58#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
59#define QTOPIA_INTERNAL_INITAPP 59#define QTOPIA_INTERNAL_INITAPP
60#include "qpeapplication.h" 60#include "qpeapplication.h"
61#include "qpestyle.h" 61#include "qpestyle.h"
62#include "styleinterface.h" 62#include "styleinterface.h"
63#if QT_VERSION >= 300 63#if QT_VERSION >= 300
64#include <qstylefactory.h> 64#include <qstylefactory.h>
65#else 65#else
66#include <qplatinumstyle.h> 66#include <qplatinumstyle.h>
67#include <qwindowsstyle.h> 67#include <qwindowsstyle.h>
68#include <qmotifstyle.h> 68#include <qmotifstyle.h>
69#include <qmotifplusstyle.h> 69#include <qmotifplusstyle.h>
70#include "lightstyle.h" 70#include "lightstyle.h"
71 71
72#include <qpe/qlibrary.h> 72#include <qpe/qlibrary.h>
73#endif 73#endif
74#include "global.h" 74#include "global.h"
75#include "resource.h" 75#include "resource.h"
76#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 76#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
77#include "qutfcodec.h" 77#include "qutfcodec.h"
78#endif 78#endif
79#include "config.h" 79#include "config.h"
80#include "network.h" 80#include "network.h"
81#ifdef QWS 81#ifdef QWS
82#include "fontmanager.h" 82#include "fontmanager.h"
83#include "fontdatabase.h" 83#include "fontdatabase.h"
84#endif 84#endif
85 85
86#include "alarmserver.h" 86#include "alarmserver.h"
87#include "applnk.h" 87#include "applnk.h"
88#include "qpemenubar.h" 88#include "qpemenubar.h"
89#include "textcodecinterface.h" 89#include "textcodecinterface.h"
90#include "imagecodecinterface.h" 90#include "imagecodecinterface.h"
91 91
92#include <unistd.h> 92#include <unistd.h>
93#include <sys/file.h> 93#include <sys/file.h>
94#include <sys/ioctl.h> 94#include <sys/ioctl.h>
95#ifndef QT_NO_SOUND 95#ifndef QT_NO_SOUND
96#include <sys/soundcard.h> 96#include <sys/soundcard.h>
97#endif 97#endif
98#include "qt_override_p.h" 98#include "qt_override_p.h"
99 99
100#include <qpe/rohfeedback.h> 100#include <backend/rohfeedback.h>
101 101
102 102
103static bool useBigPixmaps = 0; 103static bool useBigPixmaps = 0;
104 104
105
106class HackWidget : public QWidget 105class HackWidget : public QWidget
107{ 106{
108public: 107public:
109 bool needsOk() 108 bool needsOk()
110 { return (getWState() & WState_Reserved1 ); } 109 { return (getWState() & WState_Reserved1 ); }
111 110
112 QRect normalGeometry() 111 QRect normalGeometry()
113 { return topData()->normalGeometry; }; 112 { return topData()->normalGeometry; };
114}; 113};
115 114
116class QPEApplicationData 115class QPEApplicationData
117{ 116{
118public: 117public:
119 QPEApplicationData ( ) 118 QPEApplicationData ( ) :
120 : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), 119 presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ),
121 notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), 120 notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ),
122 keep_running( true ), qcopQok( false ), 121 keep_running( true ), qcopQok( false ),
123 fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), 122 fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ),
124 bigIconSize( 32 ), qpe_main_widget( 0 ) 123 bigIconSize( 32 ), qpe_main_widget( 0 )
125 { 124 {
126 Config cfg( "qpe" ); 125 Config cfg( "qpe" );
127 cfg.setGroup( "Appearance" ); 126 cfg.setGroup( "Appearance" );
128 useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false ); 127 useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false );
129 fontFamily = cfg.readEntry( "FontFamily", "Vera" ); 128 fontFamily = cfg.readEntry( "FontFamily", "Vera" );
130 fontSize = cfg.readNumEntry( "FontSize", 10 ); 129 fontSize = cfg.readNumEntry( "FontSize", 10 );
131 smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); 130 smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 );
132 bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); 131 bigIconSize = cfg.readNumEntry( "BigIconSize", 32 );
133#ifdef OPIE_ROHFEEDBACK 132#ifdef OPIE_WITHROHFEEDBACK
134 RoH = 0; 133 RoH = 0;
135#endif 134#endif
136 } 135 }
137 136
138 int presstimer; 137 int presstimer;
139 QWidget* presswidget; 138 QWidget* presswidget;
140 QPoint presspos; 139 QPoint presspos;
141#ifdef OPIE_ROHFEEDBACK 140#ifdef OPIE_WITHROHFEEDBACK
142 Opie::Internal::RoHFeedback *RoH; 141 Opie::Internal::RoHFeedback *RoH;
143#endif 142#endif
144 143
145 bool rightpressed : 1; 144 bool rightpressed : 1;
146 bool kbgrabbed : 1; 145 bool kbgrabbed : 1;
147 bool notbusysent : 1; 146 bool notbusysent : 1;
148 bool preloaded : 1; 147 bool preloaded : 1;
149 bool forceshow : 1; 148 bool forceshow : 1;
150 bool nomaximize : 1; 149 bool nomaximize : 1;
151 bool keep_running : 1; 150 bool keep_running : 1;
152 bool qcopQok : 1; 151 bool qcopQok : 1;
153 152
154 QCString fontFamily; 153 QCString fontFamily;
155 int fontSize; 154 int fontSize;
156 int smallIconSize; 155 int smallIconSize;
157 int bigIconSize; 156 int bigIconSize;
158 157
159 QStringList langs; 158 QStringList langs;
160 QString appName; 159 QString appName;
161 struct QCopRec 160 struct QCopRec
162 { 161 {
163 QCopRec( const QCString &ch, const QCString &msg, 162 QCopRec( const QCString &ch, const QCString &msg,
164 const QByteArray &d ) : 163 const QByteArray &d ) :
165 channel( ch ), message( msg ), data( d ) 164 channel( ch ), message( msg ), data( d )
166 { } 165 { }
167 166
168 QCString channel; 167 QCString channel;
169 QCString message; 168 QCString message;
170 QByteArray data; 169 QByteArray data;
171 }; 170 };
172 QWidget* qpe_main_widget; 171 QWidget* qpe_main_widget;
173 QGuardedPtr<QWidget> lastraised; 172 QGuardedPtr<QWidget> lastraised;
174 QQueue<QCopRec> qcopq; 173 QQueue<QCopRec> qcopq;
175 QString styleName; 174 QString styleName;
176 QString decorationName; 175 QString decorationName;
177 176
178 void enqueueQCop( const QCString &ch, const QCString &msg, 177 void enqueueQCop( const QCString &ch, const QCString &msg,
179 const QByteArray &data ) 178 const QByteArray &data )
180 { 179 {
181 qcopq.enqueue( new QCopRec( ch, msg, data ) ); 180 qcopq.enqueue( new QCopRec( ch, msg, data ) );
182 } 181 }
183 void sendQCopQ() 182 void sendQCopQ()
184 { 183 {
185 if (!qcopQok ) 184 if (!qcopQok )
186 return; 185 return;
187 186
188 QCopRec * r; 187 QCopRec * r;
189 188
@@ -457,96 +456,97 @@ static void qpe_show_dialog( QDialog* d, bool nomax )
457 if ( dir. exists ( )) 456 if ( dir. exists ( ))
458 list = dir.entryList(); 457 list = dir.entryList();
459 QStringList::Iterator it; 458 QStringList::Iterator it;
460 for ( it = list.begin(); it != list.end(); ++it ) { 459 for ( it = list.begin(); it != list.end(); ++it ) {
461 TextCodecInterface *iface = 0; 460 TextCodecInterface *iface = 0;
462 QLibrary *lib = new QLibrary( path + "/" + *it ); 461 QLibrary *lib = new QLibrary( path + "/" + *it );
463 if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { 462 if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) {
464 QValueList<int> mibs = iface->mibEnums(); 463 QValueList<int> mibs = iface->mibEnums();
465 for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { 464 for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) {
466 (void)iface->createForMib(*i); 465 (void)iface->createForMib(*i);
467 // ### it exists now; need to remember if we can delete it 466 // ### it exists now; need to remember if we can delete it
468 } 467 }
469 } 468 }
470 else { 469 else {
471 lib->unload(); 470 lib->unload();
472 delete lib; 471 delete lib;
473 } 472 }
474 } 473 }
475 } 474 }
476 475
477 void loadImageCodecs() 476 void loadImageCodecs()
478 { 477 {
479 QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; 478 QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs";
480#ifdef Q_OS_MACX 479#ifdef Q_OS_MACX
481 QDir dir( path, "lib*.dylib" ); 480 QDir dir( path, "lib*.dylib" );
482#else 481#else
483 QDir dir( path, "lib*.so" ); 482 QDir dir( path, "lib*.so" );
484#endif 483#endif
485 QStringList list; 484 QStringList list;
486 if ( dir. exists ( )) 485 if ( dir. exists ( ))
487 list = dir.entryList(); 486 list = dir.entryList();
488 QStringList::Iterator it; 487 QStringList::Iterator it;
489 for ( it = list.begin(); it != list.end(); ++it ) { 488 for ( it = list.begin(); it != list.end(); ++it ) {
490 ImageCodecInterface *iface = 0; 489 ImageCodecInterface *iface = 0;
491 QLibrary *lib = new QLibrary( path + "/" + *it ); 490 QLibrary *lib = new QLibrary( path + "/" + *it );
492 if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { 491 if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) {
493 QStringList formats = iface->keys(); 492 QStringList formats = iface->keys();
494 for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { 493 for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) {
495 (void)iface->installIOHandler(*i); 494 (void)iface->installIOHandler(*i);
496 // ### it exists now; need to remember if we can delete it 495 // ### it exists now; need to remember if we can delete it
497 } 496 }
498 } 497 }
499 else { 498 else {
500 lib->unload(); 499 lib->unload();
501 delete lib; 500 delete lib;
502 } 501 }
503 } 502 }
504 } 503 }
504
505}; 505};
506 506
507class ResourceMimeFactory : public QMimeSourceFactory 507class ResourceMimeFactory : public QMimeSourceFactory
508{ 508{
509public: 509public:
510 ResourceMimeFactory() : resImage( 0 ) 510 ResourceMimeFactory() : resImage( 0 )
511 { 511 {
512 setFilePath( Global::helpPath() ); 512 setFilePath( Global::helpPath() );
513 setExtensionType( "html", "text/html;charset=UTF-8" ); 513 setExtensionType( "html", "text/html;charset=UTF-8" );
514 } 514 }
515 ~ResourceMimeFactory() { 515 ~ResourceMimeFactory() {
516 delete resImage; 516 delete resImage;
517 } 517 }
518 518
519 const QMimeSource* data( const QString& abs_name ) const 519 const QMimeSource* data( const QString& abs_name ) const
520 { 520 {
521 const QMimeSource * r = QMimeSourceFactory::data( abs_name ); 521 const QMimeSource * r = QMimeSourceFactory::data( abs_name );
522 if ( !r ) { 522 if ( !r ) {
523 int sl = abs_name.length(); 523 int sl = abs_name.length();
524 do { 524 do {
525 sl = abs_name.findRev( '/', sl - 1 ); 525 sl = abs_name.findRev( '/', sl - 1 );
526 QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; 526 QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name;
527 int dot = name.findRev( '.' ); 527 int dot = name.findRev( '.' );
528 if ( dot >= 0 ) 528 if ( dot >= 0 )
529 name = name.left( dot ); 529 name = name.left( dot );
530 QImage img = Resource::loadImage( name ); 530 QImage img = Resource::loadImage( name );
531 if ( !img.isNull() ) { 531 if ( !img.isNull() ) {
532 delete resImage; 532 delete resImage;
533 resImage = new QImageDrag( img ); 533 resImage = new QImageDrag( img );
534 r = resImage; 534 r = resImage;
535 } 535 }
536 } 536 }
537 while ( !r && sl > 0 ); 537 while ( !r && sl > 0 );
538 } 538 }
539 return r; 539 return r;
540 } 540 }
541private: 541private:
542 mutable QImageDrag *resImage; 542 mutable QImageDrag *resImage;
543}; 543};
544 544
545static int& hack(int& i) 545static int& hack(int& i)
546{ 546{
547#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 547#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
548 // These should be created, but aren't in Qt 2.3.0 548 // These should be created, but aren't in Qt 2.3.0
549 (void)new QUtf8Codec; 549 (void)new QUtf8Codec;
550 (void)new QUtf16Codec; 550 (void)new QUtf16Codec;
551#endif 551#endif
552 return i; 552 return i;
@@ -1170,97 +1170,99 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e )
1170 e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); 1170 e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat );
1171 } 1171 }
1172 } 1172 }
1173 return true; 1173 return true;
1174 } 1174 }
1175 } 1175 }
1176 if ( e->type == QWSEvent::Focus ) { 1176 if ( e->type == QWSEvent::Focus ) {
1177 QWSFocusEvent * fe = ( QWSFocusEvent* ) e; 1177 QWSFocusEvent * fe = ( QWSFocusEvent* ) e;
1178 if ( !fe->simpleData.get_focus ) { 1178 if ( !fe->simpleData.get_focus ) {
1179 QWidget * active = activeWindow(); 1179 QWidget * active = activeWindow();
1180 while ( active && active->isPopup() ) { 1180 while ( active && active->isPopup() ) {
1181 active->close(); 1181 active->close();
1182 active = activeWindow(); 1182 active = activeWindow();
1183 } 1183 }
1184 } 1184 }
1185 else { 1185 else {
1186 // make sure our modal widget is ALWAYS on top 1186 // make sure our modal widget is ALWAYS on top
1187 QWidget *topm = activeModalWidget(); 1187 QWidget *topm = activeModalWidget();
1188 if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) { 1188 if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) {
1189 topm->raise(); 1189 topm->raise();
1190 } 1190 }
1191 } 1191 }
1192 if ( fe->simpleData.get_focus && inputMethodDict ) { 1192 if ( fe->simpleData.get_focus && inputMethodDict ) {
1193 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); 1193 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) );
1194 if ( m == AlwaysOff ) 1194 if ( m == AlwaysOff )
1195 Global::hideInputMethod(); 1195 Global::hideInputMethod();
1196 if ( m == AlwaysOn ) 1196 if ( m == AlwaysOn )
1197 Global::showInputMethod(); 1197 Global::showInputMethod();
1198 } 1198 }
1199 } 1199 }
1200 1200
1201 1201
1202 return QApplication::qwsEventFilter( e ); 1202 return QApplication::qwsEventFilter( e );
1203} 1203}
1204#endif 1204#endif
1205 1205
1206/*! 1206/*!
1207 Destroys the QPEApplication. 1207 Destroys the QPEApplication.
1208*/ 1208*/
1209QPEApplication::~QPEApplication() 1209QPEApplication::~QPEApplication()
1210{ 1210{
1211 ungrabKeyboard(); 1211 ungrabKeyboard();
1212#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 1212#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
1213 // Need to delete QCopChannels early, since the display will 1213 // Need to delete QCopChannels early, since the display will
1214 // be gone by the time we get to ~QObject(). 1214 // be gone by the time we get to ~QObject().
1215 delete sysChannel; 1215 delete sysChannel;
1216 delete pidChannel; 1216 delete pidChannel;
1217#endif 1217#endif
1218#ifdef OPIE_ROHFEEDBACK 1218
1219#ifdef OPIE_WITHROHFEEDBACK
1220 if( d->RoH )
1219 delete d->RoH; 1221 delete d->RoH;
1220#endif 1222#endif
1221 delete d; 1223 delete d;
1222} 1224}
1223 1225
1224/*! 1226/*!
1225 Returns <tt>$OPIEDIR/</tt>. 1227 Returns <tt>$OPIEDIR/</tt>.
1226*/ 1228*/
1227QString QPEApplication::qpeDir() 1229QString QPEApplication::qpeDir()
1228{ 1230{
1229 const char * base = getenv( "OPIEDIR" ); 1231 const char * base = getenv( "OPIEDIR" );
1230 if ( base ) 1232 if ( base )
1231 return QString( base ) + "/"; 1233 return QString( base ) + "/";
1232 1234
1233 return QString( "../" ); 1235 return QString( "../" );
1234} 1236}
1235 1237
1236/*! 1238/*!
1237 Returns the user's current Document directory. There is a trailing "/". 1239 Returns the user's current Document directory. There is a trailing "/".
1238 .. well, it does now,, and there's no trailing '/' 1240 .. well, it does now,, and there's no trailing '/'
1239*/ 1241*/
1240QString QPEApplication::documentDir() 1242QString QPEApplication::documentDir()
1241{ 1243{
1242 const char* base = getenv( "HOME"); 1244 const char* base = getenv( "HOME");
1243 if ( base ) 1245 if ( base )
1244 return QString( base ) + "/Documents"; 1246 return QString( base ) + "/Documents";
1245 1247
1246 return QString( "../Documents" ); 1248 return QString( "../Documents" );
1247} 1249}
1248 1250
1249static int deforient = -1; 1251static int deforient = -1;
1250 1252
1251/*! 1253/*!
1252 \internal 1254 \internal
1253*/ 1255*/
1254int QPEApplication::defaultRotation() 1256int QPEApplication::defaultRotation()
1255{ 1257{
1256 if ( deforient < 0 ) { 1258 if ( deforient < 0 ) {
1257 QString d = getenv( "QWS_DISPLAY" ); 1259 QString d = getenv( "QWS_DISPLAY" );
1258 if ( d.contains( "Rot90" ) ) { 1260 if ( d.contains( "Rot90" ) ) {
1259 deforient = 90; 1261 deforient = 90;
1260 } 1262 }
1261 else if ( d.contains( "Rot180" ) ) { 1263 else if ( d.contains( "Rot180" ) ) {
1262 deforient = 180; 1264 deforient = 180;
1263 } 1265 }
1264 else if ( d.contains( "Rot270" ) ) { 1266 else if ( d.contains( "Rot270" ) ) {
1265 deforient = 270; 1267 deforient = 270;
1266 } 1268 }
@@ -1990,185 +1992,185 @@ QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w )
1990 \enum QPEApplication::StylusMode 1992 \enum QPEApplication::StylusMode
1991 1993
1992 \value LeftOnly the stylus only generates LeftButton 1994 \value LeftOnly the stylus only generates LeftButton
1993 events (the default). 1995 events (the default).
1994 \value RightOnHold the stylus generates RightButton events 1996 \value RightOnHold the stylus generates RightButton events
1995 if the user uses the press-and-hold gesture. 1997 if the user uses the press-and-hold gesture.
1996 1998
1997 \sa setStylusOperation() stylusOperation() 1999 \sa setStylusOperation() stylusOperation()
1998*/ 2000*/
1999 2001
2000/*! 2002/*!
2001 Causes widget \a w to receive mouse events according to the stylus 2003 Causes widget \a w to receive mouse events according to the stylus
2002 \a mode. 2004 \a mode.
2003 2005
2004 \sa stylusOperation() StylusMode 2006 \sa stylusOperation() StylusMode
2005*/ 2007*/
2006void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) 2008void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode )
2007{ 2009{
2008 createDict(); 2010 createDict();
2009 if ( mode == LeftOnly ) { 2011 if ( mode == LeftOnly ) {
2010 stylusDict->remove 2012 stylusDict->remove
2011 ( w ); 2013 ( w );
2012 w->removeEventFilter( qApp ); 2014 w->removeEventFilter( qApp );
2013 } 2015 }
2014 else { 2016 else {
2015 stylusDict->insert( w, ( void* ) mode ); 2017 stylusDict->insert( w, ( void* ) mode );
2016 connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); 2018 connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) );
2017 w->installEventFilter( qApp ); 2019 w->installEventFilter( qApp );
2018 } 2020 }
2019} 2021}
2020 2022
2021 2023
2022/*! 2024/*!
2023 \reimp 2025 \reimp
2024*/ 2026*/
2025bool QPEApplication::eventFilter( QObject *o, QEvent *e ) 2027bool QPEApplication::eventFilter( QObject *o, QEvent *e )
2026{ 2028{
2027 if ( !o->isWidgetType() ) 2029 if ( !o->isWidgetType() )
2028 return FALSE; 2030 return FALSE;
2029 2031
2030 if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { 2032 if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) {
2031 QMouseEvent * me = ( QMouseEvent* ) e; 2033 QMouseEvent * me = ( QMouseEvent* ) e;
2032 StylusMode mode = (StylusMode)(int)stylusDict->find(o); 2034 StylusMode mode = (StylusMode)(int)stylusDict->find(o);
2033 switch (mode) { 2035 switch (mode) {
2034 case RightOnHold: 2036 case RightOnHold:
2035 switch ( me->type() ) { 2037 switch ( me->type() ) {
2036 case QEvent::MouseButtonPress: 2038 case QEvent::MouseButtonPress:
2037 if ( me->button() == LeftButton ) { 2039 if ( me->button() == LeftButton ) {
2040 static long Pref = 500; // #### pref.
2038 d->presswidget = (QWidget*)o; 2041 d->presswidget = (QWidget*)o;
2039 d->presspos = me->pos(); 2042 d->presspos = me->pos();
2040 d->rightpressed = FALSE; 2043 d->rightpressed = FALSE;
2041 // just for the time being 2044#ifdef OPIE_WITHROHFEEDBACK
2042 static int pref = 500;
2043#ifdef OPIE_ROHFEEDBACK
2044 if( ! d->RoH ) 2045 if( ! d->RoH )
2045 d->RoH = new Opie::Internal::RoHFeedback; 2046 d->RoH = new Opie::Internal::RoHFeedback;
2046 2047
2047 d->RoH->init( me->globalPos(), d->presswidget ); 2048 d->RoH->init( me->globalPos(), d->presswidget );
2048 pref = d->RoH->delay(); 2049 Pref = d->RoH->delay();
2050
2049#endif 2051#endif
2050 if (!d->presstimer ) 2052 if (!d->presstimer )
2051 d->presstimer = startTimer( pref ); // #### pref. 2053 d->presstimer = startTimer( Pref ); // #### pref.
2052 2054
2053 } 2055 }
2054 break; 2056 break;
2055 case QEvent::MouseMove: 2057 case QEvent::MouseMove:
2056 if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { 2058 if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) {
2057 killTimer(d->presstimer); 2059 killTimer(d->presstimer);
2058#ifdef OPIE_ROHFEEDBACK 2060#ifdef OPIE_WITHROHFEEDBACK
2059 if( d->RoH )
2060 d->RoH->stop( ); 2061 d->RoH->stop( );
2061#endif 2062#endif
2062 d->presstimer = 0; 2063 d->presstimer = 0;
2063 } 2064 }
2064 break; 2065 break;
2065 case QEvent::MouseButtonRelease: 2066 case QEvent::MouseButtonRelease:
2066 if ( me->button() == LeftButton ) { 2067 if ( me->button() == LeftButton ) {
2067 if ( d->presstimer ) { 2068 if ( d->presstimer ) {
2068 killTimer(d->presstimer); 2069 killTimer(d->presstimer);
2069#ifdef OPIE_ROHFEEDBACK 2070#ifdef OPIE_WITHROHFEEDBACK
2070 if( d->RoH )
2071 d->RoH->stop( ); 2071 d->RoH->stop( );
2072#endif 2072#endif
2073 d->presstimer = 0; 2073 d->presstimer = 0;
2074 } 2074 }
2075 if ( d->rightpressed && d->presswidget ) { 2075 if ( d->rightpressed && d->presswidget ) {
2076 printf( "Send ButtonRelease\n" );
2076 // Right released 2077 // Right released
2077 postEvent( d->presswidget, 2078 postEvent( d->presswidget,
2078 new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), 2079 new QMouseEvent( QEvent::MouseButtonRelease, me->pos(),
2079 RightButton, LeftButton + RightButton ) ); 2080 RightButton, LeftButton + RightButton ) );
2080 // Left released, off-widget 2081 // Left released, off-widget
2081 postEvent( d->presswidget, 2082 postEvent( d->presswidget,
2082 new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), 2083 new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1),
2083 LeftButton, LeftButton ) ); 2084 LeftButton, LeftButton ) );
2084 postEvent( d->presswidget, 2085 postEvent( d->presswidget,
2085 new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), 2086 new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1),
2086 LeftButton, LeftButton ) ); 2087 LeftButton, LeftButton ) );
2087 d->rightpressed = FALSE; 2088 d->rightpressed = FALSE;
2088 return TRUE; // don't send the real Left release 2089 return TRUE; // don't send the real Left release
2089 } 2090 }
2090 } 2091 }
2091 break; 2092 break;
2092 default: 2093 default:
2093 break; 2094 break;
2094 } 2095 }
2095 break; 2096 break;
2096 default: 2097 default:
2097 ; 2098 ;
2098 } 2099 }
2099 } 2100 }
2100 else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 2101 else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
2101 QKeyEvent *ke = (QKeyEvent *)e; 2102 QKeyEvent *ke = (QKeyEvent *)e;
2102 if ( ke->key() == Key_Enter ) { 2103 if ( ke->key() == Key_Enter ) {
2103 if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { 2104 if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) {
2104 postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', 2105 postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ',
2105 ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); 2106 ke->state(), " ", ke->isAutoRepeat(), ke->count() ) );
2106 return TRUE; 2107 return TRUE;
2107 } 2108 }
2108 } 2109 }
2109 } 2110 }
2110 return FALSE; 2111 return FALSE;
2111} 2112}
2112 2113
2113/*! 2114/*!
2114 \reimp 2115 \reimp
2115*/ 2116*/
2116void QPEApplication::timerEvent( QTimerEvent *e ) 2117void QPEApplication::timerEvent( QTimerEvent *e )
2117{ 2118{
2118 if ( e->timerId() == d->presstimer && d->presswidget ) { 2119 if ( e->timerId() == d->presstimer && d->presswidget ) {
2120
2119 // Right pressed 2121 // Right pressed
2120 postEvent( d->presswidget, 2122 postEvent( d->presswidget,
2121 new QMouseEvent( QEvent::MouseButtonPress, d->presspos, 2123 new QMouseEvent( QEvent::MouseButtonPress, d->presspos,
2122 RightButton, LeftButton ) ); 2124 RightButton, LeftButton ) );
2123 killTimer( d->presstimer ); 2125 killTimer( d->presstimer );
2124 d->presstimer = 0; 2126 d->presstimer = 0;
2125 d->rightpressed = TRUE; 2127 d->rightpressed = TRUE;
2126#ifdef OPIE_ROHFEEDBACK 2128#ifdef OPIE_WITHROHFEEDBACK
2127 d->RoH->stop(); 2129 d->RoH->stop();
2128#endif 2130#endif
2129 } 2131 }
2130} 2132}
2131 2133
2132void QPEApplication::removeSenderFromStylusDict() 2134void QPEApplication::removeSenderFromStylusDict()
2133{ 2135{
2134 stylusDict->remove 2136 stylusDict->remove
2135 ( ( void* ) sender() ); 2137 ( ( void* ) sender() );
2136 if ( d->presswidget == sender() ) 2138 if ( d->presswidget == sender() )
2137 d->presswidget = 0; 2139 d->presswidget = 0;
2138} 2140}
2139 2141
2140/*! 2142/*!
2141 \internal 2143 \internal
2142*/ 2144*/
2143bool QPEApplication::keyboardGrabbed() const 2145bool QPEApplication::keyboardGrabbed() const
2144{ 2146{
2145 return d->kbgrabbed; 2147 return d->kbgrabbed;
2146} 2148}
2147 2149
2148 2150
2149/*! 2151/*!
2150 Reverses the effect of grabKeyboard(). This is called automatically 2152 Reverses the effect of grabKeyboard(). This is called automatically
2151 on program exit. 2153 on program exit.
2152*/ 2154*/
2153void QPEApplication::ungrabKeyboard() 2155void QPEApplication::ungrabKeyboard()
2154{ 2156{
2155 ((QPEApplication *) qApp )-> d-> kbgrabbed = false; 2157 ((QPEApplication *) qApp )-> d-> kbgrabbed = false;
2156} 2158}
2157 2159
2158/*! 2160/*!
2159 Grabs the physical keyboard keys, e.g. the application's launching 2161 Grabs the physical keyboard keys, e.g. the application's launching
2160 keys. Instead of launching applications when these keys are pressed 2162 keys. Instead of launching applications when these keys are pressed
2161 the signals emitted are sent to this application instead. Some games 2163 the signals emitted are sent to this application instead. Some games
2162 programs take over the launch keys in this way to make interaction 2164 programs take over the launch keys in this way to make interaction
2163 easier. 2165 easier.
2164 2166
2165 \sa ungrabKeyboard() 2167 \sa ungrabKeyboard()
2166*/ 2168*/
2167void QPEApplication::grabKeyboard() 2169void QPEApplication::grabKeyboard()
2168{ 2170{
2169 ((QPEApplication *) qApp )-> d-> kbgrabbed = true; 2171 ((QPEApplication *) qApp )-> d-> kbgrabbed = true;
2170} 2172}
2171 2173
2172/*! 2174/*!
2173 \reimp 2175 \reimp
2174*/ 2176*/
diff --git a/library/qpeapplication.h b/library/qpeapplication.h
index d2782e4..b07802f 100644
--- a/library/qpeapplication.h
+++ b/library/qpeapplication.h
@@ -139,98 +139,96 @@ signals:
139 void clientMoused(); 139 void clientMoused();
140 void timeChanged(); 140 void timeChanged();
141 void clockChanged( bool pm ); 141 void clockChanged( bool pm );
142 void micChanged( bool muted ); 142 void micChanged( bool muted );
143 void volumeChanged( bool muted ); 143 void volumeChanged( bool muted );
144 void appMessage( const QCString& msg, const QByteArray& data); 144 void appMessage( const QCString& msg, const QByteArray& data);
145 void weekChanged( bool startOnMonday ); 145 void weekChanged( bool startOnMonday );
146 void dateFormatChanged( DateFormat ); 146 void dateFormatChanged( DateFormat );
147 void flush(); 147 void flush();
148 void reload(); 148 void reload();
149 /* linkChanged signal */ 149 /* linkChanged signal */
150 150
151private slots: 151private slots:
152 void systemMessage( const QCString &msg, const QByteArray &data ); 152 void systemMessage( const QCString &msg, const QByteArray &data );
153 void pidMessage( const QCString &msg, const QByteArray &data ); 153 void pidMessage( const QCString &msg, const QByteArray &data );
154 void removeSenderFromStylusDict(); 154 void removeSenderFromStylusDict();
155 void hideOrQuit(); 155 void hideOrQuit();
156 156
157protected: 157protected:
158 bool qwsEventFilter( QWSEvent * ); 158 bool qwsEventFilter( QWSEvent * );
159 void internalSetStyle( const QString &style ); 159 void internalSetStyle( const QString &style );
160 void prepareForTermination(bool willrestart); 160 void prepareForTermination(bool willrestart);
161 virtual void restart(); 161 virtual void restart();
162 virtual void shutdown(); 162 virtual void shutdown();
163 bool eventFilter( QObject *, QEvent * ); 163 bool eventFilter( QObject *, QEvent * );
164 void timerEvent( QTimerEvent * ); 164 void timerEvent( QTimerEvent * );
165 bool raiseAppropriateWindow(); 165 bool raiseAppropriateWindow();
166 virtual void tryQuit(); 166 virtual void tryQuit();
167#ifndef OPIE_NO_ERASE_RECT_HACKFIX 167#ifndef OPIE_NO_ERASE_RECT_HACKFIX
168 #if QT_VERSION > 233 168 #if QT_VERSION > 233
169 virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) 169 virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!)
170 #endif 170 #endif
171#endif 171#endif
172private: 172private:
173#ifndef QT_NO_TRANSLATION 173#ifndef QT_NO_TRANSLATION
174 void installTranslation( const QString& baseName ); 174 void installTranslation( const QString& baseName );
175#endif 175#endif
176 void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); 176 void mapToDefaultAction( QWSKeyEvent *ke, int defKey );
177 void processQCopFile(); 177 void processQCopFile();
178 178
179#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 179#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
180 QCopChannel *sysChannel; 180 QCopChannel *sysChannel;
181 QCopChannel *pidChannel; 181 QCopChannel *pidChannel;
182#endif 182#endif
183 QPEApplicationData *d; 183 QPEApplicationData *d;
184 184
185 bool reserved_sh; 185 bool reserved_sh;
186 186
187
188
189}; 187};
190 188
191inline void QPEApplication::showDialog( QDialog* d, bool nomax ) 189inline void QPEApplication::showDialog( QDialog* d, bool nomax )
192{ 190{
193 showWidget( d, nomax ); 191 showWidget( d, nomax );
194} 192}
195 193
196inline int QPEApplication::execDialog( QDialog* d, bool nomax ) 194inline int QPEApplication::execDialog( QDialog* d, bool nomax )
197{ 195{
198 showDialog( d, nomax ); 196 showDialog( d, nomax );
199 return d->exec(); 197 return d->exec();
200} 198}
201 199
202#ifdef Q_WS_QWS 200#ifdef Q_WS_QWS
203extern Q_EXPORT QRect qt_maxWindowRect; 201extern Q_EXPORT QRect qt_maxWindowRect;
204#endif 202#endif
205 203
206inline void QPEApplication::showWidget( QWidget* wg, bool nomax ) 204inline void QPEApplication::showWidget( QWidget* wg, bool nomax )
207{ 205{
208 if ( wg->isVisible() ) 206 if ( wg->isVisible() )
209 wg->show(); 207 wg->show();
210 else 208 else
211 { 209 {
212 if ( !nomax 210 if ( !nomax
213 && ( qApp->desktop()->width() <= 320 ) ) 211 && ( qApp->desktop()->width() <= 320 ) )
214 { 212 {
215 wg->showMaximized(); 213 wg->showMaximized();
216 } else { 214 } else {
217 #ifdef Q_WS_QWS 215 #ifdef Q_WS_QWS
218 QSize desk = QSize( qApp->desktop()->width(), qApp->desktop()->height() ); 216 QSize desk = QSize( qApp->desktop()->width(), qApp->desktop()->height() );
219 #else 217 #else
220 QSize desk = QSize( qt_maxWindowRect.width(), qt_maxWindowRect.height() ); 218 QSize desk = QSize( qt_maxWindowRect.width(), qt_maxWindowRect.height() );
221 #endif 219 #endif
222 220
223 QSize sh = wg->sizeHint(); 221 QSize sh = wg->sizeHint();
224 int w = QMAX( sh.width(), wg->width() ); 222 int w = QMAX( sh.width(), wg->width() );
225 int h = QMAX( sh.height(), wg->height() ); 223 int h = QMAX( sh.height(), wg->height() );
226 // desktop widget-frame taskbar 224 // desktop widget-frame taskbar
227 w = QMIN( w, ( desk.width() - ( wg->frameGeometry().width() - wg->geometry().width() ) - 25 ) ); 225 w = QMIN( w, ( desk.width() - ( wg->frameGeometry().width() - wg->geometry().width() ) - 25 ) );
228 h = QMIN( h, ( desk.height() - ( wg->frameGeometry().height() - wg->geometry().height() ) - 25 ) ); 226 h = QMIN( h, ( desk.height() - ( wg->frameGeometry().height() - wg->geometry().height() ) - 25 ) );
229 227
230 wg->resize( w, h ); 228 wg->resize( w, h );
231 wg->show(); 229 wg->show();
232 } 230 }
233 } 231 }
234} 232}
235 233
236enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ 234enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */