summaryrefslogtreecommitdiff
path: root/core/applets/clipboardapplet
authorkergoth <kergoth>2002-01-25 22:14:26 (UTC)
committer kergoth <kergoth>2002-01-25 22:14:26 (UTC)
commit15318cad33835e4e2dc620d033e43cd930676cdd (patch) (side-by-side diff)
treec2fa0399a2c47fda8e2cd0092c73a809d17f68eb /core/applets/clipboardapplet
downloadopie-15318cad33835e4e2dc620d033e43cd930676cdd.zip
opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.gz
opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.bz2
Initial revision
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 @@
+#############################################################################
+
+####### Compiler, tools and options
+
+CXX = $(SYSCONF_CXX) $(QT_CXX_MT)
+CXXFLAGS= $(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) $(SYSCONF_CXXFLAGS_LIB)
+CC = $(SYSCONF_CC) $(QT_C_MT)
+CFLAGS = $(SYSCONF_CFLAGS) $(SYSCONF_CFLAGS_LIB)
+INCPATH = -I$(QPEDIR)/include
+LFLAGS = $(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
+LIBS = $(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS_QTAPP)
+MOC = $(SYSCONF_MOC)
+UIC = $(SYSCONF_UIC)
+
+####### Target
+
+DESTDIR = ../../plugins/applets/
+VER_MAJ = 1
+VER_MIN = 0
+VER_PATCH = 0
+TARGET = clipboardapplet
+TARGET1 = lib$(TARGET).so.$(VER_MAJ)
+
+####### Files
+
+HEADERS = clipboard.h \
+ clipboardappletimpl.h
+SOURCES = clipboard.cpp \
+ clipboardappletimpl.cpp
+OBJECTS = clipboard.o \
+ clipboardappletimpl.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC = moc_clipboard.cpp
+OBJMOC = moc_clipboard.o
+
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(DESTDIR)$(SYSCONF_LINK_TARGET)
+
+$(DESTDIR)$(SYSCONF_LINK_TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ $(SYSCONF_LINK_LIB)
+
+moc: $(SRCMOC)
+
+tmake:
+ tmake clipboardapplet.pro
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
+ -rm -f *~ core
+ -rm -f allmoc.cpp
+
+####### Extension Modules
+
+listpromodules:
+ @echo
+
+listallmodules:
+ @echo
+
+listaddonpromodules:
+ @echo
+
+listaddonentmodules:
+ @echo
+
+
+REQUIRES=
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+
+####### Compile
+
+clipboard.o: clipboard.cpp \
+ clipboard.h
+
+clipboardappletimpl.o: clipboardappletimpl.cpp \
+ clipboard.h \
+ clipboardappletimpl.h
+
+moc_clipboard.o: moc_clipboard.cpp \
+ clipboard.h
+
+moc_clipboard.cpp: clipboard.h
+ $(MOC) clipboard.h -o moc_clipboard.cpp
+
+
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 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "clipboard.h"
+
+#include <qpe/resource.h>
+
+#include <qpainter.h>
+#include <qpopupmenu.h>
+#include <qwindowsystem_qws.h>
+
+
+//===========================================================================
+
+ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ setFixedWidth( 14 );
+ clipboardPixmap = Resource::loadPixmap( "clipboard" );
+ menu = 0;
+}
+
+ClipboardApplet::~ClipboardApplet()
+{
+}
+
+void ClipboardApplet::mousePressEvent( QMouseEvent *)
+{
+ if ( !menu ) {
+ menu = new QPopupMenu(this);
+ menu->insertItem(tr("Cut"));
+ menu->insertItem(tr("Copy"));
+ menu->insertItem(tr("Paste"));
+ connect(menu, SIGNAL(selected(int)), this, SLOT(action(int)));
+ }
+ menu->popup(mapToGlobal(QPoint(0,0)));
+}
+
+void ClipboardApplet::action(int i)
+{
+ ushort unicode=0;
+ int scan=0;
+
+ if ( i == 0 )
+ { unicode='X'-'@'; scan=Key_X; } // Cut
+ else if ( i == 1 )
+ { unicode='C'-'@'; scan=Key_C; } // Copy
+ else if ( i == 2 )
+ { unicode='V'-'@'; scan=Key_V; } // Paste
+
+ 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 );
+}
+
+
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 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef __CLIPBOARD_APPLET_H__
+#define __CLIPBOARD_APPLET_H__
+
+#include <qwidget.h>
+#include <qpixmap.h>
+
+class ClipboardApplet : public QWidget
+{
+ Q_OBJECT
+public:
+ ClipboardApplet( QWidget *parent = 0, const char *name=0 );
+ ~ClipboardApplet();
+
+protected:
+ void mousePressEvent( QMouseEvent *);
+ void paintEvent( QPaintEvent* );
+
+private slots:
+ void action(int);
+
+private:
+ QPopupMenu* menu;
+ QPixmap clipboardPixmap;
+};
+
+
+#endif // __CLIPBOARD_APPLET_H__
+
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 @@
+TEMPLATE = lib
+CONFIG += qt warn_on release
+HEADERS = clipboard.h clipboardappletimpl.h
+SOURCES = clipboard.cpp clipboardappletimpl.cpp
+TARGET = clipboardapplet
+DESTDIR = ../../plugins/applets
+INCLUDEPATH += $(QPEDIR)/include
+DEPENDPATH += ../$(QPEDIR)/include
+LIBS += -lqpe
+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 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#include "clipboard.h"
+#include "clipboardappletimpl.h"
+
+
+ClipboardAppletImpl::ClipboardAppletImpl()
+ : clipboard(0), ref(0)
+{
+}
+
+ClipboardAppletImpl::~ClipboardAppletImpl()
+{
+ delete clipboard;
+}
+
+QWidget *ClipboardAppletImpl::applet( QWidget *parent )
+{
+ if ( !clipboard )
+ clipboard = new ClipboardApplet( parent );
+ return clipboard;
+}
+
+int ClipboardAppletImpl::position() const
+{
+ return 6;
+}
+
+QRESULT ClipboardAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
+{
+ *iface = 0;
+ if ( uuid == IID_QUnknown )
+ *iface = this;
+ else if ( uuid == IID_TaskbarApplet )
+ *iface = this;
+
+ if ( *iface )
+ (*iface)->addRef();
+ return QS_OK;
+}
+
+Q_EXPORT_INTERFACE()
+{
+ Q_CREATE_INSTANCE( ClipboardAppletImpl )
+}
+
+
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 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef CLIPBOARDAPPLETIMPL_H
+#define CLIPBOARDAPPLETIMPL_H
+
+#include <qpe/taskbarappletinterface.h>
+
+class ClipboardApplet;
+
+class ClipboardAppletImpl : public TaskbarAppletInterface
+{
+public:
+ ClipboardAppletImpl();
+ virtual ~ClipboardAppletImpl();
+
+ QRESULT queryInterface( const QUuid&, QUnknownInterface** );
+ Q_REFCOUNT
+
+ virtual QWidget *applet( QWidget *parent );
+ virtual int position() const;
+
+private:
+ ClipboardApplet *clipboard;
+ ulong ref;
+};
+
+#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 @@
+Files: plugins/applets/libclipboardapplet.so*
+Priority: optional
+Section: qpe/taskbar
+Maintainer: Warwick Allison <warwick@trolltech.com>
+Architecture: arm
+Version: $QPE_VERSION-3
+Depends: qpe-base ($QPE_VERSION)
+Description: Clipboard applet
+ 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 @@
+#!/bin/sh
+/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 @@
+#!/bin/sh
+/opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()"