summaryrefslogtreecommitdiff
path: root/inputmethods/multikey
Unidiff
Diffstat (limited to 'inputmethods/multikey') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp67
-rw-r--r--inputmethods/multikey/keyboard.h4
-rw-r--r--inputmethods/multikey/multikey.pro2
3 files changed, 53 insertions, 20 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index 8f4d562..a19f07a 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -19,8 +19,10 @@
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "keyboard.h" 21#include "keyboard.h"
22#include "configdlg.h"
22 23
23#include <qpe/global.h> 24#include <qpe/global.h>
25#include <qpe/qcopenvelope_qws.h>
24 26
25#include <qwindowsystem_qws.h> 27#include <qwindowsystem_qws.h>
26#include <qpainter.h> 28#include <qpainter.h>
@@ -41,13 +43,19 @@
41Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : 43Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
42 QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), 44 QFrame(parent, _name, f), shift(0), lock(0), ctrl(0),
43 alt(0), useLargeKeys(TRUE), usePicks(0), pressedKeyRow(-1), pressedKeyCol(-1), 45 alt(0), useLargeKeys(TRUE), usePicks(0), pressedKeyRow(-1), pressedKeyCol(-1),
44 unicode(-1), qkeycode(0), modifiers(0), LANG("ko"), schar(0), mchar(0), echar(0) 46 unicode(-1), qkeycode(0), modifiers(0), LANG("ko"), schar(0), mchar(0), echar(0),
47 configdlg(0)
48
45{ 49{
46 // get the default font 50 // get the default font
47 Config qpeConfig( "qpe" ); 51 Config qpeConfig( "qpe" );
48 qpeConfig.setGroup( "Appearance" ); 52 qpeConfig.setGroup( "Appearance" );
49 QString familyStr = qpeConfig.readEntry( "FontFamily", "fixed" ); 53 QString familyStr = qpeConfig.readEntry( "FontFamily", "fixed" );
50 54
55 Config multiConfig ("multikey");
56 multiConfig.setGroup ("pickboard");
57 usePicks = multiConfig.readBoolEntry ("open", "0"); // default closed
58
51 setFont( QFont( familyStr, 8 ) ); 59 setFont( QFont( familyStr, 8 ) );
52 60
53 picks = new KeyboardPicks( this ); 61 picks = new KeyboardPicks( this );
@@ -262,27 +270,19 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
262 270
263 if (qkeycode == Qt::Key_F1) { // toggle the pickboard 271 if (qkeycode == Qt::Key_F1) { // toggle the pickboard
264 272
265 usePicks = !usePicks; 273 if ( configdlg ) {
266 if (usePicks) { 274 delete (ConfigDlg *) configdlg;
267 picks->show(); 275 configdlg = 0;
268 move(x(), y() - picks->height()); 276 }
269 adjustSize(); 277 else {
270 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 278 configdlg = new ConfigDlg ();
271 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 279 connect(configdlg, SIGNAL(pickboardToggled(bool)),
272 } else { 280 this, SLOT(togglePickboard(bool)));
273 281 configdlg->showMaximized();
274 picks->hide(); 282 configdlg->show();
275 picks->resetState(); 283 configdlg->raise();
276 move(x(), y() + picks->height());
277 adjustSize();
278 QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
279 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
280
281 } 284 }
282 285
283 keys.setPressed(row, col, usePicks);
284 need_repaint = TRUE;
285 qkeycode = 0; // don't need to emit Key_F1
286 } else if (qkeycode == Qt::Key_Control) { 286 } else if (qkeycode == Qt::Key_Control) {
287 ctrl = keys.pressedPtr(row, col); 287 ctrl = keys.pressedPtr(row, col);
288 need_repaint = TRUE; 288 need_repaint = TRUE;
@@ -462,6 +462,33 @@ void Keyboard::resetState()
462 picks->resetState(); 462 picks->resetState();
463} 463}
464 464
465/* Keyboard::togglePickboard {{{1 */
466void Keyboard::togglePickboard(bool on_off)
467{
468 usePicks = on_off;
469 if (usePicks) {
470 picks->show();
471 //move(x(), y() - picks->height()); // not required anymore because QCopChannel::send
472 //adjustSize();
473 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
474 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
475 } else {
476
477 picks->hide();
478 picks->resetState();
479 //move(x(), y() + picks->height());
480 //adjustSize();
481 QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
482 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
483
484 }
485 /*
486 * this closes && opens the input method
487 */
488 QCopChannel::send ("QPE/TaskBar", "hideInputMethod()");
489 QCopChannel::send ("QPE/TaskBar", "showInputMethod()");
490}
491
465/* korean input functions {{{1 492/* korean input functions {{{1
466 * 493 *
467 * TODO 494 * TODO
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h
index b524195..e61b76c 100644
--- a/inputmethods/multikey/keyboard.h
+++ b/inputmethods/multikey/keyboard.h
@@ -21,6 +21,7 @@
21#include <qmap.h> 21#include <qmap.h>
22#include "../pickboard/pickboardcfg.h" 22#include "../pickboard/pickboardcfg.h"
23#include "../pickboard/pickboardpicks.h" 23#include "../pickboard/pickboardpicks.h"
24#include "configdlg.h"
24 25
25class QTimer; 26class QTimer;
26 27
@@ -106,6 +107,7 @@ signals:
106 107
107private slots: 108private slots:
108 void repeat(); 109 void repeat();
110 void togglePickboard(bool on_off);
109 111
110private: 112private:
111 int getKey( int &w, int j = -1 ); 113 int getKey( int &w, int j = -1 );
@@ -143,6 +145,8 @@ private:
143 ushort constoe(const ushort c); 145 ushort constoe(const ushort c);
144 146
145 QTimer *repeatTimer; 147 QTimer *repeatTimer;
148
149 ConfigDlg *configdlg;
146}; 150};
147 151
148 152
diff --git a/inputmethods/multikey/multikey.pro b/inputmethods/multikey/multikey.pro
index 2e92e06..9d76a3d 100644
--- a/inputmethods/multikey/multikey.pro
+++ b/inputmethods/multikey/multikey.pro
@@ -1,10 +1,12 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt warn_on release
3 HEADERS= keyboard.h \ 3 HEADERS= keyboard.h \
4 configdlg.h \
4 ../pickboard/pickboardcfg.h \ 5 ../pickboard/pickboardcfg.h \
5 ../pickboard/pickboardpicks.h \ 6 ../pickboard/pickboardpicks.h \
6 keyboardimpl.h 7 keyboardimpl.h
7 SOURCES= keyboard.cpp \ 8 SOURCES= keyboard.cpp \
9 configdlg.cpp \
8 ../pickboard/pickboardcfg.cpp \ 10 ../pickboard/pickboardcfg.cpp \
9 ../pickboard/pickboardpicks.cpp \ 11 ../pickboard/pickboardpicks.cpp \
10 keyboardimpl.cpp 12 keyboardimpl.cpp