-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 | |||
@@ -34,10 +34,14 @@ | |||
34 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
35 | #include <qiconset.h> | 35 | #include <qiconset.h> |
36 | #include <qpopupmenu.h> | 36 | #include <qpopupmenu.h> |
37 | 37 | ||
38 | #include <opie/odevice.h> | ||
39 | |||
38 | #include "rotate.h" | 40 | #include "rotate.h" |
39 | 41 | ||
42 | using namespace Opie; | ||
43 | |||
40 | 44 | ||
41 | RotateApplet::RotateApplet ( ) | 45 | RotateApplet::RotateApplet ( ) |
42 | : QObject ( 0, "RotateApplet" ), ref ( 0 ), m_flipped( false ) | 46 | : QObject ( 0, "RotateApplet" ), ref ( 0 ), m_flipped( false ) |
43 | { | 47 | { |
@@ -112,16 +116,21 @@ QPopupMenu *RotateApplet::popup ( QWidget * ) const | |||
112 | void RotateApplet::activated ( ) | 116 | void RotateApplet::activated ( ) |
113 | { | 117 | { |
114 | 118 | ||
115 | int defaultRotation = QPEApplication::defaultRotation(); | 119 | int defaultRotation = QPEApplication::defaultRotation(); |
116 | 120 | int newRotation = defaultRotation; | |
117 | int newRotation; | ||
118 | 121 | ||
119 | Config cfg( "qpe" ); | 122 | Config cfg( "qpe" ); |
120 | cfg.setGroup( "Appearance" ); | 123 | cfg.setGroup( "Appearance" ); |
121 | 124 | ||
122 | // 0 -> 90° clockwise, 1 -> 90° counterclockwise | 125 | int rotDirection = cfg.readNumEntry( "rotatedir" ); |
123 | int rotDirection = cfg.readNumEntry( "rotatedir", 0 ); | 126 | ODirection rot = CW; |
127 | |||
128 | if (rotDirection == -1) { | ||
129 | rot = ODevice::inst ( )-> direction ( ); | ||
130 | } else { | ||
131 | rot = (ODirection)rotDirection; | ||
132 | } | ||
124 | 133 | ||
125 | // hide inputs methods before rotation | 134 | // hide inputs methods before rotation |
126 | QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); | 135 | QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); |
127 | 136 | ||
@@ -129,13 +138,13 @@ void RotateApplet::activated ( ) | |||
129 | // if flipped, flip back to the original state, | 138 | // if flipped, flip back to the original state, |
130 | // regardless of rotation direction | 139 | // regardless of rotation direction |
131 | newRotation = defaultRotation; | 140 | newRotation = defaultRotation; |
132 | } else { | 141 | } else { |
133 | if ( rotDirection == 1 ) { | 142 | if ( rot == CCW ) { |
134 | newRotation = ( defaultRotation + 90 ) % 360; | 143 | newRotation = ( defaultRotation + 90 ) % 360; |
135 | } else if ( rotDirection == 0 ) { | 144 | } else if ( rot == CW ) { |
136 | newRotation = ( defaultRotation + 270 ) % 360; | 145 | newRotation = ( defaultRotation + 270 ) % 360; |
137 | } else { | 146 | } else if ( rot == Flip ) { |
138 | newRotation = ( defaultRotation + 180 ) % 360; | 147 | newRotation = ( defaultRotation + 180 ) % 360; |
139 | } | 148 | } |
140 | } | 149 | } |
141 | 150 | ||
@@ -162,6 +171,4 @@ QRESULT RotateApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **if | |||
162 | Q_EXPORT_INTERFACE( ) | 171 | Q_EXPORT_INTERFACE( ) |
163 | { | 172 | { |
164 | Q_CREATE_INSTANCE( RotateApplet ) | 173 | Q_CREATE_INSTANCE( RotateApplet ) |
165 | } | 174 | } |
166 | |||
167 | |||
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 | |||
@@ -428,12 +428,20 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | |||
428 | rotLay-> addWidget ( m_rotdir_cw, 0 ); | 428 | rotLay-> addWidget ( m_rotdir_cw, 0 ); |
429 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); | 429 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); |
430 | rotLay-> addWidget ( m_rotdir_flip, 0 ); | 430 | rotLay-> addWidget ( m_rotdir_flip, 0 ); |
431 | 431 | ||
432 | int rot = cfg. readNumEntry ( "rotatedir", 0 ); | 432 | int rotDirection = cfg.readNumEntry( "rotatedir" ); |
433 | m_rotdir_cw-> setChecked ( rot == 0 ); | 433 | ODirection rot = CW; |
434 | m_rotdir_ccw-> setChecked ( rot == 1 ); | 434 | |
435 | m_rotdir_flip-> setChecked ( rot == 2 ); | 435 | if (rotDirection == -1) { |
436 | rot = ODevice::inst ( )-> direction ( ); | ||
437 | } else { | ||
438 | rot = (ODirection)rotDirection; | ||
439 | } | ||
440 | |||
441 | m_rotdir_cw-> setChecked ( rot == CW ); | ||
442 | m_rotdir_ccw-> setChecked ( rot == CCW ); | ||
443 | m_rotdir_flip-> setChecked ( rot == Flip ); | ||
436 | 444 | ||
437 | return tab; | 445 | return tab; |
438 | } | 446 | } |
439 | 447 | ||
@@ -525,18 +533,17 @@ void Appearance::accept ( ) | |||
525 | if ( item ) | 533 | if ( item ) |
526 | item-> save ( config ); | 534 | item-> save ( config ); |
527 | } | 535 | } |
528 | 536 | ||
529 | bool is_rotdir_ccw = m_rotdir_ccw-> isChecked ( ); | 537 | ODirection rot; |
530 | int rotval; | ||
531 | if (m_rotdir_ccw-> isChecked ( )) { | 538 | if (m_rotdir_ccw-> isChecked ( )) { |
532 | rotval = 1; | 539 | rot = CCW; |
533 | } else if (m_rotdir_cw-> isChecked ( )) { | 540 | } else if (m_rotdir_cw-> isChecked ( )) { |
534 | rotval = 0; | 541 | rot = CW; |
535 | } else { | 542 | } else { |
536 | rotval = 2; | 543 | rot = Flip; |
537 | } | 544 | } |
538 | config. writeEntry ( "rotatedir", rotval ); | 545 | config. writeEntry ( "rotatedir", (int)rot ); |
539 | 546 | ||
540 | m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated | 547 | m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated |
541 | 548 | ||
542 | QStringList sl; | 549 | QStringList sl; |