From 7d94c9b04f8702d0f94c6c64454d159a186a2576 Mon Sep 17 00:00:00 2001 From: zecke Date: Sun, 18 Jan 2004 13:26:43 +0000 Subject: Comit the "Mono" patch by Brad Campbell --- (limited to 'inputmethods') 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 @@ -346,7 +346,7 @@ bool QIMPenCharSet::load( const QString &fn, Domain d ) if ( file.status() == IO_Ok ) ok = TRUE; } - + setHidden ( false ); return ok; } @@ -358,6 +358,9 @@ bool QIMPenCharSet::save( Domain d ) if ( filename( d ).isEmpty() ) return FALSE; + if ( hidden() ) + return TRUE; + bool ok = FALSE; QString fn = filename( d ); 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 @@ -117,6 +117,8 @@ public: 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; } @@ -149,6 +151,7 @@ protected: unsigned maxStrokes; QIMPenCharList chars; QIMPenCharMatchList matches; + bool phidden : 1; }; typedef QList QIMPenCharSetList; 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 @@ -48,6 +48,9 @@ QIMPenProfile::QIMPenProfile( const QString &fn ) if ( s == "ToggleCases" ) pstyle = ToggleCases; + QString t = config.readEntry( "Mono", "Dual" ); + pmono = (QString::fromLatin1("Mono") == t ); + msTimeout = config.readNumEntry( "MultiTimeout", 500 ); // Read user configuration @@ -119,7 +122,7 @@ void QIMPenProfile::loadData() // 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() ) { @@ -133,6 +136,26 @@ void QIMPenProfile::loadData() // 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() ) { 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 @@ -33,6 +33,7 @@ public: enum Style { ToggleCases, BothCases }; Style style() const { return pstyle; } + bool mono() const { return pmono; } void setStyle( Style s ); bool canSelectStyle() const { return tstyle; } @@ -65,6 +66,7 @@ private: 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 @@ -401,7 +401,8 @@ void QIMPenEdit::setProfile( QIMPenProfile *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(); -- cgit v0.9.0.2