summaryrefslogtreecommitdiff
authorsandman <sandman>2002-06-19 23:05:50 (UTC)
committer sandman <sandman>2002-06-19 23:05:50 (UTC)
commit37bc7d72ed82a9593f9fd441abad23c5de458ad0 (patch) (unidiff)
tree8ed79d1e316af3b888db63ddc6045b419cc7f269
parentce6d4880d3d78fb569322c14e425654785de980d (diff)
downloadopie-37bc7d72ed82a9593f9fd441abad23c5de458ad0.zip
opie-37bc7d72ed82a9593f9fd441abad23c5de458ad0.tar.gz
opie-37bc7d72ed82a9593f9fd441abad23c5de458ad0.tar.bz2
Fixed position of popup and added pixmaps for cut/copy/paste
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/clipboardapplet/clipboard.cpp11
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
@@ -38,137 +38,140 @@ static const char * paste_xpm[] = {
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
118ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) 118ClipboardApplet::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
126ClipboardApplet::~ClipboardApplet ( ) 126ClipboardApplet::~ClipboardApplet ( )
127{ 127{
128} 128}
129 129
130void ClipboardApplet::mousePressEvent ( QMouseEvent *) 130void 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
142void ClipboardApplet::action(int id) 145void 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
168void ClipboardApplet::paintEvent ( QPaintEvent* ) 171void 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