summaryrefslogtreecommitdiff
path: root/inputmethods/handwriting/qimpensetup.cpp
Unidiff
Diffstat (limited to 'inputmethods/handwriting/qimpensetup.cpp') (more/less context) (show whitespace changes)
-rw-r--r--inputmethods/handwriting/qimpensetup.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/inputmethods/handwriting/qimpensetup.cpp b/inputmethods/handwriting/qimpensetup.cpp
index d1297a9..3f4841d 100644
--- a/inputmethods/handwriting/qimpensetup.cpp
+++ b/inputmethods/handwriting/qimpensetup.cpp
@@ -317,25 +317,25 @@ QIMPenEdit::QIMPenEdit( QIMPenProfile *p, QWidget *parent,
317 currentCode = 0; 317 currentCode = 0;
318 inputChar = new QIMPenChar(); 318 inputChar = new QIMPenChar();
319 319
320 QVBoxLayout *tvb = new QVBoxLayout( this, 5 ); 320 QVBoxLayout *tvb = new QVBoxLayout( this, 5 );
321 321
322 QGridLayout *gl = new QGridLayout( tvb, 4, 2 ); 322 QGridLayout *gl = new QGridLayout( tvb, 4, 2 );
323 gl->setRowStretch( 1, 1 ); 323 gl->setRowStretch( 1, 1 );
324 gl->addRowSpacing( 2, 35 ); 324 gl->addRowSpacing( 2, 35 );
325 gl->addRowSpacing( 3, 35 ); 325 gl->addRowSpacing( 3, 35 );
326 326
327 charSetCombo = new QComboBox( this ); 327 charSetCombo = new QComboBox( this );
328 gl->addMultiCellWidget( charSetCombo, 0, 0, 0, 1 ); 328 gl->addMultiCellWidget( charSetCombo, 0, 0, 0, 1 );
329 connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSet(int))); 329 connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSetVisible(int)));
330 QIMPenCharSetIterator it( profile->charSets() ); 330 QIMPenCharSetIterator it( profile->charSets() );
331 for ( ; it.current(); ++it ) { 331 for ( ; it.current(); ++it ) {
332 charSetCombo->insertItem( it.current()->description() ); 332 charSetCombo->insertItem( it.current()->description() );
333 } 333 }
334 334
335 charList = new QListBox( this ); 335 charList = new QListBox( this );
336 charList->setMinimumHeight( charList->sizeHint().height() ); 336 charList->setMinimumHeight( charList->sizeHint().height() );
337 connect( charList, SIGNAL(highlighted(int)), SLOT(selectChar(int)) ); 337 connect( charList, SIGNAL(highlighted(int)), SLOT(selectChar(int)) );
338 gl->addWidget( charList, 1, 0 ); 338 gl->addWidget( charList, 1, 0 );
339 339
340 pw = new QIMPenWidget( this ); 340 pw = new QIMPenWidget( this );
341 pw->setFixedHeight( 75 ); 341 pw->setFixedHeight( 75 );
@@ -379,41 +379,41 @@ QIMPenEdit::QIMPenEdit( QIMPenProfile *p, QWidget *parent,
379 379
380 //-- 380 //--
381#if !defined(Q_WS_QWS) 381#if !defined(Q_WS_QWS)
382 hb = new QHBoxLayout( tvb ); 382 hb = new QHBoxLayout( tvb );
383 pb = new QPushButton( tr("OK"), this ); 383 pb = new QPushButton( tr("OK"), this );
384 connect( pb, SIGNAL(clicked()), SLOT(accept()) ); 384 connect( pb, SIGNAL(clicked()), SLOT(accept()) );
385 hb->addWidget( pb ); 385 hb->addWidget( pb );
386 386
387 pb = new QPushButton( tr("Cancel"), this ); 387 pb = new QPushButton( tr("Cancel"), this );
388 connect( pb, SIGNAL(clicked()), SLOT(reject()) ); 388 connect( pb, SIGNAL(clicked()), SLOT(reject()) );
389 hb->addWidget( pb ); 389 hb->addWidget( pb );
390#endif 390#endif
391 selectCharSet( 0 ); 391 selectCharSetVisible( 0 );
392 charList->setFocus(); 392 charList->setFocus();
393 393
394 resize( minimumSize() ); 394 resize( minimumSize() );
395 enableButtons(); 395 enableButtons();
396} 396}
397 397
398void QIMPenEdit::setProfile( QIMPenProfile *p ) 398void 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 if ( ! it.current()->hidden() ) 404 if ( ! it.current()->hidden() )
405 charSetCombo->insertItem( it.current()->description() ); 405 charSetCombo->insertItem( it.current()->description() );
406 } 406 }
407 selectCharSet( 0 ); 407 selectCharSetVisible( 0 );
408 charList->setFocus(); 408 charList->setFocus();
409 enableButtons(); 409 enableButtons();
410} 410}
411 411
412void QIMPenEdit::selectCharSet( QIMPenCharSet *c ) 412void QIMPenEdit::selectCharSet( QIMPenCharSet *c )
413{ 413{
414 int i = 0; 414 int i = 0;
415 QIMPenCharSetIterator it( profile->charSets() ); 415 QIMPenCharSetIterator it( profile->charSets() );
416 for ( ; it.current(); ++it, i++ ) { 416 for ( ; it.current(); ++it, i++ ) {
417 if ( it.current() == c ) { 417 if ( it.current() == c ) {
418 charSetCombo->setCurrentItem( i ); 418 charSetCombo->setCurrentItem( i );
419 selectCharSet( i ); 419 selectCharSet( i );
@@ -540,24 +540,35 @@ void QIMPenEdit::selectChar( int i )
540 for ( ; it.current(); ++it ) { 540 for ( ; it.current(); ++it ) {
541 if ( it.current()->character() == currentCode && 541 if ( it.current()->character() == currentCode &&
542 !it.current()->testFlag( QIMPenChar::Deleted ) ) { 542 !it.current()->testFlag( QIMPenChar::Deleted ) ) {
543 setCurrentChar( it.current() ); 543 setCurrentChar( it.current() );
544 break; 544 break;
545 } 545 }
546 } 546 }
547 if ( !it.current() ) 547 if ( !it.current() )
548 setCurrentChar( 0 ); 548 setCurrentChar( 0 );
549 inputChar->clear(); 549 inputChar->clear();
550} 550}
551 551
552void QIMPenEdit::selectCharSetVisible( int c )
553{
554 int i = 0;
555 QIMPenCharSetIterator it( profile->charSets() );
556 for ( ; it.current(); ++it, i++ ) {
557 if ( charSetCombo->text( c ) == it.current()->description() ) {
558 selectCharSet( i );
559 }
560 }
561}
562
552void QIMPenEdit::selectCharSet( int i ) 563void QIMPenEdit::selectCharSet( int i )
553{ 564{
554 if ( currentSet ) 565 if ( currentSet )
555 pw->removeCharSet( 0 ); 566 pw->removeCharSet( 0 );
556 currentSet = profile->charSets().at( i ); 567 currentSet = profile->charSets().at( i );
557 fillCharList(); 568 fillCharList();
558 pw->insertCharSet( currentSet ); 569 pw->insertCharSet( currentSet );
559 inputChar->clear(); 570 inputChar->clear();
560 if ( charList->count() ) { 571 if ( charList->count() ) {
561 charList->setSelected( 0, TRUE ); 572 charList->setSelected( 0, TRUE );
562 selectChar(0); 573 selectChar(0);
563 } 574 }