-rw-r--r-- | core/applets/clipboardapplet/clipboard.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp index 7714f81..cd4f61c 100644 --- a/core/applets/clipboardapplet/clipboard.cpp +++ b/core/applets/clipboardapplet/clipboard.cpp | |||
@@ -86,89 +86,92 @@ static const char * paste_xpm[] = { | |||
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 ( tr( "Cut" ), 0 ); | 134 | menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "cut" )), tr( "Cut" ), 0 ); |
135 | menu-> insertItem ( tr( "Copy" ), 1 ); | 135 | menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "copy" )), tr( "Copy" ), 1 ); |
136 | menu-> insertItem ( 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 | menu->popup(mapToGlobal(QPoint(0,0))); | 139 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); |
140 | QSize s = menu-> sizeHint ( ); | ||
141 | |||
142 | menu-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( ))); | ||
140 | } | 143 | } |
141 | 144 | ||
142 | void ClipboardApplet::action(int id) | 145 | void ClipboardApplet::action(int id) |
143 | { | 146 | { |
144 | ushort unicode=0; | 147 | ushort unicode=0; |
145 | int scan=0; | 148 | int scan=0; |
146 | 149 | ||
147 | switch ( id ) { | 150 | switch ( id ) { |
148 | case 0: | 151 | case 0: |
149 | unicode='X'-'@'; | 152 | unicode='X'-'@'; |
150 | scan=Key_X; // Cut | 153 | scan=Key_X; // Cut |
151 | break; | 154 | break; |
152 | case 1: | 155 | case 1: |
153 | unicode='C'-'@'; | 156 | unicode='C'-'@'; |
154 | scan=Key_C; // Copy | 157 | scan=Key_C; // Copy |
155 | break; | 158 | break; |
156 | case 2: | 159 | case 2: |
157 | unicode='V'-'@'; | 160 | unicode='V'-'@'; |
158 | scan=Key_V; // Paste | 161 | scan=Key_V; // Paste |
159 | break; | 162 | break; |
160 | } | 163 | } |
161 | 164 | ||
162 | if ( scan ) { | 165 | if ( scan ) { |
163 | qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE ); | 166 | qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE ); |
164 | qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE ); | 167 | qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE ); |
165 | } | 168 | } |
166 | } | 169 | } |
167 | 170 | ||
168 | void ClipboardApplet::paintEvent ( QPaintEvent* ) | 171 | void ClipboardApplet::paintEvent ( QPaintEvent* ) |
169 | { | 172 | { |
170 | QPainter p ( this ); | 173 | QPainter p ( this ); |
171 | p. drawPixmap ( 0, 1, clipboardPixmap ); | 174 | p. drawPixmap ( 0, 1, clipboardPixmap ); |
172 | } | 175 | } |
173 | 176 | ||
174 | 177 | ||