summaryrefslogtreecommitdiff
path: root/core/applets/rotateapplet
Side-by-side diff
Diffstat (limited to 'core/applets/rotateapplet') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/rotateapplet/rotate.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp
index 04270f1..62567ed 100644
--- a/core/applets/rotateapplet/rotate.cpp
+++ b/core/applets/rotateapplet/rotate.cpp
@@ -32,14 +32,18 @@
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qiconset.h>
#include <qpopupmenu.h>
+#include <opie/odevice.h>
+
#include "rotate.h"
+using namespace Opie;
+
RotateApplet::RotateApplet ( )
: QObject ( 0, "RotateApplet" ), ref ( 0 ), m_flipped( false )
{
#if defined(Q_WS_QWS)
@@ -110,34 +114,39 @@ QPopupMenu *RotateApplet::popup ( QWidget * ) const
}
void RotateApplet::activated ( )
{
int defaultRotation = QPEApplication::defaultRotation();
-
- int newRotation;
+ int newRotation = defaultRotation;
Config cfg( "qpe" );
cfg.setGroup( "Appearance" );
- // 0 -> 90° clockwise, 1 -> 90° counterclockwise
- int rotDirection = cfg.readNumEntry( "rotatedir", 0 );
+ int rotDirection = cfg.readNumEntry( "rotatedir" );
+ ODirection rot = CW;
+
+ if (rotDirection == -1) {
+ rot = ODevice::inst ( )-> direction ( );
+ } else {
+ rot = (ODirection)rotDirection;
+ }
// hide inputs methods before rotation
QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" );
if ( m_flipped ) {
// if flipped, flip back to the original state,
// regardless of rotation direction
newRotation = defaultRotation;
} else {
- if ( rotDirection == 1 ) {
+ if ( rot == CCW ) {
newRotation = ( defaultRotation + 90 ) % 360;
- } else if ( rotDirection == 0 ) {
+ } else if ( rot == CW ) {
newRotation = ( defaultRotation + 270 ) % 360;
- } else {
+ } else if ( rot == Flip ) {
newRotation = ( defaultRotation + 180 ) % 360;
}
}
QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" );
env << newRotation;
@@ -160,8 +169,6 @@ QRESULT RotateApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **if
}
Q_EXPORT_INTERFACE( )
{
Q_CREATE_INSTANCE( RotateApplet )
}
-
-