summaryrefslogtreecommitdiff
authorsandman <sandman>2002-10-22 11:58:33 (UTC)
committer sandman <sandman>2002-10-22 11:58:33 (UTC)
commit486280adc2ab5dc383a56d8516c36727eb382812 (patch) (unidiff)
tree583cf961ec5c62c46137be36fcd9789d7d01158e
parent1ee836bd1bb777dded54810909e508dc0470ada3 (diff)
downloadopie-486280adc2ab5dc383a56d8516c36727eb382812.zip
opie-486280adc2ab5dc383a56d8516c36727eb382812.tar.gz
opie-486280adc2ab5dc383a56d8516c36727eb382812.tar.bz2
handwriting: qtopia 1.6 merge
all: someone made all inputmethod name()s untranslateable. This cured a symptom (opie crashing), but it was not real a bug-fix. I have marked them as translateable again and found no problems doing so.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/dvorak/dvorakimpl.cpp3
-rw-r--r--inputmethods/handwriting/handwritingimpl.cpp3
-rw-r--r--inputmethods/handwriting/qimpenhelp.cpp43
-rw-r--r--inputmethods/handwriting/qimpeninput.cpp17
-rw-r--r--inputmethods/handwriting/qimpenprofile.cpp6
-rw-r--r--inputmethods/handwriting/qimpensetup.cpp10
-rw-r--r--inputmethods/jumpx/keyboardimpl.cpp3
-rw-r--r--inputmethods/keyboard/keyboardimpl.cpp3
-rw-r--r--inputmethods/kjumpx/keyboardimpl.cpp3
-rw-r--r--inputmethods/pickboard/pickboardimpl.cpp3
-rw-r--r--inputmethods/unikeyboard/unikeyboardimpl.cpp3
11 files changed, 44 insertions, 53 deletions
diff --git a/inputmethods/dvorak/dvorakimpl.cpp b/inputmethods/dvorak/dvorakimpl.cpp
index d58b6b9..3c83464 100644
--- a/inputmethods/dvorak/dvorakimpl.cpp
+++ b/inputmethods/dvorak/dvorakimpl.cpp
@@ -7,125 +7,124 @@
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qapplication.h> 20#include <qapplication.h>
21#include <qpixmap.h> 21#include <qpixmap.h>
22#include "dvorak.h" 22#include "dvorak.h"
23#include "dvorakimpl.h" 23#include "dvorakimpl.h"
24 24
25/* XPM */ 25/* XPM */
26static const char * kb_xpm[] = { 26static const char * kb_xpm[] = {
27"28 13 4 1", 27"28 13 4 1",
28" c None", 28" c None",
29". c #4C4C4C", 29". c #4C4C4C",
30"+ c #FFF7DD", 30"+ c #FFF7DD",
31"@ c #D6CFBA", 31"@ c #D6CFBA",
32" .......................... ", 32" .......................... ",
33" .+++.+++.+++.+++.+++.++++. ", 33" .+++.+++.+++.+++.+++.++++. ",
34" .+@@.+@@.+@@.+@@.+@@.+@@@. ", 34" .+@@.+@@.+@@.+@@.+@@.+@@@. ",
35" .......................... ", 35" .......................... ",
36" .+++++.+++.+++.+++.++++++. ", 36" .+++++.+++.+++.+++.++++++. ",
37" .+@@@@.+@@.+@@.+@@.+@@@@@. ", 37" .+@@@@.+@@.+@@.+@@.+@@@@@. ",
38" .......................... ", 38" .......................... ",
39" .++++++.+++.+++.+++.+++++. ", 39" .++++++.+++.+++.+++.+++++. ",
40" .+@@@@@.+@@.+@@.+@@.+@@@@. ", 40" .+@@@@@.+@@.+@@.+@@.+@@@@. ",
41" .......................... ", 41" .......................... ",
42" .++++.++++++++++++++.++++. ", 42" .++++.++++++++++++++.++++. ",
43" .+@@@.+@@@@@@@@@@@@@.+@@@. ", 43" .+@@@.+@@@@@@@@@@@@@.+@@@. ",
44" .......................... "}; 44" .......................... "};
45 45
46 46
47/* XPM */ 47/* XPM */
48static char * opti_xpm[] = { 48static char * opti_xpm[] = {
49"28 13 4 1", 49"28 13 4 1",
50" c None", 50" c None",
51". c #4C4C4C", 51". c #4C4C4C",
52"+ c #FFF7DD", 52"+ c #FFF7DD",
53"@ c #D6CFBA", 53"@ c #D6CFBA",
54" ......................... ", 54" ......................... ",
55" .+++.+++.+++.+++.+++.+++. ", 55" .+++.+++.+++.+++.+++.+++. ",
56" .+@@.+@@.+@@.+@@.+@@.+@@. ", 56" .+@@.+@@.+@@.+@@.+@@.+@@. ",
57" ......................... ", 57" ......................... ",
58" .+++.+++.+++.+++.+++.+++. ", 58" .+++.+++.+++.+++.+++.+++. ",
59" .+@@.+@@.+@@.+@@.+@@.+@@. ", 59" .+@@.+@@.+@@.+@@.+@@.+@@. ",
60" ......................... ", 60" ......................... ",
61" .+++.+++.+++.+++.+++.+++. ", 61" .+++.+++.+++.+++.+++.+++. ",
62" .+@@.+@@.+@@.+@@.+@@.+@@. ", 62" .+@@.+@@.+@@.+@@.+@@.+@@. ",
63" ......................... ", 63" ......................... ",
64" .+++.+++.+++.+++.+++.+++. ", 64" .+++.+++.+++.+++.+++.+++. ",
65" .+@@.+@@.+@@.+@@.+@@.+@@. ", 65" .+@@.+@@.+@@.+@@.+@@.+@@. ",
66" ......................... "}; 66" ......................... "};
67 67
68 68
69 69
70KeyboardImpl::KeyboardImpl() 70KeyboardImpl::KeyboardImpl()
71 : input(0), icn(0), ref(0) 71 : input(0), icn(0), ref(0)
72{ 72{
73} 73}
74 74
75KeyboardImpl::~KeyboardImpl() 75KeyboardImpl::~KeyboardImpl()
76{ 76{
77 delete input; 77 delete input;
78 delete icn; 78 delete icn;
79} 79}
80 80
81QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) 81QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f )
82{ 82{
83 if ( !input ) 83 if ( !input )
84 input = new Keyboard( parent, "Keyboard", f ); 84 input = new Keyboard( parent, "Keyboard", f );
85 return input; 85 return input;
86} 86}
87 87
88void KeyboardImpl::resetState() 88void KeyboardImpl::resetState()
89{ 89{
90 if ( input ) 90 if ( input )
91 input->resetState(); 91 input->resetState();
92} 92}
93 93
94QPixmap *KeyboardImpl::icon() 94QPixmap *KeyboardImpl::icon()
95{ 95{
96 if ( !icn ) 96 if ( !icn )
97 icn = new QPixmap( (const char **)kb_xpm ); 97 icn = new QPixmap( (const char **)kb_xpm );
98 return icn; 98 return icn;
99} 99}
100 100
101QString KeyboardImpl::name() 101QString KeyboardImpl::name()
102{ 102{
103 // return qApp->translate( "InputMethods", "Dvorak" ); 103 return qApp->translate( "InputMethods", "Dvorak" );
104 return "Dvorak";
105} 104}
106 105
107void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) 106void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot )
108{ 107{
109 if ( input ) 108 if ( input )
110 QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); 109 QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot );
111} 110}
112 111
113#ifndef QT_NO_COMPONENT 112#ifndef QT_NO_COMPONENT
114QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 113QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
115{ 114{
116 *iface = 0; 115 *iface = 0;
117 if ( uuid == IID_QUnknown ) 116 if ( uuid == IID_QUnknown )
118 *iface = this; 117 *iface = this;
119 else if ( uuid == IID_InputMethod ) 118 else if ( uuid == IID_InputMethod )
120 *iface = this; 119 *iface = this;
121 120
122 if ( *iface ) 121 if ( *iface )
123 (*iface)->addRef(); 122 (*iface)->addRef();
124 return QS_OK; 123 return QS_OK;
125} 124}
126 125
127Q_EXPORT_INTERFACE() 126Q_EXPORT_INTERFACE()
128{ 127{
129 Q_CREATE_INSTANCE( KeyboardImpl ) 128 Q_CREATE_INSTANCE( KeyboardImpl )
130} 129}
131#endif 130#endif
diff --git a/inputmethods/handwriting/handwritingimpl.cpp b/inputmethods/handwriting/handwritingimpl.cpp
index 0ea140c..c39e1aa 100644
--- a/inputmethods/handwriting/handwritingimpl.cpp
+++ b/inputmethods/handwriting/handwritingimpl.cpp
@@ -1,114 +1,113 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <qapplication.h> 21#include <qapplication.h>
22#include <qwidget.h> 22#include <qwidget.h>
23#include <qpixmap.h> 23#include <qpixmap.h>
24#include "qimpeninput.h" 24#include "qimpeninput.h"
25#include "handwritingimpl.h" 25#include "handwritingimpl.h"
26 26
27/* XPM */ 27/* XPM */
28static const char * pen_xpm[] = { 28static const char * pen_xpm[] = {
29"28 13 9 1", 29"28 13 9 1",
30" c None", 30" c None",
31". c #000000", 31". c #000000",
32"+ c #FFE993", 32"+ c #FFE993",
33"@ c #8292FF", 33"@ c #8292FF",
34"# c #F7C500", 34"# c #F7C500",
35"$ c #C69F00", 35"$ c #C69F00",
36"% c #0022FF", 36"% c #0022FF",
37"& c #000F72", 37"& c #000F72",
38"* c #A3732C", 38"* c #A3732C",
39" . ", 39" . ",
40" .+. ", 40" .+. ",
41" .@#$. ", 41" .@#$. ",
42" .@%&. ", 42" .@%&. ",
43" .@%&. ", 43" .@%&. ",
44" . .@%&. ", 44" . .@%&. ",
45" . .@%&. ", 45" . .@%&. ",
46" . .@%&. ", 46" . .@%&. ",
47" ... ... .. .@%&. ", 47" ... ... .. .@%&. ",
48" . . . . . .*.&. ", 48" . . . . . .*.&. ",
49" . . . . . .**. ", 49" . . . . . .**. ",
50" ... ... .. ... ", 50" ... ... .. ... ",
51" "}; 51" "};
52 52
53HandwritingImpl::HandwritingImpl() 53HandwritingImpl::HandwritingImpl()
54 : input(0), icn(0), ref(0) 54 : input(0), icn(0), ref(0)
55{ 55{
56} 56}
57 57
58HandwritingImpl::~HandwritingImpl() 58HandwritingImpl::~HandwritingImpl()
59{ 59{
60 delete input; 60 delete input;
61 delete icn; 61 delete icn;
62} 62}
63 63
64QWidget *HandwritingImpl::inputMethod( QWidget *parent, Qt::WFlags f ) 64QWidget *HandwritingImpl::inputMethod( QWidget *parent, Qt::WFlags f )
65{ 65{
66 if ( !input ) 66 if ( !input )
67 input = new QIMPenInput( parent, "Handwriting", f ); 67 input = new QIMPenInput( parent, "Handwriting", f );
68 return input; 68 return input;
69} 69}
70 70
71void HandwritingImpl::resetState() 71void HandwritingImpl::resetState()
72{ 72{
73 if ( input ) 73 if ( input )
74 input->resetState(); 74 input->resetState();
75} 75}
76 76
77QPixmap *HandwritingImpl::icon() 77QPixmap *HandwritingImpl::icon()
78{ 78{
79 if ( !icn ) 79 if ( !icn )
80 icn = new QPixmap( (const char **)pen_xpm ); 80 icn = new QPixmap( (const char **)pen_xpm );
81 return icn; 81 return icn;
82} 82}
83 83
84QString HandwritingImpl::name() 84QString HandwritingImpl::name()
85{ 85{
86 // return qApp->translate( "InputMethods", "Handwriting" ); 86 return qApp->translate( "InputMethods", "Handwriting" );
87 return "Handwriting";
88} 87}
89 88
90void HandwritingImpl::onKeyPress( QObject *receiver, const char *slot ) 89void HandwritingImpl::onKeyPress( QObject *receiver, const char *slot )
91{ 90{
92 if ( input ) 91 if ( input )
93 QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); 92 QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot );
94} 93}
95 94
96#ifndef QT_NO_COMPONENT 95#ifndef QT_NO_COMPONENT
97QRESULT HandwritingImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 96QRESULT HandwritingImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
98{ 97{
99 *iface = 0; 98 *iface = 0;
100 if ( uuid == IID_QUnknown ) 99 if ( uuid == IID_QUnknown )
101 *iface = this; 100 *iface = this;
102 else if ( uuid == IID_InputMethod ) 101 else if ( uuid == IID_InputMethod )
103 *iface = this; 102 *iface = this;
104 103
105 if ( *iface ) 104 if ( *iface )
106 (*iface)->addRef(); 105 (*iface)->addRef();
107 return QS_OK; 106 return QS_OK;
108} 107}
109 108
110Q_EXPORT_INTERFACE() 109Q_EXPORT_INTERFACE()
111{ 110{
112 Q_CREATE_INSTANCE( HandwritingImpl ) 111 Q_CREATE_INSTANCE( HandwritingImpl )
113} 112}
114#endif 113#endif
diff --git a/inputmethods/handwriting/qimpenhelp.cpp b/inputmethods/handwriting/qimpenhelp.cpp
index 5ee46a2..a294301 100644
--- a/inputmethods/handwriting/qimpenhelp.cpp
+++ b/inputmethods/handwriting/qimpenhelp.cpp
@@ -1,365 +1,366 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "qimpenwidget.h" 21#include "qimpenwidget.h"
22#include "qimpencombining.h" 22#include "qimpencombining.h"
23#include "qimpenmatch.h" 23#include "qimpenmatch.h"
24#include "qimpenhelp.h" 24#include "qimpenhelp.h"
25 25
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27#include <qpe/global.h> 27#include <qpe/global.h>
28#include <qpe/config.h> 28#include <qpe/config.h>
29#include <qpe/stringutil.h> 29#include <qpe/stringutil.h>
30 30
31#include <qtextview.h> 31#include <qtextview.h>
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qlistbox.h> 33#include <qlistbox.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qtimer.h> 37#include <qtimer.h>
38#include <qtextstream.h> 38#include <qtextstream.h>
39 39
40/* XPM */ 40/* XPM */
41static const char * const left_xpm[] = { 41static const char * const left_xpm[] = {
42"16 16 2 1", 42"16 16 2 1",
43" c None", 43" c None",
44". c #000000", 44". c #000000",
45" ", 45" ",
46" ", 46" ",
47" ", 47" ",
48" . ", 48" . ",
49" .. ", 49" .. ",
50" ... ", 50" ... ",
51" .... ", 51" .... ",
52" ..... ", 52" ..... ",
53" ...... ", 53" ...... ",
54" ..... ", 54" ..... ",
55" .... ", 55" .... ",
56" ... ", 56" ... ",
57" .. ", 57" .. ",
58" . ", 58" . ",
59" ", 59" ",
60" "}; 60" "};
61 61
62 62
63/* XPM */ 63/* XPM */
64static const char * const right_xpm[] = { 64static const char * const right_xpm[] = {
65"16 16 2 1", 65"16 16 2 1",
66" c None", 66" c None",
67". c #000000", 67". c #000000",
68" ", 68" ",
69" ", 69" ",
70" ", 70" ",
71" . ", 71" . ",
72" .. ", 72" .. ",
73" ... ", 73" ... ",
74" .... ", 74" .... ",
75" ..... ", 75" ..... ",
76" ...... ", 76" ...... ",
77" ..... ", 77" ..... ",
78" .... ", 78" .... ",
79" ... ", 79" ... ",
80" .. ", 80" .. ",
81" . ", 81" . ",
82" ", 82" ",
83" "}; 83" "};
84 84
85class CharListItem : public QListBoxText 85class CharListItem : public QListBoxText
86{ 86{
87public: 87public:
88 CharListItem( const QString &text, uint c ) 88 CharListItem( const QString &text, uint c )
89 : QListBoxText( text ) 89 : QListBoxText( text )
90 { 90 {
91 _code = c; 91 _code = c;
92 } 92 }
93 93
94 uint code() const { return _code; } 94 uint code() const { return _code; }
95 95
96protected: 96protected:
97 uint _code; 97 uint _code;
98}; 98};
99 99
100HandwritingHelp::HandwritingHelp( QIMPenProfile *p, QWidget *parent, const char *name, WFlags f ) 100HandwritingHelp::HandwritingHelp( QIMPenProfile *p, QWidget *parent, const char *name, WFlags f )
101 : QTabWidget( parent, name, f ) 101 : QTabWidget( parent, name, f )
102{ 102{
103 setCaption( tr("Handwriting Help") ); 103 setCaption( tr("Handwriting Help") );
104 QTextView *help = new QTextView( this ); 104 QTextView *help = new QTextView( this );
105 help->setFrameStyle( QFrame::NoFrame ); 105 help->setFrameStyle( QFrame::NoFrame );
106 help->setText( 106 help->setText(
107 tr( "<ul><li>When you start to use the handwriting recogniser " 107 tr( "<ul><li>When you start to use the handwriting recogniser "
108 "write slowly, accurately and firmly." 108 "write slowly, accurately and firmly."
109 "<li>Use the guide lines when drawing your characters." 109 "<li>Use the guide lines when drawing your characters."
110 "<li>When drawing a character with multiple strokes, each " 110 "<li>When drawing a character with multiple strokes, each "
111 "successive stroke must be drawn before the grayed strokes are erased." 111 "successive stroke must be drawn before the grayed strokes are erased."
112 "<li>Practice your handwriting using the handwriting trainer." 112 "<li>Practice your handwriting using the handwriting trainer."
113 "<li>When adding your own character templates make sure they " 113 "<li>When adding your own character templates make sure they "
114 "are sufficiently different from other characters' templates." 114 "are sufficiently different from other characters' templates."
115 "</ul>") ); 115 "</ul>") );
116 116
117 addTab( help, tr("Tips") ); 117 addTab( help, tr("Tips") );
118 118
119 HandwritingTrainer *trainer = new HandwritingTrainer( p, this ); 119 HandwritingTrainer *trainer = new HandwritingTrainer( p, this );
120 addTab( trainer, tr("Trainer") ); 120 addTab( trainer, tr("Trainer") );
121} 121}
122 122
123void HandwritingHelp::showEvent( QShowEvent * ) 123void HandwritingHelp::showEvent( QShowEvent * )
124{ 124{
125 Global::hideInputMethod(); 125 Global::hideInputMethod();
126} 126}
127 127
128void HandwritingHelp::hideEvent( QHideEvent * ) 128void HandwritingHelp::hideEvent( QHideEvent * )
129{ 129{
130 Global::showInputMethod(); 130 Global::showInputMethod();
131} 131}
132 132
133//--------------------------------------------------------------------------- 133//---------------------------------------------------------------------------
134 134
135HandwritingTrainer::HandwritingTrainer( QIMPenProfile *p, QWidget *parent, const char *name ) 135HandwritingTrainer::HandwritingTrainer( QIMPenProfile *p, QWidget *parent, const char *name )
136 : QWidget( parent, name ), profile(p) 136 : QWidget( parent, name ), profile(p)
137{ 137{
138 QGridLayout *gl = new QGridLayout( this, 5, 2, 0, 4 ); 138 QGridLayout *gl = new QGridLayout( this, 4, 2, 0, 4 );
139 gl->setRowStretch( 1, 1 );
140 gl->setRowStretch( 2, 1 );
141 gl->setColStretch( 1, 1 ); 139 gl->setColStretch( 1, 1 );
140 gl->setRowStretch(3, 1);
142 141
143 charSetCombo = new QComboBox( this ); 142 charSetCombo = new QComboBox( this );
144 gl->addMultiCellWidget( charSetCombo, 0, 0, 0, 1 ); 143 gl->addMultiCellWidget( charSetCombo, 0, 0, 0, 1 );
145 connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSet(int))); 144 connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSet(int)));
146 QIMPenCharSetIterator it( profile->charSets() ); 145 QIMPenCharSetIterator it( profile->charSets() );
147 for ( ; it.current(); ++it ) { 146 for ( ; it.current(); ++it ) {
148 charSetCombo->insertItem( it.current()->description() ); 147 charSetCombo->insertItem( it.current()->description() );
149 } 148 }
150 149
151 charList = new QListBox( this ); 150 charList = new QListBox( this );
152 charList->setHScrollBarMode( QListBox::AlwaysOff ); 151 charList->setHScrollBarMode( QListBox::AlwaysOff );
153 charList->setFixedWidth( 80 ); 152 charList->setFixedWidth(80);
154 connect( charList, SIGNAL(highlighted(int)), this, SLOT(selectChar(int)) ); 153 connect( charList, SIGNAL(highlighted(int)), this, SLOT(selectChar(int)) );
155 gl->addMultiCellWidget( charList, 1, 2, 0, 0 ); 154 gl->addWidget(charList, 1, 0);
156
157 QLabel *help = new QLabel( this );
158 help->setAlignment( AlignLeft | AlignVCenter | WordBreak );
159 gl->addWidget( help, 1, 1 );
160 help->setText(
161 tr( "Select a character from the list. The writing area on the left "
162 "shows the reference character. Practice writing in the area on "
163 "the right.") );
164 155
165 result = new QLabel( this ); 156 result = new QLabel( this );
166 gl->addMultiCellWidget( result, 2, 3, 1, 1 ); 157 result->setAlignment(AlignLeft | AlignVCenter | WordBreak);
158 result->setText(
159 tr( "Select a reference character from the list. Practice writing in "
160 "the area on the right."));
161 gl->addMultiCellWidget(result, 1, 2, 1, 1);
167 162
168 matcher = new QIMPenMatch( this ); 163 matcher = new QIMPenMatch( this );
169 matcher->setCharSet( currentSet ); 164 matcher->setCharSet( currentSet );
170 connect( matcher, SIGNAL(noMatch()), this, SLOT(noMatch()) ); 165 connect( matcher, SIGNAL(noMatch()), this, SLOT(noMatch()) );
171 connect( matcher, SIGNAL(matchedCharacters(const QIMPenCharMatchList &)), 166 connect( matcher, SIGNAL(matchedCharacters(const QIMPenCharMatchList &)),
172 this, SLOT(matched(const QIMPenCharMatchList &)) ); 167 this, SLOT(matched(const QIMPenCharMatchList &)) );
173 168
174 QHBoxLayout *hb = new QHBoxLayout(); 169 QHBoxLayout *hb = new QHBoxLayout();
175 gl->addLayout( hb, 3, 0 ); 170 gl->addLayout( hb, 2, 0 );
176 prevBtn = new QPushButton( this ); 171 prevBtn = new QPushButton( this );
177 prevBtn->setPixmap( QPixmap( (const char **)left_xpm ) ); 172 prevBtn->setPixmap( QPixmap( (const char **)left_xpm ) );
178 connect( prevBtn, SIGNAL(clicked()), SLOT(prevChar())); 173 connect( prevBtn, SIGNAL(clicked()), SLOT(prevChar()));
179 hb->addWidget( prevBtn ); 174 hb->addWidget( prevBtn );
180 175
181 nextBtn = new QPushButton( this ); 176 nextBtn = new QPushButton( this );
182 nextBtn->setPixmap( QPixmap( (const char **)right_xpm ) ); 177 nextBtn->setPixmap( QPixmap( (const char **)right_xpm ) );
183 connect( nextBtn, SIGNAL(clicked()), SLOT(nextChar())); 178 connect( nextBtn, SIGNAL(clicked()), SLOT(nextChar()));
184 hb->addWidget( nextBtn ); 179 hb->addWidget( nextBtn );
185 180
186 refPw = new QIMPenWidget( this ); 181 refPw = new QIMPenWidget( this );
187 refPw->setReadOnly( TRUE ); 182 refPw->setReadOnly( TRUE );
188 gl->addWidget( refPw, 4, 0 ); 183 gl->addWidget( refPw, 3, 0 );
189 184
190 pracPw = new QIMPenWidget( this ); 185 pracPw = new QIMPenWidget( this );
191 connect( matcher, SIGNAL(removeStroke()), pracPw, SLOT(removeStroke()) ); 186 connect( matcher, SIGNAL(removeStroke()), pracPw, SLOT(removeStroke()) );
192 connect( pracPw, SIGNAL(beginStroke()), 187 connect( pracPw, SIGNAL(beginStroke()),
193 this, SLOT(beginStroke()) ); 188 this, SLOT(beginStroke()) );
194 connect( pracPw, SIGNAL(stroke( QIMPenStroke * )), 189 connect( pracPw, SIGNAL(stroke( QIMPenStroke * )),
195 this, SLOT(strokeEntered( QIMPenStroke * )) ); 190 this, SLOT(strokeEntered( QIMPenStroke * )) );
196 connect( pracPw, SIGNAL(beginStroke()), 191 connect( pracPw, SIGNAL(beginStroke()),
197 matcher, SLOT(beginStroke()) ); 192 matcher, SLOT(beginStroke()) );
198 connect( pracPw, SIGNAL(stroke( QIMPenStroke * )), 193 connect( pracPw, SIGNAL(stroke( QIMPenStroke * )),
199 matcher, SLOT(strokeEntered( QIMPenStroke * )) ); 194 matcher, SLOT(strokeEntered( QIMPenStroke * )) );
200 gl->addWidget( pracPw, 4, 1 ); 195 gl->addWidget( pracPw, 3, 1 );
201 196
202 redrawTimer = new QTimer( this ); 197 redrawTimer = new QTimer( this );
203 connect( redrawTimer, SIGNAL(timeout()), this, SLOT(redrawChar()) ); 198 connect( redrawTimer, SIGNAL(timeout()), this, SLOT(redrawChar()) );
204 redrawTimer->start( 5000 ); 199 redrawTimer->start( 5000 );
205 200
206 currentSet = 0; 201 currentSet = 0;
207 charSetCombo->setCurrentItem( 1 ); 202 charSetCombo->setCurrentItem( 1 );
208 selectCharSet( 1 ); 203 selectCharSet( 1 );
209} 204}
210 205
211HandwritingTrainer::~HandwritingTrainer() 206HandwritingTrainer::~HandwritingTrainer()
212{ 207{
213} 208}
214 209
215void HandwritingTrainer::showEvent( QShowEvent * ) 210void HandwritingTrainer::showEvent( QShowEvent * )
216{ 211{
217 redrawChar(); 212 redrawChar();
218 redrawTimer->start( 5000 ); 213 redrawTimer->start( 5000 );
219} 214}
220 215
221void HandwritingTrainer::setCurrentChar( QIMPenChar *c ) 216void HandwritingTrainer::setCurrentChar( QIMPenChar *c )
222{ 217{
223 currentChar = c; 218 currentChar = c;
224 refPw->showCharacter( currentChar ); 219 refPw->showCharacter( currentChar );
225 pracPw->clear(); 220 pracPw->clear();
226 if ( currentChar ) { 221 if ( currentChar ) {
227 prevBtn->setEnabled( findPrev() != 0 ); 222 prevBtn->setEnabled( findPrev() != 0 );
228 nextBtn->setEnabled( findNext() != 0 ); 223 nextBtn->setEnabled( findNext() != 0 );
229 } 224 }
230 result->setText( "" );
231 redrawTimer->start( 5000 ); 225 redrawTimer->start( 5000 );
232} 226}
233 227
234void HandwritingTrainer::selectChar( int i ) 228void HandwritingTrainer::selectChar( int i )
235{ 229{
230 static int last_char = 0;
231
232 if (last_char != i) {
233 result->setText("");
234 }
235
236 currentChar = 0; 236 currentChar = 0;
237 currentCode = ((CharListItem *)charList->item(i))->code(); 237 currentCode = ((CharListItem *)charList->item(i))->code();
238 QIMPenCharIterator it(currentSet->characters() ); 238 QIMPenCharIterator it(currentSet->characters() );
239 for ( ; it.current(); ++it ) { 239 for ( ; it.current(); ++it ) {
240 if ( it.current()->character() == currentCode && 240 if ( it.current()->character() == currentCode &&
241 !it.current()->testFlag( QIMPenChar::Deleted ) ) { 241 !it.current()->testFlag( QIMPenChar::Deleted ) ) {
242 setCurrentChar( it.current() ); 242 setCurrentChar( it.current() );
243 break; 243 break;
244 } 244 }
245 } 245 }
246 if ( !it.current() ) 246 if ( !it.current() )
247 setCurrentChar( 0 ); 247 setCurrentChar( 0 );
248} 248}
249 249
250void HandwritingTrainer::selectCharSet( int i ) 250void HandwritingTrainer::selectCharSet( int i )
251{ 251{
252 if ( currentSet ) { 252 if ( currentSet ) {
253 refPw->removeCharSet( 0 ); 253 refPw->removeCharSet( 0 );
254 pracPw->removeCharSet( 0 ); 254 pracPw->removeCharSet( 0 );
255 result->setText("");
255 } 256 }
256 currentSet = profile->charSets().at( i ); 257 currentSet = profile->charSets().at( i );
257 fillCharList(); 258 fillCharList();
258 refPw->insertCharSet( currentSet ); 259 refPw->insertCharSet( currentSet );
259 pracPw->insertCharSet( currentSet ); 260 pracPw->insertCharSet( currentSet );
260 matcher->setCharSet( currentSet ); 261 matcher->setCharSet( currentSet );
261 if ( charList->count() ) { 262 if ( charList->count() ) {
262 charList->setSelected( 0, TRUE ); 263 charList->setSelected( 0, TRUE );
263 selectChar(0); 264 selectChar(0);
264 } 265 }
265} 266}
266 267
267void HandwritingTrainer::noMatch() 268void HandwritingTrainer::noMatch()
268{ 269{
269 result->setText( "No match" ); 270 result->setText( tr("No match") );
270} 271}
271 272
272void HandwritingTrainer::matched( const QIMPenCharMatchList &ml ) 273void HandwritingTrainer::matched( const QIMPenCharMatchList &ml )
273{ 274{
274 int maxErr = 20000 + (*ml.begin()).penChar->strokeLength(0) * 1000; 275 int maxErr = 20000 + (*ml.begin()).penChar->strokeLength(0) * 1000;
275 int baseErr = (*ml.begin()).penChar->strokeLength(0) * 250; 276 int baseErr = (*ml.begin()).penChar->strokeLength(0) * 250;
276 unsigned int numStrokes = (*ml.begin()).penChar->strokeCount(); 277 unsigned int numStrokes = (*ml.begin()).penChar->strokeCount();
277 QIMPenCharMatchList::ConstIterator it; 278 QIMPenCharMatchList::ConstIterator it;
278 /* 279 /*
279 for ( it = ml.begin(); it != ml.end(); ++it ) { 280 for ( it = ml.begin(); it != ml.end(); ++it ) {
280 if ( (*it).penChar->strokeCount() == numStrokes ) { 281 if ( (*it).penChar->strokeCount() == numStrokes ) {
281 if ( (*it).error > maxErr ) 282 if ( (*it).error > maxErr )
282 maxErr = (*it).error; 283 maxErr = (*it).error;
283 } 284 }
284 } 285 }
285 */ 286 */
286 int i; 287 int i;
287 QString res; 288 QString res;
288 QTextStream ts(&res, IO_WriteOnly); 289 QTextStream ts(&res, IO_WriteOnly);
289 ts << "<qt>" << tr("Matched: "); 290 ts << "<qt>" << tr("Matched: ");
290 for ( i = 0, it = ml.begin(); it != ml.end() && i < 4; ++it, i++ ) { 291 for ( i = 0, it = ml.begin(); it != ml.end() && i < 4; ++it, i++ ) {
291 if ( (*it).penChar->strokeCount() == numStrokes ) { 292 if ( (*it).penChar->strokeCount() == numStrokes ) {
292 int rate = 100 - ( ((*it).error - baseErr) * 100 ) / maxErr; 293 int rate = 100 - ( ((*it).error - baseErr) * 100 ) / maxErr;
293 if ( it != ml.begin() ) { 294 if ( it != ml.begin() ) {
294 if ( rate < -10 ) 295 if ( rate < -10 )
295 continue; 296 continue;
296 ts << "<br>"; 297 ts << "<br>";
297 ts << tr("Similar to: "); 298 ts << tr("Similar to: ");
298 } 299 }
299 ts << "<big>"; 300 ts << "<big>";
300 if ( (*it).penChar->character() == currentChar->character() ) 301 if ( (*it).penChar->character() == currentChar->character() )
301 ts << "<b>"; 302 ts << "<b>";
302 ts << Qtopia::escapeString((*it).penChar->name()); 303 ts << Qtopia::escapeString((*it).penChar->name());
303 ts << " (" << rateString(rate) << ")"; 304 ts << " (" << rateString(rate) << ")";
304 if ( (*it).penChar->character() == currentChar->character() ) 305 if ( (*it).penChar->character() == currentChar->character() )
305 ts << "</b>"; 306 ts << "</b>";
306 ts << "</big>"; 307 ts << "</big>";
307 } 308 }
308 } 309 }
309 ts << "</qt>"; 310 ts << "</qt>";
310 result->setText( res ); 311 result->setText( res );
311} 312}
312 313
313QString HandwritingTrainer::rateString( int rate ) const 314QString HandwritingTrainer::rateString( int rate ) const
314{ 315{
315 if ( rate < 1 ) 316 if ( rate < 1 )
316 rate = 1; 317 rate = 1;
317 if ( rate > 100 ) 318 if ( rate > 100 )
318 rate = 100; 319 rate = 100;
319 return tr("%1%").arg(rate); 320 return tr("%1%").arg(rate);
320} 321}
321 322
322void HandwritingTrainer::prevChar() 323void HandwritingTrainer::prevChar()
323{ 324{
324 QIMPenChar *pc = findPrev(); 325 QIMPenChar *pc = findPrev();
325 if ( pc ) 326 if ( pc )
326 setCurrentChar( pc ); 327 setCurrentChar( pc );
327} 328}
328 329
329void HandwritingTrainer::nextChar() 330void HandwritingTrainer::nextChar()
330{ 331{
331 QIMPenChar *pc = findNext(); 332 QIMPenChar *pc = findNext();
332 if ( pc ) 333 if ( pc )
333 setCurrentChar( pc ); 334 setCurrentChar( pc );
334} 335}
335 336
336void HandwritingTrainer::redrawChar() 337void HandwritingTrainer::redrawChar()
337{ 338{
338 if ( currentChar ) 339 if ( currentChar )
339 refPw->showCharacter( currentChar ); 340 refPw->showCharacter( currentChar );
340} 341}
341 342
342void HandwritingTrainer::beginStroke() 343void HandwritingTrainer::beginStroke()
343{ 344{
344 redrawTimer->start( 5000 ); 345 redrawTimer->start( 5000 );
345} 346}
346 347
347void HandwritingTrainer::strokeEntered( QIMPenStroke * ) 348void HandwritingTrainer::strokeEntered( QIMPenStroke * )
348{ 349{
349 pracPw->greyStroke(); 350 pracPw->greyStroke();
350} 351}
351 352
352QIMPenChar *HandwritingTrainer::findPrev() 353QIMPenChar *HandwritingTrainer::findPrev()
353{ 354{
354 if ( !currentChar ) 355 if ( !currentChar )
355 return 0; 356 return 0;
356 QIMPenCharIterator it( currentSet->characters() ); 357 QIMPenCharIterator it( currentSet->characters() );
357 bool found = FALSE; 358 bool found = FALSE;
358 for ( it.toLast(); it.current(); --it ) { 359 for ( it.toLast(); it.current(); --it ) {
359 if ( !found && it.current() == currentChar ) 360 if ( !found && it.current() == currentChar )
360 found = TRUE; 361 found = TRUE;
361 else if ( found && it.current()->character() == currentCode && 362 else if ( found && it.current()->character() == currentCode &&
362 !it.current()->testFlag( QIMPenChar::Deleted ) ) { 363 !it.current()->testFlag( QIMPenChar::Deleted ) ) {
363 return it.current(); 364 return it.current();
364 } 365 }
365 } 366 }
diff --git a/inputmethods/handwriting/qimpeninput.cpp b/inputmethods/handwriting/qimpeninput.cpp
index 6a21931..3f7a347 100644
--- a/inputmethods/handwriting/qimpeninput.cpp
+++ b/inputmethods/handwriting/qimpeninput.cpp
@@ -1,373 +1,370 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "qimpenwidget.h" 21#include "qimpenwidget.h"
22#include "qimpensetup.h" 22#include "qimpensetup.h"
23#include "qimpeninput.h" 23#include "qimpeninput.h"
24#include "qimpencombining.h" 24#include "qimpencombining.h"
25#include "qimpenwordpick.h" 25#include "qimpenwordpick.h"
26#include "qimpenmatch.h" 26#include "qimpenmatch.h"
27#include "qimpenhelp.h" 27#include "qimpenhelp.h"
28 28
29#include <qpe/qpeapplication.h> 29#include <qpe/qpeapplication.h>
30#include <qpe/qdawg.h> 30#include <qpe/qdawg.h>
31#include <qpe/config.h> 31#include <qpe/config.h>
32#include <qpe/global.h> 32#include <qpe/global.h>
33 33
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qlabel.h> 36#include <qlabel.h>
37#include <qtimer.h> 37#include <qtimer.h>
38#include <qdir.h> 38#include <qdir.h>
39 39
40#include <limits.h> 40#include <limits.h>
41 41
42// We'll use little pixmaps for the buttons to save screen space. 42// We'll use little pixmaps for the buttons to save screen space.
43 43
44/* XPM */ 44/* XPM */
45static const char * const pen_xpm[] = { 45static const char * const pen_xpm[] = {
46"12 12 4 1", 46"12 12 4 1",
47 " c None", 47 " c None",
48 ".c #000000", 48 ".c #000000",
49 "+c #FFFFFF", 49 "+c #FFFFFF",
50 "@c #808080", 50 "@c #808080",
51" . ", 51" . ",
52" .+. ", 52" .+. ",
53" ..@@.", 53" ..@@.",
54" .+@.. ", 54" .+@.. ",
55" .+@@. ", 55" .+@@. ",
56" .+@@. ", 56" .+@@. ",
57" .+@@. ", 57" .+@@. ",
58" .@.@. ", 58" .@.@. ",
59" .@@. ", 59" .@@. ",
60" .... ", 60" .... ",
61" .. ", 61" .. ",
62" "}; 62" "};
63 63
64 64
65/* XPM */ 65/* XPM */
66static char * bs_xpm[] = { 66static char * bs_xpm[] = {
67"12 12 5 1", 67"12 12 5 1",
68 " c None", 68 " c None",
69 ".c #333333", 69 ".c #333333",
70 "+c #000000", 70 "+c #000000",
71 "@c #FFFFFF", 71 "@c #FFFFFF",
72 "#c #666666", 72 "#c #666666",
73" ", 73" ",
74" ", 74" ",
75" ", 75" ",
76" . ", 76" . ",
77" ++ ", 77" ++ ",
78" +@#+++++. ", 78" +@#+++++. ",
79" +@@@@@@@@+ ", 79" +@@@@@@@@+ ",
80" +@#+++++. ", 80" +@#+++++. ",
81" ++ ", 81" ++ ",
82" . ", 82" . ",
83" ", 83" ",
84" "}; 84" "};
85 85
86 86
87/* XPM */ 87/* XPM */
88static char * enter_xpm[] = { 88static char * enter_xpm[] = {
89"12 12 5 1", 89"12 12 5 1",
90 " c None", 90 " c None",
91 ".c #333333", 91 ".c #333333",
92 "+c #000000", 92 "+c #000000",
93 "@c #FFFFFF", 93 "@c #FFFFFF",
94 "#c #666666", 94 "#c #666666",
95" ", 95" ",
96" .+. ", 96" .+. ",
97" +@+ ", 97" +@+ ",
98" . +@+ ", 98" . +@+ ",
99" ++ +@+ ", 99" ++ +@+ ",
100" +@#++++@+ ", 100" +@#++++@+ ",
101" +@@@@@@@@+ ", 101" +@@@@@@@@+ ",
102" +@#+++++. ", 102" +@#+++++. ",
103" ++ ", 103" ++ ",
104" . ", 104" . ",
105" ", 105" ",
106" "}; 106" "};
107 107
108 108
109 109
110/* XPM */ 110/* XPM */
111static char * help_xpm[] = { 111static char * help_xpm[] = {
112"12 12 5 1", 112"12 12 5 1",
113 " c None", 113 " c None",
114 ".c #000000", 114 ".c #000000",
115 "+c #FFFFFF", 115 "+c #FFFFFF",
116 "@c #666666", 116 "@c #666666",
117 "#c #333333", 117 "#c #333333",
118" ", 118" ",
119" ... ", 119" ... ",
120" .+++. ", 120" .+++. ",
121" .+..@+. ", 121" .+..@+. ",
122" #.# .+. ", 122" #.# .+. ",
123" .+. ", 123" .+. ",
124" .+. ", 124" .+. ",
125" .+. ", 125" .+. ",
126" .+. ", 126" .+. ",
127" #.# ", 127" #.# ",
128" .+. ", 128" .+. ",
129" #.# "}; 129" #.# "};
130 130
131 131
132/*! 132/*!
133 \class QIMPenInput qimpeninput.h 133 \class QIMPenInput qimpeninput.h
134 134
135 Pen input widget. 135 Pen input widget.
136*/ 136*/
137QIMPenInput::QIMPenInput( QWidget *parent, const char *name, WFlags flags ) 137QIMPenInput::QIMPenInput( QWidget *parent, const char *name, WFlags f )
138 : QFrame( parent, name, flags ), helpDlg(0), profile(0) 138 : QFrame( parent, name, f ), helpDlg(0), profile(0)
139{ 139{
140 setFrameStyle( Box | Plain ); 140 setFrameStyle( Box | Plain );
141 141
142 profileList.setAutoDelete( true ); 142 profileList.setAutoDelete( true );
143 143
144 matcher = new QIMPenMatch( this ); 144 matcher = new QIMPenMatch( this );
145 connect( matcher, SIGNAL(keypress(uint)), this, SLOT(keypress(uint)) ); 145 connect( matcher, SIGNAL(keypress(uint)), this, SLOT(keypress(uint)) );
146 connect( matcher, SIGNAL(erase()), this, SLOT(erase()) ); 146 connect( matcher, SIGNAL(erase()), this, SLOT(erase()) );
147 147
148 QGridLayout *gl = new QGridLayout( this, 5, 2, 1, 0 ); 148 QGridLayout *gl = new QGridLayout( this, 5, 2, 1, 0 );
149 gl->setColStretch( 0, 1 ); 149 gl->setColStretch( 0, 1 );
150 150
151 wordPicker = new QIMPenWordPick( this ); 151 wordPicker = new QIMPenWordPick( this );
152 connect( wordPicker, SIGNAL(wordClicked(const QString &)), 152 connect( wordPicker, SIGNAL(wordClicked(const QString &)),
153 this, SLOT(wordPicked(const QString &)) ); 153 this, SLOT(wordPicked(const QString &)) );
154 connect( matcher, SIGNAL(matchedCharacters(const QIMPenCharMatchList &)), 154 connect( matcher, SIGNAL(matchedCharacters(const QIMPenCharMatchList &)),
155 this, SLOT(matchedCharacters(const QIMPenCharMatchList &)) ); 155 this, SLOT(matchedCharacters(const QIMPenCharMatchList &)) );
156 connect( matcher, SIGNAL(matchedWords(const QIMPenMatch::MatchWordList&)), 156 connect( matcher, SIGNAL(matchedWords(const QIMPenMatch::MatchWordList&)),
157 wordPicker, SLOT(setWords(const QIMPenMatch::MatchWordList&)) ); 157 wordPicker, SLOT(setWords(const QIMPenMatch::MatchWordList&)) );
158 QFont f("smallsmooth",9); 158 QFont f("smallsmooth",9);
159 QFontInfo fi( f ); 159 QFontInfo fi( f );
160 wordPicker->setFont( f ); 160 wordPicker->setFont( f );
161 wordPicker->setBackgroundColor( white ); 161 wordPicker->setBackgroundColor( white );
162 gl->addMultiCellWidget( wordPicker, 0, 0, 0, 1 ); 162 gl->addMultiCellWidget( wordPicker, 0, 0, 0, 1 );
163 if ( !Global::fixedDawg().root() || !matcher->isWordMatchingEnabled() ) 163 if ( !Global::fixedDawg().root() || !matcher->isWordMatchingEnabled() )
164 wordPicker->hide(); 164 wordPicker->hide();
165 165
166 pw = new QIMPenWidget( this ); 166 pw = new QIMPenWidget( this );
167 gl->addMultiCellWidget( pw, 1, 4, 0, 0 ); 167 gl->addMultiCellWidget( pw, 1, 4, 0, 0 );
168 168
169 int bh = pw->sizeHint().height()/4; 169 int bh = pw->sizeHint().height()/4;
170 170
171 QPushButton *b = new QPushButton( this ); 171 QPushButton *b = new QPushButton( this );
172 b->setFocusPolicy( NoFocus ); 172 b->setFocusPolicy( NoFocus );
173 b->setPixmap( QPixmap( (const char **)bs_xpm ) ); 173 b->setPixmap( QPixmap( (const char **)bs_xpm ) );
174 b->setFixedHeight(pw->sizeHint().height()-3*bh); // left-over space goes here 174 b->setFixedHeight(pw->sizeHint().height()-3*bh); // left-over space goes here
175 b->setAutoRepeat( TRUE ); 175 b->setAutoRepeat( TRUE );
176 gl->addWidget( b, 1, 1 ); 176 gl->addWidget( b, 1, 1 );
177 connect( b, SIGNAL(clicked()), SLOT(backspace())); 177 connect( b, SIGNAL(clicked()), SLOT(backspace()));
178 178
179 b = new QPushButton( this ); 179 b = new QPushButton( this );
180 b->setFocusPolicy( NoFocus ); 180 b->setFocusPolicy( NoFocus );
181 b->setPixmap( QPixmap( (const char **)enter_xpm ) ); 181 b->setPixmap( QPixmap( (const char **)enter_xpm ) );
182 b->setFixedHeight(bh); 182 b->setFixedHeight(bh);
183 b->setAutoRepeat( TRUE ); 183 b->setAutoRepeat( TRUE );
184 gl->addWidget( b, 2, 1 ); 184 gl->addWidget( b, 2, 1 );
185 connect( b, SIGNAL(clicked()), SLOT(enter())); 185 connect( b, SIGNAL(clicked()), SLOT(enter()));
186 186
187 helpBtn = new QPushButton( this ); 187 helpBtn = new QPushButton( this );
188 helpBtn->setFocusPolicy( NoFocus ); 188 helpBtn->setFocusPolicy( NoFocus );
189 helpBtn->setPixmap( QPixmap( (const char **)help_xpm ) ); 189 helpBtn->setPixmap( QPixmap( (const char **)help_xpm ) );
190 helpBtn->setFixedHeight(bh); 190 helpBtn->setFixedHeight(bh);
191 gl->addWidget( helpBtn, 3, 1 ); 191 gl->addWidget( helpBtn, 3, 1 );
192 connect( helpBtn, SIGNAL(clicked()), SLOT(help())); 192 connect( helpBtn, SIGNAL(clicked()), SLOT(help()));
193 193
194 QPixmap pm( (const char **)pen_xpm ); 194 QPixmap pm( (const char **)pen_xpm );
195 setupBtn = new QPushButton( this ); 195 setupBtn = new QPushButton( this );
196 setupBtn->setFocusPolicy( NoFocus ); 196 setupBtn->setFocusPolicy( NoFocus );
197 setupBtn->setPixmap( pm ); 197 setupBtn->setPixmap( pm );
198 setupBtn->setFixedHeight(bh); 198 setupBtn->setFixedHeight(bh);
199 gl->addWidget( setupBtn, 4, 1 ); 199 gl->addWidget( setupBtn, 4, 1 );
200 connect( setupBtn, SIGNAL(clicked()), SLOT(setup())); 200 connect( setupBtn, SIGNAL(clicked()), SLOT(setup()));
201 201
202 connect( matcher, SIGNAL(removeStroke()), pw, SLOT(removeStroke()) ); 202 connect( matcher, SIGNAL(removeStroke()), pw, SLOT(removeStroke()) );
203 connect( pw, SIGNAL(changeCharSet( QIMPenCharSet * )), 203 connect( pw, SIGNAL(changeCharSet( QIMPenCharSet * )),
204 matcher, SLOT(setCharSet( QIMPenCharSet * )) ); 204 matcher, SLOT(setCharSet( QIMPenCharSet * )) );
205 connect( pw, SIGNAL(changeCharSet( int )), 205 connect( pw, SIGNAL(changeCharSet( int )),
206 this, SLOT(selectCharSet( int )) ); 206 this, SLOT(selectCharSet( int )) );
207 connect( pw, SIGNAL(beginStroke()), 207 connect( pw, SIGNAL(beginStroke()),
208 matcher, SLOT(beginStroke()) ); 208 matcher, SLOT(beginStroke()) );
209 connect( pw, SIGNAL(stroke( QIMPenStroke * )), 209 connect( pw, SIGNAL(stroke( QIMPenStroke * )),
210 this, SLOT(strokeEntered( QIMPenStroke * )) ); 210 this, SLOT(strokeEntered( QIMPenStroke * )) );
211 connect( pw, SIGNAL(stroke( QIMPenStroke * )), 211 connect( pw, SIGNAL(stroke( QIMPenStroke * )),
212 matcher, SLOT(strokeEntered( QIMPenStroke * )) ); 212 matcher, SLOT(strokeEntered( QIMPenStroke * )) );
213 213
214 shortcutCharSet = 0; 214 shortcutCharSet = 0;
215 currCharSet = 0; 215 currCharSet = 0;
216 setupDlg = 0; 216 setupDlg = 0;
217 profile = 0; 217 profile = 0;
218 mode = Normal; 218 mode = Normal;
219 219
220 loadProfiles(); 220 loadProfiles();
221} 221}
222 222
223QIMPenInput::~QIMPenInput() 223QIMPenInput::~QIMPenInput()
224{ 224{
225 delete (HandwritingHelp*) helpDlg; 225 delete (HandwritingHelp*) helpDlg;
226} 226}
227 227
228QSize QIMPenInput::sizeHint() const 228QSize QIMPenInput::sizeHint() const
229{ 229{
230 int fw = frameWidth(); 230 int fw = frameWidth();
231 int ps = wordPicker->isHidden() ? 0 : wordPicker->sizeHint().height(); 231 int ps = wordPicker->isHidden() ? 0 : wordPicker->sizeHint().height();
232 return pw->sizeHint() + QSize( fw*2, fw*2+ps ); 232 return pw->sizeHint() + QSize( fw*2, fw*2+ps );
233} 233}
234 234
235void QIMPenInput::loadProfiles() 235void QIMPenInput::loadProfiles()
236{ 236{
237 profileList.clear(); 237 profileList.clear();
238 profile = 0; 238 profile = 0;
239 delete shortcutCharSet; 239 delete shortcutCharSet;
240 shortcutCharSet = new QIMPenCharSet(); 240 shortcutCharSet = new QIMPenCharSet();
241 shortcutCharSet->setTitle( "Shortcut" ); 241 shortcutCharSet->setTitle( tr("Shortcut") );
242 QString path = QPEApplication::qpeDir() + "etc/qimpen"; 242 QString path = QPEApplication::qpeDir() + "etc/qimpen";
243 QDir dir( path, "*.conf" ); 243 QDir dir( path, "*.conf" );
244 QStringList list = dir.entryList(); 244 QStringList list = dir.entryList();
245 QStringList::Iterator it; 245 QStringList::Iterator it;
246 for ( it = list.begin(); it != list.end(); ++it ) { 246 for ( it = list.begin(); it != list.end(); ++it ) {
247 QIMPenProfile *p = new QIMPenProfile( path + "/" + *it ); 247 QIMPenProfile *p = new QIMPenProfile( path + "/" + *it );
248 profileList.append( p ); 248 profileList.append( p );
249 if ( p->shortcut() ) { 249 if ( p->shortcut() ) {
250 QIMPenCharIterator it( p->shortcut()->characters() ); 250 QIMPenCharIterator it( p->shortcut()->characters() );
251 for ( ; it.current(); ++it ) { 251 for ( ; it.current(); ++it ) {
252 shortcutCharSet->addChar( new QIMPenChar(*it.current()) ); 252 shortcutCharSet->addChar( new QIMPenChar(*it.current()) );
253 } 253 }
254 } 254 }
255 } 255 }
256 256
257
258 Config config( "handwriting" ); 257 Config config( "handwriting" );
259 config.setGroup( "Settings" ); 258 config.setGroup( "Settings" );
260 QString prof = config.readEntry( "Profile", "Default" ); 259 QString prof = config.readEntry( "Profile", "Default" );
261 selectProfile( prof ); 260 selectProfile( prof );
262} 261}
263 262
264void QIMPenInput::selectProfile( const QString &name ) 263void QIMPenInput::selectProfile( const QString &name )
265{ 264{
266 QListIterator<QIMPenProfile> it( profileList ); 265 QListIterator<QIMPenProfile> it( profileList );
267 for ( ; it.current(); ++it ) { 266 for ( ; it.current(); ++it ) {
268 if ( it.current()->name() == name ) { 267 if ( it.current()->name() == name ) {
269 profile = it.current(); 268 profile = it.current();
270 break; 269 break;
271 } 270 }
272 } 271 }
273 272
274 if ( !it.current() ) { 273 if ( !it.current() )
275 qWarning("No profile selected!\n"); 274 return;
276 return;
277 }
278 275
279 pw->clearCharSets(); 276 pw->clearCharSets();
280 baseSets.clear(); 277 baseSets.clear();
281 278
282 matcher->setMultiStrokeTimeout( profile->multiStrokeTimeout() ); 279 matcher->setMultiStrokeTimeout( profile->multiStrokeTimeout() );
283 matcher->setWordMatchingEnabled( profile->matchWords() ); 280 matcher->setWordMatchingEnabled( profile->matchWords() );
284 281
285 if ( !Global::fixedDawg().root() || !matcher->isWordMatchingEnabled() ) 282 if ( !Global::fixedDawg().root() || !matcher->isWordMatchingEnabled() )
286 wordPicker->hide(); 283 wordPicker->hide();
287 else 284 else
288 wordPicker->show(); 285 wordPicker->show();
289 286
290 if ( profile->uppercase() && profile->style() == QIMPenProfile::BothCases ) { 287 if ( profile->uppercase() && profile->style() == QIMPenProfile::BothCases ) {
291 baseSets.append( profile->uppercase() ); 288 baseSets.append( profile->uppercase() );
292 pw->insertCharSet( profile->uppercase() ); 289 pw->insertCharSet( profile->uppercase() );
293 } 290 }
294 291
295 if ( profile->lowercase() ) { 292 if ( profile->lowercase() ) {
296 baseSets.append( profile->lowercase() ); 293 baseSets.append( profile->lowercase() );
297 pw->insertCharSet( profile->lowercase(), profile->style() == QIMPenProfile::BothCases ? 1 : 2 ); 294 pw->insertCharSet( profile->lowercase(), profile->style() == QIMPenProfile::BothCases ? 1 : 2 );
298 } 295 }
299 296
300 if ( profile->numeric() ) { 297 if ( profile->numeric() ) {
301 baseSets.append( profile->numeric() ); 298 baseSets.append( profile->numeric() );
302 pw->insertCharSet( profile->numeric() ); 299 pw->insertCharSet( profile->numeric() );
303 } 300 }
304 301
305 if ( helpDlg ) 302 if ( helpDlg )
306 delete (HandwritingHelp*) helpDlg; 303 delete (HandwritingHelp*) helpDlg;
307} 304}
308 305
309void QIMPenInput::wordPicked( const QString &w ) 306void QIMPenInput::wordPicked( const QString &w )
310{ 307{
311 int bs = matcher->word().length(); 308 int bs = matcher->word().length();
312 for ( int i = 0; i < bs; i++ ) 309 for ( int i = 0; i < bs; i++ )
313 keypress( Qt::Key_Backspace << 16 ); 310 keypress( Qt::Key_Backspace << 16 );
314 311
315 for ( unsigned int i = 0; i < w.length(); i++ ) 312 for ( unsigned int i = 0; i < w.length(); i++ )
316 keypress( w[i].unicode() ); 313 keypress( w[i].unicode() );
317 314
318 matcher->resetState(); 315 matcher->resetState();
319 wordPicker->clear(); 316 wordPicker->clear();
320} 317}
321 318
322void QIMPenInput::selectCharSet( int idx ) 319void QIMPenInput::selectCharSet( int idx )
323{ 320{
324 if ( mode == Switch ) { 321 if ( mode == Switch ) {
325 //qDebug( "Switch back to normal" ); 322 //qDebug( "Switch back to normal" );
326 pw->changeCharSet( baseSets.at(currCharSet), currCharSet ); 323 pw->changeCharSet( baseSets.at(currCharSet), currCharSet );
327 mode = Normal; 324 mode = Normal;
328 } 325 }
329 currCharSet = idx; 326 currCharSet = idx;
330} 327}
331 328
332void QIMPenInput::beginStroke() 329void QIMPenInput::beginStroke()
333{ 330{
334} 331}
335 332
336void QIMPenInput::strokeEntered( QIMPenStroke * ) 333void QIMPenInput::strokeEntered( QIMPenStroke * )
337{ 334{
338 pw->greyStroke(); 335 pw->greyStroke();
339} 336}
340 337
341void QIMPenInput::erase() 338void QIMPenInput::erase()
342{ 339{
343 keypress( Qt::Key_Backspace << 16 ); 340 keypress( Qt::Key_Backspace << 16 );
344} 341}
345 342
346void QIMPenInput::matchedCharacters( const QIMPenCharMatchList &cl ) 343void QIMPenInput::matchedCharacters( const QIMPenCharMatchList &cl )
347{ 344{
348 const QIMPenChar *ch = cl.first().penChar; 345 const QIMPenChar *ch = cl.first().penChar;
349 int scan = ch->character() >> 16; 346 int scan = ch->character() >> 16;
350 347
351 if ( scan < QIMPenChar::ModeBase ) 348 if ( scan < QIMPenChar::ModeBase )
352 return; 349 return;
353 350
354 // We matched a special character... 351 // We matched a special character...
355 352
356 switch ( scan ) { 353 switch ( scan ) {
357 case QIMPenChar::Caps: 354 case QIMPenChar::Caps:
358 if ( profile->style() == QIMPenProfile::ToggleCases ) { 355 if ( profile->style() == QIMPenProfile::ToggleCases ) {
359 // qDebug( "Caps" ); 356 // qDebug( "Caps" );
360 if ( mode == SwitchLock ) { 357 if ( mode == SwitchLock ) {
361 // qDebug( "Switch to normal" ); 358 // qDebug( "Switch to normal" );
362 pw->changeCharSet( profile->lowercase(), currCharSet ); 359 pw->changeCharSet( profile->lowercase(), currCharSet );
363 mode = Switch; 360 mode = Switch;
364 } else { 361 } else {
365 // qDebug( "Switch to upper" ); 362 // qDebug( "Switch to upper" );
366 pw->changeCharSet( profile->uppercase(), currCharSet ); 363 pw->changeCharSet( profile->uppercase(), currCharSet );
367 mode = Switch; 364 mode = Switch;
368 } 365 }
369 } 366 }
370 break; 367 break;
371 case QIMPenChar::CapsLock: 368 case QIMPenChar::CapsLock:
372 if ( profile->style() == QIMPenProfile::ToggleCases ) { 369 if ( profile->style() == QIMPenProfile::ToggleCases ) {
373 // qDebug( "CapsLock" ); 370 // qDebug( "CapsLock" );
diff --git a/inputmethods/handwriting/qimpenprofile.cpp b/inputmethods/handwriting/qimpenprofile.cpp
index 4b5bb83..3b1b5e9 100644
--- a/inputmethods/handwriting/qimpenprofile.cpp
+++ b/inputmethods/handwriting/qimpenprofile.cpp
@@ -1,193 +1,193 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "qimpencombining.h" 21#include "qimpencombining.h"
22#include "qimpenprofile.h" 22#include "qimpenprofile.h"
23 23
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/config.h> 25#include <qpe/config.h>
26#include <qpe/global.h> 26#include <qpe/global.h>
27 27
28 28
29QIMPenProfile::QIMPenProfile( const QString &fn ) 29QIMPenProfile::QIMPenProfile( const QString &fn )
30 : filename( fn ) 30 : filename( fn )
31{ 31{
32 sets.setAutoDelete( true ); 32 sets.setAutoDelete( true );
33 33
34 Config config( filename, Config::File ); 34 Config config( filename, Config::File );
35 config.setGroup( "Handwriting" ); 35 config.setGroup( "Handwriting" );
36 36
37 pname = config.readEntry( "Name" ); 37 pname = config.readEntry( "Name" );
38 pdesc = config.readEntry( "Description" ); 38 pdesc = config.readEntry( "Description" );
39 39
40 tstyle = config.readBoolEntry( "CanSelectStyle", false ); 40 tstyle = config.readBoolEntry( "CanSelectStyle", false );
41 41
42 wordMatch = config.readBoolEntry( "MatchWords", true ); 42 wordMatch = config.readBoolEntry( "MatchWords", true );
43 43
44 config.setGroup( "Settings" ); 44 config.setGroup( "Settings" );
45 45
46 pstyle = BothCases; 46 pstyle = BothCases;
47 QString s = config.readEntry( "Style", "BothCases" ); 47 QString s = config.readEntry( "Style", "BothCases" );
48 if ( s == "ToggleCases" ) 48 if ( s == "ToggleCases" )
49 pstyle = ToggleCases; 49 pstyle = ToggleCases;
50 50
51 msTimeout = config.readNumEntry( "MultiTimeout", 500 ); 51 msTimeout = config.readNumEntry( "MultiTimeout", 500 );
52 52
53 // Read user configuration 53 // Read user configuration
54 Config usrConfig( userConfig() ); 54 Config usrConfig( userConfig() );
55 usrConfig.setGroup( "Settings" ); 55 usrConfig.setGroup( "Settings" );
56 msTimeout = usrConfig.readNumEntry( "MultiTimeout", msTimeout ); 56 msTimeout = usrConfig.readNumEntry( "MultiTimeout", msTimeout );
57 57
58 if ( tstyle && usrConfig.hasKey( "Style" ) ) { 58 if ( tstyle && usrConfig.hasKey( "Style" ) ) {
59 pstyle = BothCases; 59 pstyle = BothCases;
60 QString s = usrConfig.readEntry( "Style", "BothCases" ); 60 QString s = usrConfig.readEntry( "Style", "BothCases" );
61 if ( s == "ToggleCases" ) 61 if ( s == "ToggleCases" )
62 pstyle = ToggleCases; 62 pstyle = ToggleCases;
63 } 63 }
64} 64}
65 65
66void QIMPenProfile::setStyle( Style s ) 66void QIMPenProfile::setStyle( Style s )
67{ 67{
68 if ( tstyle && s != pstyle ) { 68 if ( tstyle && s != pstyle ) {
69 pstyle = s; 69 pstyle = s;
70 Config config( userConfig() ); 70 Config config( userConfig() );
71 config.setGroup( "Settings" ); 71 config.setGroup( "Settings" );
72 QString s = pstyle == ToggleCases ? "ToggleCases" : "BothCases"; 72 QString s = pstyle == ToggleCases ? "ToggleCases" : "BothCases";
73 config.writeEntry( "Style", s ); 73 config.writeEntry( "Style", s );
74 } 74 }
75} 75}
76 76
77void QIMPenProfile::setMultiStrokeTimeout( int t ) 77void QIMPenProfile::setMultiStrokeTimeout( int t )
78{ 78{
79 if ( t != msTimeout ) { 79 if ( t != msTimeout ) {
80 msTimeout = t; 80 msTimeout = t;
81 Config config( userConfig() ); 81 Config config( userConfig() );
82 config.setGroup( "Settings" ); 82 config.setGroup( "Settings" );
83 config.writeEntry( "MultiTimeout", msTimeout ); 83 config.writeEntry( "MultiTimeout", msTimeout );
84 } 84 }
85} 85}
86 86
87QString QIMPenProfile::userConfig() 87QString QIMPenProfile::userConfig()
88{ 88{
89 QString un = filename; 89 QString un = filename;
90 int pos = un.findRev( '/' ); 90 int pos = un.findRev( '/' );
91 if ( pos >= 0 ) 91 if ( pos >= 0 )
92 un = un.mid( pos + 1 ); 92 un = un.mid( pos + 1 );
93 pos = un.find( '.' ); 93 pos = un.find( '.' );
94 if ( pos > 0 ) 94 if ( pos > 0 )
95 un.truncate( pos ); 95 un.truncate( pos );
96 96
97 un = "handwriting-" + un; 97 un = "handwriting-" + un; // No tr
98 98
99 return un; 99 return un;
100} 100}
101 101
102void QIMPenProfile::loadData() 102void QIMPenProfile::loadData()
103{ 103{
104 Config config( filename, Config::File ); 104 Config config( filename, Config::File );
105 config.setGroup( "CharSets" ); 105 config.setGroup( "CharSets" );
106 106
107 QString baseDir = QPEApplication::qpeDir(); 107 QString baseDir = QPEApplication::qpeDir();
108 baseDir += "/etc/"; 108 baseDir += "/etc/";
109 // accents 109 // accents
110 QIMPenCombining *combining = 0; 110 QIMPenCombining *combining = 0;
111 QString s = config.readEntry( "Combining" ); 111 QString s = config.readEntry( "Combining" );
112 if ( !s.isEmpty() ) { 112 if ( !s.isEmpty() ) {
113 combining = new QIMPenCombining( baseDir + "qimpen/" + s ); 113 combining = new QIMPenCombining( baseDir + "qimpen/" + s );
114 if ( combining->isEmpty() ) { 114 if ( combining->isEmpty() ) {
115 delete combining; 115 delete combining;
116 combining = 0; 116 combining = 0;
117 } 117 }
118 } 118 }
119 // uppercase latin1 119 // uppercase latin1
120 QIMPenCharSet *cs = 0; 120 QIMPenCharSet *cs = 0;
121 s = config.readEntry( "Uppercase" ); 121 s = config.readEntry( "Uppercase" );
122 if ( !s.isEmpty() ) { 122 if ( !s.isEmpty() ) {
123 cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); 123 cs = new QIMPenCharSet( baseDir + "qimpen/" + s );
124 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); 124 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
125 if ( !cs->isEmpty() ) { 125 if ( !cs->isEmpty() ) {
126 if ( combining ) 126 if ( combining )
127 combining->addCombined( cs ); 127 combining->addCombined( cs );
128 sets.append( cs ); 128 sets.append( cs );
129 } else { 129 } else {
130 delete cs; 130 delete cs;
131 } 131 }
132 } 132 }
133 // lowercase latin1 133 // lowercase latin1
134 s = config.readEntry( "Lowercase" ); 134 s = config.readEntry( "Lowercase" );
135 if ( !s.isEmpty() ) { 135 if ( !s.isEmpty() ) {
136 cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); 136 cs = new QIMPenCharSet( baseDir + "qimpen/" + s );
137 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); 137 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
138 if ( !cs->isEmpty() ) { 138 if ( !cs->isEmpty() ) {
139 if ( combining ) 139 if ( combining )
140 combining->addCombined( cs ); 140 combining->addCombined( cs );
141 sets.append( cs ); 141 sets.append( cs );
142 } else { 142 } else {
143 delete cs; 143 delete cs;
144 } 144 }
145 } 145 }
146 // numeric (may comtain punctuation and symbols) 146 // numeric (may comtain punctuation and symbols)
147 s = config.readEntry( "Numeric" ); 147 s = config.readEntry( "Numeric" );
148 if ( !s.isEmpty() ) { 148 if ( !s.isEmpty() ) {
149 cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); 149 cs = new QIMPenCharSet( baseDir + "qimpen/" + s );
150 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); 150 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
151 if ( !cs->isEmpty() ) { 151 if ( !cs->isEmpty() ) {
152 sets.append( cs ); 152 sets.append( cs );
153 } else { 153 } else {
154 delete cs; 154 delete cs;
155 } 155 }
156 } 156 }
157 // punctuation 157 // punctuation
158 s = config.readEntry( "Punctuation" ); 158 s = config.readEntry( "Punctuation" );
159 if ( !s.isEmpty() ) { 159 if ( !s.isEmpty() ) {
160 cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); 160 cs = new QIMPenCharSet( baseDir + "qimpen/" + s );
161 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); 161 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
162 if ( !cs->isEmpty() ) { 162 if ( !cs->isEmpty() ) {
163 sets.append( cs ); 163 sets.append( cs );
164 } else { 164 } else {
165 delete cs; 165 delete cs;
166 } 166 }
167 } 167 }
168 // symbol 168 // symbol
169 s = config.readEntry( "Symbol" ); 169 s = config.readEntry( "Symbol" );
170 if ( !s.isEmpty() ) { 170 if ( !s.isEmpty() ) {
171 cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); 171 cs = new QIMPenCharSet( baseDir + "qimpen/" + s );
172 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); 172 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
173 if ( !cs->isEmpty() ) { 173 if ( !cs->isEmpty() ) {
174 sets.append( cs ); 174 sets.append( cs );
175 } else { 175 } else {
176 delete cs; 176 delete cs;
177 } 177 }
178 } 178 }
179 // shortcut 179 // shortcut
180 s = config.readEntry( "Shortcut" ); 180 s = config.readEntry( "Shortcut" );
181 if ( !s.isEmpty() ) { 181 if ( !s.isEmpty() ) {
182 cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); 182 cs = new QIMPenCharSet( baseDir + "qimpen/" + s );
183 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); 183 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
184 if ( !cs->isEmpty() ) { 184 if ( !cs->isEmpty() ) {
185 sets.append( cs ); 185 sets.append( cs );
186 } else { 186 } else {
187 delete cs; 187 delete cs;
188 } 188 }
189 } 189 }
190 190
191 if ( combining ) 191 if ( combining )
192 delete combining; 192 delete combining;
193} 193}
diff --git a/inputmethods/handwriting/qimpensetup.cpp b/inputmethods/handwriting/qimpensetup.cpp
index 2c06fbc..5d49e03 100644
--- a/inputmethods/handwriting/qimpensetup.cpp
+++ b/inputmethods/handwriting/qimpensetup.cpp
@@ -1,100 +1,100 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "qimpenwidget.h" 21#include "qimpenwidget.h"
22#include "qimpenprefbase.h" 22#include "qimpenprefbase.h"
23#include "qimpensetup.h" 23#include "qimpensetup.h"
24 24
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/config.h> 26#include <qpe/config.h>
27 27
28#include <qcombobox.h> 28#include <qcombobox.h>
29#include <qlistbox.h> 29#include <qlistbox.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <qpushbutton.h> 31#include <qpushbutton.h>
32#include <qlayout.h> 32#include <qlayout.h>
33#include <qpixmap.h> 33#include <qpixmap.h>
34#include <qbuttongroup.h> 34#include <qbuttongroup.h>
35#include <qslider.h> 35#include <qslider.h>
36#include <qtabwidget.h> 36#include <qtabwidget.h>
37#include <qdir.h> 37#include <qdir.h>
38#include <qmessagebox.h> 38#include <qmessagebox.h>
39 39
40 40
41/* XPM */ 41/* XPM */
42static const char * const left_xpm[] = { 42static const char * const left_xpm[] = {
43"16 16 2 1", 43"16 16 2 1",
44 " c None", 44 " c None",
45 ".c #000000", 45 ".c #000000",
46" ", 46" ",
47" ", 47" ",
48" ", 48" ",
49" . ", 49" . ",
50" .. ", 50" .. ",
51" ... ", 51" ... ",
52" .... ", 52" .... ",
53" ..... ", 53" ..... ",
54" ...... ", 54" ...... ",
55" ..... ", 55" ..... ",
56" .... ", 56" .... ",
57" ... ", 57" ... ",
58" .. ", 58" .. ",
59" . ", 59" . ",
60" ", 60" ",
61" "}; 61" "};
62 62
63 63
64/* XPM */ 64/* XPM */
65static const char * const right_xpm[] = { 65static const char * const right_xpm[] = {
66"16 16 2 1", 66"16 16 2 1",
67 " c None", 67 " c None",
68 ".c #000000", 68 ".c #000000",
69" ", 69" ",
70" ", 70" ",
71" ", 71" ",
72" . ", 72" . ",
73" .. ", 73" .. ",
74" ... ", 74" ... ",
75" .... ", 75" .... ",
76" ..... ", 76" ..... ",
77" ...... ", 77" ...... ",
78" ..... ", 78" ..... ",
79" .... ", 79" .... ",
80" ... ", 80" ... ",
81" .. ", 81" .. ",
82" . ", 82" . ",
83" ", 83" ",
84" "}; 84" "};
85 85
86 86
87 87
88QIMPenSetup::QIMPenSetup( QIMPenProfile *p, QWidget *parent, 88QIMPenSetup::QIMPenSetup( QIMPenProfile *p, QWidget *parent,
89 const char *name, bool modal, int WFlags ) 89 const char *name, bool modal, int WFlags )
90 : QDialog( parent, name, modal, WFlags ), profileCombo(0), profile(p) 90 : QDialog( parent, name, modal, WFlags ), profileCombo(0), profile(p)
91{ 91{
92 setCaption( tr("Setup Handwriting Input") ); 92 setCaption( tr("Setup Handwriting Input") );
93 93
94 QVBoxLayout *vb = new QVBoxLayout( this ); 94 QVBoxLayout *vb = new QVBoxLayout( this );
95 95
96#if 1 96#if 1
97 profileList.setAutoDelete( true ); 97 profileList.setAutoDelete( true );
98 QHBoxLayout *hb = new QHBoxLayout( vb ); 98 QHBoxLayout *hb = new QHBoxLayout( vb );
99 hb->setMargin( 6 ); 99 hb->setMargin( 6 );
100 QLabel *l = new QLabel( tr("Character Profile:"), this ); 100 QLabel *l = new QLabel( tr("Character Profile:"), this );
@@ -142,335 +142,335 @@ void QIMPenSetup::loadProfiles()
142 QIMPenProfile *p = new QIMPenProfile( path + "/" + *it ); 142 QIMPenProfile *p = new QIMPenProfile( path + "/" + *it );
143 profileList.append( p ); 143 profileList.append( p );
144 profileCombo->insertItem( p->name() ); 144 profileCombo->insertItem( p->name() );
145 if ( p->name() == profile->name() ) { 145 if ( p->name() == profile->name() ) {
146 profileCombo->setCurrentItem( profileCombo->count()-1 ); 146 profileCombo->setCurrentItem( profileCombo->count()-1 );
147 profile = p; 147 profile = p;
148 } 148 }
149 } 149 }
150} 150}
151 151
152void QIMPenSetup::styleClicked( int id ) 152void QIMPenSetup::styleClicked( int id )
153{ 153{
154 style = id; 154 style = id;
155} 155}
156 156
157void QIMPenSetup::multiTimeoutChanged( int v ) 157void QIMPenSetup::multiTimeoutChanged( int v )
158{ 158{
159 multiTimeout = v; 159 multiTimeout = v;
160 pref->multiStrokeLabel->setText( tr("%1 ms").arg(v) ); 160 pref->multiStrokeLabel->setText( tr("%1 ms").arg(v) );
161} 161}
162 162
163void QIMPenSetup::selectProfile( const QString &p ) 163void QIMPenSetup::selectProfile( const QString &p )
164{ 164{
165 if ( p == profile->name() ) 165 if ( p == profile->name() )
166 return; 166 return;
167 167
168 profile->setStyle( style ? QIMPenProfile::ToggleCases : QIMPenProfile::BothCases ); 168 profile->setStyle( style ? QIMPenProfile::ToggleCases : QIMPenProfile::BothCases );
169 profile->setMultiStrokeTimeout( multiTimeout ); 169 profile->setMultiStrokeTimeout( multiTimeout );
170 170
171 for ( int i = 0; i < (int)profileList.count(); i++ ) { 171 for ( int i = 0; i < (int)profileList.count(); i++ ) {
172 if ( profileList.at(i)->name() == p ) { 172 if ( profileList.at(i)->name() == p ) {
173 profile = profileList.at(i); 173 profile = profileList.at(i);
174 style = profile->style() == QIMPenProfile::ToggleCases ? 1 : 0; 174 style = profile->style() == QIMPenProfile::ToggleCases ? 1 : 0;
175 pref->inputStyle->setButton( style ); 175 pref->inputStyle->setButton( style );
176 pref->inputStyle->setEnabled( profile->canSelectStyle() ); 176 pref->inputStyle->setEnabled( profile->canSelectStyle() );
177 multiTimeout = profile->multiStrokeTimeout(); 177 multiTimeout = profile->multiStrokeTimeout();
178 pref->multiStrokeSlider->setValue( multiTimeout ); 178 pref->multiStrokeSlider->setValue( multiTimeout );
179 multiTimeoutChanged( multiTimeout ); 179 multiTimeoutChanged( multiTimeout );
180 edit->setProfile( profile ); 180 edit->setProfile( profile );
181 break; 181 break;
182 } 182 }
183 } 183 }
184} 184}
185 185
186void QIMPenSetup::accept() 186void QIMPenSetup::accept()
187{ 187{
188 profile->setStyle( style ? QIMPenProfile::ToggleCases : QIMPenProfile::BothCases ); 188 profile->setStyle( style ? QIMPenProfile::ToggleCases : QIMPenProfile::BothCases );
189 profile->setMultiStrokeTimeout( multiTimeout ); 189 profile->setMultiStrokeTimeout( multiTimeout );
190 // Save current profile 190 // Save current profile
191 if ( profileCombo ) { 191 if ( profileCombo ) {
192 Config config( "handwriting" ); 192 Config config( "handwriting" );
193 config.setGroup( "Settings" ); 193 config.setGroup( "Settings" );
194 config.writeEntry( "Profile", profileCombo->currentText() ); 194 config.writeEntry( "Profile", profileCombo->currentText() );
195 } 195 }
196 // Save charsets 196 // Save charsets
197 bool ok = TRUE; 197 bool ok = TRUE;
198 for ( int i = 0; i < (int)profileList.count(); i++ ) { 198 for ( int i = 0; i < (int)profileList.count(); i++ ) {
199 QIMPenProfile *prof = profileList.at(i); 199 QIMPenProfile *prof = profileList.at(i);
200 QIMPenCharSetIterator it(prof->charSets()); 200 QIMPenCharSetIterator it(prof->charSets());
201 for ( ; it.current(); ++it ) { 201 for ( ; it.current(); ++it ) {
202 if ( !(it.current()->save( QIMPenCharSet::User )) ) { 202 if ( !(it.current()->save( QIMPenCharSet::User )) ) {
203 ok = FALSE; 203 ok = FALSE;
204 break; 204 break;
205 } 205 }
206 } 206 }
207 } 207 }
208 if ( !ok ) { 208 if ( !ok ) {
209 if ( QMessageBox::critical( 0, tr( "Out of space" ), 209 if ( QMessageBox::critical( 0, tr( "Out of space" ),
210 tr("Unable to save information.\n" 210 tr("Unable to save information.\n"
211 "Free up some space\n" 211 "Free up some space\n"
212 "and try again.\n" 212 "and try again.\n"
213 "\nQuit anyway?"), 213 "\nQuit anyway?"),
214 QMessageBox::Yes|QMessageBox::Escape, 214 QMessageBox::Yes|QMessageBox::Escape,
215 QMessageBox::No|QMessageBox::Default ) 215 QMessageBox::No|QMessageBox::Default )
216 != QMessageBox::No ) { 216 != QMessageBox::No ) {
217 QDialog::accept(); 217 QDialog::accept();
218 } 218 }
219 } else { 219 } else {
220 QDialog::accept(); 220 QDialog::accept();
221 } 221 }
222} 222}
223 223
224//--------------------------------------------------------------------------- 224//---------------------------------------------------------------------------
225 225
226QIMPenInputCharDlg::QIMPenInputCharDlg( QWidget *parent, const char *name, 226QIMPenInputCharDlg::QIMPenInputCharDlg( QWidget *parent, const char *name,
227 bool modal, int WFlags) 227 bool modal, int WFlags)
228 : QDialog( parent, name, modal, WFlags ) 228 : QDialog( parent, name, modal, WFlags )
229{ 229{
230 setCaption( tr("Enter new character") ); 230 setCaption( tr("Enter new character") );
231 uni = 0; 231 uni = 0;
232 232
233 QVBoxLayout *vb = new QVBoxLayout( this, 10 ); 233 QVBoxLayout *vb = new QVBoxLayout( this, 10 );
234 234
235 QHBoxLayout *hb = new QHBoxLayout(); 235 QHBoxLayout *hb = new QHBoxLayout();
236 vb->addLayout( hb ); 236 vb->addLayout( hb );
237 237
238 QLabel *label = new QLabel( "Character:", this ); 238 QLabel *label = new QLabel( tr("Character:"), this );
239 hb->addWidget( label ); 239 hb->addWidget( label );
240 240
241 QComboBox *cb = new QComboBox( TRUE, this ); 241 QComboBox *cb = new QComboBox( TRUE, this );
242 connect( cb, SIGNAL(activated(int)), SLOT(setSpecial(int)) ); 242 connect( cb, SIGNAL(activated(int)), SLOT(setSpecial(int)) );
243 connect( cb, SIGNAL(textChanged(const QString &)), 243 connect( cb, SIGNAL(textChanged(const QString &)),
244 SLOT(setCharacter(const QString &)) ); 244 SLOT(setCharacter(const QString &)) );
245 addSpecial( cb ); 245 addSpecial( cb );
246 cb->setEditText( "" ); 246 cb->setEditText( "" );
247 hb->addWidget( cb ); 247 hb->addWidget( cb );
248 248
249 hb = new QHBoxLayout(); 249 hb = new QHBoxLayout();
250 vb->addLayout( hb ); 250 vb->addLayout( hb );
251 251
252 QPushButton *pb = new QPushButton( "OK", this ); 252 QPushButton *pb = new QPushButton( "OK", this );
253 connect( pb, SIGNAL(clicked()), SLOT(accept())); 253 connect( pb, SIGNAL(clicked()), SLOT(accept()));
254 hb->addWidget( pb ); 254 hb->addWidget( pb );
255 pb = new QPushButton( "Cancel", this ); 255 pb = new QPushButton( "Cancel", this );
256 connect( pb, SIGNAL(clicked()), SLOT(reject())); 256 connect( pb, SIGNAL(clicked()), SLOT(reject()));
257 hb->addWidget( pb ); 257 hb->addWidget( pb );
258 258
259 cb->setFocus(); 259 cb->setFocus();
260} 260}
261 261
262void QIMPenInputCharDlg::addSpecial( QComboBox *cb ) 262void QIMPenInputCharDlg::addSpecial( QComboBox *cb )
263{ 263{
264 int i = 0; 264 int i = 0;
265 while ( qimpen_specialKeys[i].code != Key_unknown ) { 265 while ( qimpen_specialKeys[i].code != Key_unknown ) {
266 cb->insertItem( qimpen_specialKeys[i].name ); 266 cb->insertItem( qimpen_specialKeys[i].name );
267 i++; 267 i++;
268 } 268 }
269} 269}
270 270
271void QIMPenInputCharDlg::setSpecial( int sp ) 271void QIMPenInputCharDlg::setSpecial( int sp )
272{ 272{
273 uni = qimpen_specialKeys[sp].code << 16; 273 uni = qimpen_specialKeys[sp].code << 16;
274} 274}
275 275
276void QIMPenInputCharDlg::setCharacter( const QString &string ) 276void QIMPenInputCharDlg::setCharacter( const QString &string )
277{ 277{
278 uni = string[0].unicode(); 278 uni = string[0].unicode();
279} 279}
280 280
281//--------------------------------------------------------------------------- 281//---------------------------------------------------------------------------
282 282
283class CharListItem : public QListBoxText 283class CharListItem : public QListBoxText
284{ 284{
285public: 285public:
286 CharListItem( const QString &text, uint c ) 286 CharListItem( const QString &text, uint c )
287 : QListBoxText( text ) 287 : QListBoxText( text )
288 { 288 {
289 _code = c; 289 _code = c;
290 } 290 }
291 291
292 uint code() const { return _code; } 292 uint code() const { return _code; }
293 293
294protected: 294protected:
295 uint _code; 295 uint _code;
296}; 296};
297 297
298/*! 298/*!
299 \class QIMPenEdit qimpensetup.h 299 \class QIMPenEdit qimpensetup.h
300 300
301 Class to allow users to input totally useless character definitions 301 Class to allow users to input totally useless character definitions
302 which could match any number of the default set. 302 which could match any number of the default set.
303*/ 303*/
304 304
305QIMPenEdit::QIMPenEdit( QIMPenProfile *p, QWidget *parent, 305QIMPenEdit::QIMPenEdit( QIMPenProfile *p, QWidget *parent,
306 const char *name ) 306 const char *name )
307 : QWidget( parent, name ), profile(p) 307 : QWidget( parent, name ), profile(p)
308{ 308{
309 currentChar = 0; 309 currentChar = 0;
310 currentCode = 0; 310 currentCode = 0;
311 inputChar = new QIMPenChar(); 311 inputChar = new QIMPenChar();
312 312
313 QVBoxLayout *tvb = new QVBoxLayout( this, 5 ); 313 QVBoxLayout *tvb = new QVBoxLayout( this, 5 );
314 314
315 QGridLayout *gl = new QGridLayout( tvb, 4, 2 ); 315 QGridLayout *gl = new QGridLayout( tvb, 4, 2 );
316 gl->setRowStretch( 1, 1 ); 316 gl->setRowStretch( 1, 1 );
317 gl->addRowSpacing( 2, 35 ); 317 gl->addRowSpacing( 2, 35 );
318 gl->addRowSpacing( 3, 35 ); 318 gl->addRowSpacing( 3, 35 );
319 319
320 charSetCombo = new QComboBox( this ); 320 charSetCombo = new QComboBox( this );
321 gl->addMultiCellWidget( charSetCombo, 0, 0, 0, 1 ); 321 gl->addMultiCellWidget( charSetCombo, 0, 0, 0, 1 );
322 connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSet(int))); 322 connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSet(int)));
323 QIMPenCharSetIterator it( profile->charSets() ); 323 QIMPenCharSetIterator it( profile->charSets() );
324 for ( ; it.current(); ++it ) { 324 for ( ; it.current(); ++it ) {
325 charSetCombo->insertItem( it.current()->description() ); 325 charSetCombo->insertItem( it.current()->description() );
326 } 326 }
327 327
328 charList = new QListBox( this ); 328 charList = new QListBox( this );
329 charList->setMinimumHeight( charList->sizeHint().height() ); 329 charList->setMinimumHeight( charList->sizeHint().height() );
330 connect( charList, SIGNAL(highlighted(int)), SLOT(selectChar(int)) ); 330 connect( charList, SIGNAL(highlighted(int)), SLOT(selectChar(int)) );
331 gl->addWidget( charList, 1, 0 ); 331 gl->addWidget( charList, 1, 0 );
332 332
333 pw = new QIMPenWidget( this ); 333 pw = new QIMPenWidget( this );
334 pw->setFixedHeight( 75 ); 334 pw->setFixedHeight( 75 );
335 gl->addMultiCellWidget( pw, 2, 3, 0, 0 ); 335 gl->addMultiCellWidget( pw, 2, 3, 0, 0 );
336 connect( pw, SIGNAL(stroke(QIMPenStroke *)), 336 connect( pw, SIGNAL(stroke(QIMPenStroke *)),
337 SLOT(newStroke(QIMPenStroke *)) ); 337 SLOT(newStroke(QIMPenStroke *)) );
338 338
339 QVBoxLayout *vb = new QVBoxLayout(); 339 QVBoxLayout *vb = new QVBoxLayout();
340 gl->addLayout( vb, 1, 1 ); 340 gl->addLayout( vb, 1, 1 );
341 newBtn = new QPushButton( tr("New..."), this ); 341 newBtn = new QPushButton( tr("New..."), this );
342 connect( newBtn, SIGNAL(clicked()), SLOT(addNewChar()) ); 342 connect( newBtn, SIGNAL(clicked()), SLOT(addNewChar()) );
343 vb->addWidget( newBtn ); 343 vb->addWidget( newBtn );
344 344
345 addBtn = new QPushButton( tr("Add"), this ); 345 addBtn = new QPushButton( tr("Add"), this );
346 connect( addBtn, SIGNAL(clicked()), SLOT(addChar()) ); 346 connect( addBtn, SIGNAL(clicked()), SLOT(addChar()) );
347 vb->addWidget( addBtn ); 347 vb->addWidget( addBtn );
348 348
349 removeBtn = new QPushButton( tr("Remove"), this ); 349 removeBtn = new QPushButton( tr("Remove"), this );
350 connect( removeBtn, SIGNAL(clicked()), SLOT(removeChar()) ); 350 connect( removeBtn, SIGNAL(clicked()), SLOT(removeChar()) );
351 vb->addWidget( removeBtn ); 351 vb->addWidget( removeBtn );
352 352
353 QPushButton *pb = new QPushButton( tr("Default"), this ); 353 QPushButton *pb = new QPushButton( tr("Default"), this );
354 connect( pb, SIGNAL(clicked()), SLOT(defaultChars()) ); 354 connect( pb, SIGNAL(clicked()), SLOT(defaultChars()) );
355 vb->addWidget( pb ); 355 vb->addWidget( pb );
356 356
357 QHBoxLayout *hb = new QHBoxLayout(); 357 QHBoxLayout *hb = new QHBoxLayout();
358 gl->addLayout( hb, 2, 1 ); 358 gl->addLayout( hb, 2, 1 );
359 prevBtn = new QPushButton( this ); 359 prevBtn = new QPushButton( this );
360 prevBtn->setPixmap( QPixmap( (const char **)left_xpm ) ); 360 prevBtn->setPixmap( QPixmap( (const char **)left_xpm ) );
361 connect( prevBtn, SIGNAL(clicked()), SLOT(prevChar())); 361 connect( prevBtn, SIGNAL(clicked()), SLOT(prevChar()));
362 hb->addWidget( prevBtn ); 362 hb->addWidget( prevBtn );
363 363
364 nextBtn = new QPushButton( this ); 364 nextBtn = new QPushButton( this );
365 nextBtn->setPixmap( QPixmap( (const char **)right_xpm ) ); 365 nextBtn->setPixmap( QPixmap( (const char **)right_xpm ) );
366 connect( nextBtn, SIGNAL(clicked()), SLOT(nextChar())); 366 connect( nextBtn, SIGNAL(clicked()), SLOT(nextChar()));
367 hb->addWidget( nextBtn ); 367 hb->addWidget( nextBtn );
368 368
369 pb = new QPushButton( tr("Clear"), this ); 369 pb = new QPushButton( tr("Clear"), this );
370 connect( pb, SIGNAL(clicked()), SLOT(clearChar()) ); 370 connect( pb, SIGNAL(clicked()), SLOT(clearChar()) );
371 gl->addWidget( pb, 3, 1 ); 371 gl->addWidget( pb, 3, 1 );
372 372
373 //-- 373 //--
374#if !defined(Q_WS_QWS) 374#if !defined(Q_WS_QWS)
375 hb = new QHBoxLayout( tvb ); 375 hb = new QHBoxLayout( tvb );
376 pb = new QPushButton( "OK", this ); 376 pb = new QPushButton( tr("OK"), this );
377 connect( pb, SIGNAL(clicked()), SLOT(accept()) ); 377 connect( pb, SIGNAL(clicked()), SLOT(accept()) );
378 hb->addWidget( pb ); 378 hb->addWidget( pb );
379 379
380 pb = new QPushButton( "Cancel", this ); 380 pb = new QPushButton( tr("Cancel"), this );
381 connect( pb, SIGNAL(clicked()), SLOT(reject()) ); 381 connect( pb, SIGNAL(clicked()), SLOT(reject()) );
382 hb->addWidget( pb ); 382 hb->addWidget( pb );
383#endif 383#endif
384 selectCharSet( 0 ); 384 selectCharSet( 0 );
385 charList->setFocus(); 385 charList->setFocus();
386 386
387 resize( minimumSize() ); 387 resize( minimumSize() );
388 enableButtons(); 388 enableButtons();
389} 389}
390 390
391void QIMPenEdit::setProfile( QIMPenProfile *p ) 391void QIMPenEdit::setProfile( QIMPenProfile *p )
392{ 392{
393 profile = p; 393 profile = p;
394 charSetCombo->clear(); 394 charSetCombo->clear();
395 QIMPenCharSetIterator it( profile->charSets() ); 395 QIMPenCharSetIterator it( profile->charSets() );
396 for ( ; it.current(); ++it ) { 396 for ( ; it.current(); ++it ) {
397 charSetCombo->insertItem( it.current()->description() ); 397 charSetCombo->insertItem( it.current()->description() );
398 } 398 }
399 selectCharSet( 0 ); 399 selectCharSet( 0 );
400 charList->setFocus(); 400 charList->setFocus();
401 enableButtons(); 401 enableButtons();
402} 402}
403 403
404void QIMPenEdit::selectCharSet( QIMPenCharSet *c ) 404void QIMPenEdit::selectCharSet( QIMPenCharSet *c )
405{ 405{
406 int i = 0; 406 int i = 0;
407 QIMPenCharSetIterator it( profile->charSets() ); 407 QIMPenCharSetIterator it( profile->charSets() );
408 for ( ; it.current(); ++it, i++ ) { 408 for ( ; it.current(); ++it, i++ ) {
409 if ( it.current() == c ) { 409 if ( it.current() == c ) {
410 charSetCombo->setCurrentItem( i ); 410 charSetCombo->setCurrentItem( i );
411 selectCharSet( i ); 411 selectCharSet( i );
412 } 412 }
413 } 413 }
414} 414}
415 415
416 416
417/*! 417/*!
418 Fill the character list box with the characters. Duplicates are not 418 Fill the character list box with the characters. Duplicates are not
419 inserted. 419 inserted.
420*/ 420*/
421void QIMPenEdit::fillCharList() 421void QIMPenEdit::fillCharList()
422{ 422{
423 charList->clear(); 423 charList->clear();
424 QIMPenCharIterator it( currentSet->characters() ); 424 QIMPenCharIterator it( currentSet->characters() );
425 CharListItem *li = 0; 425 CharListItem *li = 0;
426 for ( ; it.current(); ++it ) { 426 for ( ; it.current(); ++it ) {
427 uint ch = it.current()->character(); 427 uint ch = it.current()->character();
428 QString n = it.current()->name(); 428 QString n = it.current()->name();
429 if ( !n.isEmpty() ) 429 if ( !n.isEmpty() )
430 li = new CharListItem( n, ch ); 430 li = new CharListItem( n, ch );
431 if ( li ) { 431 if ( li ) {
432 CharListItem *i = (CharListItem *)charList->findItem( li->text() ); 432 CharListItem *i = (CharListItem *)charList->findItem( li->text() );
433 if ( !i || i->code() != ch ) { 433 if ( !i || i->code() != ch ) {
434 charList->insertItem( li ); 434 charList->insertItem( li );
435 } else { 435 } else {
436 delete li; 436 delete li;
437 li = 0; 437 li = 0;
438 } 438 }
439 } 439 }
440 } 440 }
441 currentChar = 0; 441 currentChar = 0;
442} 442}
443 443
444void QIMPenEdit::enableButtons() 444void QIMPenEdit::enableButtons()
445{ 445{
446 bool add = !inputChar->isEmpty(); 446 bool add = !inputChar->isEmpty();
447 newBtn->setEnabled( add ); 447 newBtn->setEnabled( add );
448 addBtn->setEnabled( add ); 448 addBtn->setEnabled( add );
449 removeBtn->setEnabled( currentChar ); 449 removeBtn->setEnabled( currentChar );
450} 450}
451 451
452/*! 452/*!
453 Find the previous character with the same code as the current one. 453 Find the previous character with the same code as the current one.
454 returns 0 if there is no previous character. 454 returns 0 if there is no previous character.
455*/ 455*/
456QIMPenChar *QIMPenEdit::findPrev() 456QIMPenChar *QIMPenEdit::findPrev()
457{ 457{
458 if ( !currentChar ) 458 if ( !currentChar )
459 return 0; 459 return 0;
460 QIMPenCharIterator it( currentSet->characters() ); 460 QIMPenCharIterator it( currentSet->characters() );
461 bool found = FALSE; 461 bool found = FALSE;
462 for ( it.toLast(); it.current(); --it ) { 462 for ( it.toLast(); it.current(); --it ) {
463 if ( !found && it.current() == currentChar ) 463 if ( !found && it.current() == currentChar )
464 found = TRUE; 464 found = TRUE;
465 else if ( found && it.current()->character() == currentCode && 465 else if ( found && it.current()->character() == currentCode &&
466 !it.current()->testFlag( QIMPenChar::Deleted ) ) { 466 !it.current()->testFlag( QIMPenChar::Deleted ) ) {
467 return it.current(); 467 return it.current();
468 } 468 }
469 } 469 }
470 470
471 return 0; 471 return 0;
472} 472}
473 473
474/*! 474/*!
475 Find the next character with the same code as the current one. 475 Find the next character with the same code as the current one.
476 returns 0 if there is no next character. 476 returns 0 if there is no next character.
diff --git a/inputmethods/jumpx/keyboardimpl.cpp b/inputmethods/jumpx/keyboardimpl.cpp
index 004f0b0..92abb09 100644
--- a/inputmethods/jumpx/keyboardimpl.cpp
+++ b/inputmethods/jumpx/keyboardimpl.cpp
@@ -1,98 +1,97 @@
1/**************************************************************************************94x78** 1/**************************************************************************************94x78**
2** 2**
3** This file may be distributed and/or modified under the terms of the 3** This file may be distributed and/or modified under the terms of the
4** GNU General Public License version 2 as published by the Free Software 4** GNU General Public License version 2 as published by the Free Software
5** Foundation and appearing in the file LICENSE.GPL included in the 5** Foundation and appearing in the file LICENSE.GPL included in the
6** packaging of this file. 6** packaging of this file.
7** 7**
8** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 8** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 9** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10** 10**
11*********************************************************************************************/ 11*********************************************************************************************/
12#include <qapplication.h> 12#include <qapplication.h>
13#include <qpixmap.h> 13#include <qpixmap.h>
14#include "keyboard.h" 14#include "keyboard.h"
15#include "keyboardimpl.h" 15#include "keyboardimpl.h"
16 16
17/* XPM */ 17/* XPM */
18static const char * icon_xpm[] = { 18static const char * icon_xpm[] = {
19"26 13 2 1", 19"26 13 2 1",
20 " c None", 20 " c None",
21 ".c #000000", 21 ".c #000000",
22" ... ... ... ... ... ... ", 22" ... ... ... ... ... ... ",
23". . . . . . . ", 23". . . . . . . ",
24". . . . . . . ", 24". . . . . . . ",
25". . . . . . . ", 25". . . . . . . ",
26" ....... ... ... ....... ", 26" ....... ... ... ....... ",
27". . . . . ", 27". . . . . ",
28". . . . . ", 28". . . . . ",
29". . . . . ", 29". . . . . ",
30" ....... ... ... ....... ", 30" ....... ... ... ....... ",
31". . . . . . . ", 31". . . . . . . ",
32". . . . . . . ", 32". . . . . . . ",
33". . . . . . . ", 33". . . . . . . ",
34" ... ... ... ... ... ... "}; 34" ... ... ... ... ... ... "};
35 35
36 36
37KeyboardImpl::KeyboardImpl() 37KeyboardImpl::KeyboardImpl()
38 : input(0), icn(0), ref(0) 38 : input(0), icn(0), ref(0)
39{ 39{
40} 40}
41 41
42KeyboardImpl::~KeyboardImpl() 42KeyboardImpl::~KeyboardImpl()
43{ 43{
44 delete input; 44 delete input;
45 delete icn; 45 delete icn;
46} 46}
47 47
48QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) 48QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f )
49{ 49{
50 if ( !input ) 50 if ( !input )
51 input = new Keyboard( parent, "Keyboard", f ); 51 input = new Keyboard( parent, "Keyboard", f );
52 return input; 52 return input;
53} 53}
54 54
55void KeyboardImpl::resetState() 55void KeyboardImpl::resetState()
56{ 56{
57 if ( input ) 57 if ( input )
58 input->resetState(); 58 input->resetState();
59} 59}
60 60
61QPixmap *KeyboardImpl::icon() 61QPixmap *KeyboardImpl::icon()
62{ 62{
63 if ( !icn ) 63 if ( !icn )
64 icn = new QPixmap( (const char **)icon_xpm ); 64 icn = new QPixmap( (const char **)icon_xpm );
65 return icn; 65 return icn;
66} 66}
67 67
68QString KeyboardImpl::name() 68QString KeyboardImpl::name()
69{ 69{
70 // return qApp->translate( "InputMethods", "JumpX" ); 70 return qApp->translate( "InputMethods", "JumpX" );
71 return "JumpX";
72} 71}
73 72
74void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) 73void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot )
75{ 74{
76 if ( input ) 75 if ( input )
77 QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); 76 QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot );
78} 77}
79 78
80#ifndef QT_NO_COMPONENT 79#ifndef QT_NO_COMPONENT
81QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 80QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
82{ 81{
83 *iface = 0; 82 *iface = 0;
84 if ( uuid == IID_QUnknown ) 83 if ( uuid == IID_QUnknown )
85 *iface = this; 84 *iface = this;
86 else if ( uuid == IID_InputMethod ) 85 else if ( uuid == IID_InputMethod )
87 *iface = this; 86 *iface = this;
88 87
89 if ( *iface ) 88 if ( *iface )
90 (*iface)->addRef(); 89 (*iface)->addRef();
91 return QS_OK; 90 return QS_OK;
92} 91}
93 92
94Q_EXPORT_INTERFACE() 93Q_EXPORT_INTERFACE()
95{ 94{
96 Q_CREATE_INSTANCE( KeyboardImpl ) 95 Q_CREATE_INSTANCE( KeyboardImpl )
97} 96}
98#endif 97#endif
diff --git a/inputmethods/keyboard/keyboardimpl.cpp b/inputmethods/keyboard/keyboardimpl.cpp
index 56e6870..bc96402 100644
--- a/inputmethods/keyboard/keyboardimpl.cpp
+++ b/inputmethods/keyboard/keyboardimpl.cpp
@@ -7,125 +7,124 @@
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qapplication.h> 20#include <qapplication.h>
21#include <qpixmap.h> 21#include <qpixmap.h>
22#include "keyboard.h" 22#include "keyboard.h"
23#include "keyboardimpl.h" 23#include "keyboardimpl.h"
24 24
25/* XPM */ 25/* XPM */
26static const char * kb_xpm[] = { 26static const char * kb_xpm[] = {
27"28 13 4 1", 27"28 13 4 1",
28" c None", 28" c None",
29". c #4C4C4C", 29". c #4C4C4C",
30"+ c #FFF7DD", 30"+ c #FFF7DD",
31"@ c #D6CFBA", 31"@ c #D6CFBA",
32" .......................... ", 32" .......................... ",
33" .+++.+++.+++.+++.+++.++++. ", 33" .+++.+++.+++.+++.+++.++++. ",
34" .+@@.+@@.+@@.+@@.+@@.+@@@. ", 34" .+@@.+@@.+@@.+@@.+@@.+@@@. ",
35" .......................... ", 35" .......................... ",
36" .+++++.+++.+++.+++.++++++. ", 36" .+++++.+++.+++.+++.++++++. ",
37" .+@@@@.+@@.+@@.+@@.+@@@@@. ", 37" .+@@@@.+@@.+@@.+@@.+@@@@@. ",
38" .......................... ", 38" .......................... ",
39" .++++++.+++.+++.+++.+++++. ", 39" .++++++.+++.+++.+++.+++++. ",
40" .+@@@@@.+@@.+@@.+@@.+@@@@. ", 40" .+@@@@@.+@@.+@@.+@@.+@@@@. ",
41" .......................... ", 41" .......................... ",
42" .++++.++++++++++++++.++++. ", 42" .++++.++++++++++++++.++++. ",
43" .+@@@.+@@@@@@@@@@@@@.+@@@. ", 43" .+@@@.+@@@@@@@@@@@@@.+@@@. ",
44" .......................... "}; 44" .......................... "};
45 45
46 46
47/* XPM */ 47/* XPM */
48static char * opti_xpm[] = { 48static char * opti_xpm[] = {
49"28 13 4 1", 49"28 13 4 1",
50" c None", 50" c None",
51". c #4C4C4C", 51". c #4C4C4C",
52"+ c #FFF7DD", 52"+ c #FFF7DD",
53"@ c #D6CFBA", 53"@ c #D6CFBA",
54" ......................... ", 54" ......................... ",
55" .+++.+++.+++.+++.+++.+++. ", 55" .+++.+++.+++.+++.+++.+++. ",
56" .+@@.+@@.+@@.+@@.+@@.+@@. ", 56" .+@@.+@@.+@@.+@@.+@@.+@@. ",
57" ......................... ", 57" ......................... ",
58" .+++.+++.+++.+++.+++.+++. ", 58" .+++.+++.+++.+++.+++.+++. ",
59" .+@@.+@@.+@@.+@@.+@@.+@@. ", 59" .+@@.+@@.+@@.+@@.+@@.+@@. ",
60" ......................... ", 60" ......................... ",
61" .+++.+++.+++.+++.+++.+++. ", 61" .+++.+++.+++.+++.+++.+++. ",
62" .+@@.+@@.+@@.+@@.+@@.+@@. ", 62" .+@@.+@@.+@@.+@@.+@@.+@@. ",
63" ......................... ", 63" ......................... ",
64" .+++.+++.+++.+++.+++.+++. ", 64" .+++.+++.+++.+++.+++.+++. ",
65" .+@@.+@@.+@@.+@@.+@@.+@@. ", 65" .+@@.+@@.+@@.+@@.+@@.+@@. ",
66" ......................... "}; 66" ......................... "};
67 67
68 68
69 69
70KeyboardImpl::KeyboardImpl() 70KeyboardImpl::KeyboardImpl()
71 : input(0), icn(0), ref(0) 71 : input(0), icn(0), ref(0)
72{ 72{
73} 73}
74 74
75KeyboardImpl::~KeyboardImpl() 75KeyboardImpl::~KeyboardImpl()
76{ 76{
77 delete input; 77 delete input;
78 delete icn; 78 delete icn;
79} 79}
80 80
81QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) 81QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f )
82{ 82{
83 if ( !input ) 83 if ( !input )
84 input = new Keyboard( parent, "Keyboard", f ); 84 input = new Keyboard( parent, "Keyboard", f );
85 return input; 85 return input;
86} 86}
87 87
88void KeyboardImpl::resetState() 88void KeyboardImpl::resetState()
89{ 89{
90 if ( input ) 90 if ( input )
91 input->resetState(); 91 input->resetState();
92} 92}
93 93
94QPixmap *KeyboardImpl::icon() 94QPixmap *KeyboardImpl::icon()
95{ 95{
96 if ( !icn ) 96 if ( !icn )
97 icn = new QPixmap( (const char **)kb_xpm ); 97 icn = new QPixmap( (const char **)kb_xpm );
98 return icn; 98 return icn;
99} 99}
100 100
101QString KeyboardImpl::name() 101QString KeyboardImpl::name()
102{ 102{
103 // return qApp->translate( "InputMethods", "Keyboard" ); 103 return qApp->translate( "InputMethods", "Keyboard" );
104 return "Keyboard";
105} 104}
106 105
107void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) 106void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot )
108{ 107{
109 if ( input ) 108 if ( input )
110 QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); 109 QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot );
111} 110}
112 111
113#ifndef QT_NO_COMPONENT 112#ifndef QT_NO_COMPONENT
114QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 113QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
115{ 114{
116 *iface = 0; 115 *iface = 0;
117 if ( uuid == IID_QUnknown ) 116 if ( uuid == IID_QUnknown )
118 *iface = this; 117 *iface = this;
119 else if ( uuid == IID_InputMethod ) 118 else if ( uuid == IID_InputMethod )
120 *iface = this; 119 *iface = this;
121 120
122 if ( *iface ) 121 if ( *iface )
123 (*iface)->addRef(); 122 (*iface)->addRef();
124 return QS_OK; 123 return QS_OK;
125} 124}
126 125
127Q_EXPORT_INTERFACE() 126Q_EXPORT_INTERFACE()
128{ 127{
129 Q_CREATE_INSTANCE( KeyboardImpl ) 128 Q_CREATE_INSTANCE( KeyboardImpl )
130} 129}
131#endif 130#endif
diff --git a/inputmethods/kjumpx/keyboardimpl.cpp b/inputmethods/kjumpx/keyboardimpl.cpp
index dbae2b4..5d8e0d3 100644
--- a/inputmethods/kjumpx/keyboardimpl.cpp
+++ b/inputmethods/kjumpx/keyboardimpl.cpp
@@ -1,98 +1,97 @@
1/**************************************************************************************94x78** 1/**************************************************************************************94x78**
2** 2**
3** This file may be distributed and/or modified under the terms of the 3** This file may be distributed and/or modified under the terms of the
4** GNU General Public License version 2 as published by the Free Software 4** GNU General Public License version 2 as published by the Free Software
5** Foundation and appearing in the file LICENSE.GPL included in the 5** Foundation and appearing in the file LICENSE.GPL included in the
6** packaging of this file. 6** packaging of this file.
7** 7**
8** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 8** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 9** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10** 10**
11*********************************************************************************************/ 11*********************************************************************************************/
12#include <qapplication.h> 12#include <qapplication.h>
13#include <qpixmap.h> 13#include <qpixmap.h>
14#include "keyboard.h" 14#include "keyboard.h"
15#include "keyboardimpl.h" 15#include "keyboardimpl.h"
16 16
17/* XPM */ 17/* XPM */
18static char * icon_xpm[] = { 18static char * icon_xpm[] = {
19"26 13 2 1", 19"26 13 2 1",
20 " c None", 20 " c None",
21 ".c #000000", 21 ".c #000000",
22" ... ... ... ... ... ... ", 22" ... ... ... ... ... ... ",
23". . . . . ", 23". . . . . ",
24". . ... .. . . ", 24". . ... .. . . ",
25". . .. . . ", 25". . .. . . ",
26" ...... ...... ... .... ", 26" ...... ...... ... .... ",
27". .. .. .. . ", 27". .. .. .. . ",
28". .. .. .. . ", 28". .. .. .. . ",
29". ... .. . ", 29". ... .. . ",
30" ...... .. ...... ", 30" ...... .. ...... ",
31". . .. . . ", 31". . .. . . ",
32". . ....... . . ", 32". . ....... . . ",
33". . . . . ", 33". . . . . ",
34" ... ... ... ... ... ... "}; 34" ... ... ... ... ... ... "};
35 35
36 36
37KeyboardImpl::KeyboardImpl() 37KeyboardImpl::KeyboardImpl()
38 : input(0), icn(0), ref(0) 38 : input(0), icn(0), ref(0)
39{ 39{
40} 40}
41 41
42KeyboardImpl::~KeyboardImpl() 42KeyboardImpl::~KeyboardImpl()
43{ 43{
44 delete input; 44 delete input;
45 delete icn; 45 delete icn;
46} 46}
47 47
48QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) 48QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f )
49{ 49{
50 if ( !input ) 50 if ( !input )
51 input = new Keyboard( parent, "Keyboard", f ); 51 input = new Keyboard( parent, "Keyboard", f );
52 return input; 52 return input;
53} 53}
54 54
55void KeyboardImpl::resetState() 55void KeyboardImpl::resetState()
56{ 56{
57 if ( input ) 57 if ( input )
58 input->resetState(); 58 input->resetState();
59} 59}
60 60
61QPixmap *KeyboardImpl::icon() 61QPixmap *KeyboardImpl::icon()
62{ 62{
63 if ( !icn ) 63 if ( !icn )
64 icn = new QPixmap( (const char **)icon_xpm ); 64 icn = new QPixmap( (const char **)icon_xpm );
65 return icn; 65 return icn;
66} 66}
67 67
68QString KeyboardImpl::name() 68QString KeyboardImpl::name()
69{ 69{
70 // return qApp->translate( "InputMethods", "KJumpX" ); 70 return qApp->translate( "InputMethods", "KJumpX" );
71 return "KJumpX";
72} 71}
73 72
74void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) 73void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot )
75{ 74{
76 if ( input ) 75 if ( input )
77 QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); 76 QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot );
78} 77}
79 78
80#ifndef QT_NO_COMPONENT 79#ifndef QT_NO_COMPONENT
81QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 80QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
82{ 81{
83 *iface = 0; 82 *iface = 0;
84 if ( uuid == IID_QUnknown ) 83 if ( uuid == IID_QUnknown )
85 *iface = this; 84 *iface = this;
86 else if ( uuid == IID_InputMethod ) 85 else if ( uuid == IID_InputMethod )
87 *iface = this; 86 *iface = this;
88 87
89 if ( *iface ) 88 if ( *iface )
90 (*iface)->addRef(); 89 (*iface)->addRef();
91 return QS_OK; 90 return QS_OK;
92} 91}
93 92
94Q_EXPORT_INTERFACE() 93Q_EXPORT_INTERFACE()
95{ 94{
96 Q_CREATE_INSTANCE( KeyboardImpl ) 95 Q_CREATE_INSTANCE( KeyboardImpl )
97} 96}
98#endif 97#endif
diff --git a/inputmethods/pickboard/pickboardimpl.cpp b/inputmethods/pickboard/pickboardimpl.cpp
index 617acff..a4e8f02 100644
--- a/inputmethods/pickboard/pickboardimpl.cpp
+++ b/inputmethods/pickboard/pickboardimpl.cpp
@@ -1,102 +1,101 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qapplication.h> 20#include <qapplication.h>
21#include <qobject.h> 21#include <qobject.h>
22#include <qpixmap.h> 22#include <qpixmap.h>
23#include "pickboard.h" 23#include "pickboard.h"
24#include "pickboardimpl.h" 24#include "pickboardimpl.h"
25 25
26/* XPM */ 26/* XPM */
27static const char * pb_xpm[]={ 27static const char * pb_xpm[]={
28"28 7 2 1", 28"28 7 2 1",
29"# c #303030", 29"# c #303030",
30" c None", 30" c None",
31" ########################## ", 31" ########################## ",
32" # # # # # # # ", 32" # # # # # # # ",
33" # # # # # # # ", 33" # # # # # # # ",
34" ########################## ", 34" ########################## ",
35" # # # # # # ", 35" # # # # # # ",
36" # # # # # # ", 36" # # # # # # ",
37" ########################## "}; 37" ########################## "};
38 38
39 39
40PickboardImpl::PickboardImpl() 40PickboardImpl::PickboardImpl()
41 : pickboard(0), icn(0), ref(0) 41 : pickboard(0), icn(0), ref(0)
42{ 42{
43} 43}
44 44
45PickboardImpl::~PickboardImpl() 45PickboardImpl::~PickboardImpl()
46{ 46{
47 delete pickboard; 47 delete pickboard;
48 delete icn; 48 delete icn;
49} 49}
50 50
51QWidget *PickboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) 51QWidget *PickboardImpl::inputMethod( QWidget *parent, Qt::WFlags f )
52{ 52{
53 if ( !pickboard ) 53 if ( !pickboard )
54 pickboard = new Pickboard( parent, "pickboard", f ); 54 pickboard = new Pickboard( parent, "pickboard", f );
55 return pickboard; 55 return pickboard;
56} 56}
57 57
58void PickboardImpl::resetState() 58void PickboardImpl::resetState()
59{ 59{
60 if ( pickboard ) 60 if ( pickboard )
61 pickboard->resetState(); 61 pickboard->resetState();
62} 62}
63 63
64QPixmap *PickboardImpl::icon() 64QPixmap *PickboardImpl::icon()
65{ 65{
66 if ( !icn ) 66 if ( !icn )
67 icn = new QPixmap( (const char **)pb_xpm ); 67 icn = new QPixmap( (const char **)pb_xpm );
68 return icn; 68 return icn;
69} 69}
70 70
71QString PickboardImpl::name() 71QString PickboardImpl::name()
72{ 72{
73 // return qApp->translate( "InputMethods", "Pickboard" ); 73 return qApp->translate( "InputMethods", "Pickboard" );
74 return "Pickboard";
75} 74}
76 75
77void PickboardImpl::onKeyPress( QObject *receiver, const char *slot ) 76void PickboardImpl::onKeyPress( QObject *receiver, const char *slot )
78{ 77{
79 if ( pickboard ) 78 if ( pickboard )
80 QObject::connect( pickboard, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); 79 QObject::connect( pickboard, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot );
81} 80}
82 81
83#ifndef QT_NO_COMPONENT 82#ifndef QT_NO_COMPONENT
84QRESULT PickboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 83QRESULT PickboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
85{ 84{
86 *iface = 0; 85 *iface = 0;
87 if ( uuid == IID_QUnknown ) 86 if ( uuid == IID_QUnknown )
88 *iface = this; 87 *iface = this;
89 else if ( uuid == IID_InputMethod ) 88 else if ( uuid == IID_InputMethod )
90 *iface = this; 89 *iface = this;
91 90
92 if ( *iface ) 91 if ( *iface )
93 (*iface)->addRef(); 92 (*iface)->addRef();
94 return QS_OK; 93 return QS_OK;
95} 94}
96 95
97Q_EXPORT_INTERFACE() 96Q_EXPORT_INTERFACE()
98{ 97{
99 Q_CREATE_INSTANCE( PickboardImpl ) 98 Q_CREATE_INSTANCE( PickboardImpl )
100} 99}
101#endif 100#endif
102 101
diff --git a/inputmethods/unikeyboard/unikeyboardimpl.cpp b/inputmethods/unikeyboard/unikeyboardimpl.cpp
index aa05b31..fe601e0 100644
--- a/inputmethods/unikeyboard/unikeyboardimpl.cpp
+++ b/inputmethods/unikeyboard/unikeyboardimpl.cpp
@@ -1,106 +1,105 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qapplication.h> 20#include <qapplication.h>
21#include <qobject.h> 21#include <qobject.h>
22#include <qpixmap.h> 22#include <qpixmap.h>
23#include "unikeyboard.h" 23#include "unikeyboard.h"
24#include "unikeyboardimpl.h" 24#include "unikeyboardimpl.h"
25 25
26/* XPM */ 26/* XPM */
27static const char * uni_xpm[]={ 27static const char * uni_xpm[]={
28"28 13 2 1", 28"28 13 2 1",
29"# c #000000", 29"# c #000000",
30". c None", 30". c None",
31"............................", 31"............................",
32"...####....#####.....####...", 32"...####....#####.....####...",
33"...####....######....####...", 33"...####....######....####...",
34"...####....#######..........", 34"...####....#######..........",
35"...####....########..####...", 35"...####....########..####...",
36"...####....####.####.####...", 36"...####....####.####.####...",
37"...####....####..########...", 37"...####....####..########...",
38"...####....####...#######...", 38"...####....####...#######...",
39"...####....####....######...", 39"...####....####....######...",
40"...#####..#####.....#####...", 40"...#####..#####.....#####...",
41"....##########.......####...", 41"....##########.......####...",
42"......######..........###...", 42"......######..........###...",
43"............................"}; 43"............................"};
44 44
45UniKeyboardImpl::UniKeyboardImpl() 45UniKeyboardImpl::UniKeyboardImpl()
46 : input(0), icn(0), ref(0) 46 : input(0), icn(0), ref(0)
47{ 47{
48} 48}
49 49
50UniKeyboardImpl::~UniKeyboardImpl() 50UniKeyboardImpl::~UniKeyboardImpl()
51{ 51{
52 delete input; 52 delete input;
53 delete icn; 53 delete icn;
54} 54}
55 55
56QWidget *UniKeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) 56QWidget *UniKeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f )
57{ 57{
58 if ( !input ) 58 if ( !input )
59 input = new UniKeyboard( parent, "UniKeyboard", f ); 59 input = new UniKeyboard( parent, "UniKeyboard", f );
60 return input; 60 return input;
61} 61}
62 62
63void UniKeyboardImpl::resetState() 63void UniKeyboardImpl::resetState()
64{ 64{
65 if ( input ) 65 if ( input )
66 input->resetState(); 66 input->resetState();
67} 67}
68 68
69QPixmap *UniKeyboardImpl::icon() 69QPixmap *UniKeyboardImpl::icon()
70{ 70{
71 if ( !icn ) 71 if ( !icn )
72 icn = new QPixmap( (const char **)uni_xpm ); 72 icn = new QPixmap( (const char **)uni_xpm );
73 return icn; 73 return icn;
74} 74}
75 75
76QString UniKeyboardImpl::name() 76QString UniKeyboardImpl::name()
77{ 77{
78 // return qApp->translate( "InputMethods", "Unicode" ); 78 return qApp->translate( "InputMethods", "Unicode" );
79 return "Unicode";
80} 79}
81 80
82void UniKeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) 81void UniKeyboardImpl::onKeyPress( QObject *receiver, const char *slot )
83{ 82{
84 if ( input ) 83 if ( input )
85 QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); 84 QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot );
86} 85}
87 86
88QRESULT UniKeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 87QRESULT UniKeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
89{ 88{
90 *iface = 0; 89 *iface = 0;
91 if ( uuid == IID_QUnknown ) 90 if ( uuid == IID_QUnknown )
92 *iface = this; 91 *iface = this;
93 else if ( uuid == IID_InputMethod ) 92 else if ( uuid == IID_InputMethod )
94 *iface = this; 93 *iface = this;
95 94
96 if ( *iface ) 95 if ( *iface )
97 (*iface)->addRef(); 96 (*iface)->addRef();
98 return QS_OK; 97 return QS_OK;
99} 98}
100 99
101Q_EXPORT_INTERFACE() 100Q_EXPORT_INTERFACE()
102{ 101{
103 Q_CREATE_INSTANCE( UniKeyboardImpl ) 102 Q_CREATE_INSTANCE( UniKeyboardImpl )
104} 103}
105 104
106 105