author | kergoth <kergoth> | 2003-04-15 03:04:15 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-04-15 03:04:15 (UTC) |
commit | a0dd69741995f33de4eea6a5f97f46b91dff4cb8 (patch) (side-by-side diff) | |
tree | 2214fb9416b1914355d438cd5d0200b51d1fd2f4 /core | |
parent | f1379d479d192f8c1dc99cd982aaaf545c4867f6 (diff) | |
download | opie-a0dd69741995f33de4eea6a5f97f46b91dff4cb8.zip opie-a0dd69741995f33de4eea6a5f97f46b91dff4cb8.tar.gz opie-a0dd69741995f33de4eea6a5f97f46b91dff4cb8.tar.bz2 |
Add a third rotation direction, for 180 degree.
-rw-r--r-- | core/applets/rotateapplet/rotate.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp index 0ead016..b490626 100644 --- a/core/applets/rotateapplet/rotate.cpp +++ b/core/applets/rotateapplet/rotate.cpp @@ -76,63 +76,65 @@ 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 defaultRotation = QPEApplication::defaultRotation(); int newRotation; Config cfg( "qpe" ); cfg.setGroup( "Appearance" ); // 0 -> 90° clockwise, 1 -> 90° counterclockwise - bool rotDirection = cfg.readBoolEntry( "rotatedir", 0 ); + int rotDirection = cfg.readNumEntry( "rotatedir", 0 ); // 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 ) { + if ( rotDirection == 1 ) { newRotation = ( defaultRotation + 90 ) % 360; - } else { + } else if ( rotDirection == 0 ) { newRotation = ( defaultRotation + 270 ) % 360; - } + } else { + newRotation = ( defaultRotation + 180 ) % 360; + } } QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); env << newRotation; m_flipped = !m_flipped; } 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( ) { |