Diffstat (limited to 'core/applets/rotateapplet/rotate.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/applets/rotateapplet/rotate.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp index ac6b259..0da2f0c 100644 --- a/core/applets/rotateapplet/rotate.cpp +++ b/core/applets/rotateapplet/rotate.cpp | |||
@@ -57,24 +57,26 @@ RotateApplet::RotateApplet ( ) | |||
57 | RotateApplet::~RotateApplet ( ) | 57 | RotateApplet::~RotateApplet ( ) |
58 | { | 58 | { |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Qcop receive method. | 63 | * Qcop receive method. |
64 | */ | 64 | */ |
65 | void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) { | 65 | void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) { |
66 | QDataStream stream( data, IO_ReadOnly ); | 66 | QDataStream stream( data, IO_ReadOnly ); |
67 | if ( msg == "flip()" ) { | 67 | if ( msg == "flip()" ) { |
68 | activated ( ); | 68 | activated ( ); |
69 | } else if ( msg == "rotateDefault()") { | ||
70 | rotateDefault(); | ||
69 | } | 71 | } |
70 | } | 72 | } |
71 | 73 | ||
72 | 74 | ||
73 | int RotateApplet::position ( ) const | 75 | int RotateApplet::position ( ) const |
74 | { | 76 | { |
75 | return 3; | 77 | return 3; |
76 | } | 78 | } |
77 | 79 | ||
78 | QString RotateApplet::name ( ) const | 80 | QString RotateApplet::name ( ) const |
79 | { | 81 | { |
80 | return tr( "Rotate shortcut" ); | 82 | return tr( "Rotate shortcut" ); |
@@ -102,24 +104,63 @@ QIconSet RotateApplet::icon ( ) const | |||
102 | QImage img = Resource::loadImage ( "Rotation" ); | 104 | QImage img = Resource::loadImage ( "Rotation" ); |
103 | 105 | ||
104 | if ( !img. isNull ( )) | 106 | if ( !img. isNull ( )) |
105 | pix. convertFromImage ( img. smoothScale ( 14, 14 )); | 107 | pix. convertFromImage ( img. smoothScale ( 14, 14 )); |
106 | return pix; | 108 | return pix; |
107 | } | 109 | } |
108 | 110 | ||
109 | QPopupMenu *RotateApplet::popup ( QWidget * ) const | 111 | QPopupMenu *RotateApplet::popup ( QWidget * ) const |
110 | { | 112 | { |
111 | return 0; | 113 | return 0; |
112 | } | 114 | } |
113 | 115 | ||
116 | void RotateApplet::rotateDefault ( ) | ||
117 | { | ||
118 | |||
119 | int rot = ODevice::inst()->rotation(); | ||
120 | |||
121 | switch (rot) { | ||
122 | case Rot0: | ||
123 | rot=0; | ||
124 | break; | ||
125 | case Rot90: | ||
126 | rot=90; | ||
127 | break; | ||
128 | case Rot180: | ||
129 | rot=180; | ||
130 | break; | ||
131 | case Rot270: | ||
132 | rot=270; | ||
133 | break; | ||
134 | default: | ||
135 | rot=0; | ||
136 | break; | ||
137 | } | ||
138 | Config cfg( "qpe" ); | ||
139 | cfg.setGroup( "Appearance" ); | ||
140 | |||
141 | bool rotateDisabled = cfg.readBoolEntry( "rotateEnabled",false ); | ||
142 | |||
143 | if (rotateDisabled == true) | ||
144 | return; | ||
145 | |||
146 | // hide inputs methods before rotation | ||
147 | QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); | ||
148 | |||
149 | QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); | ||
150 | env << rot; | ||
151 | |||
152 | m_flipped = false; | ||
153 | |||
154 | } | ||
114 | void RotateApplet::activated ( ) | 155 | void RotateApplet::activated ( ) |
115 | { | 156 | { |
116 | 157 | ||
117 | int defaultRotation = QPEApplication::defaultRotation(); | 158 | int defaultRotation = QPEApplication::defaultRotation(); |
118 | int newRotation = defaultRotation; | 159 | int newRotation = defaultRotation; |
119 | 160 | ||
120 | Config cfg( "qpe" ); | 161 | Config cfg( "qpe" ); |
121 | cfg.setGroup( "Appearance" ); | 162 | cfg.setGroup( "Appearance" ); |
122 | 163 | ||
123 | int rotDirection = cfg.readNumEntry( "rotatedir" ); | 164 | int rotDirection = cfg.readNumEntry( "rotatedir" ); |
124 | ODirection rot = CW; | 165 | ODirection rot = CW; |
125 | 166 | ||