summaryrefslogtreecommitdiff
path: root/inputmethods/handwriting
authortreke <treke>2003-12-23 15:35:21 (UTC)
committer treke <treke>2003-12-23 15:35:21 (UTC)
commit0a613593f2e57c2805d1eef47c16b9fcb8c94a08 (patch) (unidiff)
tree070fe1957d0900ba3364142fe7ecccbf53c3f847 /inputmethods/handwriting
parent127c50cc446de489c702400ebc5fc4874f6311b2 (diff)
downloadopie-0a613593f2e57c2805d1eef47c16b9fcb8c94a08.zip
opie-0a613593f2e57c2805d1eef47c16b9fcb8c94a08.tar.gz
opie-0a613593f2e57c2805d1eef47c16b9fcb8c94a08.tar.bz2
Patch from Brad Campbell to fix opie-handwritings writing of data files
Diffstat (limited to 'inputmethods/handwriting') (more/less context) (show whitespace changes)
-rw-r--r--inputmethods/handwriting/qimpenchar.cpp13
-rw-r--r--inputmethods/handwriting/qimpenchar.h2
-rw-r--r--inputmethods/handwriting/qimpencombining.cpp1
3 files changed, 10 insertions, 6 deletions
diff --git a/inputmethods/handwriting/qimpenchar.cpp b/inputmethods/handwriting/qimpenchar.cpp
index 152bfec..0c37e5c 100644
--- a/inputmethods/handwriting/qimpenchar.cpp
+++ b/inputmethods/handwriting/qimpenchar.cpp
@@ -361,27 +361,30 @@ bool QIMPenCharSet::save( Domain d )
361 bool ok = FALSE; 361 bool ok = FALSE;
362 362
363 QString fn = filename( d ); 363 QString fn = filename( d );
364 QString tmpFn = fn + ".new"; 364 QString tmpFn = fn + ".new";
365 QFile file( tmpFn ); 365 QFile file( tmpFn );
366 if ( file.open( IO_WriteOnly|IO_Raw ) ) { 366 if ( file.open( IO_WriteOnly|IO_Raw ) ) {
367 QDataStream ds( &file ); 367 QByteArray buf;
368 QDataStream ds( buf, IO_WriteOnly );
368 ds << QString( "QPT 1.1" ); 369 ds << QString( "QPT 1.1" );
369 ds << csTitle; 370 ds << csTitle;
370 ds << desc; 371 ds << desc;
371 ds << (Q_INT8)csType; 372 ds << (Q_INT8)csType;
372 QIMPenCharIterator ci( chars ); 373 QIMPenCharIterator ci( chars );
373 for ( ; ci.current(); ++ci ) { 374 for ( ; ci.current(); ++ci ) {
374 QIMPenChar *pc = ci.current(); 375 QIMPenChar *pc = ci.current();
375 if ( ( (d == System) && pc->testFlag( QIMPenChar::System ) ) || 376 if ( ( ( (d == System) && pc->testFlag( QIMPenChar::System ) ) ||
376 ( (d == User) && !pc->testFlag( QIMPenChar::System ) ) ) { 377 ( (d == User) && !pc->testFlag( QIMPenChar::System ) ) ) &&
378 ( !pc->testFlag (QIMPenChar::Combined ) ) ) {
377 ds << *pc; 379 ds << *pc;
378 } 380 }
379 if ( file.status() != IO_Ok )
380 break;
381 } 381 }
382
383 file.writeBlock( buf );
384 file.close();
382 if ( file.status() == IO_Ok ) 385 if ( file.status() == IO_Ok )
383 ok = TRUE; 386 ok = TRUE;
384 } 387 }
385 388
386 if ( ok ) { 389 if ( ok ) {
387 if ( ::rename( tmpFn.latin1(), fn.latin1() ) < 0 ) { 390 if ( ::rename( tmpFn.latin1(), fn.latin1() ) < 0 ) {
diff --git a/inputmethods/handwriting/qimpenchar.h b/inputmethods/handwriting/qimpenchar.h
index 9a5f687..efd6f16 100644
--- a/inputmethods/handwriting/qimpenchar.h
+++ b/inputmethods/handwriting/qimpenchar.h
@@ -57,13 +57,13 @@ public:
57 QRect boundingRect(); 57 QRect boundingRect();
58 58
59 void setFlag( int f ) { flags |= f; } 59 void setFlag( int f ) { flags |= f; }
60 void clearFlag( int f ) { flags &= ~f; } 60 void clearFlag( int f ) { flags &= ~f; }
61 bool testFlag( int f ) { return flags & f; } 61 bool testFlag( int f ) { return flags & f; }
62 62
63 enum Flags { System=0x01, Deleted=0x02, CombineRight=0x04, Data=0x08 }; 63 enum Flags { System=0x01, Deleted=0x02, CombineRight=0x04, Data=0x08, Combined=0x10 };
64 // Correspond to codes in template files. Do not change values. 64 // Correspond to codes in template files. Do not change values.
65 enum Mode { ModeBase=0x4000, Caps=0x4001, Shortcut=0x4002, CapsLock=0x4003, 65 enum Mode { ModeBase=0x4000, Caps=0x4001, Shortcut=0x4002, CapsLock=0x4003,
66 Punctuation=0x4004, Symbol=0x4005, Extended=0x4006 }; 66 Punctuation=0x4004, Symbol=0x4005, Extended=0x4006 };
67 67
68 QIMPenChar &operator=( const QIMPenChar &s ); 68 QIMPenChar &operator=( const QIMPenChar &s );
69 69
diff --git a/inputmethods/handwriting/qimpencombining.cpp b/inputmethods/handwriting/qimpencombining.cpp
index 30459e7..2e01ac2 100644
--- a/inputmethods/handwriting/qimpencombining.cpp
+++ b/inputmethods/handwriting/qimpencombining.cpp
@@ -69,12 +69,13 @@ void QIMPenCombining::addCombined( QIMPenCharSet *cs )
69 QIMPenCharIterator cit( chars ); 69 QIMPenCharIterator cit( chars );
70 for ( ; cit.current(); ++cit ) { 70 for ( ; cit.current(); ++cit ) {
71 QIMPenChar *accentPc = cit.current(); 71 QIMPenChar *accentPc = cit.current();
72 if ( accentPc->character() == combiningSymbols[i] ) { 72 if ( accentPc->character() == combiningSymbols[i] ) {
73 QIMPenChar *combined = combine( pc, accentPc ); 73 QIMPenChar *combined = combine( pc, accentPc );
74 combined->setCharacter( combiningChars[charIdx][i+1] ); 74 combined->setCharacter( combiningChars[charIdx][i+1] );
75 combined->setFlag( QIMPenChar::Combined );
75 cs->addChar( combined ); 76 cs->addChar( combined );
76 } 77 }
77 } 78 }
78 } 79 }
79 } 80 }
80 } 81 }