author | mickeyl <mickeyl> | 2004-03-01 21:10:13 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-03-01 21:10:13 (UTC) |
commit | 77af6f58d59011e123309c82b684695508a46787 (patch) (side-by-side diff) | |
tree | 1eeb3b323bc14581af7da9fe5b58c4c611b00575 /noncore/applets/autorotateapplet/autorotate.cpp | |
parent | 7b0bdb05e4ae29b2643d73e3b8f20a86a86dcccc (diff) | |
download | opie-77af6f58d59011e123309c82b684695508a46787.zip opie-77af6f58d59011e123309c82b684695508a46787.tar.gz opie-77af6f58d59011e123309c82b684695508a46787.tar.bz2 |
remove boiler plate code in favour of a template
Diffstat (limited to 'noncore/applets/autorotateapplet/autorotate.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/applets/autorotateapplet/autorotate.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/noncore/applets/autorotateapplet/autorotate.cpp b/noncore/applets/autorotateapplet/autorotate.cpp index 5152904..94be0ae 100644 --- a/noncore/applets/autorotateapplet/autorotate.cpp +++ b/noncore/applets/autorotateapplet/autorotate.cpp @@ -5,24 +5,25 @@ * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * *************************************************************************/ #include "autorotate.h" /* OPIE */ #include <opie2/odevice.h> +#include <opie2/otaskbarapplet.h> #include <qpe/applnk.h> #include <qpe/config.h> #include <qpe/resource.h> /* QT */ #include <qpainter.h> using namespace Opie; AutoRotate::AutoRotate(QWidget * parent):QWidget(parent) { setFixedWidth( AppLnk::smallIconSize() ); @@ -34,24 +35,29 @@ AutoRotate::AutoRotate(QWidget * parent):QWidget(parent) repaint(true); popupMenu = 0; show(); } AutoRotate::~AutoRotate() { if (popupMenu) { delete popupMenu; } } +int AutoRotate::position() +{ + return 7; +} + void AutoRotate::mousePressEvent(QMouseEvent *) { QPopupMenu *menu = new QPopupMenu(this); menu->insertItem( isRotateEnabled()? "Disable Rotation" : "Enable Rotation" ,1 ); QPoint p = mapToGlobal(QPoint(0, 0)); QSize s = menu->sizeHint(); int opt = menu->exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), p.y() - s.height()), 0); if (opt==1) { setRotateEnabled( !isRotateEnabled() ); @@ -79,12 +85,17 @@ bool AutoRotate::isRotateEnabled() Config cfg( "qpe" ); cfg.setGroup( "Appearance" ); bool res = cfg.readBoolEntry( "rotateEnabled" ); if (res ) qDebug("Enabled"); else qDebug("Disabled"); return res; } +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( OTaskbarAppletWrapper<AutoRotate> ); +} + |