summaryrefslogtreecommitdiff
authorzecke <zecke>2004-09-13 14:49:52 (UTC)
committer zecke <zecke>2004-09-13 14:49:52 (UTC)
commit114abd0387d34bb0a160059d7799c4fbece63e78 (patch) (unidiff)
tree8294e4fd9608cb9110a7d747edcd528713476cfe
parent2e896a0d3d5b18a160c5cc468bee5ed129a92320 (diff)
downloadopie-114abd0387d34bb0a160059d7799c4fbece63e78.zip
opie-114abd0387d34bb0a160059d7799c4fbece63e78.tar.gz
opie-114abd0387d34bb0a160059d7799c4fbece63e78.tar.bz2
Try to use the Parent Background as BackgroundOrigin
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/inputmethods.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp
index 7e99796..586628b 100644
--- a/core/launcher/inputmethods.cpp
+++ b/core/launcher/inputmethods.cpp
@@ -20,138 +20,142 @@
20 20
21#define QTOPIA_INTERNAL_LANGLIST 21#define QTOPIA_INTERNAL_LANGLIST
22#include "inputmethods.h" 22#include "inputmethods.h"
23 23
24/* OPIE */ 24/* OPIE */
25#include <opie2/odebug.h> 25#include <opie2/odebug.h>
26#include <qpe/config.h> 26#include <qpe/config.h>
27#include <qpe/global.h> 27#include <qpe/global.h>
28#include <qpe/qpeapplication.h> 28#include <qpe/qpeapplication.h>
29using namespace Opie::Core; 29using namespace Opie::Core;
30 30
31/* QT */ 31/* QT */
32#include <qpopupmenu.h> 32#include <qpopupmenu.h>
33#include <qtoolbutton.h> 33#include <qtoolbutton.h>
34#include <qwidgetstack.h> 34#include <qwidgetstack.h>
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qdir.h> 36#include <qdir.h>
37#include <qtl.h> 37#include <qtl.h>
38#ifdef Q_WS_QWS 38#ifdef Q_WS_QWS
39#include <qwindowsystem_qws.h> 39#include <qwindowsystem_qws.h>
40#include <qwsevent_qws.h> 40#include <qwsevent_qws.h>
41#include <qcopchannel_qws.h> 41#include <qcopchannel_qws.h>
42#endif 42#endif
43 43
44/* STD */ 44/* STD */
45#include <stdlib.h> 45#include <stdlib.h>
46 46
47/* XPM */ 47/* XPM */
48static const char * tri_xpm[]={ 48static const char * tri_xpm[]={
49"9 9 2 1", 49"9 9 2 1",
50"a c #000000", 50"a c #000000",
51". c None", 51". c None",
52".........", 52".........",
53".........", 53".........",
54".........", 54".........",
55"....a....", 55"....a....",
56"...aaa...", 56"...aaa...",
57"..aaaaa..", 57"..aaaaa..",
58".aaaaaaa.", 58".aaaaaaa.",
59".........", 59".........",
60"........."}; 60"........."};
61 61
62int InputMethod::operator <(const InputMethod& o) const 62int InputMethod::operator <(const InputMethod& o) const
63{ 63{
64 return name() < o.name(); 64 return name() < o.name();
65} 65}
66int InputMethod::operator >(const InputMethod& o) const 66int InputMethod::operator >(const InputMethod& o) const
67{ 67{
68 return name() > o.name(); 68 return name() > o.name();
69} 69}
70int InputMethod::operator <=(const InputMethod& o) const 70int InputMethod::operator <=(const InputMethod& o) const
71{ 71{
72 return name() <= o.name(); 72 return name() <= o.name();
73} 73}
74 74
75 75
76/* 76/*
77 Slightly hacky: We use WStyle_Tool as a flag to say "this widget 77 Slightly hacky: We use WStyle_Tool as a flag to say "this widget
78 belongs to the IM system, so clicking it should not cause a reset". 78 belongs to the IM system, so clicking it should not cause a reset".
79 */ 79 */
80class IMToolButton : public QToolButton 80class IMToolButton : public QToolButton
81{ 81{
82public: 82public:
83 IMToolButton::IMToolButton( QWidget *parent ) : QToolButton( parent ) 83 IMToolButton::IMToolButton( QWidget *parent ) : QToolButton( parent )
84 { setWFlags( WStyle_Tool ); } 84 { setWFlags( WStyle_Tool );
85 setBackgroundOrigin( ParentOrigin );
86 setBackgroundMode( PaletteBackground );
87 }
85}; 88};
86 89
87 90
88InputMethods::InputMethods( QWidget *parent ) : 91InputMethods::InputMethods( QWidget *parent ) :
89 QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ), 92 QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ),
90 mkeyboard(0), imethod(0) 93 mkeyboard(0), imethod(0)
91{ 94{
92 readConfig(); 95 readConfig();
93 96
97 setBackgroundOrigin( ParentOrigin );
94 setBackgroundMode( PaletteBackground ); 98 setBackgroundMode( PaletteBackground );
95 QHBoxLayout *hbox = new QHBoxLayout( this ); 99 QHBoxLayout *hbox = new QHBoxLayout( this );
96 100
97 kbdButton = new IMToolButton( this); 101 kbdButton = new IMToolButton( this);
98 kbdButton->setFocusPolicy(NoFocus); 102 kbdButton->setFocusPolicy(NoFocus);
99 kbdButton->setToggleButton( TRUE ); 103 kbdButton->setToggleButton( TRUE );
100 if (parent->sizeHint().height() > 0) 104 if (parent->sizeHint().height() > 0)
101 kbdButton->setFixedHeight( parent->sizeHint().height() ); 105 kbdButton->setFixedHeight( parent->sizeHint().height() );
102 kbdButton->setFixedWidth( 32 ); 106 kbdButton->setFixedWidth( 32 );
103 kbdButton->setAutoRaise( TRUE ); 107 kbdButton->setAutoRaise( TRUE );
104 kbdButton->setUsesBigPixmap( TRUE ); 108 kbdButton->setUsesBigPixmap( TRUE );
105 hbox->addWidget( kbdButton ); 109 hbox->addWidget( kbdButton );
106 connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) ); 110 connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) );
107 111
108 kbdChoice = new IMToolButton( this ); 112 kbdChoice = new IMToolButton( this );
109 kbdChoice->setFocusPolicy(NoFocus); 113 kbdChoice->setFocusPolicy(NoFocus);
110 kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); 114 kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) );
111 if (parent->sizeHint().height() > 0) 115 if (parent->sizeHint().height() > 0)
112 kbdChoice->setFixedHeight( parent->sizeHint().height() ); 116 kbdChoice->setFixedHeight( parent->sizeHint().height() );
113 kbdChoice->setFixedWidth( 13 ); 117 kbdChoice->setFixedWidth( 13 );
114 kbdChoice->setAutoRaise( TRUE ); 118 kbdChoice->setAutoRaise( TRUE );
115 hbox->addWidget( kbdChoice ); 119 hbox->addWidget( kbdChoice );
116 connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) ); 120 connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) );
117 121
118 connect( (QPEApplication*)qApp, SIGNAL(clientMoused()), 122 connect( (QPEApplication*)qApp, SIGNAL(clientMoused()),
119 this, SLOT(resetStates()) ); 123 this, SLOT(resetStates()) );
120 124
121 125
122 imButton = new QWidgetStack( this ); // later a widget stack 126 imButton = new QWidgetStack( this ); // later a widget stack
123 imButton->setFocusPolicy(NoFocus); 127 imButton->setFocusPolicy(NoFocus);
124 if (parent->sizeHint().height() > 0) 128 if (parent->sizeHint().height() > 0)
125 imButton->setFixedHeight( parent->sizeHint().height() ); 129 imButton->setFixedHeight( parent->sizeHint().height() );
126 hbox->addWidget(imButton); 130 hbox->addWidget(imButton);
127 131
128 imChoice = new QToolButton( this ); 132 imChoice = new QToolButton( this );
129 imChoice->setFocusPolicy(NoFocus); 133 imChoice->setFocusPolicy(NoFocus);
130 imChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); 134 imChoice->setPixmap( QPixmap( (const char **)tri_xpm ) );
131 if (parent->sizeHint().height() > 0) 135 if (parent->sizeHint().height() > 0)
132 imChoice->setFixedHeight( parent->sizeHint().height() ); 136 imChoice->setFixedHeight( parent->sizeHint().height() );
133 imChoice->setFixedWidth( 13 ); 137 imChoice->setFixedWidth( 13 );
134 imChoice->setAutoRaise( TRUE ); 138 imChoice->setAutoRaise( TRUE );
135 hbox->addWidget( imChoice ); 139 hbox->addWidget( imChoice );
136 connect( imChoice, SIGNAL(clicked()), this, SLOT(chooseIm()) ); 140 connect( imChoice, SIGNAL(clicked()), this, SLOT(chooseIm()) );
137 141
138 loadInputMethods(); 142 loadInputMethods();
139 143
140 QCopChannel *channel = new QCopChannel( "QPE/IME", this ); 144 QCopChannel *channel = new QCopChannel( "QPE/IME", this );
141 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), 145 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
142 this, SLOT(qcopReceive(const QCString&,const QByteArray&)) ); 146 this, SLOT(qcopReceive(const QCString&,const QByteArray&)) );
143} 147}
144 148
145InputMethods::~InputMethods() 149InputMethods::~InputMethods()
146{ 150{
147 Config cfg("qpe"); 151 Config cfg("qpe");
148 cfg.setGroup("InputMethod"); 152 cfg.setGroup("InputMethod");
149 if (imethod) 153 if (imethod)
150 cfg.writeEntry("im", imethod->name() ); 154 cfg.writeEntry("im", imethod->name() );
151 if (mkeyboard) 155 if (mkeyboard)
152 cfg.writeEntry("current", mkeyboard->name() ); 156 cfg.writeEntry("current", mkeyboard->name() );
153 157
154 unloadInputMethods(); 158 unloadInputMethods();
155} 159}
156 160
157void InputMethods::hideInputMethod() 161void InputMethods::hideInputMethod()