summaryrefslogtreecommitdiff
path: root/inputmethods/multikey/keyboard.cpp
Unidiff
Diffstat (limited to 'inputmethods/multikey/keyboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp39
1 files changed, 26 insertions, 13 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index 8280297..7334c1c 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -36,34 +36,34 @@
36#include <qstringlist.h> 36#include <qstringlist.h>
37#include <iostream.h> 37#include <iostream.h>
38 38
39#include <sys/utsname.h> 39#include <sys/utsname.h>
40 40
41 41
42#define USE_SMALL_BACKSPACE
43
44/* Keyboard::Keyboard {{{1 */ 42/* Keyboard::Keyboard {{{1 */
45Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : 43Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
46 QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), 44 QFrame(parent, _name, f), shift(0), lock(0), ctrl(0),
47 alt(0), useLargeKeys(TRUE), usePicks(0), pressedKeyRow(-1), pressedKeyCol(-1), 45 alt(0), useLargeKeys(TRUE), usePicks(0), useRepeat(0), pressedKeyRow(-1), pressedKeyCol(-1),
48 unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), 46 unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0),
49 configdlg(0) 47 configdlg(0)
50 48
51{ 49{
52 50
53 // get the default font 51 // get the default font
54 Config *config = new Config( "qpe" ); 52 Config *config = new Config( "qpe" );
55 config->setGroup( "Appearance" ); 53 config->setGroup( "Appearance" );
56 QString familyStr = config->readEntry( "FontFamily", "fixed" ); 54 QString familyStr = config->readEntry( "FontFamily", "fixed" );
57 delete config; 55 delete config;
58 56
59 config = new Config("multikey"); 57 config = new Config("multikey");
60 config->setGroup ("pickboard"); 58 config->setGroup ("general");
61 usePicks = config->readBoolEntry ("open", "0"); // default closed 59 usePicks = config->readBoolEntry ("usePickboard", "0"); // default closed
60 useRepeat = config->readBoolEntry ("useRepeat", "1");
62 delete config; 61 delete config;
63 62
63
64 setFont( QFont( familyStr, 10 ) ); 64 setFont( QFont( familyStr, 10 ) );
65 65
66 picks = new KeyboardPicks( this ); 66 picks = new KeyboardPicks( this );
67 picks->setFont( QFont( familyStr, 10 ) ); 67 picks->setFont( QFont( familyStr, 10 ) );
68 picks->initialise(); 68 picks->initialise();
69 if (usePicks) { 69 if (usePicks) {
@@ -281,18 +281,20 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
281 if ( configdlg ) { 281 if ( configdlg ) {
282 delete (ConfigDlg *) configdlg; 282 delete (ConfigDlg *) configdlg;
283 configdlg = 0; 283 configdlg = 0;
284 } 284 }
285 else { 285 else {
286 configdlg = new ConfigDlg (); 286 configdlg = new ConfigDlg ();
287 connect(configdlg, SIGNAL(pickboardToggled(bool)),
288 this, SLOT(togglePickboard(bool)));
289 connect(configdlg, SIGNAL(setMapToDefault()), 287 connect(configdlg, SIGNAL(setMapToDefault()),
290 this, SLOT(setMapToDefault())); 288 this, SLOT(setMapToDefault()));
291 connect(configdlg, SIGNAL(setMapToFile(QString)), 289 connect(configdlg, SIGNAL(setMapToFile(QString)),
292 this, SLOT(setMapToFile(QString))); 290 this, SLOT(setMapToFile(QString)));
291 connect(configdlg, SIGNAL(pickboardToggled(bool)),
292 this, SLOT(togglePickboard(bool)));
293 connect(configdlg, SIGNAL(repeatToggled(bool)),
294 this, SLOT(toggleRepeat(bool)));
293 connect(configdlg, SIGNAL(reloadKeyboard()), 295 connect(configdlg, SIGNAL(reloadKeyboard()),
294 this, SLOT(reloadKeyboard())); 296 this, SLOT(reloadKeyboard()));
295 configdlg->showMaximized(); 297 configdlg->showMaximized();
296 configdlg->show(); 298 configdlg->show();
297 configdlg->raise(); 299 configdlg->raise();
298 } 300 }
@@ -392,22 +394,23 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
392 394
393 QPainter p(this); 395 QPainter p(this);
394 drawKeyboard(p, row, col); 396 drawKeyboard(p, row, col);
395 397
396 } 398 }
397 399
398 pressTid = startTimer(80); 400 if (useRepeat) repeatTimer->start( 800 );
401 //pressTid = startTimer(80);
399 402
400} 403}
401 404
402 405
403/* Keyboard::mouseReleaseEvent {{{1 */ 406/* Keyboard::mouseReleaseEvent {{{1 */
404void Keyboard::mouseReleaseEvent(QMouseEvent*) 407void Keyboard::mouseReleaseEvent(QMouseEvent*)
405{ 408{
406 pressed = FALSE; 409 pressed = FALSE;
407 if ( pressTid == 0 ) 410 //if ( pressTid == 0 )
408#if defined(Q_WS_QWS) || defined(_WS_QWS_) 411#if defined(Q_WS_QWS) || defined(_WS_QWS_)
409 if ( unicode != -1 ) { 412 if ( unicode != -1 ) {
410 emit key( unicode, qkeycode, modifiers, false, false ); 413 emit key( unicode, qkeycode, modifiers, false, false );
411 repeatTimer->stop(); 414 repeatTimer->stop();
412 } 415 }
413#endif 416#endif
@@ -422,30 +425,34 @@ void Keyboard::mouseReleaseEvent(QMouseEvent*)
422 else 425 else
423 426
424 clearHighlight(); 427 clearHighlight();
425} 428}
426 429
427/* Keyboard::timerEvent {{{1 */ 430/* Keyboard::timerEvent {{{1 */
428/* 431
429void Keyboard::timerEvent(QTimerEvent* e) 432/* dont know what this does, but i think it is here so that if your screen
433 * sticks (like on an ipaq) then it will stop repeating if you click another
434 * key... but who knows what anything does in this thing anyway?
435
436 void Keyboard::timerEvent(QTimerEvent* e)
430{ 437{
431 if ( e->timerId() == pressTid ) { 438 if ( e->timerId() == pressTid ) {
432 killTimer(pressTid); 439 killTimer(pressTid);
433 pressTid = 0; 440 pressTid = 0;
434 if ( !pressed ) 441 if ( !pressed )
435 cout << "calling clearHighlight from timerEvent\n"; 442 cout << "calling clearHighlight from timerEvent\n";
436 clearHighlight(); 443 //clearHighlight();
437 } 444 }
438} 445}
439*/ 446*/
440 447
441void Keyboard::repeat() 448void Keyboard::repeat()
442{ 449{
443 450
444 repeatTimer->start( 200 ); 451 repeatTimer->start( 200 );
445 emit key( unicode, 0, modifiers, true, true ); 452 emit key( unicode, qkeycode, modifiers, true, true );
446} 453}
447 454
448void Keyboard::clearHighlight() 455void Keyboard::clearHighlight()
449{ 456{
450 if ( pressedKeyRow >= 0 && pressedKeyCol >= 0) { 457 if ( pressedKeyRow >= 0 && pressedKeyCol >= 0) {
451 int tmpRow = pressedKeyRow; 458 int tmpRow = pressedKeyRow;
@@ -500,12 +507,18 @@ void Keyboard::togglePickboard(bool on_off)
500 * this closes && opens the input method 507 * this closes && opens the input method
501 */ 508 */
502 QCopChannel::send ("QPE/TaskBar", "hideInputMethod()"); 509 QCopChannel::send ("QPE/TaskBar", "hideInputMethod()");
503 QCopChannel::send ("QPE/TaskBar", "showInputMethod()"); 510 QCopChannel::send ("QPE/TaskBar", "showInputMethod()");
504} 511}
505 512
513void Keyboard::toggleRepeat(bool on) {
514
515 useRepeat = on;
516 cout << "setting useRepeat to: " << useRepeat << "\n";
517}
518
506/* Keyboard::setMapTo ... {{{1 */ 519/* Keyboard::setMapTo ... {{{1 */
507void Keyboard::setMapToDefault() { 520void Keyboard::setMapToDefault() {
508 521
509 522
510 /* load current locale language map */ 523 /* load current locale language map */
511 Config *config = new Config("locale"); 524 Config *config = new Config("locale");