summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/clipboardapplet/clipboard.cpp160
-rw-r--r--core/applets/clipboardapplet/opie-clipboardapplet.control2
2 files changed, 128 insertions, 34 deletions
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp
index 57beffc..7714f81 100644
--- a/core/applets/clipboardapplet/clipboard.cpp
+++ b/core/applets/clipboardapplet/clipboard.cpp
@@ -16,65 +16,159 @@
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 28#include <qmessagebox.h>
29#include <qtimer.h>
29 30
30//=========================================================================== 31//===========================================================================
31 32
32ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) 33/* XPM */
33 : QWidget( parent, name ) 34static const char * paste_xpm[] = {
35"14 16 64 1",
36 " c None",
37 ".c #020202",
38 "+c #867616",
39 "@c #A69A42",
40 "#c #BAB676",
41 "$c #060606",
42 "%c #EAD2AA",
43 "&c #F6F6DA",
44 "*c #222212",
45 "=c #86761E",
46 "-c #868686",
47 ";c #5A5202",
48 ">c #8A7E2E",
49 ",c #2C2C2C",
50 "'c #9A9A9A",
51 ")c #F6EADA",
52 "!c #AAA262",
53 "~c #323232",
54 "{c #726A32",
55 "]c #6E6E6E",
56 "^c #C2B69E",
57 "/c #9E9E9E",
58 "(c #EED6BA",
59 "_c #F2DEC2",
60 ":c #D2CE8E",
61 "<c #3A3A3A",
62 "[c #EACAA2",
63 "}c #3E3E3E",
64 "|c #727272",
65 "1c #CECECE",
66 "2c #929292",
67 "3c #4A462A",
68 "4c #424242",
69 "5c #666666",
70 "6c #C2AE96",
71 "7c #767676",
72 "8c #D6D6D6",
73 "9c #C2C2C2",
74 "0c #BFA681",
75 "ac #1E1E1E",
76 "bc #FAF6F3",
77 "cc #AEAEAE",
78 "dc #C29A6A",
79 "ec #FEFEFE",
80 "fc #B6B6B6",
81 "gc #7E7E7E",
82 "hc #FAF2E6",
83 "ic #8E8E8E",
84 "jc #C6BCAE",
85 "kc #DEDEDE",
86 "lc #BEBEBE",
87 "mc #464646",
88 "nc #BEAE92",
89 "oc #262626",
90 "pc #F2E2CE",
91 "qc #C2A175",
92 "rc #CACACA",
93 "sc #969696",
94 "tc #8A8A8A",
95 "uc #828282",
96 "vc #6A6A6A",
97 "wc #BEB6AE",
98 "xc #E2E0E0",
99 "yc #7A7A7A",
100" *{>; ",
101" }}}@e:!;}}} ",
102"<x8=&:#@+;ll, ",
103"}k/=;;3}337|o ",
104"<k's24444m45o ",
105"}8'ss4xkkk]}a ",
106"<1s224keee|b4 ",
107"}r2itmkeee]]44",
108"<9iitmkeeehkw.",
109"<lt-u4keeb)pn.",
110"<fu-umkebhp(0.",
111"<cugg4kbh)_(q.",
112"<cyyymk))p(%q.",
113",5vvv4k)p_%[q.",
114" ...$mljnn0qd.",
115" 4.......,"};
116
117
118ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name )
34{ 119{
35 setFixedWidth( 14 ); 120 setFixedWidth ( 14 );
36 clipboardPixmap = Resource::loadPixmap( "clipboard" ); 121 setFixedHeight ( 18 );
37 menu = 0; 122 clipboardPixmap = QPixmap ( paste_xpm );
123 menu = 0;
38} 124}
39 125
40ClipboardApplet::~ClipboardApplet() 126ClipboardApplet::~ClipboardApplet ( )
41{ 127{
42} 128}
43 129
44void ClipboardApplet::mousePressEvent( QMouseEvent *) 130void ClipboardApplet::mousePressEvent ( QMouseEvent *)
45{ 131{
46 if ( !menu ) { 132 if ( !menu ) {
47 menu = new QPopupMenu(this); 133 menu = new QPopupMenu ( this );
48 menu->insertItem(tr("Cut")); 134 menu-> insertItem ( tr( "Cut" ), 0 );
49 menu->insertItem(tr("Copy")); 135 menu-> insertItem ( tr( "Copy" ), 1 );
50 menu->insertItem(tr("Paste")); 136 menu-> insertItem ( tr( "Paste" ), 2 );
51 connect(menu, SIGNAL(selected(int)), this, SLOT(action(int))); 137 connect ( menu, SIGNAL( activated ( int )), this, SLOT( action ( int )));
52 } 138 }
53 menu->popup(mapToGlobal(QPoint(0,0))); 139 menu->popup(mapToGlobal(QPoint(0,0)));
54} 140}
55 141
56void ClipboardApplet::action(int i) 142void ClipboardApplet::action(int id)
57{ 143{
58 ushort unicode=0; 144 ushort unicode=0;
59 int scan=0; 145 int scan=0;
60
61 if ( i == 0 )
62 { unicode='X'-'@'; scan=Key_X; } // Cut
63 else if ( i == 1 )
64 { unicode='C'-'@'; scan=Key_C; } // Copy
65 else if ( i == 2 )
66 { unicode='V'-'@'; scan=Key_V; } // Paste
67 146
68 if ( scan ) { 147 switch ( id ) {
69 qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE ); 148 case 0:
70 qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE ); 149 unicode='X'-'@';
71 } 150 scan=Key_X; // Cut
151 break;
152 case 1:
153 unicode='C'-'@';
154 scan=Key_C; // Copy
155 break;
156 case 2:
157 unicode='V'-'@';
158 scan=Key_V; // Paste
159 break;
160 }
161
162 if ( scan ) {
163 qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE );
164 qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE );
165 }
72} 166}
73 167
74void ClipboardApplet::paintEvent( QPaintEvent* ) 168void ClipboardApplet::paintEvent ( QPaintEvent* )
75{ 169{
76 QPainter p(this); 170 QPainter p ( this );
77 p.drawPixmap( 0, 1, clipboardPixmap ); 171 p. drawPixmap ( 0, 1, clipboardPixmap );
78} 172}
79 173
80 174
diff --git a/core/applets/clipboardapplet/opie-clipboardapplet.control b/core/applets/clipboardapplet/opie-clipboardapplet.control
index 78c90b7..57ce542 100644
--- a/core/applets/clipboardapplet/opie-clipboardapplet.control
+++ b/core/applets/clipboardapplet/opie-clipboardapplet.control
@@ -1,9 +1,9 @@
1Files: plugins/applets/libclipboardapplet.so* 1Files: plugins/applets/libclipboardapplet.so*
2Priority: optional 2Priority: optional
3Section: opie/taskbar 3Section: opie/taskbar
4Maintainer: Warwick Allison <warwick@trolltech.com> 4Maintainer: Robert Griebl <sandman@handhelds.org>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION 6Version: $QPE_VERSION-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION) 7Depends: opie-base ($QPE_VERSION)
8Description: Clipboard applet 8Description: Clipboard applet
9 Clipboard applet for the Opie environment taskbar. 9 Clipboard applet for the Opie environment taskbar.