-rw-r--r-- | core/applets/rotateapplet/rotate.cpp | 25 | ||||
-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 27 |
2 files changed, 33 insertions, 19 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 @@ -37,4 +37,8 @@ +#include <opie/odevice.h> + #include "rotate.h" +using namespace Opie; + @@ -115,4 +119,3 @@ void RotateApplet::activated ( ) int defaultRotation = QPEApplication::defaultRotation(); - - int newRotation; + int newRotation = defaultRotation; @@ -121,4 +124,10 @@ void RotateApplet::activated ( ) - // 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; + } @@ -132,7 +141,7 @@ void RotateApplet::activated ( ) } 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; @@ -165,3 +174 @@ Q_EXPORT_INTERFACE( ) } - - diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index 83532de..c376ec7 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp @@ -431,6 +431,14 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) - int rot = cfg. readNumEntry ( "rotatedir", 0 ); - m_rotdir_cw-> setChecked ( rot == 0 ); - m_rotdir_ccw-> setChecked ( rot == 1 ); - m_rotdir_flip-> setChecked ( rot == 2 ); + int rotDirection = cfg.readNumEntry( "rotatedir" ); + ODirection rot = CW; + + if (rotDirection == -1) { + rot = ODevice::inst ( )-> direction ( ); + } else { + rot = (ODirection)rotDirection; + } + + m_rotdir_cw-> setChecked ( rot == CW ); + m_rotdir_ccw-> setChecked ( rot == CCW ); + m_rotdir_flip-> setChecked ( rot == Flip ); @@ -528,12 +536,11 @@ void Appearance::accept ( ) - bool is_rotdir_ccw = m_rotdir_ccw-> isChecked ( ); - int rotval; + ODirection rot; if (m_rotdir_ccw-> isChecked ( )) { - rotval = 1; + rot = CCW; } else if (m_rotdir_cw-> isChecked ( )) { - rotval = 0; + rot = CW; } else { - rotval = 2; + rot = Flip; } - config. writeEntry ( "rotatedir", rotval ); + config. writeEntry ( "rotatedir", (int)rot ); |