summaryrefslogtreecommitdiff
path: root/core/applets/clipboardapplet
Unidiff
Diffstat (limited to 'core/applets/clipboardapplet') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/clipboardapplet/Makefile.in115
-rw-r--r--core/applets/clipboardapplet/clipboard.cpp80
-rw-r--r--core/applets/clipboardapplet/clipboard.h47
-rw-r--r--core/applets/clipboardapplet/clipboardapplet.pro10
-rw-r--r--core/applets/clipboardapplet/clipboardappletimpl.cpp64
-rw-r--r--core/applets/clipboardapplet/clipboardappletimpl.h44
-rw-r--r--core/applets/clipboardapplet/qpe-clipboardapplet.control9
-rw-r--r--core/applets/clipboardapplet/qpe-clipboardapplet.postinst2
-rw-r--r--core/applets/clipboardapplet/qpe-clipboardapplet.postrm2
9 files changed, 373 insertions, 0 deletions
diff --git a/core/applets/clipboardapplet/Makefile.in b/core/applets/clipboardapplet/Makefile.in
new file mode 100644
index 0000000..2ddeb42
--- a/dev/null
+++ b/core/applets/clipboardapplet/Makefile.in
@@ -0,0 +1,115 @@
1#############################################################################
2
3####### Compiler, tools and options
4
5 CXX =$(SYSCONF_CXX) $(QT_CXX_MT)
6 CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) $(SYSCONF_CXXFLAGS_LIB)
7 CC =$(SYSCONF_CC) $(QT_C_MT)
8 CFLAGS =$(SYSCONF_CFLAGS) $(SYSCONF_CFLAGS_LIB)
9 INCPATH =-I$(QPEDIR)/include
10 LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
11 LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS_QTAPP)
12 MOC =$(SYSCONF_MOC)
13 UIC =$(SYSCONF_UIC)
14
15####### Target
16
17DESTDIR = ../../plugins/applets/
18VER_MAJ = 1
19VER_MIN = 0
20VER_PATCH = 0
21 TARGET= clipboardapplet
22TARGET1 = lib$(TARGET).so.$(VER_MAJ)
23
24####### Files
25
26 HEADERS =clipboard.h \
27 clipboardappletimpl.h
28 SOURCES =clipboard.cpp \
29 clipboardappletimpl.cpp
30 OBJECTS =clipboard.o \
31 clipboardappletimpl.o
32INTERFACES =
33UICDECLS =
34UICIMPLS =
35 SRCMOC =moc_clipboard.cpp
36 OBJMOC =moc_clipboard.o
37
38
39####### Implicit rules
40
41.SUFFIXES: .cpp .cxx .cc .C .c
42
43.cpp.o:
44 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
45
46.cxx.o:
47 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
48
49.cc.o:
50 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
51
52.C.o:
53 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
54
55.c.o:
56 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
57
58####### Build rules
59
60
61all: $(DESTDIR)$(SYSCONF_LINK_TARGET)
62
63$(DESTDIR)$(SYSCONF_LINK_TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
64 $(SYSCONF_LINK_LIB)
65
66moc: $(SRCMOC)
67
68tmake:
69 tmake clipboardapplet.pro
70
71clean:
72 -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
73 -rm -f *~ core
74 -rm -f allmoc.cpp
75
76####### Extension Modules
77
78listpromodules:
79 @echo
80
81listallmodules:
82 @echo
83
84listaddonpromodules:
85 @echo
86
87listaddonentmodules:
88 @echo
89
90
91REQUIRES=
92
93####### Sub-libraries
94
95
96###### Combined headers
97
98
99
100####### Compile
101
102clipboard.o: clipboard.cpp \
103 clipboard.h
104
105clipboardappletimpl.o: clipboardappletimpl.cpp \
106 clipboard.h \
107 clipboardappletimpl.h
108
109moc_clipboard.o: moc_clipboard.cpp \
110 clipboard.h
111
112moc_clipboard.cpp: clipboard.h
113 $(MOC) clipboard.h -o moc_clipboard.cpp
114
115
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp
new file mode 100644
index 0000000..57beffc
--- a/dev/null
+++ b/core/applets/clipboardapplet/clipboard.cpp
@@ -0,0 +1,80 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "clipboard.h"
22
23#include <qpe/resource.h>
24
25#include <qpainter.h>
26#include <qpopupmenu.h>
27#include <qwindowsystem_qws.h>
28
29
30//===========================================================================
31
32ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name )
33 : QWidget( parent, name )
34{
35 setFixedWidth( 14 );
36 clipboardPixmap = Resource::loadPixmap( "clipboard" );
37 menu = 0;
38}
39
40ClipboardApplet::~ClipboardApplet()
41{
42}
43
44void ClipboardApplet::mousePressEvent( QMouseEvent *)
45{
46 if ( !menu ) {
47 menu = new QPopupMenu(this);
48 menu->insertItem(tr("Cut"));
49 menu->insertItem(tr("Copy"));
50 menu->insertItem(tr("Paste"));
51 connect(menu, SIGNAL(selected(int)), this, SLOT(action(int)));
52 }
53 menu->popup(mapToGlobal(QPoint(0,0)));
54}
55
56void ClipboardApplet::action(int i)
57{
58 ushort unicode=0;
59 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
68 if ( scan ) {
69 qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE );
70 qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE );
71 }
72}
73
74void ClipboardApplet::paintEvent( QPaintEvent* )
75{
76 QPainter p(this);
77 p.drawPixmap( 0, 1, clipboardPixmap );
78}
79
80
diff --git a/core/applets/clipboardapplet/clipboard.h b/core/applets/clipboardapplet/clipboard.h
new file mode 100644
index 0000000..9dd59ed
--- a/dev/null
+++ b/core/applets/clipboardapplet/clipboard.h
@@ -0,0 +1,47 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef __CLIPBOARD_APPLET_H__
21#define __CLIPBOARD_APPLET_H__
22
23#include <qwidget.h>
24#include <qpixmap.h>
25
26class ClipboardApplet : public QWidget
27{
28 Q_OBJECT
29public:
30 ClipboardApplet( QWidget *parent = 0, const char *name=0 );
31 ~ClipboardApplet();
32
33protected:
34 void mousePressEvent( QMouseEvent *);
35 void paintEvent( QPaintEvent* );
36
37private slots:
38 void action(int);
39
40private:
41 QPopupMenu* menu;
42 QPixmap clipboardPixmap;
43};
44
45
46#endif // __CLIPBOARD_APPLET_H__
47
diff --git a/core/applets/clipboardapplet/clipboardapplet.pro b/core/applets/clipboardapplet/clipboardapplet.pro
new file mode 100644
index 0000000..b0624ef
--- a/dev/null
+++ b/core/applets/clipboardapplet/clipboardapplet.pro
@@ -0,0 +1,10 @@
1 TEMPLATE= lib
2 CONFIG += qt warn_on release
3 HEADERS= clipboard.h clipboardappletimpl.h
4 SOURCES= clipboard.cpp clipboardappletimpl.cpp
5 TARGET = clipboardapplet
6 DESTDIR = ../../plugins/applets
7INCLUDEPATH += $(QPEDIR)/include
8DEPENDPATH += ../$(QPEDIR)/include
9LIBS += -lqpe
10 VERSION = 1.0.0
diff --git a/core/applets/clipboardapplet/clipboardappletimpl.cpp b/core/applets/clipboardapplet/clipboardappletimpl.cpp
new file mode 100644
index 0000000..8080690
--- a/dev/null
+++ b/core/applets/clipboardapplet/clipboardappletimpl.cpp
@@ -0,0 +1,64 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#include "clipboard.h"
21#include "clipboardappletimpl.h"
22
23
24ClipboardAppletImpl::ClipboardAppletImpl()
25 : clipboard(0), ref(0)
26{
27}
28
29ClipboardAppletImpl::~ClipboardAppletImpl()
30{
31 delete clipboard;
32}
33
34QWidget *ClipboardAppletImpl::applet( QWidget *parent )
35{
36 if ( !clipboard )
37 clipboard = new ClipboardApplet( parent );
38 return clipboard;
39}
40
41int ClipboardAppletImpl::position() const
42{
43 return 6;
44}
45
46QRESULT ClipboardAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
47{
48 *iface = 0;
49 if ( uuid == IID_QUnknown )
50 *iface = this;
51 else if ( uuid == IID_TaskbarApplet )
52 *iface = this;
53
54 if ( *iface )
55 (*iface)->addRef();
56 return QS_OK;
57}
58
59Q_EXPORT_INTERFACE()
60{
61 Q_CREATE_INSTANCE( ClipboardAppletImpl )
62}
63
64
diff --git a/core/applets/clipboardapplet/clipboardappletimpl.h b/core/applets/clipboardapplet/clipboardappletimpl.h
new file mode 100644
index 0000000..0426109
--- a/dev/null
+++ b/core/applets/clipboardapplet/clipboardappletimpl.h
@@ -0,0 +1,44 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef CLIPBOARDAPPLETIMPL_H
21#define CLIPBOARDAPPLETIMPL_H
22
23#include <qpe/taskbarappletinterface.h>
24
25class ClipboardApplet;
26
27class ClipboardAppletImpl : public TaskbarAppletInterface
28{
29public:
30 ClipboardAppletImpl();
31 virtual ~ClipboardAppletImpl();
32
33 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
34 Q_REFCOUNT
35
36 virtual QWidget *applet( QWidget *parent );
37 virtual int position() const;
38
39private:
40 ClipboardApplet *clipboard;
41 ulong ref;
42};
43
44#endif
diff --git a/core/applets/clipboardapplet/qpe-clipboardapplet.control b/core/applets/clipboardapplet/qpe-clipboardapplet.control
new file mode 100644
index 0000000..26cbc55
--- a/dev/null
+++ b/core/applets/clipboardapplet/qpe-clipboardapplet.control
@@ -0,0 +1,9 @@
1Files: plugins/applets/libclipboardapplet.so*
2Priority: optional
3Section: qpe/taskbar
4Maintainer: Warwick Allison <warwick@trolltech.com>
5Architecture: arm
6Version: $QPE_VERSION-3
7Depends: qpe-base ($QPE_VERSION)
8Description: Clipboard applet
9 Clipboard applet for the Qtopia environment taskbar.
diff --git a/core/applets/clipboardapplet/qpe-clipboardapplet.postinst b/core/applets/clipboardapplet/qpe-clipboardapplet.postinst
new file mode 100644
index 0000000..ba76ffa
--- a/dev/null
+++ b/core/applets/clipboardapplet/qpe-clipboardapplet.postinst
@@ -0,0 +1,2 @@
1#!/bin/sh
2/opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()"
diff --git a/core/applets/clipboardapplet/qpe-clipboardapplet.postrm b/core/applets/clipboardapplet/qpe-clipboardapplet.postrm
new file mode 100644
index 0000000..ba76ffa
--- a/dev/null
+++ b/core/applets/clipboardapplet/qpe-clipboardapplet.postrm
@@ -0,0 +1,2 @@
1#!/bin/sh
2/opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()"