summaryrefslogtreecommitdiff
path: root/noncore/applets/autorotateapplet/autorotate.cpp
Unidiff
Diffstat (limited to 'noncore/applets/autorotateapplet/autorotate.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/applets/autorotateapplet/autorotate.cpp11
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 @@
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by * 7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or * 8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. * 9 * (at your option) any later version. *
10 * * 10 * *
11 *************************************************************************/ 11 *************************************************************************/
12 12
13#include "autorotate.h" 13#include "autorotate.h"
14 14
15/* OPIE */ 15/* OPIE */
16#include <opie2/odevice.h> 16#include <opie2/odevice.h>
17#include <opie2/otaskbarapplet.h>
17#include <qpe/applnk.h> 18#include <qpe/applnk.h>
18#include <qpe/config.h> 19#include <qpe/config.h>
19#include <qpe/resource.h> 20#include <qpe/resource.h>
20 21
21/* QT */ 22/* QT */
22#include <qpainter.h> 23#include <qpainter.h>
23 24
24using namespace Opie; 25using namespace Opie;
25 26
26AutoRotate::AutoRotate(QWidget * parent):QWidget(parent) 27AutoRotate::AutoRotate(QWidget * parent):QWidget(parent)
27{ 28{
28 setFixedWidth( AppLnk::smallIconSize() ); 29 setFixedWidth( AppLnk::smallIconSize() );
@@ -34,24 +35,29 @@ AutoRotate::AutoRotate(QWidget * parent):QWidget(parent)
34 repaint(true); 35 repaint(true);
35 popupMenu = 0; 36 popupMenu = 0;
36 show(); 37 show();
37} 38}
38 39
39AutoRotate::~AutoRotate() 40AutoRotate::~AutoRotate()
40{ 41{
41 if (popupMenu) { 42 if (popupMenu) {
42 delete popupMenu; 43 delete popupMenu;
43 } 44 }
44} 45}
45 46
47int AutoRotate::position()
48{
49 return 7;
50}
51
46void AutoRotate::mousePressEvent(QMouseEvent *) 52void AutoRotate::mousePressEvent(QMouseEvent *)
47{ 53{
48 QPopupMenu *menu = new QPopupMenu(this); 54 QPopupMenu *menu = new QPopupMenu(this);
49 menu->insertItem( isRotateEnabled()? "Disable Rotation" : "Enable Rotation" ,1 ); 55 menu->insertItem( isRotateEnabled()? "Disable Rotation" : "Enable Rotation" ,1 );
50 56
51 QPoint p = mapToGlobal(QPoint(0, 0)); 57 QPoint p = mapToGlobal(QPoint(0, 0));
52 QSize s = menu->sizeHint(); 58 QSize s = menu->sizeHint();
53 int opt = menu->exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), p.y() - s.height()), 0); 59 int opt = menu->exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), p.y() - s.height()), 0);
54 60
55 if (opt==1) 61 if (opt==1)
56 { 62 {
57 setRotateEnabled( !isRotateEnabled() ); 63 setRotateEnabled( !isRotateEnabled() );
@@ -79,12 +85,17 @@ bool AutoRotate::isRotateEnabled()
79 Config cfg( "qpe" ); 85 Config cfg( "qpe" );
80 cfg.setGroup( "Appearance" ); 86 cfg.setGroup( "Appearance" );
81 87
82 bool res = cfg.readBoolEntry( "rotateEnabled" ); 88 bool res = cfg.readBoolEntry( "rotateEnabled" );
83 89
84 if (res ) 90 if (res )
85 qDebug("Enabled"); 91 qDebug("Enabled");
86 else 92 else
87 qDebug("Disabled"); 93 qDebug("Disabled");
88 return res; 94 return res;
89} 95}
90 96
97Q_EXPORT_INTERFACE()
98{
99 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<AutoRotate> );
100}
101