summaryrefslogtreecommitdiff
path: root/inputmethods
authorzecke <zecke>2004-01-18 13:26:43 (UTC)
committer zecke <zecke>2004-01-18 13:26:43 (UTC)
commit7d94c9b04f8702d0f94c6c64454d159a186a2576 (patch) (side-by-side diff)
treea5989f07e02e610abab7cf7514737a67c78b1d68 /inputmethods
parenta2a3aabf21655cc9c7df8e2ed0d420d2b208fd3d (diff)
downloadopie-7d94c9b04f8702d0f94c6c64454d159a186a2576.zip
opie-7d94c9b04f8702d0f94c6c64454d159a186a2576.tar.gz
opie-7d94c9b04f8702d0f94c6c64454d159a186a2576.tar.bz2
Comit the "Mono" patch by
Brad Campbell <brad@wasp.net.au>
Diffstat (limited to 'inputmethods') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/handwriting/qimpenchar.cpp5
-rw-r--r--inputmethods/handwriting/qimpenchar.h3
-rw-r--r--inputmethods/handwriting/qimpenprofile.cpp25
-rw-r--r--inputmethods/handwriting/qimpenprofile.h2
-rw-r--r--inputmethods/handwriting/qimpensetup.cpp3
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
@@ -325,60 +325,63 @@ bool QIMPenCharSet::load( const QString &fn, Domain d )
int major = version.mid( 4, 1 ).toInt();
int minor = version.mid( 6 ).toInt();
if ( major >= 1 && minor > 0 ) {
ds >> (Q_INT8 &)csType;
} else {
if ( csTitle == "abc" )
csType = Lower;
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 ( 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 );
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 ) ) ) &&
( !pc->testFlag (QIMPenChar::Combined ) ) ) {
ds << *pc;
}
}
file.writeBlock( buf );
file.close();
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
@@ -96,62 +96,65 @@ struct QIMPenCharMatch
};
typedef QValueList<QIMPenCharMatch> QIMPenCharMatchList;
class QIMPenCharSet
{
public:
QIMPenCharSet();
QIMPenCharSet( const QString &fn );
bool isEmpty() const { return chars.isEmpty(); }
unsigned int count() const { return chars.count(); }
void clear() { chars.clear(); }
void setDescription( const QString &d ) { desc = d; }
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,
Numeric=0x08, Punctuation=0x10, Symbol=0x20, Shortcut=0x40 };
const QIMPenCharList &characters() const { return chars; }
void setType( Type t ) { csType = t; }
Type type() const { return csType; }
const QString &filename( Domain d ) const;
void setFilename( const QString &fn, Domain d=System );
bool load( const QString &fn, Domain d=System );
bool save( Domain d=System );
protected:
void markDeleted( uint ch );
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
@@ -27,48 +27,51 @@
QIMPenProfile::QIMPenProfile( const QString &fn )
: filename( fn )
{
sets.setAutoDelete( true );
Config config( filename, Config::File );
config.setGroup( "Handwriting" );
pname = config.readEntry( "Name" );
pdesc = config.readEntry( "Description" );
tstyle = config.readBoolEntry( "CanSelectStyle", false );
wordMatch = config.readBoolEntry( "MatchWords", true );
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" ) ) {
pstyle = BothCases;
QString s = usrConfig.readEntry( "Style", "BothCases" );
if ( s == "ToggleCases" )
pstyle = ToggleCases;
}
}
void QIMPenProfile::setStyle( Style s )
{
if ( tstyle && s != pstyle ) {
pstyle = s;
Config config( userConfig() );
config.setGroup( "Settings" );
QString s = pstyle == ToggleCases ? "ToggleCases" : "BothCases";
config.writeEntry( "Style", s );
}
@@ -98,62 +101,82 @@ QString QIMPenProfile::userConfig()
return un;
}
void QIMPenProfile::loadData()
{
Config config( filename, Config::File );
config.setGroup( "CharSets" );
QString baseDir = QPEApplication::qpeDir();
baseDir += "/etc/";
// accents
QIMPenCombining *combining = 0;
QString s = config.readEntry( "Combining" );
if ( !s.isEmpty() ) {
combining = new QIMPenCombining( baseDir + "qimpen/" + s );
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;
}
}
// numeric (may comtain punctuation and symbols)
s = config.readEntry( "Numeric" );
if ( !s.isEmpty() ) {
cs = new QIMPenCharSet( baseDir + "qimpen/" + s );
cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
if ( !cs->isEmpty() ) {
sets.append( cs );
} else {
delete cs;
}
}
// punctuation
s = config.readEntry( "Punctuation" );
if ( !s.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
@@ -12,59 +12,61 @@
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QIMPENPROFILE_H_
#define QIMPENPROFILE_H_
#include "qimpenchar.h"
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; }
QIMPenCharSet *uppercase();
QIMPenCharSet *lowercase();
QIMPenCharSet *numeric();
QIMPenCharSet *punctuation();
QIMPenCharSet *symbol();
QIMPenCharSet *shortcut();
QIMPenCharSet *find( QIMPenCharSet::Type t );
QIMPenCharSetList &charSets();
private:
QString userConfig();
void loadData();
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
@@ -380,49 +380,50 @@ QIMPenEdit::QIMPenEdit( QIMPenProfile *p, QWidget *parent,
//--
#if !defined(Q_WS_QWS)
hb = new QHBoxLayout( tvb );
pb = new QPushButton( tr("OK"), this );
connect( pb, SIGNAL(clicked()), SLOT(accept()) );
hb->addWidget( pb );
pb = new QPushButton( tr("Cancel"), this );
connect( pb, SIGNAL(clicked()), SLOT(reject()) );
hb->addWidget( pb );
#endif
selectCharSet( 0 );
charList->setFocus();
resize( minimumSize() );
enableButtons();
}
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 )
{
int i = 0;
QIMPenCharSetIterator it( profile->charSets() );
for ( ; it.current(); ++it, i++ ) {
if ( it.current() == c ) {
charSetCombo->setCurrentItem( i );
selectCharSet( i );
}
}
}
/*!
Fill the character list box with the characters. Duplicates are not
inserted.
*/
void QIMPenEdit::fillCharList()