author | treke <treke> | 2003-12-23 15:35:21 (UTC) |
---|---|---|
committer | treke <treke> | 2003-12-23 15:35:21 (UTC) |
commit | 0a613593f2e57c2805d1eef47c16b9fcb8c94a08 (patch) (side-by-side diff) | |
tree | 070fe1957d0900ba3364142fe7ecccbf53c3f847 | |
parent | 127c50cc446de489c702400ebc5fc4874f6311b2 (diff) | |
download | opie-0a613593f2e57c2805d1eef47c16b9fcb8c94a08.zip opie-0a613593f2e57c2805d1eef47c16b9fcb8c94a08.tar.gz opie-0a613593f2e57c2805d1eef47c16b9fcb8c94a08.tar.bz2 |
Patch from Brad Campbell to fix opie-handwritings writing of data files
-rw-r--r-- | inputmethods/handwriting/qimpenchar.cpp | 13 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpenchar.h | 2 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpencombining.cpp | 1 |
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 @@ -364,7 +364,8 @@ bool QIMPenCharSet::save( Domain d ) QString tmpFn = fn + ".new"; QFile file( tmpFn ); if ( file.open( IO_WriteOnly|IO_Raw ) ) { - QDataStream ds( &file ); + QByteArray buf; + QDataStream ds( buf, IO_WriteOnly ); ds << QString( "QPT 1.1" ); ds << csTitle; ds << desc; @@ -372,13 +373,15 @@ bool QIMPenCharSet::save( Domain d ) QIMPenCharIterator ci( chars ); for ( ; ci.current(); ++ci ) { QIMPenChar *pc = ci.current(); - if ( ( (d == System) && pc->testFlag( QIMPenChar::System ) ) || - ( (d == User) && !pc->testFlag( QIMPenChar::System ) ) ) { + if ( ( ( (d == System) && pc->testFlag( QIMPenChar::System ) ) || + ( (d == User) && !pc->testFlag( QIMPenChar::System ) ) ) && + ( !pc->testFlag (QIMPenChar::Combined ) ) ) { ds << *pc; } - if ( file.status() != IO_Ok ) - break; } + + file.writeBlock( buf ); + file.close(); if ( file.status() == IO_Ok ) ok = TRUE; } 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 @@ -60,7 +60,7 @@ public: void clearFlag( int f ) { flags &= ~f; } bool testFlag( int f ) { return flags & f; } - enum Flags { System=0x01, Deleted=0x02, CombineRight=0x04, Data=0x08 }; + enum Flags { System=0x01, Deleted=0x02, CombineRight=0x04, Data=0x08, Combined=0x10 }; // Correspond to codes in template files. Do not change values. enum Mode { ModeBase=0x4000, Caps=0x4001, Shortcut=0x4002, CapsLock=0x4003, Punctuation=0x4004, Symbol=0x4005, Extended=0x4006 }; 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 @@ -72,6 +72,7 @@ void QIMPenCombining::addCombined( QIMPenCharSet *cs ) if ( accentPc->character() == combiningSymbols[i] ) { QIMPenChar *combined = combine( pc, accentPc ); combined->setCharacter( combiningChars[charIdx][i+1] ); + combined->setFlag( QIMPenChar::Combined ); cs->addChar( combined ); } } |