-rw-r--r-- | inputmethods/handwriting/qimpenchar.cpp | 5 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpenchar.h | 3 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpenprofile.cpp | 25 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpenprofile.h | 2 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpensetup.cpp | 3 |
5 files changed, 35 insertions, 3 deletions
diff --git a/inputmethods/handwriting/qimpenchar.cpp b/inputmethods/handwriting/qimpenchar.cpp index 0c37e5c..929f370 100644 --- a/inputmethods/handwriting/qimpenchar.cpp +++ b/inputmethods/handwriting/qimpenchar.cpp | |||
@@ -341,28 +341,31 @@ bool QIMPenCharSet::load( const QString &fn, Domain d ) | |||
341 | ds >> *pc; | 341 | ds >> *pc; |
342 | if ( d == User ) | 342 | if ( d == User ) |
343 | markDeleted( pc->character() ); // override system | 343 | markDeleted( pc->character() ); // override system |
344 | addChar( pc ); | 344 | addChar( pc ); |
345 | } | 345 | } |
346 | if ( file.status() == IO_Ok ) | 346 | if ( file.status() == IO_Ok ) |
347 | ok = TRUE; | 347 | ok = TRUE; |
348 | } | 348 | } |
349 | 349 | setHidden ( false ); | |
350 | return ok; | 350 | return ok; |
351 | } | 351 | } |
352 | 352 | ||
353 | /*! | 353 | /*! |
354 | Save this character set. | 354 | Save this character set. |
355 | */ | 355 | */ |
356 | bool QIMPenCharSet::save( Domain d ) | 356 | bool QIMPenCharSet::save( Domain d ) |
357 | { | 357 | { |
358 | if ( filename( d ).isEmpty() ) | 358 | if ( filename( d ).isEmpty() ) |
359 | return FALSE; | 359 | return FALSE; |
360 | 360 | ||
361 | if ( hidden() ) | ||
362 | return TRUE; | ||
363 | |||
361 | bool ok = FALSE; | 364 | bool ok = FALSE; |
362 | 365 | ||
363 | QString fn = filename( d ); | 366 | QString fn = filename( d ); |
364 | QString tmpFn = fn + ".new"; | 367 | QString tmpFn = fn + ".new"; |
365 | QFile file( tmpFn ); | 368 | QFile file( tmpFn ); |
366 | if ( file.open( IO_WriteOnly|IO_Raw ) ) { | 369 | if ( file.open( IO_WriteOnly|IO_Raw ) ) { |
367 | QByteArray buf; | 370 | QByteArray buf; |
368 | QDataStream ds( buf, IO_WriteOnly ); | 371 | QDataStream ds( buf, IO_WriteOnly ); |
diff --git a/inputmethods/handwriting/qimpenchar.h b/inputmethods/handwriting/qimpenchar.h index efd6f16..e4e7645 100644 --- a/inputmethods/handwriting/qimpenchar.h +++ b/inputmethods/handwriting/qimpenchar.h | |||
@@ -112,16 +112,18 @@ public: | |||
112 | QString description() const { return desc; } | 112 | QString description() const { return desc; } |
113 | void setTitle( const QString &t ) { csTitle = t; } | 113 | void setTitle( const QString &t ) { csTitle = t; } |
114 | QString title() const { return csTitle; } | 114 | QString title() const { return csTitle; } |
115 | 115 | ||
116 | QIMPenCharMatchList match( QIMPenChar *ch ); | 116 | QIMPenCharMatchList match( QIMPenChar *ch ); |
117 | void addChar( QIMPenChar *ch ); | 117 | void addChar( QIMPenChar *ch ); |
118 | void removeChar( QIMPenChar *ch ); | 118 | void removeChar( QIMPenChar *ch ); |
119 | QIMPenChar *at( int i ); | 119 | QIMPenChar *at( int i ); |
120 | void setHidden ( const bool &b ) { phidden = &b; } | ||
121 | bool hidden() const { return phidden; } | ||
120 | 122 | ||
121 | unsigned maximumStrokes() const { return maxStrokes; } | 123 | unsigned maximumStrokes() const { return maxStrokes; } |
122 | 124 | ||
123 | void up( QIMPenChar *ch ); | 125 | void up( QIMPenChar *ch ); |
124 | void down( QIMPenChar *ch ); | 126 | void down( QIMPenChar *ch ); |
125 | 127 | ||
126 | enum Domain { System, User }; | 128 | enum Domain { System, User }; |
127 | enum Type { Unknown=0x00, Lower=0x01, Upper=0x02, Combining=0x04, | 129 | enum Type { Unknown=0x00, Lower=0x01, Upper=0x02, Combining=0x04, |
@@ -144,14 +146,15 @@ protected: | |||
144 | QString csTitle; | 146 | QString csTitle; |
145 | QString desc; | 147 | QString desc; |
146 | QString sysFilename; | 148 | QString sysFilename; |
147 | QString userFilename; | 149 | QString userFilename; |
148 | Type csType; | 150 | Type csType; |
149 | unsigned maxStrokes; | 151 | unsigned maxStrokes; |
150 | QIMPenCharList chars; | 152 | QIMPenCharList chars; |
151 | QIMPenCharMatchList matches; | 153 | QIMPenCharMatchList matches; |
154 | bool phidden : 1; | ||
152 | }; | 155 | }; |
153 | 156 | ||
154 | typedef QList<QIMPenCharSet> QIMPenCharSetList; | 157 | typedef QList<QIMPenCharSet> QIMPenCharSetList; |
155 | typedef QListIterator<QIMPenCharSet> QIMPenCharSetIterator; | 158 | typedef QListIterator<QIMPenCharSet> QIMPenCharSetIterator; |
156 | 159 | ||
157 | #endif | 160 | #endif |
diff --git a/inputmethods/handwriting/qimpenprofile.cpp b/inputmethods/handwriting/qimpenprofile.cpp index 3b1b5e9..b1a6592 100644 --- a/inputmethods/handwriting/qimpenprofile.cpp +++ b/inputmethods/handwriting/qimpenprofile.cpp | |||
@@ -43,16 +43,19 @@ QIMPenProfile::QIMPenProfile( const QString &fn ) | |||
43 | 43 | ||
44 | config.setGroup( "Settings" ); | 44 | config.setGroup( "Settings" ); |
45 | 45 | ||
46 | pstyle = BothCases; | 46 | pstyle = BothCases; |
47 | QString s = config.readEntry( "Style", "BothCases" ); | 47 | QString s = config.readEntry( "Style", "BothCases" ); |
48 | if ( s == "ToggleCases" ) | 48 | if ( s == "ToggleCases" ) |
49 | pstyle = ToggleCases; | 49 | pstyle = ToggleCases; |
50 | 50 | ||
51 | QString t = config.readEntry( "Mono", "Dual" ); | ||
52 | pmono = (QString::fromLatin1("Mono") == t ); | ||
53 | |||
51 | msTimeout = config.readNumEntry( "MultiTimeout", 500 ); | 54 | msTimeout = config.readNumEntry( "MultiTimeout", 500 ); |
52 | 55 | ||
53 | // Read user configuration | 56 | // Read user configuration |
54 | Config usrConfig( userConfig() ); | 57 | Config usrConfig( userConfig() ); |
55 | usrConfig.setGroup( "Settings" ); | 58 | usrConfig.setGroup( "Settings" ); |
56 | msTimeout = usrConfig.readNumEntry( "MultiTimeout", msTimeout ); | 59 | msTimeout = usrConfig.readNumEntry( "MultiTimeout", msTimeout ); |
57 | 60 | ||
58 | if ( tstyle && usrConfig.hasKey( "Style" ) ) { | 61 | if ( tstyle && usrConfig.hasKey( "Style" ) ) { |
@@ -114,30 +117,50 @@ void QIMPenProfile::loadData() | |||
114 | if ( combining->isEmpty() ) { | 117 | if ( combining->isEmpty() ) { |
115 | delete combining; | 118 | delete combining; |
116 | combining = 0; | 119 | combining = 0; |
117 | } | 120 | } |
118 | } | 121 | } |
119 | // uppercase latin1 | 122 | // uppercase latin1 |
120 | QIMPenCharSet *cs = 0; | 123 | QIMPenCharSet *cs = 0; |
121 | s = config.readEntry( "Uppercase" ); | 124 | s = config.readEntry( "Uppercase" ); |
122 | if ( !s.isEmpty() ) { | 125 | if ( !s.isEmpty() && !mono() ) { |
123 | cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); | 126 | cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); |
124 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); | 127 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); |
125 | if ( !cs->isEmpty() ) { | 128 | if ( !cs->isEmpty() ) { |
126 | if ( combining ) | 129 | if ( combining ) |
127 | combining->addCombined( cs ); | 130 | combining->addCombined( cs ); |
128 | sets.append( cs ); | 131 | sets.append( cs ); |
129 | } else { | 132 | } else { |
130 | delete cs; | 133 | delete cs; |
131 | } | 134 | } |
132 | } | 135 | } |
133 | // lowercase latin1 | 136 | // lowercase latin1 |
134 | s = config.readEntry( "Lowercase" ); | 137 | s = config.readEntry( "Lowercase" ); |
135 | if ( !s.isEmpty() ) { | 138 | if ( !s.isEmpty() ) { |
139 | if ( mono() ) { | ||
140 | cs = new QIMPenCharSet ( baseDir + "qimpen/" + s ); | ||
141 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); | ||
142 | if ( !cs->isEmpty() ) { | ||
143 | cs->setTitle( cs->title().upper() ); | ||
144 | cs->setType( QIMPenCharSet::Upper ); | ||
145 | cs->setHidden ( true ); | ||
146 | QIMPenCharIterator it( cs->characters() ); | ||
147 | for ( ; it.current(); ++it ) { | ||
148 | uint ch = it.current()->character(); | ||
149 | if ( ch >= 'a' && ch <= 'z' ) | ||
150 | it.current()->setCharacter( QChar(ch).upper() ); | ||
151 | } | ||
152 | if ( combining ) | ||
153 | combining->addCombined( cs ); | ||
154 | sets.append( cs ); | ||
155 | } else { | ||
156 | delete cs; | ||
157 | } | ||
158 | } | ||
136 | cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); | 159 | cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); |
137 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); | 160 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); |
138 | if ( !cs->isEmpty() ) { | 161 | if ( !cs->isEmpty() ) { |
139 | if ( combining ) | 162 | if ( combining ) |
140 | combining->addCombined( cs ); | 163 | combining->addCombined( cs ); |
141 | sets.append( cs ); | 164 | sets.append( cs ); |
142 | } else { | 165 | } else { |
143 | delete cs; | 166 | delete cs; |
diff --git a/inputmethods/handwriting/qimpenprofile.h b/inputmethods/handwriting/qimpenprofile.h index 4ce4367..adfa866 100644 --- a/inputmethods/handwriting/qimpenprofile.h +++ b/inputmethods/handwriting/qimpenprofile.h | |||
@@ -28,16 +28,17 @@ class QIMPenProfile | |||
28 | public: | 28 | public: |
29 | QIMPenProfile( const QString &fn ); | 29 | QIMPenProfile( const QString &fn ); |
30 | 30 | ||
31 | const QString &name() const { return pname; } | 31 | const QString &name() const { return pname; } |
32 | const QString &description() const { return pdesc; } | 32 | const QString &description() const { return pdesc; } |
33 | 33 | ||
34 | enum Style { ToggleCases, BothCases }; | 34 | enum Style { ToggleCases, BothCases }; |
35 | Style style() const { return pstyle; } | 35 | Style style() const { return pstyle; } |
36 | bool mono() const { return pmono; } | ||
36 | void setStyle( Style s ); | 37 | void setStyle( Style s ); |
37 | 38 | ||
38 | bool canSelectStyle() const { return tstyle; } | 39 | bool canSelectStyle() const { return tstyle; } |
39 | 40 | ||
40 | int multiStrokeTimeout() const { return msTimeout; } | 41 | int multiStrokeTimeout() const { return msTimeout; } |
41 | void setMultiStrokeTimeout( int t ); | 42 | void setMultiStrokeTimeout( int t ); |
42 | 43 | ||
43 | bool matchWords() const { return wordMatch; } | 44 | bool matchWords() const { return wordMatch; } |
@@ -60,11 +61,12 @@ private: | |||
60 | QIMPenCharSetList sets; | 61 | QIMPenCharSetList sets; |
61 | QString filename; | 62 | QString filename; |
62 | QString pname; | 63 | QString pname; |
63 | QString pdesc; | 64 | QString pdesc; |
64 | Style pstyle; | 65 | Style pstyle; |
65 | bool tstyle; | 66 | bool tstyle; |
66 | int msTimeout; | 67 | int msTimeout; |
67 | bool wordMatch; | 68 | bool wordMatch; |
69 | bool pmono; | ||
68 | }; | 70 | }; |
69 | 71 | ||
70 | #endif | 72 | #endif |
diff --git a/inputmethods/handwriting/qimpensetup.cpp b/inputmethods/handwriting/qimpensetup.cpp index 2441102..d0f9ffd 100644 --- a/inputmethods/handwriting/qimpensetup.cpp +++ b/inputmethods/handwriting/qimpensetup.cpp | |||
@@ -396,17 +396,18 @@ QIMPenEdit::QIMPenEdit( QIMPenProfile *p, QWidget *parent, | |||
396 | } | 396 | } |
397 | 397 | ||
398 | void QIMPenEdit::setProfile( QIMPenProfile *p ) | 398 | void QIMPenEdit::setProfile( QIMPenProfile *p ) |
399 | { | 399 | { |
400 | profile = p; | 400 | profile = p; |
401 | charSetCombo->clear(); | 401 | charSetCombo->clear(); |
402 | QIMPenCharSetIterator it( profile->charSets() ); | 402 | QIMPenCharSetIterator it( profile->charSets() ); |
403 | for ( ; it.current(); ++it ) { | 403 | for ( ; it.current(); ++it ) { |
404 | charSetCombo->insertItem( it.current()->description() ); | 404 | if ( ! it.current()->hidden() ) |
405 | charSetCombo->insertItem( it.current()->description() ); | ||
405 | } | 406 | } |
406 | selectCharSet( 0 ); | 407 | selectCharSet( 0 ); |
407 | charList->setFocus(); | 408 | charList->setFocus(); |
408 | enableButtons(); | 409 | enableButtons(); |
409 | } | 410 | } |
410 | 411 | ||
411 | void QIMPenEdit::selectCharSet( QIMPenCharSet *c ) | 412 | void QIMPenEdit::selectCharSet( QIMPenCharSet *c ) |
412 | { | 413 | { |