summaryrefslogtreecommitdiff
path: root/inputmethods/handwriting/qimpeninput.cpp
Unidiff
Diffstat (limited to 'inputmethods/handwriting/qimpeninput.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/handwriting/qimpeninput.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/inputmethods/handwriting/qimpeninput.cpp b/inputmethods/handwriting/qimpeninput.cpp
index d073cdf..6ea1bb4 100644
--- a/inputmethods/handwriting/qimpeninput.cpp
+++ b/inputmethods/handwriting/qimpeninput.cpp
@@ -27,24 +27,25 @@
27#include "qimpenhelp.h" 27#include "qimpenhelp.h"
28 28
29#include <qpe/qpeapplication.h> 29#include <qpe/qpeapplication.h>
30#include <qpe/qdawg.h> 30#include <qpe/qdawg.h>
31#include <qpe/config.h> 31#include <qpe/config.h>
32#include <qpe/global.h> 32#include <qpe/global.h>
33 33
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qlabel.h> 36#include <qlabel.h>
37#include <qtimer.h> 37#include <qtimer.h>
38#include <qdir.h> 38#include <qdir.h>
39#include <opie2/odebug.h>
39 40
40#include <limits.h> 41#include <limits.h>
41 42
42// We'll use little pixmaps for the buttons to save screen space. 43// We'll use little pixmaps for the buttons to save screen space.
43 44
44/* XPM */ 45/* XPM */
45static const char * const pen_xpm[] = { 46static const char * const pen_xpm[] = {
46"12 12 4 1", 47"12 12 4 1",
47 " c None", 48 " c None",
48 ".c #000000", 49 ".c #000000",
49 "+c #FFFFFF", 50 "+c #FFFFFF",
50 "@c #808080", 51 "@c #808080",
@@ -310,25 +311,25 @@ void QIMPenInput::wordPicked( const QString &w )
310 keypress( Qt::Key_Backspace << 16 ); 311 keypress( Qt::Key_Backspace << 16 );
311 312
312 for ( unsigned int i = 0; i < w.length(); i++ ) 313 for ( unsigned int i = 0; i < w.length(); i++ )
313 keypress( w[i].unicode() ); 314 keypress( w[i].unicode() );
314 315
315 matcher->resetState(); 316 matcher->resetState();
316 wordPicker->clear(); 317 wordPicker->clear();
317} 318}
318 319
319void QIMPenInput::selectCharSet( int idx ) 320void QIMPenInput::selectCharSet( int idx )
320{ 321{
321 if ( mode == Switch ) { 322 if ( mode == Switch ) {
322 //qDebug( "Switch back to normal" ); 323 //odebug << "Switch back to normal" << oendl;
323 pw->changeCharSet( baseSets.at(currCharSet), currCharSet ); 324 pw->changeCharSet( baseSets.at(currCharSet), currCharSet );
324 mode = Normal; 325 mode = Normal;
325 } 326 }
326 currCharSet = idx; 327 currCharSet = idx;
327} 328}
328 329
329void QIMPenInput::beginStroke() 330void QIMPenInput::beginStroke()
330{ 331{
331} 332}
332 333
333void QIMPenInput::strokeEntered( QIMPenStroke * ) 334void QIMPenInput::strokeEntered( QIMPenStroke * )
334{ 335{
@@ -344,67 +345,68 @@ void QIMPenInput::matchedCharacters( const QIMPenCharMatchList &cl )
344{ 345{
345 const QIMPenChar *ch = cl.first().penChar; 346 const QIMPenChar *ch = cl.first().penChar;
346 int scan = ch->character() >> 16; 347 int scan = ch->character() >> 16;
347 348
348 if ( scan < QIMPenChar::ModeBase ) 349 if ( scan < QIMPenChar::ModeBase )
349 return; 350 return;
350 351
351 // We matched a special character... 352 // We matched a special character...
352 353
353 switch ( scan ) { 354 switch ( scan ) {
354 case QIMPenChar::Caps: 355 case QIMPenChar::Caps:
355 if ( profile->style() == QIMPenProfile::ToggleCases ) { 356 if ( profile->style() == QIMPenProfile::ToggleCases ) {
356 // qDebug( "Caps" ); 357 // odebug << "Caps" << oendl;
358 //
357 if ( mode == SwitchLock ) { 359 if ( mode == SwitchLock ) {
358 // qDebug( "Switch to normal" ); 360 // odebug << "Switch to normal" << oendl;
359 pw->changeCharSet( profile->lowercase(), currCharSet ); 361 pw->changeCharSet( profile->lowercase(), currCharSet );
360 mode = Switch; 362 mode = Switch;
361 } else { 363 } else {
362 // qDebug( "Switch to upper" ); 364 // odebug << "Switch to upper" << oendl;
363 pw->changeCharSet( profile->uppercase(), currCharSet ); 365 pw->changeCharSet( profile->uppercase(), currCharSet );
364 mode = Switch; 366 mode = Switch;
365 } 367 }
366 } 368 }
367 break; 369 break;
368 case QIMPenChar::CapsLock: 370 case QIMPenChar::CapsLock:
369 if ( profile->style() == QIMPenProfile::ToggleCases ) { 371 if ( profile->style() == QIMPenProfile::ToggleCases ) {
370 // qDebug( "CapsLock" ); 372 // odebug << "CapsLock" << oendl;
371 if ( mode == Switch && 373 if ( mode == Switch &&
372 baseSets.at(currCharSet) == profile->uppercase() ) { 374 baseSets.at(currCharSet) == profile->uppercase() ) {
373 // qDebug( "Switch to normal" ); 375 // odebug << "Switch to normal" << oendl;
374 pw->changeCharSet( profile->lowercase(), currCharSet ); 376 pw->changeCharSet( profile->lowercase(), currCharSet );
375 // change our base set back to lower. 377 // change our base set back to lower.
376 baseSets.remove( currCharSet ); 378 baseSets.remove( currCharSet );
377 baseSets.insert( currCharSet, profile->lowercase() ); 379 baseSets.insert( currCharSet, profile->lowercase() );
378 mode = Normal; 380 mode = Normal;
379 } else { 381 } else {
380 // qDebug( "Switch to caps lock" ); 382 // odebug << "Switch to caps lock" << oendl;
381 pw->changeCharSet( profile->uppercase(), currCharSet ); 383 pw->changeCharSet( profile->uppercase(), currCharSet );
382 // change our base set to upper. 384 // change our base set to upper.
383 baseSets.remove( currCharSet ); 385 baseSets.remove( currCharSet );
384 baseSets.insert( currCharSet, profile->uppercase() ); 386 baseSets.insert( currCharSet, profile->uppercase() );
385 mode = SwitchLock; 387 mode = SwitchLock;
386 } 388 }
387 } 389 }
388 break; 390 break;
389 case QIMPenChar::Punctuation: 391 case QIMPenChar::Punctuation:
390 if ( profile->punctuation() ) { 392 if ( profile->punctuation() ) {
391 //qDebug( "Switch to punctuation" ); 393 //odebug << "Switch to punctuation" << oendl;
392 pw->changeCharSet( profile->punctuation(), currCharSet ); 394 pw->changeCharSet( profile->punctuation(), currCharSet );
393 mode = Switch; 395 mode = Switch;
394 } 396 }
395 break; 397 break;
396 case QIMPenChar::Symbol: 398 case QIMPenChar::Symbol:
397 if ( profile->symbol() ) { 399 if ( profile->symbol() ) {
398 //qDebug( "Switch to symbol" ); 400 //odebug << "Switch to symbol" << oendl ;
399 pw->changeCharSet( profile->symbol(), currCharSet ); 401 pw->changeCharSet( profile->symbol(), currCharSet );
400 mode = Switch; 402 mode = Switch;
401 } 403 }
402 break; 404 break;
403 case QIMPenChar::Shortcut: 405 case QIMPenChar::Shortcut:
404 if ( shortcutCharSet ) { 406 if ( shortcutCharSet ) {
405 pw->changeCharSet( shortcutCharSet, currCharSet ); 407 pw->changeCharSet( shortcutCharSet, currCharSet );
406 mode = Switch; 408 mode = Switch;
407 } 409 }
408 break; 410 break;
409 case QIMPenChar::Extended: 411 case QIMPenChar::Extended:
410 handleExtended( ch->data() ); 412 handleExtended( ch->data() );
@@ -434,41 +436,41 @@ void QIMPenInput::keypress( uint scan_uni )
434 break; 436 break;
435 case Key_Backspace: 437 case Key_Backspace:
436 scan_uni = 8; 438 scan_uni = 8;
437 break; 439 break;
438 case Key_Escape: 440 case Key_Escape:
439 scan_uni = 27; 441 scan_uni = 27;
440 break; 442 break;
441 default: 443 default:
442 break; 444 break;
443 } 445 }
444 446
445 if ( mode == Switch ) { 447 if ( mode == Switch ) {
446 //qDebug( "Switch back to normal" ); 448 //odebug << "Switch back to normal" << oendl ;
447 pw->changeCharSet( baseSets.at(currCharSet), currCharSet ); 449 pw->changeCharSet( baseSets.at(currCharSet), currCharSet );
448 if ( baseSets.at(currCharSet) == profile->uppercase() ) 450 if ( baseSets.at(currCharSet) == profile->uppercase() )
449 mode = SwitchLock; 451 mode = SwitchLock;
450 else 452 else
451 mode = Normal; 453 mode = Normal;
452 } 454 }
453 455
454 emit key( scan_uni&0xffff, scan, 0, true, false ); 456 emit key( scan_uni&0xffff, scan, 0, true, false );
455 emit key( scan_uni&0xffff, scan, 0, false, false ); 457 emit key( scan_uni&0xffff, scan, 0, false, false );
456} 458}
457 459
458void QIMPenInput::handleExtended( const QString &ex ) 460void QIMPenInput::handleExtended( const QString &ex )
459{ 461{
460 if ( ex.find( "Select" ) == 0 ) { 462 if ( ex.find( "Select" ) == 0 ) {
461 QString set = ex.mid( 7 ); 463 QString set = ex.mid( 7 );
462 qDebug( "Select new profile: %s", set.latin1() ); 464 odebug << "Select new profile: " << set.latin1() << oendl;
463 selectProfile( set ); 465 selectProfile( set );
464 } 466 }
465} 467}
466 468
467void QIMPenInput::help() 469void QIMPenInput::help()
468{ 470{
469 if ( helpDlg ) 471 if ( helpDlg )
470 delete (HandwritingHelp*) helpDlg; 472 delete (HandwritingHelp*) helpDlg;
471 helpDlg = new HandwritingHelp( profile, 0, 0, WDestructiveClose ); 473 helpDlg = new HandwritingHelp( profile, 0, 0, WDestructiveClose );
472 helpDlg->showMaximized(); 474 helpDlg->showMaximized();
473 helpDlg->show(); 475 helpDlg->show();
474 helpDlg->raise(); 476 helpDlg->raise();