summaryrefslogtreecommitdiff
path: root/inputmethods
authorhash <hash>2002-08-22 06:47:27 (UTC)
committer hash <hash>2002-08-22 06:47:27 (UTC)
commit4ed706f6a327e06403e1def058b7290dcde3e634 (patch) (unidiff)
treeb31268a6673791d4163712d83592750345a1c672 /inputmethods
parentee8b169221775d527fdf76947503e870dfef63aa (diff)
downloadopie-4ed706f6a327e06403e1def058b7290dcde3e634.zip
opie-4ed706f6a327e06403e1def058b7290dcde3e634.tar.gz
opie-4ed706f6a327e06403e1def058b7290dcde3e634.tar.bz2
comments behind shift and meta key map definitions wasnt working...
Diffstat (limited to 'inputmethods') (more/less context) (show whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index 74c99c7..1c17172 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -1000,96 +1000,99 @@ ushort Keyboard::constoe(const ushort c) {
1000 1000
1001Keys::Keys() { 1001Keys::Keys() {
1002 1002
1003 Config *config = new Config ("multikey"); 1003 Config *config = new Config ("multikey");
1004 config->setGroup( "keymaps" ); 1004 config->setGroup( "keymaps" );
1005 QString map = config->readEntry( "current" ); 1005 QString map = config->readEntry( "current" );
1006 delete config; 1006 delete config;
1007 1007
1008 if (map.isNull() || !(QFile(map).exists())) { 1008 if (map.isNull() || !(QFile(map).exists())) {
1009 1009
1010 Config *config = new Config("locale"); 1010 Config *config = new Config("locale");
1011 config->setGroup( "Language" ); 1011 config->setGroup( "Language" );
1012 QString l = config->readEntry( "Language" , "en" ); 1012 QString l = config->readEntry( "Language" , "en" );
1013 delete config; 1013 delete config;
1014 1014
1015 map = QPEApplication::qpeDir() + "/share/multikey/" 1015 map = QPEApplication::qpeDir() + "/share/multikey/"
1016 + l + ".keymap"; 1016 + l + ".keymap";
1017 1017
1018 } 1018 }
1019 1019
1020 setKeysFromFile(map); 1020 setKeysFromFile(map);
1021} 1021}
1022 1022
1023Keys::Keys(const char * filename) { 1023Keys::Keys(const char * filename) {
1024 1024
1025 setKeysFromFile(filename); 1025 setKeysFromFile(filename);
1026} 1026}
1027 1027
1028// Keys::setKeysFromFile {{{2 1028// Keys::setKeysFromFile {{{2
1029void Keys::setKeysFromFile(const char * filename) { 1029void Keys::setKeysFromFile(const char * filename) {
1030 1030
1031 QFile f(filename); 1031 QFile f(filename);
1032 1032
1033 if (f.open(IO_ReadOnly)) { 1033 if (f.open(IO_ReadOnly)) {
1034 1034
1035 QTextStream t(&f); 1035 QTextStream t(&f);
1036 int row; 1036 int row;
1037 int qcode; 1037 int qcode;
1038 ushort unicode; 1038 ushort unicode;
1039 int width; 1039 int width;
1040 QString buf; 1040 QString buf;
1041 QString comment; 1041 QString comment;
1042 char * xpm[256]; //couldnt be larger than that... could it? 1042 char * xpm[256]; //couldnt be larger than that... could it?
1043 QPixmap *xpm2pix = 0; 1043 QPixmap *xpm2pix = 0;
1044 1044
1045 buf = t.readLine(); 1045 buf = t.readLine();
1046 while (buf) { 1046 while (buf) {
1047 1047
1048 // get rid of comments
1049 buf.replace(QRegExp("#.*$", FALSE, FALSE), "");
1050
1048 // key definition 1051 // key definition
1049 if (buf.contains(QRegExp("^\\d+\\s+[0-1a-fx]+", FALSE, FALSE))) { 1052 if (buf.contains(QRegExp("^\\d+\\s+[0-1a-fx]+", FALSE, FALSE))) {
1050 // no $1 type referencing!!! this implementation of regexp sucks 1053 // no $1 type referencing!!! this implementation of regexp sucks
1051 1054
1052 // dont know of any sscanf() type funcs in Qt lib 1055 // dont know of any sscanf() type funcs in Qt lib
1053 QTextStream tmp (buf, IO_ReadOnly); 1056 QTextStream tmp (buf, IO_ReadOnly);
1054 tmp >> row >> qcode >> unicode >> width >> comment; 1057 tmp >> row >> qcode >> unicode >> width >> comment;
1055 1058
1056 buf = t.readLine(); 1059 buf = t.readLine();
1057 int xpmLineCount = 0; 1060 int xpmLineCount = 0;
1058 xpm2pix = 0; 1061 xpm2pix = 0;
1059 1062
1060 // erase blank space 1063 // erase blank space
1061 while (buf.contains(QRegExp("^\\s*$")) && buf) buf = t.readLine(); 1064 while (buf.contains(QRegExp("^\\s*$")) && buf) buf = t.readLine();
1062 1065
1063 while (buf.contains(QRegExp("^\\s*\".*\""))) { 1066 while (buf.contains(QRegExp("^\\s*\".*\""))) {
1064 1067
1065 QString xpmBuf = buf.stripWhiteSpace(); 1068 QString xpmBuf = buf.stripWhiteSpace();
1066 1069
1067 xpm[xpmLineCount] = new char [xpmBuf.length()]; 1070 xpm[xpmLineCount] = new char [xpmBuf.length()];
1068 1071
1069 int j = 0; 1072 int j = 0;
1070 for (ushort i = 0; i < xpmBuf.length(); i++) { 1073 for (ushort i = 0; i < xpmBuf.length(); i++) {
1071 if (xpmBuf[i].latin1() != '"') { 1074 if (xpmBuf[i].latin1() != '"') {
1072 1075
1073 ((char *)xpm[xpmLineCount])[j] = xpmBuf.at(i).latin1(); 1076 ((char *)xpm[xpmLineCount])[j] = xpmBuf.at(i).latin1();
1074 j++; 1077 j++;
1075 } 1078 }
1076 1079
1077 } 1080 }
1078 // have to close that facker up 1081 // have to close that facker up
1079 ((char *)xpm[xpmLineCount])[j] = '\0'; 1082 ((char *)xpm[xpmLineCount])[j] = '\0';
1080 1083
1081 xpmLineCount++; 1084 xpmLineCount++;
1082 buf = t.readLine(); 1085 buf = t.readLine();
1083 } 1086 }
1084 if (xpmLineCount) { 1087 if (xpmLineCount) {
1085 1088
1086 xpm2pix = new QPixmap((const char **)xpm); 1089 xpm2pix = new QPixmap((const char **)xpm);
1087 for (int i = 0; i < xpmLineCount; i++) 1090 for (int i = 0; i < xpmLineCount; i++)
1088 1091
1089 delete [] (xpm[i]); 1092 delete [] (xpm[i]);
1090 1093
1091 } 1094 }
1092 setKey(row, qcode, unicode, width, xpm2pix); 1095 setKey(row, qcode, unicode, width, xpm2pix);
1093 } 1096 }
1094 1097
1095 // shift map 1098 // shift map