summaryrefslogtreecommitdiff
path: root/inputmethods
Unidiff
Diffstat (limited to 'inputmethods') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/configdlg.cpp31
-rw-r--r--inputmethods/multikey/configdlg.h3
-rw-r--r--inputmethods/multikey/keyboard.cpp39
-rw-r--r--inputmethods/multikey/keyboard.h2
4 files changed, 57 insertions, 18 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp
index 59a290b..566b2b9 100644
--- a/inputmethods/multikey/configdlg.cpp
+++ b/inputmethods/multikey/configdlg.cpp
@@ -110,20 +110,32 @@ ConfigDlg::ConfigDlg () : QTabWidget ()
110 if ((int)map_dir.count() >= keymaps->currentItem()) 110 if ((int)map_dir.count() >= keymaps->currentItem())
111 remove_button->setDisabled(true); 111 remove_button->setDisabled(true);
112 connect(remove_button, SIGNAL(clicked()), SLOT(removeMap())); 112 connect(remove_button, SIGNAL(clicked()), SLOT(removeMap()));
113 113
114 pick_button = new QCheckBox(tr("Pickboard"), gen_box); 114 // make a box that will contain the buttons on the bottom
115 QGrid *other_grid = new QGrid(2, gen_box);
116 pick_button = new QCheckBox(tr("Pickboard"), other_grid);
115 117
116 config.setGroup ("pickboard"); 118 config.setGroup ("general");
117 bool pick_open = config.readBoolEntry ("open", "0"); // default closed 119 bool pick_open = config.readBoolEntry ("usePickboard", (bool)0); // default closed
118 if (pick_open) { 120 if (pick_open) {
119 121
120 pick_button->setChecked(true); 122 pick_button->setChecked(true);
121 } 123 }
122 124
123 // by connecting it after checking it, the signal isn't emmited 125 // by connecting it after checking it, the signal isn't emmited
124 connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog())); 126 connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog()));
125 127
128 repeat_button = new QCheckBox(tr("Key Repeat"), other_grid);
129 bool repeat_on = config.readBoolEntry ("useRepeat", (bool)1);
130
131 if (repeat_on) {
132
133 repeat_button->setChecked(true);
134 }
135 connect (repeat_button, SIGNAL(clicked()), this, SLOT(repeatTog()));
136
137
126 /* 138 /*
127 * 'color' tab 139 * 'color' tab
128 */ 140 */
129 141
@@ -168,14 +180,23 @@ ConfigDlg::ConfigDlg () : QTabWidget ()
168 180
169void ConfigDlg::pickTog() { 181void ConfigDlg::pickTog() {
170 182
171 Config config ("multikey"); 183 Config config ("multikey");
172 config.setGroup ("pickboard"); 184 config.setGroup ("general");
173 config.writeEntry ("open", pick_button->isChecked()); // default closed 185 config.writeEntry ("usePickboard", pick_button->isChecked()); // default closed
174 186
175 emit pickboardToggled(pick_button->isChecked()); 187 emit pickboardToggled(pick_button->isChecked());
176} 188}
177 189
190void ConfigDlg::repeatTog() {
191
192 Config config ("multikey");
193 config.setGroup ("general");
194 config.writeEntry ("useRepeat", repeat_button->isChecked()); // default closed
195
196 emit repeatToggled(repeat_button->isChecked());
197}
198
178/* 199/*
179 * the index is kinda screwy, because in the config file, index 0 is just the 200 * the index is kinda screwy, because in the config file, index 0 is just the
180 * first element in the QStringList, but here it's the "Current Language" 201 * first element in the QStringList, but here it's the "Current Language"
181 * listItem. therefor you have to minus one to the index before you access it. 202 * listItem. therefor you have to minus one to the index before you access it.
diff --git a/inputmethods/multikey/configdlg.h b/inputmethods/multikey/configdlg.h
index ae7afe2..a000e60 100644
--- a/inputmethods/multikey/configdlg.h
+++ b/inputmethods/multikey/configdlg.h
@@ -15,14 +15,16 @@ public:
15 ConfigDlg (); 15 ConfigDlg ();
16 16
17signals: 17signals:
18 void pickboardToggled(bool on_off); 18 void pickboardToggled(bool on_off);
19 void repeatToggled(bool on_off);
19 void setMapToDefault(); 20 void setMapToDefault();
20 void setMapToFile(QString map); 21 void setMapToFile(QString map);
21 void reloadKeyboard(); 22 void reloadKeyboard();
22 23
23private slots: 24private slots:
24 void pickTog(); 25 void pickTog();
26 void repeatTog();
25 void setMap(int index); 27 void setMap(int index);
26 void addMap(); 28 void addMap();
27 void removeMap(); 29 void removeMap();
28 30
@@ -30,8 +32,9 @@ private slots:
30 void keyColorButtonClicked(); 32 void keyColorButtonClicked();
31 33
32private: 34private:
33 QCheckBox *pick_button; 35 QCheckBox *pick_button;
36 QCheckBox *repeat_button;
34 QListBox *keymaps; 37 QListBox *keymaps;
35 QPushButton *add_button; 38 QPushButton *add_button;
36 QPushButton *remove_button; 39 QPushButton *remove_button;
37 40
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
@@ -38,14 +38,12 @@
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{
@@ -56,12 +54,14 @@ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
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 ) );
@@ -283,14 +283,16 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
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();
@@ -394,18 +396,19 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
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();
@@ -424,26 +427,30 @@ void Keyboard::mouseReleaseEvent(QMouseEvent*)
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{
@@ -502,8 +509,14 @@ void Keyboard::togglePickboard(bool on_off)
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
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h
index 6e577ab..dc50e55 100644
--- a/inputmethods/multikey/keyboard.h
+++ b/inputmethods/multikey/keyboard.h
@@ -111,8 +111,9 @@ signals:
111 111
112private slots: 112private slots:
113 void repeat(); 113 void repeat();
114 void togglePickboard(bool on_off); 114 void togglePickboard(bool on_off);
115 void toggleRepeat(bool on_off);
115 void setMapToDefault(); 116 void setMapToDefault();
116 void setMapToFile(QString map); 117 void setMapToFile(QString map);
117 118
118 // used to redraw keyboard after edited colors 119 // used to redraw keyboard after edited colors
@@ -127,8 +128,9 @@ private:
127 bool *ctrl; 128 bool *ctrl;
128 bool *alt; 129 bool *alt;
129 uint useLargeKeys:1; 130 uint useLargeKeys:1;
130 uint usePicks:1; 131 uint usePicks:1;
132 uint useRepeat:1;
131 133
132 int pressedKeyRow; 134 int pressedKeyRow;
133 int pressedKeyCol; 135 int pressedKeyCol;
134 136