author | groucho <groucho> | 2003-03-26 08:48:04 (UTC) |
---|---|---|
committer | groucho <groucho> | 2003-03-26 08:48:04 (UTC) |
commit | 174bf901c2a59bbf1980ea3e770bfb33c50f1c08 (patch) (side-by-side diff) | |
tree | 0e73b0b445fc8bd91288d8f96351aa3b54bc7f04 | |
parent | 77aa3a82f511038d81705af30a169b809ff29002 (diff) | |
download | opie-174bf901c2a59bbf1980ea3e770bfb33c50f1c08.zip opie-174bf901c2a59bbf1980ea3e770bfb33c50f1c08.tar.gz opie-174bf901c2a59bbf1980ea3e770bfb33c50f1c08.tar.bz2 |
On older ipaqs the display is rotated to 270 as default so adding 90 does nothing => fixed by rotating the values (270+90=0, 0-90=370)
-rw-r--r-- | core/applets/rotateapplet/rotate.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp index 653c61f..e236cd1 100644 --- a/core/applets/rotateapplet/rotate.cpp +++ b/core/applets/rotateapplet/rotate.cpp @@ -29,99 +29,107 @@ #include <qpe/resource.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> #include <qiconset.h> #include <qpopupmenu.h> #include "rotate.h" RotateApplet::RotateApplet ( ) : QObject ( 0, "RotateApplet" ), ref ( 0 ) { m_native = true; } RotateApplet::~RotateApplet ( ) { } int RotateApplet::position ( ) const { return 2; } QString RotateApplet::name ( ) const { return tr( "Rotate shortcut" ); } QString RotateApplet::text ( ) const { return tr( "Rotate" ); } QString RotateApplet::tr( const char* s ) const { return qApp->translate( "RotateApplet", s, 0 ); } QString RotateApplet::tr( const char* s, const char* p ) const { return qApp->translate( "RotateApplet", s, p ); } QIconSet RotateApplet::icon ( ) const { QPixmap pix; QImage img = Resource::loadImage ( "Rotation" ); if ( !img. isNull ( )) pix. convertFromImage ( img. smoothScale ( 14, 14 )); return pix; } QPopupMenu *RotateApplet::popup ( QWidget * ) const { return 0; } void RotateApplet::activated ( ) { int currentRotation = QPEApplication::defaultRotation(); + int newRotation; if ( m_native == true ) { + newRotation = currentRotation + 90; + if(newRotation >= 360) newRotation = 0; //ipaqs like the 36xx have the display + //rotated to 270 as default, so 360 does nothing => handle this here + } else { newRotation = currentRotation - 90; + if (newRotation <=0) newRotation = 270; + //ipaqs like the 36xx have the display rotated + // to 270 as default, and -90 is invalid => handle this here } QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); env << newRotation; QCopEnvelope env2( "QPE/System", "setDefaultRotation(int)" ); env2 << newRotation; m_native = !m_native; } QRESULT RotateApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_MenuApplet ) *iface = this; if ( *iface ) (*iface)-> addRef ( ); return QS_OK; } Q_EXPORT_INTERFACE( ) { Q_CREATE_INSTANCE( RotateApplet ) } |