summaryrefslogtreecommitdiff
path: root/inputmethods
authorbrad <brad>2004-06-17 11:45:51 (UTC)
committer brad <brad>2004-06-17 11:45:51 (UTC)
commit9875d0391f21f4d7518dba946455d844f04c1668 (patch) (side-by-side diff)
treeb53e0415e0f238e21cb8cc1a19175b9d4799bcaa /inputmethods
parent4386dec4cc1b5ef3272b9aba352dfa6fba6a4e06 (diff)
downloadopie-9875d0391f21f4d7518dba946455d844f04c1668.zip
opie-9875d0391f21f4d7518dba946455d844f04c1668.tar.gz
opie-9875d0391f21f4d7518dba946455d844f04c1668.tar.bz2
Fix inability to delete system characters.
It appears this has never previously worked correctly. Reported by : A.Pearce@salford.ac.uk
Diffstat (limited to 'inputmethods') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/handwriting/qimpenchar.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/inputmethods/handwriting/qimpenchar.cpp b/inputmethods/handwriting/qimpenchar.cpp
index b83b2a4..96a0502 100644
--- a/inputmethods/handwriting/qimpenchar.cpp
+++ b/inputmethods/handwriting/qimpenchar.cpp
@@ -333,25 +333,26 @@ bool QIMPenCharSet::load( const QString &fn, Domain d )
else if ( csTitle == "ABC" )
csType = Upper;
else if ( csTitle == "123" )
csType = Numeric;
else if ( fn == "Combining" )
csType = Combining;
}
while ( !ds.atEnd() ) {
QIMPenChar *pc = new QIMPenChar;
ds >> *pc;
if ( d == User )
markDeleted( pc->character() ); // override system
- addChar( pc );
+ if ( !pc->testFlag( QIMPenChar::Deleted ) )
+ addChar( pc );
}
if ( file.status() == IO_Ok )
ok = TRUE;
}
setHidden ( false );
return ok;
}
/*!
Save this character set.
*/
bool QIMPenCharSet::save( Domain d )
@@ -368,26 +369,39 @@ bool QIMPenCharSet::save( Domain d )
QString tmpFn = fn + ".new";
QFile file( tmpFn );
if ( file.open( IO_WriteOnly|IO_Raw ) ) {
QByteArray buf;
QDataStream ds( buf, IO_WriteOnly );
ds << QString( "QPT 1.1" );
ds << csTitle;
ds << desc;
ds << (Q_INT8)csType;
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 the Domain is System and the Char is marked System - OR
+ * the domain is User, the Char is User and it's not deleted - OR
+ * the domain is User, the Char is System and it is deleted - AND
+ * the character is not an automated Combined Character
+ *
+ * This is required to ensure that we don't save user defined chars that have been deleted, but
+ * we *DO* save System chars that have been deleted. There is still the issue of deleted combined
+ * chars but I'm not sure how to tackle that yet
+ *
+ */
+
+ if ( ( ( (d == System) && pc->testFlag( QIMPenChar::System ) ) ||
+ ( (d == User) && !pc->testFlag( QIMPenChar::System ) && !pc->testFlag( QIMPenChar::Deleted ) ) ||
+ ( (d == User) && pc->testFlag( QIMPenChar::System ) && pc->testFlag( QIMPenChar::Deleted ) ) ) &&
( !pc->testFlag (QIMPenChar::Combined ) ) ) {
ds << *pc;
}
}
file.writeBlock( buf );
file.close();
if ( file.status() == IO_Ok )
ok = TRUE;
}
if ( ok ) {