-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 | |||
@@ -359,31 +359,34 @@ bool QIMPenCharSet::save( Domain d ) | |||
359 | return FALSE; | 359 | return FALSE; |
360 | 360 | ||
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 ) { |
388 | qWarning( "problem renaming file %s to %s, errno: %d", | 391 | qWarning( "problem renaming file %s to %s, errno: %d", |
389 | tmpFn.latin1(), fn.latin1(), errno ); | 392 | tmpFn.latin1(), fn.latin1(), errno ); |
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 | |||
@@ -55,17 +55,17 @@ public: | |||
55 | const QIMPenStrokeList &penStrokes() { return strokes; } | 55 | const QIMPenStrokeList &penStrokes() { return strokes; } |
56 | QPoint startingPoint() const { return strokes.getFirst()->startingPoint(); } | 56 | QPoint startingPoint() const { return strokes.getFirst()->startingPoint(); } |
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 | ||
70 | void addStroke( QIMPenStroke * ); | 70 | void addStroke( QIMPenStroke * ); |
71 | 71 | ||
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 | |||
@@ -67,16 +67,17 @@ void QIMPenCombining::addCombined( QIMPenCharSet *cs ) | |||
67 | for ( int i = 0; i < 6; i++ ) { | 67 | for ( int i = 0; i < 6; i++ ) { |
68 | if ( combiningChars[charIdx][i+1] ) { | 68 | if ( combiningChars[charIdx][i+1] ) { |
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 | } |
81 | } | 82 | } |
82 | 83 | ||