summaryrefslogtreecommitdiff
authorhash <hash>2002-11-25 10:07:40 (UTC)
committer hash <hash>2002-11-25 10:07:40 (UTC)
commit6525f85bff4ef02e6636e1b9cfdb3440cdeed78c (patch) (unidiff)
tree7f56d4a76fa0a54be9233f15749351dee2f9d753
parente73898d0cda891308115871bfbfa4a2739275c6a (diff)
downloadopie-6525f85bff4ef02e6636e1b9cfdb3440cdeed78c.zip
opie-6525f85bff4ef02e6636e1b9cfdb3440cdeed78c.tar.gz
opie-6525f85bff4ef02e6636e1b9cfdb3440cdeed78c.tar.bz2
for now, lets just disable the charset selection... there is something very
wrong with it.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/handwriting/qimpenprefbase.ui8
-rw-r--r--inputmethods/handwriting/qimpensetup.cpp2
2 files changed, 5 insertions, 5 deletions
diff --git a/inputmethods/handwriting/qimpenprefbase.ui b/inputmethods/handwriting/qimpenprefbase.ui
index 1639d1a..4189206 100644
--- a/inputmethods/handwriting/qimpenprefbase.ui
+++ b/inputmethods/handwriting/qimpenprefbase.ui
@@ -1,185 +1,185 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>QIMPenPrefBase</class> 2<class>QIMPenPrefBase</class>
3<widget> 3<widget>
4 <class>QWidget</class> 4 <class>QWidget</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>QIMPenPrefBase</cstring> 7 <cstring>QIMPenPrefBase</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>247</width> 14 <width>247</width>
15 <height>280</height> 15 <height>280</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Form1</string> 20 <string>Form1</string>
21 </property> 21 </property>
22 <vbox> 22 <vbox>
23 <property stdset="1"> 23 <property stdset="1">
24 <name>margin</name> 24 <name>margin</name>
25 <number>11</number> 25 <number>11</number>
26 </property> 26 </property>
27 <property stdset="1"> 27 <property stdset="1">
28 <name>spacing</name> 28 <name>spacing</name>
29 <number>6</number> 29 <number>6</number>
30 </property> 30 </property>
31 <widget> 31 <widget>
32 <class>QLabel</class> 32 <class>QLabel</class>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>name</name> 34 <name>name</name>
35 <cstring>TextLabel1</cstring> 35 <cstring>TextLabel1</cstring>
36 </property> 36 </property>
37 <property stdset="1"> 37 <property stdset="1">
38 <name>text</name> 38 <name>text</name>
39 <string>Multi-stroke character timeout:</string> 39 <string>Multi-stroke character timeout:</string>
40 </property> 40 </property>
41 </widget> 41 </widget>
42 <widget> 42 <widget>
43 <class>QLayoutWidget</class> 43 <class>QLayoutWidget</class>
44 <property stdset="1"> 44 <property stdset="1">
45 <name>name</name> 45 <name>name</name>
46 <cstring>Layout2</cstring> 46 <cstring>Layout2</cstring>
47 </property> 47 </property>
48 <hbox> 48 <hbox>
49 <property stdset="1"> 49 <property stdset="1">
50 <name>margin</name> 50 <name>margin</name>
51 <number>0</number> 51 <number>0</number>
52 </property> 52 </property>
53 <property stdset="1"> 53 <property stdset="1">
54 <name>spacing</name> 54 <name>spacing</name>
55 <number>6</number> 55 <number>6</number>
56 </property> 56 </property>
57 <widget> 57 <widget>
58 <class>QSlider</class> 58 <class>QSlider</class>
59 <property stdset="1"> 59 <property stdset="1">
60 <name>name</name> 60 <name>name</name>
61 <cstring>multiStrokeSlider</cstring> 61 <cstring>multiStrokeSlider</cstring>
62 </property> 62 </property>
63 <property stdset="1"> 63 <property stdset="1">
64 <name>minValue</name>
65 <number>250</number>
66 </property>
67 <property stdset="1">
68 <name>maxValue</name> 64 <name>maxValue</name>
69 <number>1000</number> 65 <number>1000</number>
70 </property> 66 </property>
71 <property stdset="1"> 67 <property stdset="1">
68 <name>minValue</name>
69 <number>250</number>
70 </property>
71 <property stdset="1">
72 <name>lineStep</name> 72 <name>lineStep</name>
73 <number>10</number> 73 <number>10</number>
74 </property> 74 </property>
75 <property stdset="1"> 75 <property stdset="1">
76 <name>pageStep</name> 76 <name>pageStep</name>
77 <number>50</number> 77 <number>50</number>
78 </property> 78 </property>
79 <property stdset="1"> 79 <property stdset="1">
80 <name>value</name> 80 <name>value</name>
81 <number>500</number> 81 <number>500</number>
82 </property> 82 </property>
83 <property stdset="1"> 83 <property stdset="1">
84 <name>orientation</name> 84 <name>orientation</name>
85 <enum>Horizontal</enum> 85 <enum>Horizontal</enum>
86 </property> 86 </property>
87 <property stdset="1"> 87 <property stdset="1">
88 <name>tickmarks</name> 88 <name>tickmarks</name>
89 <enum>Right</enum> 89 <enum>Right</enum>
90 </property> 90 </property>
91 </widget> 91 </widget>
92 <widget> 92 <widget>
93 <class>QLabel</class> 93 <class>QLabel</class>
94 <property stdset="1"> 94 <property stdset="1">
95 <name>name</name> 95 <name>name</name>
96 <cstring>multiStrokeLabel</cstring> 96 <cstring>multiStrokeLabel</cstring>
97 </property> 97 </property>
98 <property stdset="1"> 98 <property stdset="1">
99 <name>minimumSize</name> 99 <name>minimumSize</name>
100 <size> 100 <size>
101 <width>45</width> 101 <width>45</width>
102 <height>0</height> 102 <height>0</height>
103 </size> 103 </size>
104 </property> 104 </property>
105 <property stdset="1"> 105 <property stdset="1">
106 <name>text</name> 106 <name>text</name>
107 <string>ms</string> 107 <string>ms</string>
108 </property> 108 </property>
109 <property stdset="1"> 109 <property stdset="1">
110 <name>alignment</name> 110 <name>alignment</name>
111 <set>AlignVCenter|AlignRight</set> 111 <set>AlignVCenter|AlignRight</set>
112 </property> 112 </property>
113 <property> 113 <property>
114 <name>hAlign</name> 114 <name>hAlign</name>
115 </property> 115 </property>
116 </widget> 116 </widget>
117 </hbox> 117 </hbox>
118 </widget> 118 </widget>
119 <widget> 119 <widget>
120 <class>QButtonGroup</class> 120 <class>QButtonGroup</class>
121 <property stdset="1"> 121 <property stdset="1">
122 <name>name</name> 122 <name>name</name>
123 <cstring>inputStyle</cstring> 123 <cstring>inputStyle</cstring>
124 </property> 124 </property>
125 <property stdset="1"> 125 <property stdset="1">
126 <name>title</name> 126 <name>title</name>
127 <string>Input areas displayed</string> 127 <string>Input areas displayed</string>
128 </property> 128 </property>
129 <vbox> 129 <vbox>
130 <property stdset="1"> 130 <property stdset="1">
131 <name>margin</name> 131 <name>margin</name>
132 <number>11</number> 132 <number>11</number>
133 </property> 133 </property>
134 <property stdset="1"> 134 <property stdset="1">
135 <name>spacing</name> 135 <name>spacing</name>
136 <number>6</number> 136 <number>6</number>
137 </property> 137 </property>
138 <widget> 138 <widget>
139 <class>QRadioButton</class> 139 <class>QRadioButton</class>
140 <property stdset="1"> 140 <property stdset="1">
141 <name>name</name> 141 <name>name</name>
142 <cstring>bothCasesRadio</cstring> 142 <cstring>bothCasesRadio</cstring>
143 </property> 143 </property>
144 <property stdset="1"> 144 <property stdset="1">
145 <name>text</name> 145 <name>text</name>
146 <string>Upper and lower case areas</string> 146 <string>Upper and lower case areas</string>
147 </property> 147 </property>
148 </widget> 148 </widget>
149 <widget> 149 <widget>
150 <class>QRadioButton</class> 150 <class>QRadioButton</class>
151 <property stdset="1"> 151 <property stdset="1">
152 <name>name</name> 152 <name>name</name>
153 <cstring>toggleCaseRadio</cstring> 153 <cstring>toggleCaseRadio</cstring>
154 </property> 154 </property>
155 <property stdset="1"> 155 <property stdset="1">
156 <name>text</name> 156 <name>text</name>
157 <string>Lower case (toggle Upper case)</string> 157 <string>Lower case (toggle Upper case)</string>
158 </property> 158 </property>
159 </widget> 159 </widget>
160 </vbox> 160 </vbox>
161 </widget> 161 </widget>
162 <spacer> 162 <spacer>
163 <property> 163 <property>
164 <name>name</name> 164 <name>name</name>
165 <cstring>Spacer2</cstring> 165 <cstring>Spacer2</cstring>
166 </property> 166 </property>
167 <property stdset="1"> 167 <property stdset="1">
168 <name>orientation</name> 168 <name>orientation</name>
169 <enum>Vertical</enum> 169 <enum>Vertical</enum>
170 </property> 170 </property>
171 <property stdset="1"> 171 <property stdset="1">
172 <name>sizeType</name> 172 <name>sizeType</name>
173 <enum>Expanding</enum> 173 <enum>Expanding</enum>
174 </property> 174 </property>
175 <property> 175 <property>
176 <name>sizeHint</name> 176 <name>sizeHint</name>
177 <size> 177 <size>
178 <width>20</width> 178 <width>20</width>
179 <height>20</height> 179 <height>20</height>
180 </size> 180 </size>
181 </property> 181 </property>
182 </spacer> 182 </spacer>
183 </vbox> 183 </vbox>
184</widget> 184</widget>
185</UI> 185</UI>
diff --git a/inputmethods/handwriting/qimpensetup.cpp b/inputmethods/handwriting/qimpensetup.cpp
index 5d49e03..10c136d 100644
--- a/inputmethods/handwriting/qimpensetup.cpp
+++ b/inputmethods/handwriting/qimpensetup.cpp
@@ -1,656 +1,656 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the 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 0
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 );
101 hb->addWidget( l ); 101 hb->addWidget( l );
102 profileCombo = new QComboBox( this ); 102 profileCombo = new QComboBox( this );
103 connect( profileCombo, SIGNAL(activated(const QString &)), 103 connect( profileCombo, SIGNAL(activated(const QString &)),
104 this, SLOT(selectProfile(const QString &)) ); 104 this, SLOT(selectProfile(const QString &)) );
105 hb->addWidget( profileCombo ); 105 hb->addWidget( profileCombo );
106 loadProfiles(); 106 loadProfiles();
107#else 107#else
108 profileList.append( profile ); 108 profileList.append( profile );
109#endif 109#endif
110 110
111 QTabWidget *tw = new QTabWidget( this ); 111 QTabWidget *tw = new QTabWidget( this );
112 vb->addWidget( tw ); 112 vb->addWidget( tw );
113 113
114 pref = new QIMPenPrefBase( this ); 114 pref = new QIMPenPrefBase( this );
115 tw->addTab( pref, tr("Preferences") ); 115 tw->addTab( pref, tr("Preferences") );
116 116
117 pref->inputStyle->setExclusive( TRUE ); 117 pref->inputStyle->setExclusive( TRUE );
118 118
119 style = profile->style() == QIMPenProfile::ToggleCases ? 1 : 0; 119 style = profile->style() == QIMPenProfile::ToggleCases ? 1 : 0;
120 pref->inputStyle->setButton( style ); 120 pref->inputStyle->setButton( style );
121 connect( pref->inputStyle, SIGNAL(clicked(int)), 121 connect( pref->inputStyle, SIGNAL(clicked(int)),
122 this, SLOT(styleClicked(int)) ); 122 this, SLOT(styleClicked(int)) );
123 pref->inputStyle->setEnabled( profile->canSelectStyle() ); 123 pref->inputStyle->setEnabled( profile->canSelectStyle() );
124 124
125 multiTimeout = profile->multiStrokeTimeout(); 125 multiTimeout = profile->multiStrokeTimeout();
126 pref->multiStrokeSlider->setValue( multiTimeout ); 126 pref->multiStrokeSlider->setValue( multiTimeout );
127 multiTimeoutChanged( multiTimeout ); 127 multiTimeoutChanged( multiTimeout );
128 connect( pref->multiStrokeSlider, SIGNAL(valueChanged(int)), 128 connect( pref->multiStrokeSlider, SIGNAL(valueChanged(int)),
129 this, SLOT(multiTimeoutChanged(int)) ); 129 this, SLOT(multiTimeoutChanged(int)) );
130 130
131 edit = new QIMPenEdit( p, tw ); 131 edit = new QIMPenEdit( p, tw );
132 tw->addTab( edit, tr("Customize") ); 132 tw->addTab( edit, tr("Customize") );
133} 133}
134 134
135void QIMPenSetup::loadProfiles() 135void QIMPenSetup::loadProfiles()
136{ 136{
137 QString path = QPEApplication::qpeDir() + "etc/qimpen"; 137 QString path = QPEApplication::qpeDir() + "etc/qimpen";
138 QDir dir( path, "*.conf" ); 138 QDir dir( path, "*.conf" );
139 QStringList list = dir.entryList(); 139 QStringList list = dir.entryList();
140 QStringList::Iterator it; 140 QStringList::Iterator it;
141 for ( it = list.begin(); it != list.end(); ++it ) { 141 for ( it = list.begin(); it != list.end(); ++it ) {
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( tr("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( tr("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( tr("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.
477*/ 477*/
478QIMPenChar *QIMPenEdit::findNext() 478QIMPenChar *QIMPenEdit::findNext()
479{ 479{
480 if ( !currentChar ) 480 if ( !currentChar )
481 return 0; 481 return 0;
482 QIMPenCharIterator it( currentSet->characters() ); 482 QIMPenCharIterator it( currentSet->characters() );
483 bool found = FALSE; 483 bool found = FALSE;
484 for ( ; it.current(); ++it ) { 484 for ( ; it.current(); ++it ) {
485 if ( !found && it.current() == currentChar ) 485 if ( !found && it.current() == currentChar )
486 found = TRUE; 486 found = TRUE;
487 else if ( found && it.current()->character() == currentCode && 487 else if ( found && it.current()->character() == currentCode &&
488 !it.current()->testFlag( QIMPenChar::Deleted ) ) { 488 !it.current()->testFlag( QIMPenChar::Deleted ) ) {
489 return it.current(); 489 return it.current();
490 } 490 }
491 } 491 }
492 492
493 return 0; 493 return 0;
494} 494}
495 495
496void QIMPenEdit::setCurrentChar( QIMPenChar *pc ) 496void QIMPenEdit::setCurrentChar( QIMPenChar *pc )
497{ 497{
498 currentChar = pc; 498 currentChar = pc;
499 pw->showCharacter( currentChar ); 499 pw->showCharacter( currentChar );
500 if ( currentChar ) { 500 if ( currentChar ) {
501 prevBtn->setEnabled( findPrev() != 0 ); 501 prevBtn->setEnabled( findPrev() != 0 );
502 nextBtn->setEnabled( findNext() != 0 ); 502 nextBtn->setEnabled( findNext() != 0 );
503 } 503 }
504} 504}
505 505
506void QIMPenEdit::prevChar() 506void QIMPenEdit::prevChar()
507{ 507{
508 QIMPenChar *pc = findPrev(); 508 QIMPenChar *pc = findPrev();
509 if ( pc ) 509 if ( pc )
510 setCurrentChar( pc ); 510 setCurrentChar( pc );
511} 511}
512 512
513void QIMPenEdit::nextChar() 513void QIMPenEdit::nextChar()
514{ 514{
515 QIMPenChar *pc = findNext(); 515 QIMPenChar *pc = findNext();
516 if ( pc ) 516 if ( pc )
517 setCurrentChar( pc ); 517 setCurrentChar( pc );
518} 518}
519 519
520void QIMPenEdit::clearChar() 520void QIMPenEdit::clearChar()
521{ 521{
522 inputChar->clear(); 522 inputChar->clear();
523 pw->clear(); 523 pw->clear();
524 enableButtons(); 524 enableButtons();
525} 525}
526 526
527void QIMPenEdit::selectChar( int i ) 527void QIMPenEdit::selectChar( int i )
528{ 528{
529 currentChar = 0; 529 currentChar = 0;
530 currentCode = ((CharListItem *)charList->item(i))->code(); 530 currentCode = ((CharListItem *)charList->item(i))->code();
531 QIMPenCharIterator it(currentSet->characters() ); 531 QIMPenCharIterator it(currentSet->characters() );
532 for ( ; it.current(); ++it ) { 532 for ( ; it.current(); ++it ) {
533 if ( it.current()->character() == currentCode && 533 if ( it.current()->character() == currentCode &&
534 !it.current()->testFlag( QIMPenChar::Deleted ) ) { 534 !it.current()->testFlag( QIMPenChar::Deleted ) ) {
535 setCurrentChar( it.current() ); 535 setCurrentChar( it.current() );
536 break; 536 break;
537 } 537 }
538 } 538 }
539 if ( !it.current() ) 539 if ( !it.current() )
540 setCurrentChar( 0 ); 540 setCurrentChar( 0 );
541 inputChar->clear(); 541 inputChar->clear();
542} 542}
543 543
544void QIMPenEdit::selectCharSet( int i ) 544void QIMPenEdit::selectCharSet( int i )
545{ 545{
546 if ( currentSet ) 546 if ( currentSet )
547 pw->removeCharSet( 0 ); 547 pw->removeCharSet( 0 );
548 currentSet = profile->charSets().at( i ); 548 currentSet = profile->charSets().at( i );
549 fillCharList(); 549 fillCharList();
550 pw->insertCharSet( currentSet ); 550 pw->insertCharSet( currentSet );
551 inputChar->clear(); 551 inputChar->clear();
552 if ( charList->count() ) { 552 if ( charList->count() ) {
553 charList->setSelected( 0, TRUE ); 553 charList->setSelected( 0, TRUE );
554 selectChar(0); 554 selectChar(0);
555 } 555 }
556} 556}
557 557
558void QIMPenEdit::addChar() 558void QIMPenEdit::addChar()
559{ 559{
560 if ( !inputChar->isEmpty() ) { 560 if ( !inputChar->isEmpty() ) {
561 QIMPenChar *pc = new QIMPenChar( *inputChar ); 561 QIMPenChar *pc = new QIMPenChar( *inputChar );
562 pc->setCharacter( currentCode ); 562 pc->setCharacter( currentCode );
563 563
564 // User characters override all matching system characters. 564 // User characters override all matching system characters.
565 // Copy and mark deleted identical system characters. 565 // Copy and mark deleted identical system characters.
566 QIMPenCharIterator it(currentSet->characters() ); 566 QIMPenCharIterator it(currentSet->characters() );
567 QIMPenChar *sc = 0; 567 QIMPenChar *sc = 0;
568 while ( (sc = it.current()) != 0 ) { 568 while ( (sc = it.current()) != 0 ) {
569 ++it; 569 ++it;
570 if ( sc->character() == currentCode && 570 if ( sc->character() == currentCode &&
571 sc->testFlag( QIMPenChar::System ) && 571 sc->testFlag( QIMPenChar::System ) &&
572 !sc->testFlag( QIMPenChar::Deleted ) ) { 572 !sc->testFlag( QIMPenChar::Deleted ) ) {
573 QIMPenChar *cc = new QIMPenChar( *sc ); 573 QIMPenChar *cc = new QIMPenChar( *sc );
574 cc->clearFlag( QIMPenChar::System ); 574 cc->clearFlag( QIMPenChar::System );
575 currentSet->addChar( cc ); 575 currentSet->addChar( cc );
576 sc->setFlag( QIMPenChar::Deleted ); 576 sc->setFlag( QIMPenChar::Deleted );
577 } 577 }
578 } 578 }
579 579
580 currentSet->addChar( pc ); 580 currentSet->addChar( pc );
581 setCurrentChar( pc ); 581 setCurrentChar( pc );
582 inputChar->clear(); 582 inputChar->clear();
583 } 583 }
584} 584}
585 585
586void QIMPenEdit::addNewChar() 586void QIMPenEdit::addNewChar()
587{ 587{
588 if ( !inputChar->isEmpty() ) { 588 if ( !inputChar->isEmpty() ) {
589 QIMPenInputCharDlg dlg( 0, 0, TRUE ); 589 QIMPenInputCharDlg dlg( 0, 0, TRUE );
590 if ( dlg.exec() ) { 590 if ( dlg.exec() ) {
591 currentCode = dlg.unicode(); 591 currentCode = dlg.unicode();
592 addChar(); 592 addChar();
593 fillCharList(); 593 fillCharList();
594 for ( unsigned int i = 0; i < charList->count(); i++ ) { 594 for ( unsigned int i = 0; i < charList->count(); i++ ) {
595 CharListItem *li = (CharListItem *)charList->item(i); 595 CharListItem *li = (CharListItem *)charList->item(i);
596 if ( li->code() == dlg.unicode() ) { 596 if ( li->code() == dlg.unicode() ) {
597 charList->setSelected( i, TRUE ); 597 charList->setSelected( i, TRUE );
598 break; 598 break;
599 } 599 }
600 } 600 }
601 } 601 }
602 } 602 }
603} 603}
604 604
605void QIMPenEdit::removeChar() 605void QIMPenEdit::removeChar()
606{ 606{
607 if ( currentChar ) { 607 if ( currentChar ) {
608 QIMPenChar *pc = findPrev(); 608 QIMPenChar *pc = findPrev();
609 if ( !pc ) pc = findNext(); 609 if ( !pc ) pc = findNext();
610 if ( currentChar->testFlag( QIMPenChar::System ) ) 610 if ( currentChar->testFlag( QIMPenChar::System ) )
611 currentChar->setFlag( QIMPenChar::Deleted ); 611 currentChar->setFlag( QIMPenChar::Deleted );
612 else 612 else
613 currentSet->removeChar( currentChar ); 613 currentSet->removeChar( currentChar );
614 setCurrentChar( pc ); 614 setCurrentChar( pc );
615 } 615 }
616} 616}
617 617
618void QIMPenEdit::defaultChars() 618void QIMPenEdit::defaultChars()
619{ 619{
620 if ( currentCode ) { 620 if ( currentCode ) {
621 currentChar = 0; 621 currentChar = 0;
622 bool haveSystem = FALSE; 622 bool haveSystem = FALSE;
623 QIMPenCharIterator it(currentSet->characters() ); 623 QIMPenCharIterator it(currentSet->characters() );
624 for ( ; it.current(); ++it ) { 624 for ( ; it.current(); ++it ) {
625 if ( it.current()->character() == currentCode && 625 if ( it.current()->character() == currentCode &&
626 it.current()->testFlag( QIMPenChar::System ) ) { 626 it.current()->testFlag( QIMPenChar::System ) ) {
627 haveSystem = TRUE; 627 haveSystem = TRUE;
628 break; 628 break;
629 } 629 }
630 } 630 }
631 if ( haveSystem ) { 631 if ( haveSystem ) {
632 it.toFirst(); 632 it.toFirst();
633 while ( it.current() ) { 633 while ( it.current() ) {
634 QIMPenChar *pc = it.current(); 634 QIMPenChar *pc = it.current();
635 ++it; 635 ++it;
636 if ( pc->character() == currentCode ) { 636 if ( pc->character() == currentCode ) {
637 if ( pc->testFlag( QIMPenChar::System ) ) { 637 if ( pc->testFlag( QIMPenChar::System ) ) {
638 pc->clearFlag( QIMPenChar::Deleted ); 638 pc->clearFlag( QIMPenChar::Deleted );
639 if ( !currentChar ) 639 if ( !currentChar )
640 currentChar = pc; 640 currentChar = pc;
641 } else { 641 } else {
642 currentSet->removeChar( pc ); 642 currentSet->removeChar( pc );
643 } 643 }
644 } 644 }
645 } 645 }
646 setCurrentChar( currentChar ); 646 setCurrentChar( currentChar );
647 } 647 }
648 } 648 }
649} 649}
650 650
651void QIMPenEdit::newStroke( QIMPenStroke *st ) 651void QIMPenEdit::newStroke( QIMPenStroke *st )
652{ 652{
653 inputChar->addStroke( st ); 653 inputChar->addStroke( st );
654 enableButtons(); 654 enableButtons();
655} 655}
656 656