summaryrefslogtreecommitdiff
authorsandman <sandman>2002-06-19 23:05:50 (UTC)
committer sandman <sandman>2002-06-19 23:05:50 (UTC)
commit37bc7d72ed82a9593f9fd441abad23c5de458ad0 (patch) (side-by-side diff)
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
@@ -86,89 +86,92 @@ static const char * paste_xpm[] = {
"l c #BEBEBE",
"m c #464646",
"n c #BEAE92",
"o c #262626",
"p c #F2E2CE",
"q c #C2A175",
"r c #CACACA",
"s c #969696",
"t c #8A8A8A",
"u c #828282",
"v c #6A6A6A",
"w c #BEB6AE",
"x c #E2E0E0",
"y c #7A7A7A",
" *{>; ",
" }}}@e:!;}}} ",
"<x8=&:#@+;ll, ",
"}k/=;;3}337|o ",
"<k's24444m45o ",
"}8'ss4xkkk]}a ",
"<1s224keee|b4 ",
"}r2itmkeee]]44",
"<9iitmkeeehkw.",
"<lt-u4keeb)pn.",
"<fu-umkebhp(0.",
"<cugg4kbh)_(q.",
"<cyyymk))p(%q.",
",5vvv4k)p_%[q.",
" ...$mljnn0qd.",
" 4.......,"};
ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name )
{
setFixedWidth ( 14 );
setFixedHeight ( 18 );
clipboardPixmap = QPixmap ( paste_xpm );
menu = 0;
}
ClipboardApplet::~ClipboardApplet ( )
{
}
void ClipboardApplet::mousePressEvent ( QMouseEvent *)
{
if ( !menu ) {
menu = new QPopupMenu ( this );
- menu-> insertItem ( tr( "Cut" ), 0 );
- menu-> insertItem ( tr( "Copy" ), 1 );
- menu-> insertItem ( tr( "Paste" ), 2 );
+ menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "cut" )), tr( "Cut" ), 0 );
+ menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "copy" )), tr( "Copy" ), 1 );
+ menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "paste" )), tr( "Paste" ), 2 );
connect ( menu, SIGNAL( activated ( int )), this, SLOT( action ( int )));
}
- menu->popup(mapToGlobal(QPoint(0,0)));
+ QPoint p = mapToGlobal ( QPoint ( 0, 0 ));
+ QSize s = menu-> sizeHint ( );
+
+ menu-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( )));
}
void ClipboardApplet::action(int id)
{
ushort unicode=0;
int scan=0;
switch ( id ) {
case 0:
unicode='X'-'@';
scan=Key_X; // Cut
break;
case 1:
unicode='C'-'@';
scan=Key_C; // Copy
break;
case 2:
unicode='V'-'@';
scan=Key_V; // Paste
break;
}
if ( scan ) {
qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE );
qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE );
}
}
void ClipboardApplet::paintEvent ( QPaintEvent* )
{
QPainter p ( this );
p. drawPixmap ( 0, 1, clipboardPixmap );
}