summaryrefslogtreecommitdiff
path: root/inputmethods/handwriting/qimpeninput.cpp
Unidiff
Diffstat (limited to 'inputmethods/handwriting/qimpeninput.cpp') (more/less context) (show whitespace changes)
-rw-r--r--inputmethods/handwriting/qimpeninput.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/inputmethods/handwriting/qimpeninput.cpp b/inputmethods/handwriting/qimpeninput.cpp
index 6a21931..3f7a347 100644
--- a/inputmethods/handwriting/qimpeninput.cpp
+++ b/inputmethods/handwriting/qimpeninput.cpp
@@ -1,16 +1,16 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
@@ -125,26 +125,26 @@ static char * help_xpm[] = {
125" .+. ", 125" .+. ",
126" .+. ", 126" .+. ",
127" #.# ", 127" #.# ",
128" .+. ", 128" .+. ",
129" #.# "}; 129" #.# "};
130 130
131 131
132/*! 132/*!
133 \class QIMPenInput qimpeninput.h 133 \class QIMPenInput qimpeninput.h
134 134
135 Pen input widget. 135 Pen input widget.
136*/ 136*/
137QIMPenInput::QIMPenInput( QWidget *parent, const char *name, WFlags flags ) 137QIMPenInput::QIMPenInput( QWidget *parent, const char *name, WFlags f )
138 : QFrame( parent, name, flags ), helpDlg(0), profile(0) 138 : QFrame( parent, name, f ), helpDlg(0), profile(0)
139{ 139{
140 setFrameStyle( Box | Plain ); 140 setFrameStyle( Box | Plain );
141 141
142 profileList.setAutoDelete( true ); 142 profileList.setAutoDelete( true );
143 143
144 matcher = new QIMPenMatch( this ); 144 matcher = new QIMPenMatch( this );
145 connect( matcher, SIGNAL(keypress(uint)), this, SLOT(keypress(uint)) ); 145 connect( matcher, SIGNAL(keypress(uint)), this, SLOT(keypress(uint)) );
146 connect( matcher, SIGNAL(erase()), this, SLOT(erase()) ); 146 connect( matcher, SIGNAL(erase()), this, SLOT(erase()) );
147 147
148 QGridLayout *gl = new QGridLayout( this, 5, 2, 1, 0 ); 148 QGridLayout *gl = new QGridLayout( this, 5, 2, 1, 0 );
149 gl->setColStretch( 0, 1 ); 149 gl->setColStretch( 0, 1 );
150 150
@@ -229,61 +229,58 @@ QSize QIMPenInput::sizeHint() const
229{ 229{
230 int fw = frameWidth(); 230 int fw = frameWidth();
231 int ps = wordPicker->isHidden() ? 0 : wordPicker->sizeHint().height(); 231 int ps = wordPicker->isHidden() ? 0 : wordPicker->sizeHint().height();
232 return pw->sizeHint() + QSize( fw*2, fw*2+ps ); 232 return pw->sizeHint() + QSize( fw*2, fw*2+ps );
233} 233}
234 234
235void QIMPenInput::loadProfiles() 235void QIMPenInput::loadProfiles()
236{ 236{
237 profileList.clear(); 237 profileList.clear();
238 profile = 0; 238 profile = 0;
239 delete shortcutCharSet; 239 delete shortcutCharSet;
240 shortcutCharSet = new QIMPenCharSet(); 240 shortcutCharSet = new QIMPenCharSet();
241 shortcutCharSet->setTitle( "Shortcut" ); 241 shortcutCharSet->setTitle( tr("Shortcut") );
242 QString path = QPEApplication::qpeDir() + "etc/qimpen"; 242 QString path = QPEApplication::qpeDir() + "etc/qimpen";
243 QDir dir( path, "*.conf" ); 243 QDir dir( path, "*.conf" );
244 QStringList list = dir.entryList(); 244 QStringList list = dir.entryList();
245 QStringList::Iterator it; 245 QStringList::Iterator it;
246 for ( it = list.begin(); it != list.end(); ++it ) { 246 for ( it = list.begin(); it != list.end(); ++it ) {
247 QIMPenProfile *p = new QIMPenProfile( path + "/" + *it ); 247 QIMPenProfile *p = new QIMPenProfile( path + "/" + *it );
248 profileList.append( p ); 248 profileList.append( p );
249 if ( p->shortcut() ) { 249 if ( p->shortcut() ) {
250 QIMPenCharIterator it( p->shortcut()->characters() ); 250 QIMPenCharIterator it( p->shortcut()->characters() );
251 for ( ; it.current(); ++it ) { 251 for ( ; it.current(); ++it ) {
252 shortcutCharSet->addChar( new QIMPenChar(*it.current()) ); 252 shortcutCharSet->addChar( new QIMPenChar(*it.current()) );
253 } 253 }
254 } 254 }
255 } 255 }
256 256
257
258 Config config( "handwriting" ); 257 Config config( "handwriting" );
259 config.setGroup( "Settings" ); 258 config.setGroup( "Settings" );
260 QString prof = config.readEntry( "Profile", "Default" ); 259 QString prof = config.readEntry( "Profile", "Default" );
261 selectProfile( prof ); 260 selectProfile( prof );
262} 261}
263 262
264void QIMPenInput::selectProfile( const QString &name ) 263void QIMPenInput::selectProfile( const QString &name )
265{ 264{
266 QListIterator<QIMPenProfile> it( profileList ); 265 QListIterator<QIMPenProfile> it( profileList );
267 for ( ; it.current(); ++it ) { 266 for ( ; it.current(); ++it ) {
268 if ( it.current()->name() == name ) { 267 if ( it.current()->name() == name ) {
269 profile = it.current(); 268 profile = it.current();
270 break; 269 break;
271 } 270 }
272 } 271 }
273 272
274 if ( !it.current() ) { 273 if ( !it.current() )
275 qWarning("No profile selected!\n");
276 return; 274 return;
277 }
278 275
279 pw->clearCharSets(); 276 pw->clearCharSets();
280 baseSets.clear(); 277 baseSets.clear();
281 278
282 matcher->setMultiStrokeTimeout( profile->multiStrokeTimeout() ); 279 matcher->setMultiStrokeTimeout( profile->multiStrokeTimeout() );
283 matcher->setWordMatchingEnabled( profile->matchWords() ); 280 matcher->setWordMatchingEnabled( profile->matchWords() );
284 281
285 if ( !Global::fixedDawg().root() || !matcher->isWordMatchingEnabled() ) 282 if ( !Global::fixedDawg().root() || !matcher->isWordMatchingEnabled() )
286 wordPicker->hide(); 283 wordPicker->hide();
287 else 284 else
288 wordPicker->show(); 285 wordPicker->show();
289 286