From 6e7112a3610c4e562f991ba6d6f33ca2fe0c605d Mon Sep 17 00:00:00 2001
From: kergoth <kergoth>
Date: Fri, 18 Apr 2003 22:17:38 +0000
Subject: Make appearance and rotate applet use the new rotation method of odevice.

---
(limited to 'core')

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
@@ -35,8 +35,12 @@
 #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 )
@@ -113,14 +117,19 @@ 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()" );
@@ -130,11 +139,11 @@ void RotateApplet::activated ( )
 	// 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;
 	}
     }
@@ -163,5 +172,3 @@ Q_EXPORT_INTERFACE( )
 {
 	Q_CREATE_INSTANCE( RotateApplet )
 }
-
-
--
cgit v0.9.0.2