summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-01-12 19:38:37 (UTC)
committer mickeyl <mickeyl>2004-01-12 19:38:37 (UTC)
commit209e45790acd34ad85f8eaa103de20243f099e3e (patch) (unidiff)
tree980fccdea02e0aa8f9d52a857502c5dd1c87b151
parent27e75f81eba7f5f7d267c2bac8f576cf7c9e2128 (diff)
downloadopie-209e45790acd34ad85f8eaa103de20243f099e3e.zip
opie-209e45790acd34ad85f8eaa103de20243f099e3e.tar.gz
opie-209e45790acd34ad85f8eaa103de20243f099e3e.tar.bz2
nanoseconds are neither milliseconds nor microseconds
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/rotateapplet/rotate.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp
index d8081a6..906063e 100644
--- a/core/applets/rotateapplet/rotate.cpp
+++ b/core/applets/rotateapplet/rotate.cpp
@@ -28,97 +28,97 @@
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>
41using namespace Opie; 41using namespace Opie;
42 42
43/* QT */ 43/* QT */
44#include <qiconset.h> 44#include <qiconset.h>
45#include <qpopupmenu.h> 45#include <qpopupmenu.h>
46 46
47#include <time.h> 47#include <time.h>
48 48
49RotateApplet::RotateApplet() 49RotateApplet::RotateApplet()
50 :QObject( 0, "RotateApplet" ), ref( 0 ), m_flipped( false ) 50 :QObject( 0, "RotateApplet" ), ref( 0 ), m_flipped( false )
51{ 51{
52 52
53#if !defined(QT_NO_COP) 53#if !defined(QT_NO_COP)
54 QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this ); 54 QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this );
55 connect ( rotateChannel, SIGNAL( received( const QCString &, const QByteArray &) ), 55 connect ( rotateChannel, SIGNAL( received( const QCString &, const QByteArray &) ),
56 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); 56 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) );
57#endif 57#endif
58 58
59} 59}
60 60
61RotateApplet::~RotateApplet ( ) 61RotateApplet::~RotateApplet ( )
62{} 62{}
63 63
64/** 64/**
65 * Qcop receive method. 65 * Qcop receive method.
66 */ 66 */
67void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) 67void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data )
68{ 68{
69 qDebug( "RotateApplet::channelReceived( '%s' )", (const char*) msg ); 69 qDebug( "RotateApplet::channelReceived( '%s' )", (const char*) msg );
70 70
71 if ( ODevice::inst()->hasHingeSensor() ) 71 if ( ODevice::inst()->hasHingeSensor() )
72 { 72 {
73 struct timespec interval; 73 struct timespec interval;
74 struct timespec remain; 74 struct timespec remain;
75 interval.tv_sec = 0; 75 interval.tv_sec = 0;
76 interval.tv_nsec = 600; 76 interval.tv_nsec = 600000;
77 ::nanosleep( &interval, &remain ); 77 ::nanosleep( &interval, &remain );
78 OHingeStatus status = ODevice::inst()->readHingeSensor(); 78 OHingeStatus status = ODevice::inst()->readHingeSensor();
79 qDebug( "RotateApplet::readHingeSensor = %d", (int) status ); 79 qDebug( "RotateApplet::readHingeSensor = %d", (int) status );
80 80
81 Config cfg( "apm" ); 81 Config cfg( "apm" );
82 cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" ); 82 cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" );
83 int action = cfg.readNumEntry( "CloseHingeAction", 0 ); 83 int action = cfg.readNumEntry( "CloseHingeAction", 0 );
84 84
85 if ( status == CASE_CLOSED ) 85 if ( status == CASE_CLOSED )
86 { 86 {
87 switch ( action ) 87 switch ( action )
88 { 88 {
89 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 0 ); break; 89 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 0 ); break;
90 case 2: /* SUSPEND */ ODevice::inst()->suspend(); break; 90 case 2: /* SUSPEND */ ODevice::inst()->suspend(); break;
91 default: /* IGNORE */ break; 91 default: /* IGNORE */ break;
92 } 92 }
93 } 93 }
94 else /* status != CASE_CLOSED */ 94 else /* status != CASE_CLOSED */
95 { 95 {
96 switch ( action ) 96 switch ( action )
97 { 97 {
98 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 127 ); break; 98 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 127 ); break;
99 case 2: /* SUSPEND */ /* How to wake up the device from kernel? */; break; 99 case 2: /* SUSPEND */ /* How to wake up the device from kernel? */; break;
100 default: /* IGNORE */ break; 100 default: /* IGNORE */ break;
101 } 101 }
102 } 102 }
103 qDebug( "RotateApplet::switchAction %d performed.", cfg.readNumEntry( "CloseHingeAction", 0 ) ); 103 qDebug( "RotateApplet::switchAction %d performed.", cfg.readNumEntry( "CloseHingeAction", 0 ) );
104 } 104 }
105 105
106 QDataStream stream( data, IO_ReadOnly ); 106 QDataStream stream( data, IO_ReadOnly );
107 if ( msg == "flip()" ) 107 if ( msg == "flip()" )
108 { 108 {
109 activated ( ); 109 activated ( );
110 } 110 }
111 else if ( msg == "rotateDefault()") 111 else if ( msg == "rotateDefault()")
112 { 112 {
113 rotateDefault(); 113 rotateDefault();
114 } 114 }
115} 115}
116 116
117int RotateApplet::position() const 117int RotateApplet::position() const
118{ 118{
119 return 3; 119 return 3;
120} 120}
121 121
122QString RotateApplet::name() const 122QString RotateApplet::name() const
123{ 123{
124 return tr( "Rotate shortcut" ); 124 return tr( "Rotate shortcut" );