summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/rotateapplet/rotate.cpp43
-rw-r--r--core/applets/rotateapplet/rotate.h1
-rw-r--r--libopie/odevice.cpp124
-rw-r--r--libopie/odevice.h4
-rw-r--r--qt/qt-2.3.7.patch/qte237-all.patch11
5 files changed, 163 insertions, 20 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
@@ -61,17 +61,19 @@ RotateApplet::~RotateApplet ( )
/**
* Qcop receive method.
*/
void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) {
QDataStream stream( data, IO_ReadOnly );
if ( msg == "flip()" ) {
activated ( );
- }
+ } else if ( msg == "rotateDefault()") {
+ rotateDefault();
+ }
}
int RotateApplet::position ( ) const
{
return 3;
}
@@ -106,16 +108,55 @@ QIconSet RotateApplet::icon ( ) const
return pix;
}
QPopupMenu *RotateApplet::popup ( QWidget * ) const
{
return 0;
}
+void RotateApplet::rotateDefault ( )
+{
+
+ int rot = ODevice::inst()->rotation();
+
+ switch (rot) {
+ case Rot0:
+ rot=0;
+ break;
+ case Rot90:
+ rot=90;
+ break;
+ case Rot180:
+ rot=180;
+ break;
+ case Rot270:
+ rot=270;
+ break;
+ default:
+ rot=0;
+ break;
+ }
+ Config cfg( "qpe" );
+ cfg.setGroup( "Appearance" );
+
+ bool rotateDisabled = cfg.readBoolEntry( "rotateEnabled",false );
+
+ if (rotateDisabled == true)
+ return;
+
+ // hide inputs methods before rotation
+ QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" );
+
+ QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" );
+ env << rot;
+
+ m_flipped = false;
+
+}
void RotateApplet::activated ( )
{
int defaultRotation = QPEApplication::defaultRotation();
int newRotation = defaultRotation;
Config cfg( "qpe" );
cfg.setGroup( "Appearance" );
diff --git a/core/applets/rotateapplet/rotate.h b/core/applets/rotateapplet/rotate.h
index de2a707..572b82a 100644
--- a/core/applets/rotateapplet/rotate.h
+++ b/core/applets/rotateapplet/rotate.h
@@ -53,16 +53,17 @@ public:
virtual QString name ( ) const;
virtual QIconSet icon ( ) const;
virtual QString text ( ) const;
/* virtual QString tr( const char* ) const;
virtual QString tr( const char*, const char* ) const;
*/
virtual QPopupMenu *popup ( QWidget *parent ) const;
virtual void activated ( );
+ virtual void rotateDefault ( );
private slots:
void channelReceived( const QCString &msg, const QByteArray & data );
private:
ulong ref;
bool m_flipped;
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 9373ef9..5038cc9 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -136,16 +136,21 @@ public:
virtual void touchSound ( );
virtual QValueList <OLed> ledList ( ) const;
virtual QValueList <OLedState> ledStateList ( OLed led ) const;
virtual OLedState ledState ( OLed led ) const;
virtual bool setLedState ( OLed led, OLedState st );
static bool isZaurus();
+
+ // Does this break BC?
+ virtual bool suspend ( );
+ virtual Transformation rotation ( ) const;
+ virtual ODirection direction ( ) const;
protected:
virtual void buzzer ( int snd );
OLedState m_leds [1];
bool m_embedix;
};
@@ -284,20 +289,20 @@ struct z_button z_buttons_c700 [] = {
{ Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
"devicebuttons/z_home",
"QPE/Launcher", "home()",
"buttonsettings", "raise()" },
{ Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
"devicebuttons/z_menu",
"QPE/TaskBar", "toggleMenu()",
"QPE/TaskBar", "toggleStartMenu()" },
- { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
+ { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
"",
- "QPE/Rotation", "flip()",
- "QPE/Rotation", "flip()" },
+ "QPE/Rotation", "rotateDefault()",
+ "QPE/Rotation", "rotateDefault()" },
};
struct s_button {
uint model;
Qt::Key code;
char *utext;
char *pix;
char *fpressedservice;
@@ -1627,30 +1632,18 @@ void Zaurus::init ( )
}
bool flipstate = false;
switch ( d-> m_model ) {
case Model_Zaurus_SLA300:
d-> m_rotation = Rot0;
break;
case Model_Zaurus_SLC7x0:
- // Note: need to 1) set flipstate based on physical screen orientation
- // and 2) check to see if the user overrode the rotation direction
- // using appearance, and if so, remove that item from the Config to
- // ensure the rotate applet flips us back to the previous state.
- // treke said he has patches for detecting the phys. so where are they, treke? -mickeyl.
- if ( flipstate ) {
- // 480x640
- d-> m_rotation = Rot0;
- d-> m_direction = CW;
- } else {
- // 640x480
- d-> m_rotation = Rot270;
- d-> m_direction = CCW;
- }
+ d-> m_rotation = rotation();
+ d-> m_direction = direction();
break;
case Model_Zaurus_SLB600:
case Model_Zaurus_SL5500:
case Model_Zaurus_SL5000:
default:
d-> m_rotation = Rot270;
break;
}
@@ -1741,16 +1734,18 @@ void Zaurus::initButtons ( )
//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */
//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */
//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */
//
#define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1)
+#define SHARP_IOCTL_GET_ROTATION 0x413c
+
typedef struct sharp_led_status {
int which; /* select which LED status is wanted. */
int status; /* set new led status if you call SHARP_LED_SETSTATUS */
} sharp_led_status;
#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */
#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */
@@ -1974,16 +1969,111 @@ bool Zaurus::setDisplayBrightness ( int bright )
if (( fd = ::open ( "/dev/fb0", O_WRONLY )) >= 0 ) {
res = ( ::ioctl ( fd , FB_BACKLIGHT_SET_BRIGHTNESS, bright ) == 0 );
::close ( fd );
}
}
return res;
}
+bool Zaurus::suspend ( )
+{
+ qDebug("ODevice::suspend");
+ if ( !isQWS( ) ) // only qwsserver is allowed to suspend
+ return false;
+
+ if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
+ return false;
+
+ bool res = false;
+
+ struct timeval tvs, tvn;
+ ::gettimeofday ( &tvs, 0 );
+
+ ::sync ( ); // flush fs caches
+ res = ( ::system ( "apm --suspend" ) == 0 );
+
+ // This is needed because the iPAQ apm implementation is asynchronous and we
+ // can not be sure when exactly the device is really suspended
+ // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
+
+ if ( res ) {
+ do { // Yes, wait 15 seconds. This APM bug sucks big time.
+ ::usleep ( 200 * 1000 );
+ ::gettimeofday ( &tvn, 0 );
+ } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 );
+ }
+
+ QCopEnvelope ( "QPE/Rotation", "rotateDefault()" );
+ return res;
+}
+
+
+Transformation Zaurus::rotation ( ) const
+{
+ Transformation rot;
+ int handle = 0;
+ int retval = 0;
+
+ switch ( d-> m_model ) {
+ case Model_Zaurus_SLC7x0:
+ handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK);
+ if (handle == -1) {
+ return Rot270;
+ } else {
+ retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION);
+ ::close (handle);
+
+ if (retval == 2 )
+ rot = Rot0;
+ else
+ rot = Rot270;
+ }
+ break;
+ case Model_Zaurus_SLA300:
+ case Model_Zaurus_SLB600:
+ case Model_Zaurus_SL5500:
+ case Model_Zaurus_SL5000:
+ default:
+ rot = d-> m_rotation;
+ break;
+ }
+
+ return rot;
+}
+ODirection Zaurus::direction ( ) const
+{
+ ODirection dir;
+ int handle = 0;
+ int retval = 0;
+ switch ( d-> m_model ) {
+ case Model_Zaurus_SLC7x0:
+ handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK);
+ if (handle == -1) {
+ dir = Rot270;
+ } else {
+ retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION);
+ ::close (handle);
+ if (retval == 2 )
+ dir = CCW;
+ else
+ dir = CW;
+ }
+ break;
+ case Model_Zaurus_SLA300:
+ case Model_Zaurus_SLB600:
+ case Model_Zaurus_SL5500:
+ case Model_Zaurus_SL5000:
+ default:
+ dir = d-> m_direction;
+ break;
+ }
+ return dir;
+
+}
int Zaurus::displayBrightnessResolution ( ) const
{
if (m_embedix)
return 5;
else
return 256;
}
diff --git a/libopie/odevice.h b/libopie/odevice.h
index 25910b5..8273761 100644
--- a/libopie/odevice.h
+++ b/libopie/odevice.h
@@ -182,18 +182,18 @@ public:
QString vendorString ( ) const;
OVendor vendor ( ) const;
QString systemString ( ) const;
OSystem system ( ) const;
QString systemVersionString ( ) const;
- Transformation rotation ( ) const;
- ODirection direction ( ) const;
+ virtual Transformation rotation ( ) const;
+ virtual ODirection direction ( ) const;
// system
virtual bool setSoftSuspend ( bool on );
virtual bool suspend ( );
virtual bool setDisplayStatus ( bool on );
virtual bool setDisplayBrightness ( int brightness );
diff --git a/qt/qt-2.3.7.patch/qte237-all.patch b/qt/qt-2.3.7.patch/qte237-all.patch
index 233996a..e6cf0a4 100644
--- a/qt/qt-2.3.7.patch/qte237-all.patch
+++ b/qt/qt-2.3.7.patch/qte237-all.patch
@@ -403,8 +403,19 @@ diff -ru qt-2.3.5_fresh/src/widgets/qtoolbutton.cpp qt-2.3.5/src/widgets/qtoolbu
+ if ( h < 24 )
+ h = 24;
} else {
- w = h = 16;
+ w = h = 14;
QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Small, QIconSet::Normal);
w = pm.width();
h = pm.height();
+--- qt-2.3.7/src/kernel/qkeyboard_qws.cpp~c7xxrotate 2003-07-16 18:20:25.000000000 -0700
++++ qt-2.3.7/src/kernel/qkeyboard_qws.cpp 2003-12-07 15:54:10.000000000 -0800
+@@ -238,7 +238,7 @@
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 63
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 64
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 65
+- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 66
++ { Qt::Key_F14, 0xffff , 0xffff , 0xffff }, // 66
+ { Qt::Key_Meta, 0xffff , 0xffff , 0xffff }, // 67
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 68
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 69