summaryrefslogtreecommitdiff
path: root/core/applets/rotateapplet/rotate.cpp
Unidiff
Diffstat (limited to 'core/applets/rotateapplet/rotate.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/applets/rotateapplet/rotate.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp
index b490626..04270f1 100644
--- a/core/applets/rotateapplet/rotate.cpp
+++ b/core/applets/rotateapplet/rotate.cpp
@@ -32,72 +32,95 @@
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
41RotateApplet::RotateApplet ( ) 41RotateApplet::RotateApplet ( )
42 : QObject ( 0, "RotateApplet" ), ref ( 0 ), m_flipped( false ) 42 : QObject ( 0, "RotateApplet" ), ref ( 0 ), m_flipped( false )
43{ 43{
44
45#if defined(Q_WS_QWS)
46#if !defined(QT_NO_COP)
47 QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this );
48 connect ( rotateChannel, SIGNAL( received( const QCString &, const QByteArray &) ),
49 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) );
50#endif
51#endif
52
44} 53}
45 54
46RotateApplet::~RotateApplet ( ) 55RotateApplet::~RotateApplet ( )
47{ 56{
48} 57}
49 58
59
60/**
61 * Qcop receive method.
62 */
63void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) {
64 QDataStream stream( data, IO_ReadOnly );
65 if ( msg == "flip()" ) {
66 activated ( );
67 }
68}
69
70
50int RotateApplet::position ( ) const 71int RotateApplet::position ( ) const
51{ 72{
52 return 3; 73 return 3;
53} 74}
54 75
55QString RotateApplet::name ( ) const 76QString RotateApplet::name ( ) const
56{ 77{
57 return tr( "Rotate shortcut" ); 78 return tr( "Rotate shortcut" );
58} 79}
59 80
60QString RotateApplet::text ( ) const 81QString RotateApplet::text ( ) const
61{ 82{
62 return tr( "Rotate" ); 83 return tr( "Rotate" );
63} 84}
64 85
65QString RotateApplet::tr( const char* s ) const 86/*QString RotateApplet::tr( const char* s ) const
66{ 87{
67 return qApp->translate( "RotateApplet", s, 0 ); 88 return qApp->translate( "RotateApplet", s, 0 );
68} 89}
69 90
70QString RotateApplet::tr( const char* s, const char* p ) const 91QString RotateApplet::tr( const char* s, const char* p ) const
71{ 92{
72 return qApp->translate( "RotateApplet", s, p ); 93 return qApp->translate( "RotateApplet", s, p );
73} 94}
95*/
74 96
75QIconSet RotateApplet::icon ( ) const 97QIconSet RotateApplet::icon ( ) const
76{ 98{
77 QPixmap pix; 99 QPixmap pix;
78 QImage img = Resource::loadImage ( "Rotation" ); 100 QImage img = Resource::loadImage ( "Rotation" );
79 101
80 if ( !img. isNull ( )) 102 if ( !img. isNull ( ))
81 pix. convertFromImage ( img. smoothScale ( 14, 14 )); 103 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
82 return pix; 104 return pix;
83} 105}
84 106
85QPopupMenu *RotateApplet::popup ( QWidget * ) const 107QPopupMenu *RotateApplet::popup ( QWidget * ) const
86{ 108{
87 return 0; 109 return 0;
88} 110}
89 111
90void RotateApplet::activated ( ) 112void RotateApplet::activated ( )
91{ 113{
114
92 int defaultRotation = QPEApplication::defaultRotation(); 115 int defaultRotation = QPEApplication::defaultRotation();
93 116
94 int newRotation; 117 int newRotation;
95 118
96 Config cfg( "qpe" ); 119 Config cfg( "qpe" );
97 cfg.setGroup( "Appearance" ); 120 cfg.setGroup( "Appearance" );
98 121
99 // 0 -> 90° clockwise, 1 -> 90° counterclockwise 122 // 0 -> 90° clockwise, 1 -> 90° counterclockwise
100 int rotDirection = cfg.readNumEntry( "rotatedir", 0 ); 123 int rotDirection = cfg.readNumEntry( "rotatedir", 0 );
101 124
102 // hide inputs methods before rotation 125 // hide inputs methods before rotation
103 QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); 126 QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" );