summaryrefslogtreecommitdiff
path: root/core/applets
authortreke <treke>2003-12-08 06:52:35 (UTC)
committer treke <treke>2003-12-08 06:52:35 (UTC)
commit7b4e723545a645056156246d27b2c26c78d599f3 (patch) (side-by-side diff)
tree8b349615fc1441a60bc418e10c53b1799db895e4 /core/applets
parent3bbeef6702ef80b7506b5393cc51d1fd5b04559d (diff)
downloadopie-7b4e723545a645056156246d27b2c26c78d599f3.zip
opie-7b4e723545a645056156246d27b2c26c78d599f3.tar.gz
opie-7b4e723545a645056156246d27b2c26c78d599f3.tar.bz2
Automatic rotation. This might break binary compatibility, so beware including
in BRANCH_1_0
Diffstat (limited to 'core/applets') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/rotateapplet/rotate.cpp43
-rw-r--r--core/applets/rotateapplet/rotate.h1
2 files changed, 43 insertions, 1 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,25 +57,27 @@ RotateApplet::RotateApplet ( )
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;
}
QString RotateApplet::name ( ) const
{
return tr( "Rotate shortcut" );
}
@@ -102,24 +104,63 @@ QIconSet RotateApplet::icon ( ) const
QImage img = Resource::loadImage ( "Rotation" );
if ( !img. isNull ( ))
pix. convertFromImage ( img. smoothScale ( 14, 14 ));
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" );
int rotDirection = cfg.readNumEntry( "rotatedir" );
ODirection rot = CW;
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
@@ -49,23 +49,24 @@ public:
Q_REFCOUNT
virtual int position() const;
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;
};
#endif