author | sandman <sandman> | 2002-06-20 17:36:21 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-06-20 17:36:21 (UTC) |
commit | fd64293dbcfae3bcf3265e31fbe847ac86b2a0af (patch) (unidiff) | |
tree | 77b9541ed66bf6cc388da18cc7cdbe463cc2930e | |
parent | 0996b7f1bcbdb05db00eadb0cdd60b2066cdd899 (diff) | |
download | opie-fd64293dbcfae3bcf3265e31fbe847ac86b2a0af.zip opie-fd64293dbcfae3bcf3265e31fbe847ac86b2a0af.tar.gz opie-fd64293dbcfae3bcf3265e31fbe847ac86b2a0af.tar.bz2 |
virtual key events should use sendKeyEvent, not processKeyEvents
-rw-r--r-- | core/applets/clipboardapplet/clipboard.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp index cd4f61c..203e23e 100644 --- a/core/applets/clipboardapplet/clipboard.cpp +++ b/core/applets/clipboardapplet/clipboard.cpp | |||
@@ -1,177 +1,177 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "clipboard.h" | 21 | #include "clipboard.h" |
22 | 22 | ||
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | 24 | ||
25 | #include <qpainter.h> | 25 | #include <qpainter.h> |
26 | #include <qpopupmenu.h> | 26 | #include <qpopupmenu.h> |
27 | #include <qwindowsystem_qws.h> | 27 | #include <qwindowsystem_qws.h> |
28 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
29 | #include <qtimer.h> | 29 | #include <qtimer.h> |
30 | 30 | ||
31 | //=========================================================================== | 31 | //=========================================================================== |
32 | 32 | ||
33 | /* XPM */ | 33 | /* XPM */ |
34 | static const char * paste_xpm[] = { | 34 | static const char * paste_xpm[] = { |
35 | "14 16 64 1", | 35 | "14 16 64 1", |
36 | " c None", | 36 | " c None", |
37 | ".c #020202", | 37 | ".c #020202", |
38 | "+c #867616", | 38 | "+c #867616", |
39 | "@c #A69A42", | 39 | "@c #A69A42", |
40 | "#c #BAB676", | 40 | "#c #BAB676", |
41 | "$c #060606", | 41 | "$c #060606", |
42 | "%c #EAD2AA", | 42 | "%c #EAD2AA", |
43 | "&c #F6F6DA", | 43 | "&c #F6F6DA", |
44 | "*c #222212", | 44 | "*c #222212", |
45 | "=c #86761E", | 45 | "=c #86761E", |
46 | "-c #868686", | 46 | "-c #868686", |
47 | ";c #5A5202", | 47 | ";c #5A5202", |
48 | ">c #8A7E2E", | 48 | ">c #8A7E2E", |
49 | ",c #2C2C2C", | 49 | ",c #2C2C2C", |
50 | "'c #9A9A9A", | 50 | "'c #9A9A9A", |
51 | ")c #F6EADA", | 51 | ")c #F6EADA", |
52 | "!c #AAA262", | 52 | "!c #AAA262", |
53 | "~c #323232", | 53 | "~c #323232", |
54 | "{c #726A32", | 54 | "{c #726A32", |
55 | "]c #6E6E6E", | 55 | "]c #6E6E6E", |
56 | "^c #C2B69E", | 56 | "^c #C2B69E", |
57 | "/c #9E9E9E", | 57 | "/c #9E9E9E", |
58 | "(c #EED6BA", | 58 | "(c #EED6BA", |
59 | "_c #F2DEC2", | 59 | "_c #F2DEC2", |
60 | ":c #D2CE8E", | 60 | ":c #D2CE8E", |
61 | "<c #3A3A3A", | 61 | "<c #3A3A3A", |
62 | "[c #EACAA2", | 62 | "[c #EACAA2", |
63 | "}c #3E3E3E", | 63 | "}c #3E3E3E", |
64 | "|c #727272", | 64 | "|c #727272", |
65 | "1c #CECECE", | 65 | "1c #CECECE", |
66 | "2c #929292", | 66 | "2c #929292", |
67 | "3c #4A462A", | 67 | "3c #4A462A", |
68 | "4c #424242", | 68 | "4c #424242", |
69 | "5c #666666", | 69 | "5c #666666", |
70 | "6c #C2AE96", | 70 | "6c #C2AE96", |
71 | "7c #767676", | 71 | "7c #767676", |
72 | "8c #D6D6D6", | 72 | "8c #D6D6D6", |
73 | "9c #C2C2C2", | 73 | "9c #C2C2C2", |
74 | "0c #BFA681", | 74 | "0c #BFA681", |
75 | "ac #1E1E1E", | 75 | "ac #1E1E1E", |
76 | "bc #FAF6F3", | 76 | "bc #FAF6F3", |
77 | "cc #AEAEAE", | 77 | "cc #AEAEAE", |
78 | "dc #C29A6A", | 78 | "dc #C29A6A", |
79 | "ec #FEFEFE", | 79 | "ec #FEFEFE", |
80 | "fc #B6B6B6", | 80 | "fc #B6B6B6", |
81 | "gc #7E7E7E", | 81 | "gc #7E7E7E", |
82 | "hc #FAF2E6", | 82 | "hc #FAF2E6", |
83 | "ic #8E8E8E", | 83 | "ic #8E8E8E", |
84 | "jc #C6BCAE", | 84 | "jc #C6BCAE", |
85 | "kc #DEDEDE", | 85 | "kc #DEDEDE", |
86 | "lc #BEBEBE", | 86 | "lc #BEBEBE", |
87 | "mc #464646", | 87 | "mc #464646", |
88 | "nc #BEAE92", | 88 | "nc #BEAE92", |
89 | "oc #262626", | 89 | "oc #262626", |
90 | "pc #F2E2CE", | 90 | "pc #F2E2CE", |
91 | "qc #C2A175", | 91 | "qc #C2A175", |
92 | "rc #CACACA", | 92 | "rc #CACACA", |
93 | "sc #969696", | 93 | "sc #969696", |
94 | "tc #8A8A8A", | 94 | "tc #8A8A8A", |
95 | "uc #828282", | 95 | "uc #828282", |
96 | "vc #6A6A6A", | 96 | "vc #6A6A6A", |
97 | "wc #BEB6AE", | 97 | "wc #BEB6AE", |
98 | "xc #E2E0E0", | 98 | "xc #E2E0E0", |
99 | "yc #7A7A7A", | 99 | "yc #7A7A7A", |
100 | " *{>; ", | 100 | " *{>; ", |
101 | " }}}@e:!;}}} ", | 101 | " }}}@e:!;}}} ", |
102 | "<x8=&:#@+;ll, ", | 102 | "<x8=&:#@+;ll, ", |
103 | "}k/=;;3}337|o ", | 103 | "}k/=;;3}337|o ", |
104 | "<k's24444m45o ", | 104 | "<k's24444m45o ", |
105 | "}8'ss4xkkk]}a ", | 105 | "}8'ss4xkkk]}a ", |
106 | "<1s224keee|b4 ", | 106 | "<1s224keee|b4 ", |
107 | "}r2itmkeee]]44", | 107 | "}r2itmkeee]]44", |
108 | "<9iitmkeeehkw.", | 108 | "<9iitmkeeehkw.", |
109 | "<lt-u4keeb)pn.", | 109 | "<lt-u4keeb)pn.", |
110 | "<fu-umkebhp(0.", | 110 | "<fu-umkebhp(0.", |
111 | "<cugg4kbh)_(q.", | 111 | "<cugg4kbh)_(q.", |
112 | "<cyyymk))p(%q.", | 112 | "<cyyymk))p(%q.", |
113 | ",5vvv4k)p_%[q.", | 113 | ",5vvv4k)p_%[q.", |
114 | " ...$mljnn0qd.", | 114 | " ...$mljnn0qd.", |
115 | " 4.......,"}; | 115 | " 4.......,"}; |
116 | 116 | ||
117 | 117 | ||
118 | ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) | 118 | ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) |
119 | { | 119 | { |
120 | setFixedWidth ( 14 ); | 120 | setFixedWidth ( 14 ); |
121 | setFixedHeight ( 18 ); | 121 | setFixedHeight ( 18 ); |
122 | clipboardPixmap = QPixmap ( paste_xpm ); | 122 | clipboardPixmap = QPixmap ( paste_xpm ); |
123 | menu = 0; | 123 | menu = 0; |
124 | } | 124 | } |
125 | 125 | ||
126 | ClipboardApplet::~ClipboardApplet ( ) | 126 | ClipboardApplet::~ClipboardApplet ( ) |
127 | { | 127 | { |
128 | } | 128 | } |
129 | 129 | ||
130 | void ClipboardApplet::mousePressEvent ( QMouseEvent *) | 130 | void ClipboardApplet::mousePressEvent ( QMouseEvent *) |
131 | { | 131 | { |
132 | if ( !menu ) { | 132 | if ( !menu ) { |
133 | menu = new QPopupMenu ( this ); | 133 | menu = new QPopupMenu ( this ); |
134 | menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "cut" )), tr( "Cut" ), 0 ); | 134 | menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "cut" )), tr( "Cut" ), 0 ); |
135 | menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "copy" )), tr( "Copy" ), 1 ); | 135 | menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "copy" )), tr( "Copy" ), 1 ); |
136 | menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "paste" )), tr( "Paste" ), 2 ); | 136 | menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "paste" )), tr( "Paste" ), 2 ); |
137 | connect ( menu, SIGNAL( activated ( int )), this, SLOT( action ( int ))); | 137 | connect ( menu, SIGNAL( activated ( int )), this, SLOT( action ( int ))); |
138 | } | 138 | } |
139 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); | 139 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); |
140 | QSize s = menu-> sizeHint ( ); | 140 | QSize s = menu-> sizeHint ( ); |
141 | 141 | ||
142 | menu-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( ))); | 142 | menu-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( ))); |
143 | } | 143 | } |
144 | 144 | ||
145 | void ClipboardApplet::action(int id) | 145 | void ClipboardApplet::action(int id) |
146 | { | 146 | { |
147 | ushort unicode=0; | 147 | ushort unicode=0; |
148 | int scan=0; | 148 | int scan=0; |
149 | 149 | ||
150 | switch ( id ) { | 150 | switch ( id ) { |
151 | case 0: | 151 | case 0: |
152 | unicode='X'-'@'; | 152 | unicode='X'-'@'; |
153 | scan=Key_X; // Cut | 153 | scan=Key_X; // Cut |
154 | break; | 154 | break; |
155 | case 1: | 155 | case 1: |
156 | unicode='C'-'@'; | 156 | unicode='C'-'@'; |
157 | scan=Key_C; // Copy | 157 | scan=Key_C; // Copy |
158 | break; | 158 | break; |
159 | case 2: | 159 | case 2: |
160 | unicode='V'-'@'; | 160 | unicode='V'-'@'; |
161 | scan=Key_V; // Paste | 161 | scan=Key_V; // Paste |
162 | break; | 162 | break; |
163 | } | 163 | } |
164 | 164 | ||
165 | if ( scan ) { | 165 | if ( scan ) { |
166 | qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE ); | 166 | qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false ); |
167 | qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE ); | 167 | qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false ); |
168 | } | 168 | } |
169 | } | 169 | } |
170 | 170 | ||
171 | void ClipboardApplet::paintEvent ( QPaintEvent* ) | 171 | void ClipboardApplet::paintEvent ( QPaintEvent* ) |
172 | { | 172 | { |
173 | QPainter p ( this ); | 173 | QPainter p ( this ); |
174 | p. drawPixmap ( 0, 1, clipboardPixmap ); | 174 | p. drawPixmap ( 0, 1, clipboardPixmap ); |
175 | } | 175 | } |
176 | 176 | ||
177 | 177 | ||