-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 ) ds >> *pc; if ( d == User ) markDeleted( pc->character() ); // override system addChar( pc ); } if ( file.status() == IO_Ok ) ok = TRUE; } - + setHidden ( false ); return ok; } /*! Save this character set. */ bool QIMPenCharSet::save( Domain d ) { if ( filename( d ).isEmpty() ) return FALSE; + if ( hidden() ) + return TRUE; + bool ok = FALSE; QString fn = filename( d ); QString tmpFn = fn + ".new"; QFile file( tmpFn ); if ( file.open( IO_WriteOnly|IO_Raw ) ) { QByteArray buf; 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: QString description() const { return desc; } void setTitle( const QString &t ) { csTitle = t; } QString title() const { return csTitle; } QIMPenCharMatchList match( QIMPenChar *ch ); void addChar( QIMPenChar *ch ); void removeChar( QIMPenChar *ch ); QIMPenChar *at( int i ); + void setHidden ( const bool &b ) { phidden = &b; } + bool hidden() const { return phidden; } unsigned maximumStrokes() const { return maxStrokes; } void up( QIMPenChar *ch ); void down( QIMPenChar *ch ); enum Domain { System, User }; enum Type { Unknown=0x00, Lower=0x01, Upper=0x02, Combining=0x04, @@ -144,14 +146,15 @@ protected: QString csTitle; QString desc; QString sysFilename; QString userFilename; Type csType; unsigned maxStrokes; QIMPenCharList chars; QIMPenCharMatchList matches; + bool phidden : 1; }; typedef QList<QIMPenCharSet> QIMPenCharSetList; typedef QListIterator<QIMPenCharSet> QIMPenCharSetIterator; #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 ) config.setGroup( "Settings" ); pstyle = BothCases; QString s = config.readEntry( "Style", "BothCases" ); if ( s == "ToggleCases" ) pstyle = ToggleCases; + QString t = config.readEntry( "Mono", "Dual" ); + pmono = (QString::fromLatin1("Mono") == t ); + msTimeout = config.readNumEntry( "MultiTimeout", 500 ); // Read user configuration Config usrConfig( userConfig() ); usrConfig.setGroup( "Settings" ); msTimeout = usrConfig.readNumEntry( "MultiTimeout", msTimeout ); if ( tstyle && usrConfig.hasKey( "Style" ) ) { @@ -114,30 +117,50 @@ void QIMPenProfile::loadData() if ( combining->isEmpty() ) { delete combining; combining = 0; } } // uppercase latin1 QIMPenCharSet *cs = 0; s = config.readEntry( "Uppercase" ); - if ( !s.isEmpty() ) { + if ( !s.isEmpty() && !mono() ) { cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); if ( !cs->isEmpty() ) { if ( combining ) combining->addCombined( cs ); sets.append( cs ); } else { delete cs; } } // lowercase latin1 s = config.readEntry( "Lowercase" ); if ( !s.isEmpty() ) { + if ( mono() ) { + cs = new QIMPenCharSet ( baseDir + "qimpen/" + s ); + cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); + if ( !cs->isEmpty() ) { + cs->setTitle( cs->title().upper() ); + cs->setType( QIMPenCharSet::Upper ); + cs->setHidden ( true ); + QIMPenCharIterator it( cs->characters() ); + for ( ; it.current(); ++it ) { + uint ch = it.current()->character(); + if ( ch >= 'a' && ch <= 'z' ) + it.current()->setCharacter( QChar(ch).upper() ); + } + if ( combining ) + combining->addCombined( cs ); + sets.append( cs ); + } else { + delete cs; + } + } cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); if ( !cs->isEmpty() ) { if ( combining ) combining->addCombined( cs ); sets.append( cs ); } else { 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 public: QIMPenProfile( const QString &fn ); const QString &name() const { return pname; } const QString &description() const { return pdesc; } enum Style { ToggleCases, BothCases }; Style style() const { return pstyle; } + bool mono() const { return pmono; } void setStyle( Style s ); bool canSelectStyle() const { return tstyle; } int multiStrokeTimeout() const { return msTimeout; } void setMultiStrokeTimeout( int t ); bool matchWords() const { return wordMatch; } @@ -60,11 +61,12 @@ private: QIMPenCharSetList sets; QString filename; QString pname; QString pdesc; Style pstyle; bool tstyle; int msTimeout; bool wordMatch; + bool pmono; }; #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, } void QIMPenEdit::setProfile( QIMPenProfile *p ) { profile = p; charSetCombo->clear(); QIMPenCharSetIterator it( profile->charSets() ); for ( ; it.current(); ++it ) { - charSetCombo->insertItem( it.current()->description() ); + if ( ! it.current()->hidden() ) + charSetCombo->insertItem( it.current()->description() ); } selectCharSet( 0 ); charList->setFocus(); enableButtons(); } void QIMPenEdit::selectCharSet( QIMPenCharSet *c ) { |