summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/handwriting/config.in2
-rw-r--r--inputmethods/handwriting/handwriting.pro2
-rw-r--r--inputmethods/handwriting/qimpenchar.cpp4
-rw-r--r--inputmethods/handwriting/qimpensetup.cpp3
4 files changed, 6 insertions, 5 deletions
diff --git a/inputmethods/handwriting/config.in b/inputmethods/handwriting/config.in
index 3a5fddb..b4acc9a 100644
--- a/inputmethods/handwriting/config.in
+++ b/inputmethods/handwriting/config.in
@@ -1,8 +1,8 @@
1 config HANDWRITING 1 config HANDWRITING
2 boolean "opie-handwriting (Handwriting recognition)" 2 boolean "opie-handwriting (Handwriting recognition)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
5 comment "opie-handwriting-classicset automatically selected" 5 comment "opie-handwriting-classicset automatically selected"
6 depends HANDWRITING 6 depends HANDWRITING
7 comment "opie-handwriting-graffitiset automatically selected" 7 comment "opie-handwriting-graffitiset automatically selected"
8 depends HANDWRITING 8 depends HANDWRITING
diff --git a/inputmethods/handwriting/handwriting.pro b/inputmethods/handwriting/handwriting.pro
index 3800381..e6f3b3f 100644
--- a/inputmethods/handwriting/handwriting.pro
+++ b/inputmethods/handwriting/handwriting.pro
@@ -1,34 +1,34 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt plugin warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= qimpenchar.h \ 3 HEADERS= qimpenchar.h \
4 qimpenprofile.h \ 4 qimpenprofile.h \
5 qimpencombining.h \ 5 qimpencombining.h \
6 qimpenhelp.h \ 6 qimpenhelp.h \
7 qimpeninput.h \ 7 qimpeninput.h \
8 qimpenmatch.h \ 8 qimpenmatch.h \
9 qimpensetup.h \ 9 qimpensetup.h \
10 qimpenstroke.h \ 10 qimpenstroke.h \
11 qimpenwidget.h \ 11 qimpenwidget.h \
12 qimpenwordpick.h \ 12 qimpenwordpick.h \
13 handwritingimpl.h 13 handwritingimpl.h
14 SOURCES= qimpenchar.cpp \ 14 SOURCES= qimpenchar.cpp \
15 qimpenprofile.cpp \ 15 qimpenprofile.cpp \
16 qimpencombining.cpp \ 16 qimpencombining.cpp \
17 qimpenhelp.cpp \ 17 qimpenhelp.cpp \
18 qimpeninput.cpp \ 18 qimpeninput.cpp \
19 qimpenmatch.cpp \ 19 qimpenmatch.cpp \
20 qimpensetup.cpp \ 20 qimpensetup.cpp \
21 qimpenstroke.cpp \ 21 qimpenstroke.cpp \
22 qimpenwidget.cpp \ 22 qimpenwidget.cpp \
23 qimpenwordpick.cpp \ 23 qimpenwordpick.cpp \
24 handwritingimpl.cpp 24 handwritingimpl.cpp
25INTERFACES = qimpenprefbase.ui 25INTERFACES = qimpenprefbase.ui
26 TARGET = qhandwriting 26 TARGET = qhandwriting
27 DESTDIR = ../../plugins/inputmethods 27 DESTDIR = ../../plugins/inputmethods
28INCLUDEPATH += $(OPIEDIR)/include 28INCLUDEPATH += $(OPIEDIR)/include
29DEPENDPATH += ../$(OPIEDIR)/include ../../launcher 29DEPENDPATH += ../$(OPIEDIR)/include ../../launcher
30LIBS += -lqpe 30LIBS += -lqpe -lopiecore2
31 VERSION = 1.0.0 31 VERSION = 1.0.0
32 32
33include ( $(OPIEDIR)/include.pro ) 33include ( $(OPIEDIR)/include.pro )
34target.path = $$prefix/plugins/inputmethods 34target.path = $$prefix/plugins/inputmethods
diff --git a/inputmethods/handwriting/qimpenchar.cpp b/inputmethods/handwriting/qimpenchar.cpp
index db5d135..b83b2a4 100644
--- a/inputmethods/handwriting/qimpenchar.cpp
+++ b/inputmethods/handwriting/qimpenchar.cpp
@@ -299,194 +299,194 @@ const QString &QIMPenCharSet::filename( Domain d ) const
299 else 299 else
300 return userFilename; 300 return userFilename;
301} 301}
302 302
303void QIMPenCharSet::setFilename( const QString &fn, Domain d ) 303void QIMPenCharSet::setFilename( const QString &fn, Domain d )
304{ 304{
305 if ( d == System ) 305 if ( d == System )
306 sysFilename = fn; 306 sysFilename = fn;
307 else if ( d == User ) 307 else if ( d == User )
308 userFilename = fn; 308 userFilename = fn;
309} 309}
310 310
311/*! 311/*!
312 Load a character set from file \a fn. 312 Load a character set from file \a fn.
313 */ 313 */
314bool QIMPenCharSet::load( const QString &fn, Domain d ) 314bool QIMPenCharSet::load( const QString &fn, Domain d )
315{ 315{
316 setFilename( fn, d ); 316 setFilename( fn, d );
317 317
318 bool ok = FALSE; 318 bool ok = FALSE;
319 QFile file( fn ); 319 QFile file( fn );
320 if ( file.open( IO_ReadOnly ) ) { 320 if ( file.open( IO_ReadOnly ) ) {
321 QDataStream ds( &file ); 321 QDataStream ds( &file );
322 QString version; 322 QString version;
323 ds >> version; 323 ds >> version;
324 ds >> csTitle; 324 ds >> csTitle;
325 ds >> desc; 325 ds >> desc;
326 int major = version.mid( 4, 1 ).toInt(); 326 int major = version.mid( 4, 1 ).toInt();
327 int minor = version.mid( 6 ).toInt(); 327 int minor = version.mid( 6 ).toInt();
328 if ( major >= 1 && minor > 0 ) { 328 if ( major >= 1 && minor > 0 ) {
329 ds >> (Q_INT8 &)csType; 329 ds >> (Q_INT8 &)csType;
330 } else { 330 } else {
331 if ( csTitle == "abc" ) 331 if ( csTitle == "abc" )
332 csType = Lower; 332 csType = Lower;
333 else if ( csTitle == "ABC" ) 333 else if ( csTitle == "ABC" )
334 csType = Upper; 334 csType = Upper;
335 else if ( csTitle == "123" ) 335 else if ( csTitle == "123" )
336 csType = Numeric; 336 csType = Numeric;
337 else if ( fn == "Combining" ) 337 else if ( fn == "Combining" )
338 csType = Combining; 338 csType = Combining;
339 } 339 }
340 while ( !ds.atEnd() ) { 340 while ( !ds.atEnd() ) {
341 QIMPenChar *pc = new QIMPenChar; 341 QIMPenChar *pc = new QIMPenChar;
342 ds >> *pc; 342 ds >> *pc;
343 if ( d == User ) 343 if ( d == User )
344 markDeleted( pc->character() ); // override system 344 markDeleted( pc->character() ); // override system
345 addChar( pc ); 345 addChar( pc );
346 } 346 }
347 if ( file.status() == IO_Ok ) 347 if ( file.status() == IO_Ok )
348 ok = TRUE; 348 ok = TRUE;
349 } 349 }
350 setHidden ( false ); 350 setHidden ( false );
351 return ok; 351 return ok;
352} 352}
353 353
354/*! 354/*!
355 Save this character set. 355 Save this character set.
356 */ 356 */
357bool QIMPenCharSet::save( Domain d ) 357bool QIMPenCharSet::save( Domain d )
358{ 358{
359 if ( filename( d ).isEmpty() ) 359 if ( filename( d ).isEmpty() )
360 return FALSE; 360 return FALSE;
361 361
362 if ( hidden() ) 362 if ( hidden() )
363 return TRUE; 363 return TRUE;
364 364
365 bool ok = FALSE; 365 bool ok = FALSE;
366 366
367 QString fn = filename( d ); 367 QString fn = filename( d );
368 QString tmpFn = fn + ".new"; 368 QString tmpFn = fn + ".new";
369 QFile file( tmpFn ); 369 QFile file( tmpFn );
370 if ( file.open( IO_WriteOnly|IO_Raw ) ) { 370 if ( file.open( IO_WriteOnly|IO_Raw ) ) {
371 QByteArray buf; 371 QByteArray buf;
372 QDataStream ds( buf, IO_WriteOnly ); 372 QDataStream ds( buf, IO_WriteOnly );
373 ds << QString( "QPT 1.1" ); 373 ds << QString( "QPT 1.1" );
374 ds << csTitle; 374 ds << csTitle;
375 ds << desc; 375 ds << desc;
376 ds << (Q_INT8)csType; 376 ds << (Q_INT8)csType;
377 QIMPenCharIterator ci( chars ); 377 QIMPenCharIterator ci( chars );
378 for ( ; ci.current(); ++ci ) { 378 for ( ; ci.current(); ++ci ) {
379 QIMPenChar *pc = ci.current(); 379 QIMPenChar *pc = ci.current();
380 if ( ( ( (d == System) && pc->testFlag( QIMPenChar::System ) ) || 380 if ( ( ( (d == System) && pc->testFlag( QIMPenChar::System ) ) ||
381 ( (d == User) && !pc->testFlag( QIMPenChar::System ) ) ) && 381 ( (d == User) && !pc->testFlag( QIMPenChar::System ) ) ) &&
382 ( !pc->testFlag (QIMPenChar::Combined ) ) ) { 382 ( !pc->testFlag (QIMPenChar::Combined ) ) ) {
383 ds << *pc; 383 ds << *pc;
384 } 384 }
385 } 385 }
386 386
387 file.writeBlock( buf ); 387 file.writeBlock( buf );
388 file.close(); 388 file.close();
389 if ( file.status() == IO_Ok ) 389 if ( file.status() == IO_Ok )
390 ok = TRUE; 390 ok = TRUE;
391 } 391 }
392 392
393 if ( ok ) { 393 if ( ok ) {
394 if ( ::rename( tmpFn.latin1(), fn.latin1() ) < 0 ) { 394 if ( ::rename( tmpFn.latin1(), fn.latin1() ) < 0 ) {
395 qWarning( "problem renaming file %s to %s, errno: %d", 395 owarn << "problem renaming file " <<tmpFn.latin1() << " to "<< fn.latin1()
396 tmpFn.latin1(), fn.latin1(), errno ); 396 << ", errno: " << errno << oendl;
397 // remove the tmp file, otherwise, it will just lay around... 397 // remove the tmp file, otherwise, it will just lay around...
398 QFile::remove( tmpFn.latin1() ); 398 QFile::remove( tmpFn.latin1() );
399 ok = FALSE; 399 ok = FALSE;
400 } 400 }
401 } 401 }
402 402
403 return ok; 403 return ok;
404} 404}
405 405
406QIMPenChar *QIMPenCharSet::at( int i ) 406QIMPenChar *QIMPenCharSet::at( int i )
407{ 407{
408 return chars.at(i); 408 return chars.at(i);
409} 409}
410 410
411void QIMPenCharSet::markDeleted( uint ch ) 411void QIMPenCharSet::markDeleted( uint ch )
412{ 412{
413 QIMPenCharIterator ci( chars ); 413 QIMPenCharIterator ci( chars );
414 for ( ; ci.current(); ++ci ) { 414 for ( ; ci.current(); ++ci ) {
415 QIMPenChar *pc = ci.current(); 415 QIMPenChar *pc = ci.current();
416 if ( pc->character() == ch && pc->testFlag( QIMPenChar::System ) ) 416 if ( pc->character() == ch && pc->testFlag( QIMPenChar::System ) )
417 pc->setFlag( QIMPenChar::Deleted ); 417 pc->setFlag( QIMPenChar::Deleted );
418 } 418 }
419} 419}
420 420
421/*! 421/*!
422 Find the best matches for \a ch in this character set. 422 Find the best matches for \a ch in this character set.
423 */ 423 */
424QIMPenCharMatchList QIMPenCharSet::match( QIMPenChar *ch ) 424QIMPenCharMatchList QIMPenCharSet::match( QIMPenChar *ch )
425{ 425{
426 QIMPenCharMatchList matches; 426 QIMPenCharMatchList matches;
427 427
428 QIMPenCharIterator ci( chars ); 428 QIMPenCharIterator ci( chars );
429 for ( ; ci.current(); ++ci ) { 429 for ( ; ci.current(); ++ci ) {
430 QIMPenChar *tmplChar = ci.current(); 430 QIMPenChar *tmplChar = ci.current();
431 if ( tmplChar->testFlag( QIMPenChar::Deleted ) ) { 431 if ( tmplChar->testFlag( QIMPenChar::Deleted ) ) {
432 continue; 432 continue;
433 } 433 }
434 int err; 434 int err;
435 if ( ch->penStrokes().count() <= tmplChar->penStrokes().count() ) { 435 if ( ch->penStrokes().count() <= tmplChar->penStrokes().count() ) {
436 err = ch->match( tmplChar ); 436 err = ch->match( tmplChar );
437 if ( err <= QIMPEN_MATCH_THRESHOLD ) { 437 if ( err <= QIMPEN_MATCH_THRESHOLD ) {
438 if (tmplChar->penStrokes().count() != ch->penStrokes().count()) 438 if (tmplChar->penStrokes().count() != ch->penStrokes().count())
439 err = QMIN(err*3, QIMPEN_MATCH_THRESHOLD); 439 err = QMIN(err*3, QIMPEN_MATCH_THRESHOLD);
440 QIMPenCharMatchList::Iterator it; 440 QIMPenCharMatchList::Iterator it;
441 for ( it = matches.begin(); it != matches.end(); ++it ) { 441 for ( it = matches.begin(); it != matches.end(); ++it ) {
442 if ( (*it).penChar->character() == tmplChar->character() && 442 if ( (*it).penChar->character() == tmplChar->character() &&
443 (*it).penChar->penStrokes().count() == tmplChar->penStrokes().count() ) { 443 (*it).penChar->penStrokes().count() == tmplChar->penStrokes().count() ) {
444 if ( (*it).error > err ) 444 if ( (*it).error > err )
445 (*it).error = err; 445 (*it).error = err;
446 break; 446 break;
447 } 447 }
448 } 448 }
449 if ( it == matches.end() ) { 449 if ( it == matches.end() ) {
450 QIMPenCharMatch m; 450 QIMPenCharMatch m;
451 m.error = err; 451 m.error = err;
452 m.penChar = tmplChar; 452 m.penChar = tmplChar;
453 matches.append( m ); 453 matches.append( m );
454 } 454 }
455 } 455 }
456 } 456 }
457 } 457 }
458 qHeapSort( matches ); 458 qHeapSort( matches );
459 /* 459 /*
460 QIMPenCharMatchList::Iterator it; 460 QIMPenCharMatchList::Iterator it;
461 for ( it = matches.begin(); it != matches.end(); ++it ) { 461 for ( it = matches.begin(); it != matches.end(); ++it ) {
462 462
463 odebug << "Match: \'" << (*it).penChar->character() "\', error " << (*it).error ", strokes " <<(*it).penChar->penStrokes().count() << oendl; 463 odebug << "Match: \'" << (*it).penChar->character() "\', error " << (*it).error ", strokes " <<(*it).penChar->penStrokes().count() << oendl;
464 } 464 }
465 */ 465 */
466 return matches; 466 return matches;
467} 467}
468 468
469/*! 469/*!
470 Add a character \a ch to this set. 470 Add a character \a ch to this set.
471 QIMPenCharSet will delete this character when it is no longer needed. 471 QIMPenCharSet will delete this character when it is no longer needed.
472 */ 472 */
473void QIMPenCharSet::addChar( QIMPenChar *ch ) 473void QIMPenCharSet::addChar( QIMPenChar *ch )
474{ 474{
475 if ( ch->penStrokes().count() > maxStrokes ) 475 if ( ch->penStrokes().count() > maxStrokes )
476 maxStrokes = ch->penStrokes().count(); 476 maxStrokes = ch->penStrokes().count();
477 chars.append( ch ); 477 chars.append( ch );
478} 478}
479 479
480/*! 480/*!
481 Remove a character by reference \a ch from this set. 481 Remove a character by reference \a ch from this set.
482 QIMPenCharSet will delete this character. 482 QIMPenCharSet will delete this character.
483 */ 483 */
484void QIMPenCharSet::removeChar( QIMPenChar *ch ) 484void QIMPenCharSet::removeChar( QIMPenChar *ch )
485{ 485{
486 chars.remove( ch ); 486 chars.remove( ch );
487} 487}
488 488
489/*! 489/*!
490 Move the character up the list of characters. 490 Move the character up the list of characters.
491 */ 491 */
492void QIMPenCharSet::up( QIMPenChar *ch ) 492void QIMPenCharSet::up( QIMPenChar *ch )
diff --git a/inputmethods/handwriting/qimpensetup.cpp b/inputmethods/handwriting/qimpensetup.cpp
index 3f4841d..564b6ba 100644
--- a/inputmethods/handwriting/qimpensetup.cpp
+++ b/inputmethods/handwriting/qimpensetup.cpp
@@ -1,207 +1,208 @@
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#include <opie2/odebug.h>
39 40
40 41
41/* XPM */ 42/* XPM */
42static const char * const left_xpm[] = { 43static const char * const left_xpm[] = {
43"16 16 2 1", 44"16 16 2 1",
44 " c None", 45 " c None",
45 ".c #000000", 46 ".c #000000",
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
64/* XPM */ 65/* XPM */
65static const char * const right_xpm[] = { 66static const char * const right_xpm[] = {
66"16 16 2 1", 67"16 16 2 1",
67 " c None", 68 " c None",
68 ".c #000000", 69 ".c #000000",
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 88
88QIMPenSetup::QIMPenSetup( QIMPenProfile *p, QWidget *parent, 89QIMPenSetup::QIMPenSetup( QIMPenProfile *p, QWidget *parent,
89 const char *name, bool modal, int WFlags ) 90 const char *name, bool modal, int WFlags )
90 : QDialog( parent, name, modal, WFlags ), profileCombo(0), profile(p) 91 : QDialog( parent, name, modal, WFlags ), profileCombo(0), profile(p)
91{ 92{
92 setCaption( tr("Setup Handwriting Input") ); 93 setCaption( tr("Setup Handwriting Input") );
93 94
94 QVBoxLayout *vb = new QVBoxLayout( this ); 95 QVBoxLayout *vb = new QVBoxLayout( this );
95 96
96#define MULTIPROFILE 97#define MULTIPROFILE
97#ifdef MULTIPROFILE 98#ifdef MULTIPROFILE
98 profileList.setAutoDelete( true ); 99 profileList.setAutoDelete( true );
99 QHBoxLayout *hb = new QHBoxLayout( vb ); 100 QHBoxLayout *hb = new QHBoxLayout( vb );
100 hb->setMargin( 6 ); 101 hb->setMargin( 6 );
101 QLabel *l = new QLabel( tr("Character Profile:"), this ); 102 QLabel *l = new QLabel( tr("Character Profile:"), this );
102 hb->addWidget( l ); 103 hb->addWidget( l );
103 profileCombo = new QComboBox( this ); 104 profileCombo = new QComboBox( this );
104 connect( profileCombo, SIGNAL(activated(const QString&)), 105 connect( profileCombo, SIGNAL(activated(const QString&)),
105 this, SLOT(selectProfile(const QString&)) ); 106 this, SLOT(selectProfile(const QString&)) );
106 hb->addWidget( profileCombo ); 107 hb->addWidget( profileCombo );
107#else 108#else
108 profileList.append( profile ); 109 profileList.append( profile );
109#endif 110#endif
110 111
111 qWarning("profiles: %d", profileList.count()); 112 owarn << "profiles: " << profileList.count() << oendl;
112 113
113 QTabWidget *tw = new QTabWidget( this ); 114 QTabWidget *tw = new QTabWidget( this );
114 vb->addWidget( tw ); 115 vb->addWidget( tw );
115 116
116 pref = new QIMPenPrefBase( this ); 117 pref = new QIMPenPrefBase( this );
117 tw->addTab( pref, tr("Preferences") ); 118 tw->addTab( pref, tr("Preferences") );
118 119
119 pref->inputStyle->setExclusive( TRUE ); 120 pref->inputStyle->setExclusive( TRUE );
120 121
121 style = profile->style() == QIMPenProfile::ToggleCases ? 1 : 0; 122 style = profile->style() == QIMPenProfile::ToggleCases ? 1 : 0;
122 pref->inputStyle->setButton( style ); 123 pref->inputStyle->setButton( style );
123 connect( pref->inputStyle, SIGNAL(clicked(int)), 124 connect( pref->inputStyle, SIGNAL(clicked(int)),
124 this, SLOT(styleClicked(int)) ); 125 this, SLOT(styleClicked(int)) );
125 pref->inputStyle->setEnabled( profile->canSelectStyle() ); 126 pref->inputStyle->setEnabled( profile->canSelectStyle() );
126 127
127 multiTimeout = profile->multiStrokeTimeout(); 128 multiTimeout = profile->multiStrokeTimeout();
128 pref->multiStrokeSlider->setValue( multiTimeout ); 129 pref->multiStrokeSlider->setValue( multiTimeout );
129 multiTimeoutChanged( multiTimeout ); 130 multiTimeoutChanged( multiTimeout );
130 connect( pref->multiStrokeSlider, SIGNAL(valueChanged(int)), 131 connect( pref->multiStrokeSlider, SIGNAL(valueChanged(int)),
131 this, SLOT(multiTimeoutChanged(int)) ); 132 this, SLOT(multiTimeoutChanged(int)) );
132 133
133 edit = new QIMPenEdit( p, tw ); 134 edit = new QIMPenEdit( p, tw );
134 tw->addTab( edit, tr("Customize") ); 135 tw->addTab( edit, tr("Customize") );
135#ifdef MULTIPROFILE 136#ifdef MULTIPROFILE
136 loadProfiles(); 137 loadProfiles();
137#endif 138#endif
138 139
139} 140}
140 141
141void QIMPenSetup::loadProfiles() 142void QIMPenSetup::loadProfiles()
142{ 143{
143 QString path = QPEApplication::qpeDir() + "etc/qimpen"; 144 QString path = QPEApplication::qpeDir() + "etc/qimpen";
144 QDir dir( path, "*.conf" ); 145 QDir dir( path, "*.conf" );
145 QStringList list = dir.entryList(); 146 QStringList list = dir.entryList();
146 QStringList::Iterator it; 147 QStringList::Iterator it;
147 for ( it = list.begin(); it != list.end(); ++it ) { 148 for ( it = list.begin(); it != list.end(); ++it ) {
148 QIMPenProfile *p = new QIMPenProfile( path + "/" + *it ); 149 QIMPenProfile *p = new QIMPenProfile( path + "/" + *it );
149 profileList.append( p ); 150 profileList.append( p );
150 profileCombo->insertItem( p->name() ); 151 profileCombo->insertItem( p->name() );
151 if ( p->name() == profile->name() ) { 152 if ( p->name() == profile->name() ) {
152 profileCombo->setCurrentItem( profileCombo->count()-1 ); 153 profileCombo->setCurrentItem( profileCombo->count()-1 );
153 profile = p; 154 profile = p;
154 edit->setProfile( profile ); 155 edit->setProfile( profile );
155 } 156 }
156 } 157 }
157} 158}
158 159
159void QIMPenSetup::styleClicked( int id ) 160void QIMPenSetup::styleClicked( int id )
160{ 161{
161 style = id; 162 style = id;
162} 163}
163 164
164void QIMPenSetup::multiTimeoutChanged( int v ) 165void QIMPenSetup::multiTimeoutChanged( int v )
165{ 166{
166 multiTimeout = v; 167 multiTimeout = v;
167 pref->multiStrokeLabel->setText( tr("%1 ms").arg(v) ); 168 pref->multiStrokeLabel->setText( tr("%1 ms").arg(v) );
168} 169}
169 170
170void QIMPenSetup::selectProfile( const QString &p ) 171void QIMPenSetup::selectProfile( const QString &p )
171{ 172{
172 if ( p == profile->name() ) 173 if ( p == profile->name() )
173 return; 174 return;
174 175
175 profile->setStyle( style ? QIMPenProfile::ToggleCases : QIMPenProfile::BothCases ); 176 profile->setStyle( style ? QIMPenProfile::ToggleCases : QIMPenProfile::BothCases );
176 profile->setMultiStrokeTimeout( multiTimeout ); 177 profile->setMultiStrokeTimeout( multiTimeout );
177 178
178 for ( int i = 0; i < (int)profileList.count(); i++ ) { 179 for ( int i = 0; i < (int)profileList.count(); i++ ) {
179 if ( profileList.at(i)->name() == p ) { 180 if ( profileList.at(i)->name() == p ) {
180 profile = profileList.at(i); 181 profile = profileList.at(i);
181 style = profile->style() == QIMPenProfile::ToggleCases ? 1 : 0; 182 style = profile->style() == QIMPenProfile::ToggleCases ? 1 : 0;
182 pref->inputStyle->setButton( style ); 183 pref->inputStyle->setButton( style );
183 pref->inputStyle->setEnabled( profile->canSelectStyle() ); 184 pref->inputStyle->setEnabled( profile->canSelectStyle() );
184 multiTimeout = profile->multiStrokeTimeout(); 185 multiTimeout = profile->multiStrokeTimeout();
185 pref->multiStrokeSlider->setValue( multiTimeout ); 186 pref->multiStrokeSlider->setValue( multiTimeout );
186 multiTimeoutChanged( multiTimeout ); 187 multiTimeoutChanged( multiTimeout );
187 edit->setProfile( profile ); 188 edit->setProfile( profile );
188 break; 189 break;
189 } 190 }
190 } 191 }
191} 192}
192 193
193void QIMPenSetup::accept() 194void QIMPenSetup::accept()
194{ 195{
195 profile->setStyle( style ? QIMPenProfile::ToggleCases : QIMPenProfile::BothCases ); 196 profile->setStyle( style ? QIMPenProfile::ToggleCases : QIMPenProfile::BothCases );
196 profile->setMultiStrokeTimeout( multiTimeout ); 197 profile->setMultiStrokeTimeout( multiTimeout );
197 // Save current profile 198 // Save current profile
198 if ( profileCombo ) { 199 if ( profileCombo ) {
199 Config config( "handwriting" ); 200 Config config( "handwriting" );
200 config.setGroup( "Settings" ); 201 config.setGroup( "Settings" );
201 config.writeEntry( "Profile", profileCombo->currentText() ); 202 config.writeEntry( "Profile", profileCombo->currentText() );
202 } 203 }
203 // Save charsets 204 // Save charsets
204 bool ok = TRUE; 205 bool ok = TRUE;
205 for ( int i = 0; i < (int)profileList.count(); i++ ) { 206 for ( int i = 0; i < (int)profileList.count(); i++ ) {
206 QIMPenProfile *prof = profileList.at(i); 207 QIMPenProfile *prof = profileList.at(i);
207 QIMPenCharSetIterator it(prof->charSets()); 208 QIMPenCharSetIterator it(prof->charSets());