summaryrefslogtreecommitdiff
path: root/noncore/applets/autorotateapplet
Unidiff
Diffstat (limited to 'noncore/applets/autorotateapplet') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/autorotateapplet/autorotate.cpp11
-rw-r--r--noncore/applets/autorotateapplet/autorotate.h3
-rw-r--r--noncore/applets/autorotateapplet/autorotateapplet.pro16
-rw-r--r--noncore/applets/autorotateapplet/autorotateimpl.cpp42
-rw-r--r--noncore/applets/autorotateapplet/autorotateimpl.h18
5 files changed, 20 insertions, 70 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
@@ -11,12 +11,13 @@
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>
@@ -40,12 +41,17 @@ AutoRotate::~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));
@@ -85,6 +91,11 @@ bool AutoRotate::isRotateEnabled()
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
diff --git a/noncore/applets/autorotateapplet/autorotate.h b/noncore/applets/autorotateapplet/autorotate.h
index e05e7a0..ef322a6 100644
--- a/noncore/applets/autorotateapplet/autorotate.h
+++ b/noncore/applets/autorotateapplet/autorotate.h
@@ -19,14 +19,13 @@
19 19
20class AutoRotate : public QWidget { 20class AutoRotate : public QWidget {
21 Q_OBJECT 21 Q_OBJECT
22public: 22public:
23 AutoRotate( QWidget *parent = 0 ); 23 AutoRotate( QWidget *parent = 0 );
24 ~AutoRotate(); 24 ~AutoRotate();
25 25 static int position();
26private slots:
27 26
28protected: 27protected:
29 void paintEvent( QPaintEvent* ); 28 void paintEvent( QPaintEvent* );
30 void mousePressEvent( QMouseEvent * ); 29 void mousePressEvent( QMouseEvent * );
31private: 30private:
32 bool isRotateEnabled(); 31 bool isRotateEnabled();
diff --git a/noncore/applets/autorotateapplet/autorotateapplet.pro b/noncore/applets/autorotateapplet/autorotateapplet.pro
index 0ccbeba..465b165 100644
--- a/noncore/applets/autorotateapplet/autorotateapplet.pro
+++ b/noncore/applets/autorotateapplet/autorotateapplet.pro
@@ -1,13 +1,13 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt plugin warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = autorotate.h autorotateimpl.h 3HEADERS = autorotate.h
4SOURCES = autorotate.cpp autorotateimpl.cpp 4SOURCES = autorotate.cpp
5TARGET = autorotateapplet 5TARGET = autorotateapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include ../launcher 8DEPENDPATH += $(OPIEDIR)/include ../launcher
9LIBS += -lqpe -lopiecore2 9LIBS += -lqpe -lopiecore2
10VERSION = 1.0.0 10VERSION = 1.0.0
11 11
12include ( $(OPIEDIR)/include.pro ) 12include ( $(OPIEDIR)/include.pro )
13target.path = $$prefix/plugins/applets 13target.path = $$prefix/plugins/applets
diff --git a/noncore/applets/autorotateapplet/autorotateimpl.cpp b/noncore/applets/autorotateapplet/autorotateimpl.cpp
deleted file mode 100644
index 305ac50..0000000
--- a/noncore/applets/autorotateapplet/autorotateimpl.cpp
+++ b/dev/null
@@ -1,42 +0,0 @@
1#include "autorotate.h"
2#include "autorotateimpl.h"
3
4
5AutoRotateImpl::AutoRotateImpl()
6 : autoRotate(0){
7 qDebug ("here");
8}
9
10AutoRotateImpl::~AutoRotateImpl() {
11 delete autoRotate;
12}
13
14QWidget *AutoRotateImpl::applet( QWidget *parent ) {
15 if ( !autoRotate ) {
16 autoRotate = new AutoRotate( parent );
17 }
18 return autoRotate;
19}
20
21int AutoRotateImpl::position() const {
22 return 7;
23}
24
25QRESULT AutoRotateImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
26 *iface = 0;
27 if ( uuid == IID_QUnknown ) {
28 *iface = this;
29 } else if ( uuid == IID_TaskbarApplet ) {
30 *iface = this;
31 } else
32 return QS_FALSE;
33
34 if ( *iface ) {
35 (*iface)->addRef();
36 }
37 return QS_OK;
38}
39
40Q_EXPORT_INTERFACE() {
41 Q_CREATE_INSTANCE( AutoRotateImpl )
42}
diff --git a/noncore/applets/autorotateapplet/autorotateimpl.h b/noncore/applets/autorotateapplet/autorotateimpl.h
deleted file mode 100644
index fde23a9..0000000
--- a/noncore/applets/autorotateapplet/autorotateimpl.h
+++ b/dev/null
@@ -1,18 +0,0 @@
1#include <qpe/taskbarappletinterface.h>
2
3class AutoRotate;
4
5class AutoRotateImpl : public TaskbarAppletInterface {
6public:
7 AutoRotateImpl();
8 virtual ~AutoRotateImpl();
9
10 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
11 Q_REFCOUNT
12
13 virtual QWidget *applet( QWidget *parent );
14 virtual int position() const;
15
16private:
17 AutoRotate *autoRotate;
18};