summaryrefslogtreecommitdiff
path: root/inputmethods
Side-by-side diff
Diffstat (limited to 'inputmethods') (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
@@ -18,10 +18,12 @@
**
**********************************************************************/
#include "keyboard.h"
+#include "configdlg.h"
#include <qpe/global.h>
+#include <qpe/qcopenvelope_qws.h>
#include <qwindowsystem_qws.h>
#include <qpainter.h>
#include <qfontmetrics.h>
@@ -40,15 +42,21 @@
/* Keyboard::Keyboard {{{1 */
Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
QFrame(parent, _name, f), shift(0), lock(0), ctrl(0),
alt(0), useLargeKeys(TRUE), usePicks(0), pressedKeyRow(-1), pressedKeyCol(-1),
- unicode(-1), qkeycode(0), modifiers(0), LANG("ko"), schar(0), mchar(0), echar(0)
+ unicode(-1), qkeycode(0), modifiers(0), LANG("ko"), schar(0), mchar(0), echar(0),
+ configdlg(0)
+
{
// get the default font
Config qpeConfig( "qpe" );
qpeConfig.setGroup( "Appearance" );
QString familyStr = qpeConfig.readEntry( "FontFamily", "fixed" );
+ Config multiConfig ("multikey");
+ multiConfig.setGroup ("pickboard");
+ usePicks = multiConfig.readBoolEntry ("open", "0"); // default closed
+
setFont( QFont( familyStr, 8 ) );
picks = new KeyboardPicks( this );
picks->setFont( QFont( familyStr, 8 ) );
@@ -261,29 +269,21 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
if (unicode == 0) { // either Qt char, or nothing
if (qkeycode == Qt::Key_F1) { // toggle the pickboard
- usePicks = !usePicks;
- if (usePicks) {
- picks->show();
- move(x(), y() - picks->height());
- adjustSize();
- QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
- this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
- } else {
-
- picks->hide();
- picks->resetState();
- move(x(), y() + picks->height());
- adjustSize();
- QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
- this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
-
+ if ( configdlg ) {
+ delete (ConfigDlg *) configdlg;
+ configdlg = 0;
+ }
+ else {
+ configdlg = new ConfigDlg ();
+ connect(configdlg, SIGNAL(pickboardToggled(bool)),
+ this, SLOT(togglePickboard(bool)));
+ configdlg->showMaximized();
+ configdlg->show();
+ configdlg->raise();
}
- keys.setPressed(row, col, usePicks);
- need_repaint = TRUE;
- qkeycode = 0; // don't need to emit Key_F1
} else if (qkeycode == Qt::Key_Control) {
ctrl = keys.pressedPtr(row, col);
need_repaint = TRUE;
*ctrl = !keys.pressed(row, col);
@@ -461,8 +461,35 @@ void Keyboard::resetState()
schar = mchar = echar = 0;
picks->resetState();
}
+/* Keyboard::togglePickboard {{{1 */
+void Keyboard::togglePickboard(bool on_off)
+{
+ usePicks = on_off;
+ if (usePicks) {
+ picks->show();
+ //move(x(), y() - picks->height()); // not required anymore because QCopChannel::send
+ //adjustSize();
+ QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
+ this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
+ } else {
+
+ picks->hide();
+ picks->resetState();
+ //move(x(), y() + picks->height());
+ //adjustSize();
+ QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
+ this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
+
+ }
+ /*
+ * this closes && opens the input method
+ */
+ QCopChannel::send ("QPE/TaskBar", "hideInputMethod()");
+ QCopChannel::send ("QPE/TaskBar", "showInputMethod()");
+}
+
/* korean input functions {{{1
*
* TODO
* one major problem with this implementation is that you can't move the
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
@@ -20,8 +20,9 @@
#include <qframe.h>
#include <qmap.h>
#include "../pickboard/pickboardcfg.h"
#include "../pickboard/pickboardpicks.h"
+#include "configdlg.h"
class QTimer;
class KeyboardConfig : public DictFilterConfig
@@ -105,8 +106,9 @@ signals:
void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool );
private slots:
void repeat();
+ void togglePickboard(bool on_off);
private:
int getKey( int &w, int j = -1 );
void clearHighlight();
@@ -142,7 +144,9 @@ private:
ushort combineKoreanChars(const ushort s, const ushort m, const ushort e);
ushort constoe(const ushort c);
QTimer *repeatTimer;
+
+ ConfigDlg *configdlg;
};
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,11 +1,13 @@
TEMPLATE = lib
CONFIG += qt warn_on release
HEADERS = keyboard.h \
+ configdlg.h \
../pickboard/pickboardcfg.h \
../pickboard/pickboardpicks.h \
keyboardimpl.h
SOURCES = keyboard.cpp \
+ configdlg.cpp \
../pickboard/pickboardcfg.cpp \
../pickboard/pickboardpicks.cpp \
keyboardimpl.cpp
TARGET = qmultikey