author | harlekin <harlekin> | 2003-03-31 16:52:59 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-03-31 16:52:59 (UTC) |
commit | f23b042e2ac0a8b31a51c1059dee281156dd5ce9 (patch) (unidiff) | |
tree | 46c82859209ff014b197605f8d8909f933ffc7f2 | |
parent | f3b37f3dd4ae27e809415af67dd4df052d72d076 (diff) | |
download | opie-f23b042e2ac0a8b31a51c1059dee281156dd5ce9.zip opie-f23b042e2ac0a8b31a51c1059dee281156dd5ce9.tar.gz opie-f23b042e2ac0a8b31a51c1059dee281156dd5ce9.tar.bz2 |
rotate applet between desktop and suspend and not suspend and logout
-rw-r--r-- | core/applets/rotateapplet/rotate.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp index 42406da..0ead016 100644 --- a/core/applets/rotateapplet/rotate.cpp +++ b/core/applets/rotateapplet/rotate.cpp | |||
@@ -1,142 +1,142 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2003 Maximilian Reiss <harlekin@handhelds.org> | 3 | .=l. Copyright (c) 2003 Maximilian Reiss <harlekin@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <, > . <= redistribute it and/or modify it under | 6 | .> <, > . <= redistribute it and/or modify it under |
7 | :=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%+i> _;_. | 11 | .%+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=| MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=| MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. . .: details. | 18 | ++= -. . .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-= this library; see the file COPYING.LIB. | 22 | -- :-= this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | 29 | ||
30 | #include <qpe/resource.h> | 30 | #include <qpe/resource.h> |
31 | #include <qpe/qcopenvelope_qws.h> | 31 | #include <qpe/qcopenvelope_qws.h> |
32 | 32 | ||
33 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
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 "rotate.h" | 38 | #include "rotate.h" |
39 | 39 | ||
40 | 40 | ||
41 | RotateApplet::RotateApplet ( ) | 41 | RotateApplet::RotateApplet ( ) |
42 | : QObject ( 0, "RotateApplet" ), ref ( 0 ), m_flipped( false ) | 42 | : QObject ( 0, "RotateApplet" ), ref ( 0 ), m_flipped( false ) |
43 | { | 43 | { |
44 | } | 44 | } |
45 | 45 | ||
46 | RotateApplet::~RotateApplet ( ) | 46 | RotateApplet::~RotateApplet ( ) |
47 | { | 47 | { |
48 | } | 48 | } |
49 | 49 | ||
50 | int RotateApplet::position ( ) const | 50 | int RotateApplet::position ( ) const |
51 | { | 51 | { |
52 | return 2; | 52 | return 3; |
53 | } | 53 | } |
54 | 54 | ||
55 | QString RotateApplet::name ( ) const | 55 | QString RotateApplet::name ( ) const |
56 | { | 56 | { |
57 | return tr( "Rotate shortcut" ); | 57 | return tr( "Rotate shortcut" ); |
58 | } | 58 | } |
59 | 59 | ||
60 | QString RotateApplet::text ( ) const | 60 | QString RotateApplet::text ( ) const |
61 | { | 61 | { |
62 | return tr( "Rotate" ); | 62 | return tr( "Rotate" ); |
63 | } | 63 | } |
64 | 64 | ||
65 | QString RotateApplet::tr( const char* s ) const | 65 | QString RotateApplet::tr( const char* s ) const |
66 | { | 66 | { |
67 | return qApp->translate( "RotateApplet", s, 0 ); | 67 | return qApp->translate( "RotateApplet", s, 0 ); |
68 | } | 68 | } |
69 | 69 | ||
70 | QString RotateApplet::tr( const char* s, const char* p ) const | 70 | QString RotateApplet::tr( const char* s, const char* p ) const |
71 | { | 71 | { |
72 | return qApp->translate( "RotateApplet", s, p ); | 72 | return qApp->translate( "RotateApplet", s, p ); |
73 | } | 73 | } |
74 | 74 | ||
75 | QIconSet RotateApplet::icon ( ) const | 75 | QIconSet RotateApplet::icon ( ) const |
76 | { | 76 | { |
77 | QPixmap pix; | 77 | QPixmap pix; |
78 | QImage img = Resource::loadImage ( "Rotation" ); | 78 | QImage img = Resource::loadImage ( "Rotation" ); |
79 | 79 | ||
80 | if ( !img. isNull ( )) | 80 | if ( !img. isNull ( )) |
81 | pix. convertFromImage ( img. smoothScale ( 14, 14 )); | 81 | pix. convertFromImage ( img. smoothScale ( 14, 14 )); |
82 | return pix; | 82 | return pix; |
83 | } | 83 | } |
84 | 84 | ||
85 | QPopupMenu *RotateApplet::popup ( QWidget * ) const | 85 | QPopupMenu *RotateApplet::popup ( QWidget * ) const |
86 | { | 86 | { |
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | void RotateApplet::activated ( ) | 90 | void RotateApplet::activated ( ) |
91 | { | 91 | { |
92 | int defaultRotation = QPEApplication::defaultRotation(); | 92 | int defaultRotation = QPEApplication::defaultRotation(); |
93 | 93 | ||
94 | int newRotation; | 94 | int newRotation; |
95 | 95 | ||
96 | Config cfg( "qpe" ); | 96 | Config cfg( "qpe" ); |
97 | cfg.setGroup( "Appearance" ); | 97 | cfg.setGroup( "Appearance" ); |
98 | 98 | ||
99 | // 0 -> 90° clockwise, 1 -> 90° counterclockwise | 99 | // 0 -> 90° clockwise, 1 -> 90° counterclockwise |
100 | bool rotDirection = cfg.readBoolEntry( "rotatedir", 0 ); | 100 | bool rotDirection = cfg.readBoolEntry( "rotatedir", 0 ); |
101 | 101 | ||
102 | // hide inputs methods before rotation | 102 | // hide inputs methods before rotation |
103 | QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); | 103 | QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); |
104 | 104 | ||
105 | if ( m_flipped ) { | 105 | if ( m_flipped ) { |
106 | // if flipped, flip back to the original state, | 106 | // if flipped, flip back to the original state, |
107 | // regardless of rotation direction | 107 | // regardless of rotation direction |
108 | newRotation = defaultRotation; | 108 | newRotation = defaultRotation; |
109 | } else { | 109 | } else { |
110 | if ( rotDirection ) { | 110 | if ( rotDirection ) { |
111 | newRotation = ( defaultRotation + 90 ) % 360; | 111 | newRotation = ( defaultRotation + 90 ) % 360; |
112 | } else { | 112 | } else { |
113 | newRotation = ( defaultRotation + 270 ) % 360; | 113 | newRotation = ( defaultRotation + 270 ) % 360; |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); | 117 | QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); |
118 | env << newRotation; | 118 | env << newRotation; |
119 | 119 | ||
120 | m_flipped = !m_flipped; | 120 | m_flipped = !m_flipped; |
121 | } | 121 | } |
122 | 122 | ||
123 | 123 | ||
124 | QRESULT RotateApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | 124 | QRESULT RotateApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) |
125 | { | 125 | { |
126 | *iface = 0; | 126 | *iface = 0; |
127 | if ( uuid == IID_QUnknown ) | 127 | if ( uuid == IID_QUnknown ) |
128 | *iface = this; | 128 | *iface = this; |
129 | else if ( uuid == IID_MenuApplet ) | 129 | else if ( uuid == IID_MenuApplet ) |
130 | *iface = this; | 130 | *iface = this; |
131 | 131 | ||
132 | if ( *iface ) | 132 | if ( *iface ) |
133 | (*iface)-> addRef ( ); | 133 | (*iface)-> addRef ( ); |
134 | return QS_OK; | 134 | return QS_OK; |
135 | } | 135 | } |
136 | 136 | ||
137 | Q_EXPORT_INTERFACE( ) | 137 | Q_EXPORT_INTERFACE( ) |
138 | { | 138 | { |
139 | Q_CREATE_INSTANCE( RotateApplet ) | 139 | Q_CREATE_INSTANCE( RotateApplet ) |
140 | } | 140 | } |
141 | 141 | ||
142 | 142 | ||