summaryrefslogtreecommitdiff
path: root/inputmethods
authorhash <hash>2002-08-12 07:55:58 (UTC)
committer hash <hash>2002-08-12 07:55:58 (UTC)
commit1e045c5b7b5278b4a5925ba878cbdbdea9d03e1d (patch) (unidiff)
tree9687a824bde2de00bd1b42c34988acd778660b9a /inputmethods
parent895a6e1cebade986110758c57cafdadd942a63ff (diff)
downloadopie-1e045c5b7b5278b4a5925ba878cbdbdea9d03e1d.zip
opie-1e045c5b7b5278b4a5925ba878cbdbdea9d03e1d.tar.gz
opie-1e045c5b7b5278b4a5925ba878cbdbdea9d03e1d.tar.bz2
uses langauge setting to choose keymap
Diffstat (limited to 'inputmethods') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index d0cfa51..8f4d562 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -33,66 +33,65 @@
33#include <qtextstream.h> 33#include <qtextstream.h>
34 34
35#include <sys/utsname.h> 35#include <sys/utsname.h>
36 36
37 37
38#define USE_SMALL_BACKSPACE 38#define USE_SMALL_BACKSPACE
39 39
40/* Keyboard::Keyboard {{{1 */ 40/* Keyboard::Keyboard {{{1 */
41Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : 41Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
42 QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), 42 QFrame(parent, _name, f), shift(0), lock(0), ctrl(0),
43 alt(0), useLargeKeys(TRUE), usePicks(0), pressedKeyRow(-1), pressedKeyCol(-1), 43 alt(0), useLargeKeys(TRUE), usePicks(0), pressedKeyRow(-1), pressedKeyCol(-1),
44 unicode(-1), qkeycode(0), modifiers(0), LANG("ko"), schar(0), mchar(0), echar(0) 44 unicode(-1), qkeycode(0), modifiers(0), LANG("ko"), schar(0), mchar(0), echar(0)
45{ 45{
46 // get the default font 46 // get the default font
47 Config qpeConfig( "qpe" ); 47 Config qpeConfig( "qpe" );
48 qpeConfig.setGroup( "Appearance" ); 48 qpeConfig.setGroup( "Appearance" );
49 QString familyStr = qpeConfig.readEntry( "FontFamily", "fixed" ); 49 QString familyStr = qpeConfig.readEntry( "FontFamily", "fixed" );
50 50
51 setFont( QFont( familyStr, 8 ) ); 51 setFont( QFont( familyStr, 8 ) );
52 52
53 picks = new KeyboardPicks( this ); 53 picks = new KeyboardPicks( this );
54 picks->setFont( QFont( familyStr, 8 ) ); 54 picks->setFont( QFont( familyStr, 8 ) );
55 picks->initialise(); 55 picks->initialise();
56 if (usePicks) { 56 if (usePicks) {
57 57
58 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 58 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
59 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 59 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
60 60
61 } else picks->hide(); 61 } else picks->hide();
62 62
63 Config config("locale"); 63 Config config("locale");
64 config.setGroup( "Language" ); 64 config.setGroup( "Language" );
65 //LANG = config.readEntry( "Language", "en" ); 65 LANG = config.readEntry( "Language", "en" );
66 LANG = "ko";
67 66
68 repeatTimer = new QTimer( this ); 67 repeatTimer = new QTimer( this );
69 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); 68 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) );
70 69
71} 70}
72 71
73/* Keyboard::resizeEvent {{{1 */ 72/* Keyboard::resizeEvent {{{1 */
74void Keyboard::resizeEvent(QResizeEvent*) 73void Keyboard::resizeEvent(QResizeEvent*)
75{ 74{
76 int ph = picks->sizeHint().height(); 75 int ph = picks->sizeHint().height();
77 picks->setGeometry( 0, 0, width(), ph ); 76 picks->setGeometry( 0, 0, width(), ph );
78 keyHeight = (height()-(usePicks ? ph : 0))/5; 77 keyHeight = (height()-(usePicks ? ph : 0))/5;
79 78
80 int nk; // number of keys? 79 int nk; // number of keys?
81 if ( useLargeKeys ) { 80 if ( useLargeKeys ) {
82 nk = 15; 81 nk = 15;
83 } else { 82 } else {
84 nk = 19; 83 nk = 19;
85 } 84 }
86 defaultKeyWidth = (width()/nk)/2; 85 defaultKeyWidth = (width()/nk)/2;
87 xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? 86 xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces?
88 87
89} 88}
90 89
91/* KeyboardPicks::initialize {{{1 */ 90/* KeyboardPicks::initialize {{{1 */
92void KeyboardPicks::initialise() 91void KeyboardPicks::initialise()
93{ 92{
94 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); 93 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
95 mode = 0; 94 mode = 0;
96 dc = new KeyboardConfig(this); 95 dc = new KeyboardConfig(this);
97 configs.append(dc); 96 configs.append(dc);
98} 97}
@@ -745,66 +744,65 @@ ushort Keyboard::constoe(const ushort c) {
745 case 0x11a9: return 0x1101; 744 case 0x11a9: return 0x1101;
746 case 0x11ab: return 0x1102; 745 case 0x11ab: return 0x1102;
747 case 0x11ae: return 0x1103; 746 case 0x11ae: return 0x1103;
748 case 0x11af: return 0x1105; 747 case 0x11af: return 0x1105;
749 case 0x11b7: return 0x1106; 748 case 0x11b7: return 0x1106;
750 case 0x11b8: return 0x1107; 749 case 0x11b8: return 0x1107;
751 case 0x11ba: return 0x1109; 750 case 0x11ba: return 0x1109;
752 case 0x11bb: return 0x110a; 751 case 0x11bb: return 0x110a;
753 case 0x11bc: return 0x110b; 752 case 0x11bc: return 0x110b;
754 case 0x11bd: return 0x110c; 753 case 0x11bd: return 0x110c;
755 case 0x11be: return 0x110e; 754 case 0x11be: return 0x110e;
756 case 0x11bf: return 0x110f; 755 case 0x11bf: return 0x110f;
757 case 0x11c0: return 0x1110; 756 case 0x11c0: return 0x1110;
758 case 0x11c1: return 0x1111; 757 case 0x11c1: return 0x1111;
759 case 0x11c2: return 0x1112; 758 case 0x11c2: return 0x1112;
760 default: return 0; 759 default: return 0;
761 760
762 } 761 }
763 762
764 } 763 }
765} 764}
766 765
767 766
768// Keys::Keys {{{1 767// Keys::Keys {{{1
769 768
770Keys::Keys() { 769Keys::Keys() {
771 770
772 Config config("locale"); 771 Config config("locale");
773 config.setGroup( "Language" ); 772 config.setGroup( "Language" );
774 QString l = config.readEntry( "Language" , "en" ); 773 QString l = config.readEntry( "Language" , "en" );
775 774
776 QString key_map = QPEApplication::qpeDir() + "/share/multikey/" 775 QString key_map = QPEApplication::qpeDir() + "/share/multikey/"
777 + /* l // testing korean for now */ 776 + l + ".keymap";
778 + "ko.keymap";
779 777
780 setKeysFromFile(key_map); 778 setKeysFromFile(key_map);
781} 779}
782 780
783Keys::Keys(const char * filename) { 781Keys::Keys(const char * filename) {
784 782
785 setKeysFromFile(filename); 783 setKeysFromFile(filename);
786} 784}
787 785
788// Keys::setKeysFromFile {{{2 786// Keys::setKeysFromFile {{{2
789void Keys::setKeysFromFile(const char * filename) { 787void Keys::setKeysFromFile(const char * filename) {
790 788
791 QFile f(filename); 789 QFile f(filename);
792 790
793 if (f.open(IO_ReadOnly)) { 791 if (f.open(IO_ReadOnly)) {
794 792
795 QTextStream t(&f); 793 QTextStream t(&f);
796 int row; 794 int row;
797 int qcode; 795 int qcode;
798 ushort unicode; 796 ushort unicode;
799 int width; 797 int width;
800 QString buf; 798 QString buf;
801 QString comment; 799 QString comment;
802 char * xpm[256]; //couldnt be larger than that... could it? 800 char * xpm[256]; //couldnt be larger than that... could it?
803 QPixmap *xpm2pix = 0; 801 QPixmap *xpm2pix = 0;
804 802
805 buf = t.readLine(); 803 buf = t.readLine();
806 while (buf) { 804 while (buf) {
807 805
808 if (buf.contains(QRegExp("^\\d+\\s+[0-1a-fx]+", FALSE, FALSE))) { 806 if (buf.contains(QRegExp("^\\d+\\s+[0-1a-fx]+", FALSE, FALSE))) {
809 // no $1 type referencing!!! this implementation of regexp sucks 807 // no $1 type referencing!!! this implementation of regexp sucks
810 808