summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/handwriting/qimpenchar.cpp5
-rw-r--r--inputmethods/handwriting/qimpenchar.h3
-rw-r--r--inputmethods/handwriting/qimpenprofile.cpp25
-rw-r--r--inputmethods/handwriting/qimpenprofile.h2
-rw-r--r--inputmethods/handwriting/qimpensetup.cpp3
5 files changed, 35 insertions, 3 deletions
diff --git a/inputmethods/handwriting/qimpenchar.cpp b/inputmethods/handwriting/qimpenchar.cpp
index 0c37e5c..929f370 100644
--- a/inputmethods/handwriting/qimpenchar.cpp
+++ b/inputmethods/handwriting/qimpenchar.cpp
@@ -301,108 +301,111 @@ const QString &QIMPenCharSet::filename( Domain d ) const
301 301
302void QIMPenCharSet::setFilename( const QString &fn, Domain d ) 302void QIMPenCharSet::setFilename( const QString &fn, Domain d )
303{ 303{
304 if ( d == System ) 304 if ( d == System )
305 sysFilename = fn; 305 sysFilename = fn;
306 else if ( d == User ) 306 else if ( d == User )
307 userFilename = fn; 307 userFilename = fn;
308} 308}
309 309
310/*! 310/*!
311 Load a character set from file \a fn. 311 Load a character set from file \a fn.
312 */ 312 */
313bool QIMPenCharSet::load( const QString &fn, Domain d ) 313bool QIMPenCharSet::load( const QString &fn, Domain d )
314{ 314{
315 setFilename( fn, d ); 315 setFilename( fn, d );
316 316
317 bool ok = FALSE; 317 bool ok = FALSE;
318 QFile file( fn ); 318 QFile file( fn );
319 if ( file.open( IO_ReadOnly ) ) { 319 if ( file.open( IO_ReadOnly ) ) {
320 QDataStream ds( &file ); 320 QDataStream ds( &file );
321 QString version; 321 QString version;
322 ds >> version; 322 ds >> version;
323 ds >> csTitle; 323 ds >> csTitle;
324 ds >> desc; 324 ds >> desc;
325 int major = version.mid( 4, 1 ).toInt(); 325 int major = version.mid( 4, 1 ).toInt();
326 int minor = version.mid( 6 ).toInt(); 326 int minor = version.mid( 6 ).toInt();
327 if ( major >= 1 && minor > 0 ) { 327 if ( major >= 1 && minor > 0 ) {
328 ds >> (Q_INT8 &)csType; 328 ds >> (Q_INT8 &)csType;
329 } else { 329 } else {
330 if ( csTitle == "abc" ) 330 if ( csTitle == "abc" )
331 csType = Lower; 331 csType = Lower;
332 else if ( csTitle == "ABC" ) 332 else if ( csTitle == "ABC" )
333 csType = Upper; 333 csType = Upper;
334 else if ( csTitle == "123" ) 334 else if ( csTitle == "123" )
335 csType = Numeric; 335 csType = Numeric;
336 else if ( fn == "Combining" ) 336 else if ( fn == "Combining" )
337 csType = Combining; 337 csType = Combining;
338 } 338 }
339 while ( !ds.atEnd() ) { 339 while ( !ds.atEnd() ) {
340 QIMPenChar *pc = new QIMPenChar; 340 QIMPenChar *pc = new QIMPenChar;
341 ds >> *pc; 341 ds >> *pc;
342 if ( d == User ) 342 if ( d == User )
343 markDeleted( pc->character() ); // override system 343 markDeleted( pc->character() ); // override system
344 addChar( pc ); 344 addChar( pc );
345 } 345 }
346 if ( file.status() == IO_Ok ) 346 if ( file.status() == IO_Ok )
347 ok = TRUE; 347 ok = TRUE;
348 } 348 }
349 349 setHidden ( false );
350 return ok; 350 return ok;
351} 351}
352 352
353/*! 353/*!
354 Save this character set. 354 Save this character set.
355 */ 355 */
356bool QIMPenCharSet::save( Domain d ) 356bool QIMPenCharSet::save( Domain d )
357{ 357{
358 if ( filename( d ).isEmpty() ) 358 if ( filename( d ).isEmpty() )
359 return FALSE; 359 return FALSE;
360 360
361 if ( hidden() )
362 return TRUE;
363
361 bool ok = FALSE; 364 bool ok = FALSE;
362 365
363 QString fn = filename( d ); 366 QString fn = filename( d );
364 QString tmpFn = fn + ".new"; 367 QString tmpFn = fn + ".new";
365 QFile file( tmpFn ); 368 QFile file( tmpFn );
366 if ( file.open( IO_WriteOnly|IO_Raw ) ) { 369 if ( file.open( IO_WriteOnly|IO_Raw ) ) {
367 QByteArray buf; 370 QByteArray buf;
368 QDataStream ds( buf, IO_WriteOnly ); 371 QDataStream ds( buf, IO_WriteOnly );
369 ds << QString( "QPT 1.1" ); 372 ds << QString( "QPT 1.1" );
370 ds << csTitle; 373 ds << csTitle;
371 ds << desc; 374 ds << desc;
372 ds << (Q_INT8)csType; 375 ds << (Q_INT8)csType;
373 QIMPenCharIterator ci( chars ); 376 QIMPenCharIterator ci( chars );
374 for ( ; ci.current(); ++ci ) { 377 for ( ; ci.current(); ++ci ) {
375 QIMPenChar *pc = ci.current(); 378 QIMPenChar *pc = ci.current();
376 if ( ( ( (d == System) && pc->testFlag( QIMPenChar::System ) ) || 379 if ( ( ( (d == System) && pc->testFlag( QIMPenChar::System ) ) ||
377 ( (d == User) && !pc->testFlag( QIMPenChar::System ) ) ) && 380 ( (d == User) && !pc->testFlag( QIMPenChar::System ) ) ) &&
378 ( !pc->testFlag (QIMPenChar::Combined ) ) ) { 381 ( !pc->testFlag (QIMPenChar::Combined ) ) ) {
379 ds << *pc; 382 ds << *pc;
380 } 383 }
381 } 384 }
382 385
383 file.writeBlock( buf ); 386 file.writeBlock( buf );
384 file.close(); 387 file.close();
385 if ( file.status() == IO_Ok ) 388 if ( file.status() == IO_Ok )
386 ok = TRUE; 389 ok = TRUE;
387 } 390 }
388 391
389 if ( ok ) { 392 if ( ok ) {
390 if ( ::rename( tmpFn.latin1(), fn.latin1() ) < 0 ) { 393 if ( ::rename( tmpFn.latin1(), fn.latin1() ) < 0 ) {
391 qWarning( "problem renaming file %s to %s, errno: %d", 394 qWarning( "problem renaming file %s to %s, errno: %d",
392 tmpFn.latin1(), fn.latin1(), errno ); 395 tmpFn.latin1(), fn.latin1(), errno );
393 // remove the tmp file, otherwise, it will just lay around... 396 // remove the tmp file, otherwise, it will just lay around...
394 QFile::remove( tmpFn.latin1() ); 397 QFile::remove( tmpFn.latin1() );
395 ok = FALSE; 398 ok = FALSE;
396 } 399 }
397 } 400 }
398 401
399 return ok; 402 return ok;
400} 403}
401 404
402QIMPenChar *QIMPenCharSet::at( int i ) 405QIMPenChar *QIMPenCharSet::at( int i )
403{ 406{
404 return chars.at(i); 407 return chars.at(i);
405} 408}
406 409
407void QIMPenCharSet::markDeleted( uint ch ) 410void QIMPenCharSet::markDeleted( uint ch )
408{ 411{
diff --git a/inputmethods/handwriting/qimpenchar.h b/inputmethods/handwriting/qimpenchar.h
index efd6f16..e4e7645 100644
--- a/inputmethods/handwriting/qimpenchar.h
+++ b/inputmethods/handwriting/qimpenchar.h
@@ -72,86 +72,89 @@ public:
72protected: 72protected:
73 unsigned int ch; 73 unsigned int ch;
74 QString d; 74 QString d;
75 Q_UINT8 flags; 75 Q_UINT8 flags;
76 QIMPenStrokeList strokes; 76 QIMPenStrokeList strokes;
77 77
78 friend QDataStream &operator<< (QDataStream &, const QIMPenChar &); 78 friend QDataStream &operator<< (QDataStream &, const QIMPenChar &);
79 friend QDataStream &operator>> (QDataStream &, QIMPenChar &); 79 friend QDataStream &operator>> (QDataStream &, QIMPenChar &);
80}; 80};
81 81
82typedef QList<QIMPenChar> QIMPenCharList; 82typedef QList<QIMPenChar> QIMPenCharList;
83typedef QListIterator<QIMPenChar> QIMPenCharIterator; 83typedef QListIterator<QIMPenChar> QIMPenCharIterator;
84 84
85QDataStream & operator<< (QDataStream & s, const QIMPenChar &ws); 85QDataStream & operator<< (QDataStream & s, const QIMPenChar &ws);
86QDataStream & operator>> (QDataStream & s, QIMPenChar &ws); 86QDataStream & operator>> (QDataStream & s, QIMPenChar &ws);
87 87
88struct QIMPenCharMatch 88struct QIMPenCharMatch
89{ 89{
90 int error; 90 int error;
91 QIMPenChar *penChar; 91 QIMPenChar *penChar;
92 92
93 bool operator>( const QIMPenCharMatch &m ); 93 bool operator>( const QIMPenCharMatch &m );
94 bool operator<( const QIMPenCharMatch &m ); 94 bool operator<( const QIMPenCharMatch &m );
95 bool operator<=( const QIMPenCharMatch &m ); 95 bool operator<=( const QIMPenCharMatch &m );
96}; 96};
97 97
98typedef QValueList<QIMPenCharMatch> QIMPenCharMatchList; 98typedef QValueList<QIMPenCharMatch> QIMPenCharMatchList;
99 99
100 100
101class QIMPenCharSet 101class QIMPenCharSet
102{ 102{
103public: 103public:
104 QIMPenCharSet(); 104 QIMPenCharSet();
105 QIMPenCharSet( const QString &fn ); 105 QIMPenCharSet( const QString &fn );
106 106
107 bool isEmpty() const { return chars.isEmpty(); } 107 bool isEmpty() const { return chars.isEmpty(); }
108 unsigned int count() const { return chars.count(); } 108 unsigned int count() const { return chars.count(); }
109 void clear() { chars.clear(); } 109 void clear() { chars.clear(); }
110 110
111 void setDescription( const QString &d ) { desc = d; } 111 void setDescription( const QString &d ) { desc = d; }
112 QString description() const { return desc; } 112 QString description() const { return desc; }
113 void setTitle( const QString &t ) { csTitle = t; } 113 void setTitle( const QString &t ) { csTitle = t; }
114 QString title() const { return csTitle; } 114 QString title() const { return csTitle; }
115 115
116 QIMPenCharMatchList match( QIMPenChar *ch ); 116 QIMPenCharMatchList match( QIMPenChar *ch );
117 void addChar( QIMPenChar *ch ); 117 void addChar( QIMPenChar *ch );
118 void removeChar( QIMPenChar *ch ); 118 void removeChar( QIMPenChar *ch );
119 QIMPenChar *at( int i ); 119 QIMPenChar *at( int i );
120 void setHidden ( const bool &b ) { phidden = &b; }
121 bool hidden() const { return phidden; }
120 122
121 unsigned maximumStrokes() const { return maxStrokes; } 123 unsigned maximumStrokes() const { return maxStrokes; }
122 124
123 void up( QIMPenChar *ch ); 125 void up( QIMPenChar *ch );
124 void down( QIMPenChar *ch ); 126 void down( QIMPenChar *ch );
125 127
126 enum Domain { System, User }; 128 enum Domain { System, User };
127 enum Type { Unknown=0x00, Lower=0x01, Upper=0x02, Combining=0x04, 129 enum Type { Unknown=0x00, Lower=0x01, Upper=0x02, Combining=0x04,
128 Numeric=0x08, Punctuation=0x10, Symbol=0x20, Shortcut=0x40 }; 130 Numeric=0x08, Punctuation=0x10, Symbol=0x20, Shortcut=0x40 };
129 131
130 const QIMPenCharList &characters() const { return chars; } 132 const QIMPenCharList &characters() const { return chars; }
131 133
132 void setType( Type t ) { csType = t; } 134 void setType( Type t ) { csType = t; }
133 Type type() const { return csType; } 135 Type type() const { return csType; }
134 136
135 const QString &filename( Domain d ) const; 137 const QString &filename( Domain d ) const;
136 void setFilename( const QString &fn, Domain d=System ); 138 void setFilename( const QString &fn, Domain d=System );
137 bool load( const QString &fn, Domain d=System ); 139 bool load( const QString &fn, Domain d=System );
138 bool save( Domain d=System ); 140 bool save( Domain d=System );
139 141
140protected: 142protected:
141 void markDeleted( uint ch ); 143 void markDeleted( uint ch );
142 144
143protected: 145protected:
144 QString csTitle; 146 QString csTitle;
145 QString desc; 147 QString desc;
146 QString sysFilename; 148 QString sysFilename;
147 QString userFilename; 149 QString userFilename;
148 Type csType; 150 Type csType;
149 unsigned maxStrokes; 151 unsigned maxStrokes;
150 QIMPenCharList chars; 152 QIMPenCharList chars;
151 QIMPenCharMatchList matches; 153 QIMPenCharMatchList matches;
154 bool phidden : 1;
152}; 155};
153 156
154typedef QList<QIMPenCharSet> QIMPenCharSetList; 157typedef QList<QIMPenCharSet> QIMPenCharSetList;
155typedef QListIterator<QIMPenCharSet> QIMPenCharSetIterator; 158typedef QListIterator<QIMPenCharSet> QIMPenCharSetIterator;
156 159
157#endif 160#endif
diff --git a/inputmethods/handwriting/qimpenprofile.cpp b/inputmethods/handwriting/qimpenprofile.cpp
index 3b1b5e9..b1a6592 100644
--- a/inputmethods/handwriting/qimpenprofile.cpp
+++ b/inputmethods/handwriting/qimpenprofile.cpp
@@ -3,181 +3,204 @@
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 "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 QString t = config.readEntry( "Mono", "Dual" );
52 pmono = (QString::fromLatin1("Mono") == t );
53
51 msTimeout = config.readNumEntry( "MultiTimeout", 500 ); 54 msTimeout = config.readNumEntry( "MultiTimeout", 500 );
52 55
53 // Read user configuration 56 // Read user configuration
54 Config usrConfig( userConfig() ); 57 Config usrConfig( userConfig() );
55 usrConfig.setGroup( "Settings" ); 58 usrConfig.setGroup( "Settings" );
56 msTimeout = usrConfig.readNumEntry( "MultiTimeout", msTimeout ); 59 msTimeout = usrConfig.readNumEntry( "MultiTimeout", msTimeout );
57 60
58 if ( tstyle && usrConfig.hasKey( "Style" ) ) { 61 if ( tstyle && usrConfig.hasKey( "Style" ) ) {
59 pstyle = BothCases; 62 pstyle = BothCases;
60 QString s = usrConfig.readEntry( "Style", "BothCases" ); 63 QString s = usrConfig.readEntry( "Style", "BothCases" );
61 if ( s == "ToggleCases" ) 64 if ( s == "ToggleCases" )
62 pstyle = ToggleCases; 65 pstyle = ToggleCases;
63 } 66 }
64} 67}
65 68
66void QIMPenProfile::setStyle( Style s ) 69void QIMPenProfile::setStyle( Style s )
67{ 70{
68 if ( tstyle && s != pstyle ) { 71 if ( tstyle && s != pstyle ) {
69 pstyle = s; 72 pstyle = s;
70 Config config( userConfig() ); 73 Config config( userConfig() );
71 config.setGroup( "Settings" ); 74 config.setGroup( "Settings" );
72 QString s = pstyle == ToggleCases ? "ToggleCases" : "BothCases"; 75 QString s = pstyle == ToggleCases ? "ToggleCases" : "BothCases";
73 config.writeEntry( "Style", s ); 76 config.writeEntry( "Style", s );
74 } 77 }
75} 78}
76 79
77void QIMPenProfile::setMultiStrokeTimeout( int t ) 80void QIMPenProfile::setMultiStrokeTimeout( int t )
78{ 81{
79 if ( t != msTimeout ) { 82 if ( t != msTimeout ) {
80 msTimeout = t; 83 msTimeout = t;
81 Config config( userConfig() ); 84 Config config( userConfig() );
82 config.setGroup( "Settings" ); 85 config.setGroup( "Settings" );
83 config.writeEntry( "MultiTimeout", msTimeout ); 86 config.writeEntry( "MultiTimeout", msTimeout );
84 } 87 }
85} 88}
86 89
87QString QIMPenProfile::userConfig() 90QString QIMPenProfile::userConfig()
88{ 91{
89 QString un = filename; 92 QString un = filename;
90 int pos = un.findRev( '/' ); 93 int pos = un.findRev( '/' );
91 if ( pos >= 0 ) 94 if ( pos >= 0 )
92 un = un.mid( pos + 1 ); 95 un = un.mid( pos + 1 );
93 pos = un.find( '.' ); 96 pos = un.find( '.' );
94 if ( pos > 0 ) 97 if ( pos > 0 )
95 un.truncate( pos ); 98 un.truncate( pos );
96 99
97 un = "handwriting-" + un; // No tr 100 un = "handwriting-" + un; // No tr
98 101
99 return un; 102 return un;
100} 103}
101 104
102void QIMPenProfile::loadData() 105void QIMPenProfile::loadData()
103{ 106{
104 Config config( filename, Config::File ); 107 Config config( filename, Config::File );
105 config.setGroup( "CharSets" ); 108 config.setGroup( "CharSets" );
106 109
107 QString baseDir = QPEApplication::qpeDir(); 110 QString baseDir = QPEApplication::qpeDir();
108 baseDir += "/etc/"; 111 baseDir += "/etc/";
109 // accents 112 // accents
110 QIMPenCombining *combining = 0; 113 QIMPenCombining *combining = 0;
111 QString s = config.readEntry( "Combining" ); 114 QString s = config.readEntry( "Combining" );
112 if ( !s.isEmpty() ) { 115 if ( !s.isEmpty() ) {
113 combining = new QIMPenCombining( baseDir + "qimpen/" + s ); 116 combining = new QIMPenCombining( baseDir + "qimpen/" + s );
114 if ( combining->isEmpty() ) { 117 if ( combining->isEmpty() ) {
115 delete combining; 118 delete combining;
116 combining = 0; 119 combining = 0;
117 } 120 }
118 } 121 }
119 // uppercase latin1 122 // uppercase latin1
120 QIMPenCharSet *cs = 0; 123 QIMPenCharSet *cs = 0;
121 s = config.readEntry( "Uppercase" ); 124 s = config.readEntry( "Uppercase" );
122 if ( !s.isEmpty() ) { 125 if ( !s.isEmpty() && !mono() ) {
123 cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); 126 cs = new QIMPenCharSet( baseDir + "qimpen/" + s );
124 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); 127 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
125 if ( !cs->isEmpty() ) { 128 if ( !cs->isEmpty() ) {
126 if ( combining ) 129 if ( combining )
127 combining->addCombined( cs ); 130 combining->addCombined( cs );
128 sets.append( cs ); 131 sets.append( cs );
129 } else { 132 } else {
130 delete cs; 133 delete cs;
131 } 134 }
132 } 135 }
133 // lowercase latin1 136 // lowercase latin1
134 s = config.readEntry( "Lowercase" ); 137 s = config.readEntry( "Lowercase" );
135 if ( !s.isEmpty() ) { 138 if ( !s.isEmpty() ) {
139 if ( mono() ) {
140 cs = new QIMPenCharSet ( baseDir + "qimpen/" + s );
141 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
142 if ( !cs->isEmpty() ) {
143 cs->setTitle( cs->title().upper() );
144 cs->setType( QIMPenCharSet::Upper );
145 cs->setHidden ( true );
146 QIMPenCharIterator it( cs->characters() );
147 for ( ; it.current(); ++it ) {
148 uint ch = it.current()->character();
149 if ( ch >= 'a' && ch <= 'z' )
150 it.current()->setCharacter( QChar(ch).upper() );
151 }
152 if ( combining )
153 combining->addCombined( cs );
154 sets.append( cs );
155 } else {
156 delete cs;
157 }
158 }
136 cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); 159 cs = new QIMPenCharSet( baseDir + "qimpen/" + s );
137 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); 160 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
138 if ( !cs->isEmpty() ) { 161 if ( !cs->isEmpty() ) {
139 if ( combining ) 162 if ( combining )
140 combining->addCombined( cs ); 163 combining->addCombined( cs );
141 sets.append( cs ); 164 sets.append( cs );
142 } else { 165 } else {
143 delete cs; 166 delete cs;
144 } 167 }
145 } 168 }
146 // numeric (may comtain punctuation and symbols) 169 // numeric (may comtain punctuation and symbols)
147 s = config.readEntry( "Numeric" ); 170 s = config.readEntry( "Numeric" );
148 if ( !s.isEmpty() ) { 171 if ( !s.isEmpty() ) {
149 cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); 172 cs = new QIMPenCharSet( baseDir + "qimpen/" + s );
150 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); 173 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
151 if ( !cs->isEmpty() ) { 174 if ( !cs->isEmpty() ) {
152 sets.append( cs ); 175 sets.append( cs );
153 } else { 176 } else {
154 delete cs; 177 delete cs;
155 } 178 }
156 } 179 }
157 // punctuation 180 // punctuation
158 s = config.readEntry( "Punctuation" ); 181 s = config.readEntry( "Punctuation" );
159 if ( !s.isEmpty() ) { 182 if ( !s.isEmpty() ) {
160 cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); 183 cs = new QIMPenCharSet( baseDir + "qimpen/" + s );
161 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); 184 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
162 if ( !cs->isEmpty() ) { 185 if ( !cs->isEmpty() ) {
163 sets.append( cs ); 186 sets.append( cs );
164 } else { 187 } else {
165 delete cs; 188 delete cs;
166 } 189 }
167 } 190 }
168 // symbol 191 // symbol
169 s = config.readEntry( "Symbol" ); 192 s = config.readEntry( "Symbol" );
170 if ( !s.isEmpty() ) { 193 if ( !s.isEmpty() ) {
171 cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); 194 cs = new QIMPenCharSet( baseDir + "qimpen/" + s );
172 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); 195 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
173 if ( !cs->isEmpty() ) { 196 if ( !cs->isEmpty() ) {
174 sets.append( cs ); 197 sets.append( cs );
175 } else { 198 } else {
176 delete cs; 199 delete cs;
177 } 200 }
178 } 201 }
179 // shortcut 202 // shortcut
180 s = config.readEntry( "Shortcut" ); 203 s = config.readEntry( "Shortcut" );
181 if ( !s.isEmpty() ) { 204 if ( !s.isEmpty() ) {
182 cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); 205 cs = new QIMPenCharSet( baseDir + "qimpen/" + s );
183 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); 206 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
diff --git a/inputmethods/handwriting/qimpenprofile.h b/inputmethods/handwriting/qimpenprofile.h
index 4ce4367..adfa866 100644
--- a/inputmethods/handwriting/qimpenprofile.h
+++ b/inputmethods/handwriting/qimpenprofile.h
@@ -1,70 +1,72 @@
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#ifndef QIMPENPROFILE_H_ 21#ifndef QIMPENPROFILE_H_
22#define QIMPENPROFILE_H_ 22#define QIMPENPROFILE_H_
23 23
24#include "qimpenchar.h" 24#include "qimpenchar.h"
25 25
26class QIMPenProfile 26class QIMPenProfile
27{ 27{
28public: 28public:
29 QIMPenProfile( const QString &fn ); 29 QIMPenProfile( const QString &fn );
30 30
31 const QString &name() const { return pname; } 31 const QString &name() const { return pname; }
32 const QString &description() const { return pdesc; } 32 const QString &description() const { return pdesc; }
33 33
34 enum Style { ToggleCases, BothCases }; 34 enum Style { ToggleCases, BothCases };
35 Style style() const { return pstyle; } 35 Style style() const { return pstyle; }
36 bool mono() const { return pmono; }
36 void setStyle( Style s ); 37 void setStyle( Style s );
37 38
38 bool canSelectStyle() const { return tstyle; } 39 bool canSelectStyle() const { return tstyle; }
39 40
40 int multiStrokeTimeout() const { return msTimeout; } 41 int multiStrokeTimeout() const { return msTimeout; }
41 void setMultiStrokeTimeout( int t ); 42 void setMultiStrokeTimeout( int t );
42 43
43 bool matchWords() const { return wordMatch; } 44 bool matchWords() const { return wordMatch; }
44 45
45 QIMPenCharSet *uppercase(); 46 QIMPenCharSet *uppercase();
46 QIMPenCharSet *lowercase(); 47 QIMPenCharSet *lowercase();
47 QIMPenCharSet *numeric(); 48 QIMPenCharSet *numeric();
48 QIMPenCharSet *punctuation(); 49 QIMPenCharSet *punctuation();
49 QIMPenCharSet *symbol(); 50 QIMPenCharSet *symbol();
50 QIMPenCharSet *shortcut(); 51 QIMPenCharSet *shortcut();
51 QIMPenCharSet *find( QIMPenCharSet::Type t ); 52 QIMPenCharSet *find( QIMPenCharSet::Type t );
52 53
53 QIMPenCharSetList &charSets(); 54 QIMPenCharSetList &charSets();
54 55
55private: 56private:
56 QString userConfig(); 57 QString userConfig();
57 void loadData(); 58 void loadData();
58 59
59private: 60private:
60 QIMPenCharSetList sets; 61 QIMPenCharSetList sets;
61 QString filename; 62 QString filename;
62 QString pname; 63 QString pname;
63 QString pdesc; 64 QString pdesc;
64 Style pstyle; 65 Style pstyle;
65 bool tstyle; 66 bool tstyle;
66 int msTimeout; 67 int msTimeout;
67 bool wordMatch; 68 bool wordMatch;
69 bool pmono;
68}; 70};
69 71
70#endif 72#endif
diff --git a/inputmethods/handwriting/qimpensetup.cpp b/inputmethods/handwriting/qimpensetup.cpp
index 2441102..d0f9ffd 100644
--- a/inputmethods/handwriting/qimpensetup.cpp
+++ b/inputmethods/handwriting/qimpensetup.cpp
@@ -356,97 +356,98 @@ QIMPenEdit::QIMPenEdit( QIMPenProfile *p, QWidget *parent,
356 removeBtn = new QPushButton( tr("Remove"), this ); 356 removeBtn = new QPushButton( tr("Remove"), this );
357 connect( removeBtn, SIGNAL(clicked()), SLOT(removeChar()) ); 357 connect( removeBtn, SIGNAL(clicked()), SLOT(removeChar()) );
358 vb->addWidget( removeBtn ); 358 vb->addWidget( removeBtn );
359 359
360 QPushButton *pb = new QPushButton( tr("Default"), this ); 360 QPushButton *pb = new QPushButton( tr("Default"), this );
361 connect( pb, SIGNAL(clicked()), SLOT(defaultChars()) ); 361 connect( pb, SIGNAL(clicked()), SLOT(defaultChars()) );
362 vb->addWidget( pb ); 362 vb->addWidget( pb );
363 363
364 QHBoxLayout *hb = new QHBoxLayout(); 364 QHBoxLayout *hb = new QHBoxLayout();
365 gl->addLayout( hb, 2, 1 ); 365 gl->addLayout( hb, 2, 1 );
366 prevBtn = new QPushButton( this ); 366 prevBtn = new QPushButton( this );
367 prevBtn->setPixmap( QPixmap( (const char **)left_xpm ) ); 367 prevBtn->setPixmap( QPixmap( (const char **)left_xpm ) );
368 connect( prevBtn, SIGNAL(clicked()), SLOT(prevChar())); 368 connect( prevBtn, SIGNAL(clicked()), SLOT(prevChar()));
369 hb->addWidget( prevBtn ); 369 hb->addWidget( prevBtn );
370 370
371 nextBtn = new QPushButton( this ); 371 nextBtn = new QPushButton( this );
372 nextBtn->setPixmap( QPixmap( (const char **)right_xpm ) ); 372 nextBtn->setPixmap( QPixmap( (const char **)right_xpm ) );
373 connect( nextBtn, SIGNAL(clicked()), SLOT(nextChar())); 373 connect( nextBtn, SIGNAL(clicked()), SLOT(nextChar()));
374 hb->addWidget( nextBtn ); 374 hb->addWidget( nextBtn );
375 375
376 pb = new QPushButton( tr("Clear"), this ); 376 pb = new QPushButton( tr("Clear"), this );
377 connect( pb, SIGNAL(clicked()), SLOT(clearChar()) ); 377 connect( pb, SIGNAL(clicked()), SLOT(clearChar()) );
378 gl->addWidget( pb, 3, 1 ); 378 gl->addWidget( pb, 3, 1 );
379 379
380 //-- 380 //--
381#if !defined(Q_WS_QWS) 381#if !defined(Q_WS_QWS)
382 hb = new QHBoxLayout( tvb ); 382 hb = new QHBoxLayout( tvb );
383 pb = new QPushButton( tr("OK"), this ); 383 pb = new QPushButton( tr("OK"), this );
384 connect( pb, SIGNAL(clicked()), SLOT(accept()) ); 384 connect( pb, SIGNAL(clicked()), SLOT(accept()) );
385 hb->addWidget( pb ); 385 hb->addWidget( pb );
386 386
387 pb = new QPushButton( tr("Cancel"), this ); 387 pb = new QPushButton( tr("Cancel"), this );
388 connect( pb, SIGNAL(clicked()), SLOT(reject()) ); 388 connect( pb, SIGNAL(clicked()), SLOT(reject()) );
389 hb->addWidget( pb ); 389 hb->addWidget( pb );
390#endif 390#endif
391 selectCharSet( 0 ); 391 selectCharSet( 0 );
392 charList->setFocus(); 392 charList->setFocus();
393 393
394 resize( minimumSize() ); 394 resize( minimumSize() );
395 enableButtons(); 395 enableButtons();
396} 396}
397 397
398void QIMPenEdit::setProfile( QIMPenProfile *p ) 398void QIMPenEdit::setProfile( QIMPenProfile *p )
399{ 399{
400 profile = p; 400 profile = p;
401 charSetCombo->clear(); 401 charSetCombo->clear();
402 QIMPenCharSetIterator it( profile->charSets() ); 402 QIMPenCharSetIterator it( profile->charSets() );
403 for ( ; it.current(); ++it ) { 403 for ( ; it.current(); ++it ) {
404 charSetCombo->insertItem( it.current()->description() ); 404 if ( ! it.current()->hidden() )
405 charSetCombo->insertItem( it.current()->description() );
405 } 406 }
406 selectCharSet( 0 ); 407 selectCharSet( 0 );
407 charList->setFocus(); 408 charList->setFocus();
408 enableButtons(); 409 enableButtons();
409} 410}
410 411
411void QIMPenEdit::selectCharSet( QIMPenCharSet *c ) 412void QIMPenEdit::selectCharSet( QIMPenCharSet *c )
412{ 413{
413 int i = 0; 414 int i = 0;
414 QIMPenCharSetIterator it( profile->charSets() ); 415 QIMPenCharSetIterator it( profile->charSets() );
415 for ( ; it.current(); ++it, i++ ) { 416 for ( ; it.current(); ++it, i++ ) {
416 if ( it.current() == c ) { 417 if ( it.current() == c ) {
417 charSetCombo->setCurrentItem( i ); 418 charSetCombo->setCurrentItem( i );
418 selectCharSet( i ); 419 selectCharSet( i );
419 } 420 }
420 } 421 }
421} 422}
422 423
423 424
424/*! 425/*!
425 Fill the character list box with the characters. Duplicates are not 426 Fill the character list box with the characters. Duplicates are not
426 inserted. 427 inserted.
427*/ 428*/
428void QIMPenEdit::fillCharList() 429void QIMPenEdit::fillCharList()
429{ 430{
430 charList->clear(); 431 charList->clear();
431 QIMPenCharIterator it( currentSet->characters() ); 432 QIMPenCharIterator it( currentSet->characters() );
432 CharListItem *li = 0; 433 CharListItem *li = 0;
433 for ( ; it.current(); ++it ) { 434 for ( ; it.current(); ++it ) {
434 uint ch = it.current()->character(); 435 uint ch = it.current()->character();
435 QString n = it.current()->name(); 436 QString n = it.current()->name();
436 if ( !n.isEmpty() ) 437 if ( !n.isEmpty() )
437 li = new CharListItem( n, ch ); 438 li = new CharListItem( n, ch );
438 if ( li ) { 439 if ( li ) {
439 CharListItem *i = (CharListItem *)charList->findItem( li->text() ); 440 CharListItem *i = (CharListItem *)charList->findItem( li->text() );
440 if ( !i || i->code() != ch ) { 441 if ( !i || i->code() != ch ) {
441 charList->insertItem( li ); 442 charList->insertItem( li );
442 } else { 443 } else {
443 delete li; 444 delete li;
444 li = 0; 445 li = 0;
445 } 446 }
446 } 447 }
447 } 448 }
448 currentChar = 0; 449 currentChar = 0;
449} 450}
450 451
451void QIMPenEdit::enableButtons() 452void QIMPenEdit::enableButtons()
452{ 453{