author | mickeyl <mickeyl> | 2004-01-04 23:36:39 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-04 23:36:39 (UTC) |
commit | 8b0be84aaf5da9b43ab6935c1939bf77caf0aa02 (patch) (unidiff) | |
tree | 794ed2440f4fdf35588c50d1858eacdda36d6c81 | |
parent | 68f09442c635da109c0f31888d4f42bd14e8de1f (diff) | |
download | opie-8b0be84aaf5da9b43ab6935c1939bf77caf0aa02.zip opie-8b0be84aaf5da9b43ab6935c1939bf77caf0aa02.tar.gz opie-8b0be84aaf5da9b43ab6935c1939bf77caf0aa02.tar.bz2 |
better not shutoff the display without shutting it on again :D
-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 ea114bb..79098d4 100644 --- a/core/applets/rotateapplet/rotate.cpp +++ b/core/applets/rotateapplet/rotate.cpp | |||
@@ -17,129 +17,129 @@ | |||
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=| MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=| MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. . .: details. | 21 | ++= -. . .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-= this library; see the file COPYING.LIB. | 25 | -- :-= this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "rotate.h" | 31 | #include "rotate.h" |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie/odevice.h> | 34 | #include <opie/odevice.h> |
35 | #include <qpe/applnk.h> | 35 | #include <qpe/applnk.h> |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <qpe/power.h> | 37 | #include <qpe/power.h> |
38 | #include <qpe/qpeapplication.h> | 38 | #include <qpe/qpeapplication.h> |
39 | #include <qpe/qcopenvelope_qws.h> | 39 | #include <qpe/qcopenvelope_qws.h> |
40 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | 41 | ||
42 | /* QT */ | 42 | /* QT */ |
43 | #include <qiconset.h> | 43 | #include <qiconset.h> |
44 | #include <qpopupmenu.h> | 44 | #include <qpopupmenu.h> |
45 | 45 | ||
46 | using namespace Opie; | 46 | using namespace Opie; |
47 | 47 | ||
48 | RotateApplet::RotateApplet() | 48 | RotateApplet::RotateApplet() |
49 | :QObject( 0, "RotateApplet" ), ref( 0 ), m_flipped( false ) | 49 | :QObject( 0, "RotateApplet" ), ref( 0 ), m_flipped( false ) |
50 | { | 50 | { |
51 | 51 | ||
52 | #if !defined(QT_NO_COP) | 52 | #if !defined(QT_NO_COP) |
53 | QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this ); | 53 | QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this ); |
54 | connect ( rotateChannel, SIGNAL( received( const QCString &, const QByteArray &) ), | 54 | connect ( rotateChannel, SIGNAL( received( const QCString &, const QByteArray &) ), |
55 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); | 55 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); |
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | } | 58 | } |
59 | 59 | ||
60 | RotateApplet::~RotateApplet ( ) | 60 | RotateApplet::~RotateApplet ( ) |
61 | {} | 61 | {} |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Qcop receive method. | 64 | * Qcop receive method. |
65 | */ | 65 | */ |
66 | void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) | 66 | void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) |
67 | { | 67 | { |
68 | qDebug( "RotateApplet::channelReceived( '%s' )", (const char*) msg ); | 68 | qDebug( "RotateApplet::channelReceived( '%s' )", (const char*) msg ); |
69 | 69 | ||
70 | if ( ODevice::inst()->hasHingeSensor() ) | 70 | if ( ODevice::inst()->hasHingeSensor() ) |
71 | { | 71 | { |
72 | OHingeStatus status = ODevice::inst()->readHingeSensor(); | 72 | OHingeStatus status = ODevice::inst()->readHingeSensor(); |
73 | qDebug( "RotateApplet::readHingeSensor = %d", (int) status ); | 73 | qDebug( "RotateApplet::readHingeSensor = %d", (int) status ); |
74 | if ( status == CASE_CLOSED ) | 74 | if ( status == CASE_CLOSED ) |
75 | { | 75 | { |
76 | Config cfg( "apm" ); | 76 | Config cfg( "apm" ); |
77 | cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" ); | 77 | cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" ); |
78 | int action = cfg.readNumEntry( "CloseHingeAction", 0 ); | 78 | int action = cfg.readNumEntry( "CloseHingeAction", 0 ); |
79 | switch ( action ) | 79 | switch ( action ) |
80 | { | 80 | { |
81 | case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayStatus( false ); ODevice::inst()->setDisplayBrightness( 0 ); break; | 81 | case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 0 ); break; |
82 | case 2: /* SUSPEND */ ODevice::inst()->suspend(); break; | 82 | case 2: /* SUSPEND */ ODevice::inst()->suspend(); break; |
83 | default: /* IGNORE */ break; | 83 | default: /* IGNORE */ break; |
84 | } | 84 | } |
85 | qDebug( "RotateApplet::switchAction %d performed.", cfg.readNumEntry( "CloseHingeAction", 0 ) ); | 85 | qDebug( "RotateApplet::switchAction %d performed.", cfg.readNumEntry( "CloseHingeAction", 0 ) ); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | QDataStream stream( data, IO_ReadOnly ); | 89 | QDataStream stream( data, IO_ReadOnly ); |
90 | if ( msg == "flip()" ) | 90 | if ( msg == "flip()" ) |
91 | { | 91 | { |
92 | activated ( ); | 92 | activated ( ); |
93 | } | 93 | } |
94 | else if ( msg == "rotateDefault()") | 94 | else if ( msg == "rotateDefault()") |
95 | { | 95 | { |
96 | rotateDefault(); | 96 | rotateDefault(); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | int RotateApplet::position() const | 100 | int RotateApplet::position() const |
101 | { | 101 | { |
102 | return 3; | 102 | return 3; |
103 | } | 103 | } |
104 | 104 | ||
105 | QString RotateApplet::name() const | 105 | QString RotateApplet::name() const |
106 | { | 106 | { |
107 | return tr( "Rotate shortcut" ); | 107 | return tr( "Rotate shortcut" ); |
108 | } | 108 | } |
109 | 109 | ||
110 | QString RotateApplet::text() const | 110 | QString RotateApplet::text() const |
111 | { | 111 | { |
112 | return tr( "Rotate" ); | 112 | return tr( "Rotate" ); |
113 | } | 113 | } |
114 | 114 | ||
115 | /*QString RotateApplet::tr( const char* s ) const | 115 | /*QString RotateApplet::tr( const char* s ) const |
116 | { | 116 | { |
117 | return qApp->translate( "RotateApplet", s, 0 ); | 117 | return qApp->translate( "RotateApplet", s, 0 ); |
118 | } | 118 | } |
119 | 119 | ||
120 | QString RotateApplet::tr( const char* s, const char* p ) const | 120 | QString RotateApplet::tr( const char* s, const char* p ) const |
121 | { | 121 | { |
122 | return qApp->translate( "RotateApplet", s, p ); | 122 | return qApp->translate( "RotateApplet", s, p ); |
123 | } | 123 | } |
124 | */ | 124 | */ |
125 | 125 | ||
126 | QIconSet RotateApplet::icon() const | 126 | QIconSet RotateApplet::icon() const |
127 | { | 127 | { |
128 | QPixmap pix; | 128 | QPixmap pix; |
129 | QImage img = Resource::loadImage( "Rotation" ); | 129 | QImage img = Resource::loadImage( "Rotation" ); |
130 | if ( !img.isNull() ) | 130 | if ( !img.isNull() ) |
131 | pix.convertFromImage( img.smoothScale( 14, 14 ) ); | 131 | pix.convertFromImage( img.smoothScale( 14, 14 ) ); |
132 | return pix; | 132 | return pix; |
133 | } | 133 | } |
134 | 134 | ||
135 | QPopupMenu* RotateApplet::popup(QWidget*) const | 135 | QPopupMenu* RotateApplet::popup(QWidget*) const |
136 | { | 136 | { |
137 | return 0; | 137 | return 0; |
138 | } | 138 | } |
139 | 139 | ||
140 | void RotateApplet::rotateDefault() | 140 | void RotateApplet::rotateDefault() |
141 | { | 141 | { |
142 | int rot = ODevice::inst()->rotation(); | 142 | int rot = ODevice::inst()->rotation(); |
143 | 143 | ||
144 | switch (rot) | 144 | switch (rot) |
145 | { | 145 | { |