-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 2 | ||||
-rw-r--r-- | inputmethods/multikey/keyboard.h | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp index a6e4dad..ac132d3 100644 --- a/inputmethods/multikey/configdlg.cpp +++ b/inputmethods/multikey/configdlg.cpp | |||
@@ -155,48 +155,50 @@ void ConfigDlg::pickTog() { | |||
155 | config.writeEntry ("open", pick_button->isChecked()); // default closed | 155 | config.writeEntry ("open", pick_button->isChecked()); // default closed |
156 | 156 | ||
157 | emit pickboardToggled(pick_button->isChecked()); | 157 | emit pickboardToggled(pick_button->isChecked()); |
158 | } | 158 | } |
159 | 159 | ||
160 | /* | 160 | /* |
161 | * the index is kinda screwy, because in the config file, index 0 is just the | 161 | * the index is kinda screwy, because in the config file, index 0 is just the |
162 | * first element in the QStringList, but here it's the "Current Language" | 162 | * first element in the QStringList, but here it's the "Current Language" |
163 | * listItem. therefor you have to minus one to the index before you access it. | 163 | * listItem. therefor you have to minus one to the index before you access it. |
164 | * | 164 | * |
165 | */ | 165 | */ |
166 | 166 | ||
167 | void ConfigDlg::setMap(int index) { | 167 | void ConfigDlg::setMap(int index) { |
168 | 168 | ||
169 | if (index == 0) { | 169 | if (index == 0) { |
170 | 170 | ||
171 | remove_button->setDisabled(true); | 171 | remove_button->setDisabled(true); |
172 | 172 | ||
173 | emit setMapToDefault(); | 173 | emit setMapToDefault(); |
174 | } | 174 | } |
175 | else if ((uint)index <= default_maps.count()) { | 175 | else if ((uint)index <= default_maps.count()) { |
176 | 176 | ||
177 | remove_button->setDisabled(true); | 177 | remove_button->setDisabled(true); |
178 | 178 | ||
179 | emit setMapToFile(keymaps->text(index)); | ||
180 | |||
179 | } else { | 181 | } else { |
180 | 182 | ||
181 | remove_button->setEnabled(true); | 183 | remove_button->setEnabled(true); |
182 | 184 | ||
183 | emit setMapToFile(keymaps->text(index)); | 185 | emit setMapToFile(keymaps->text(index)); |
184 | } | 186 | } |
185 | } | 187 | } |
186 | 188 | ||
187 | void ConfigDlg::addMap() { | 189 | void ConfigDlg::addMap() { |
188 | 190 | ||
189 | QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); | 191 | QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); |
190 | Config config ("multikey"); | 192 | Config config ("multikey"); |
191 | config.setGroup("keymaps"); | 193 | config.setGroup("keymaps"); |
192 | QStringList maps = config.readListEntry("maps", QChar('|')); | 194 | QStringList maps = config.readListEntry("maps", QChar('|')); |
193 | maps.append(map); | 195 | maps.append(map); |
194 | keymaps->insertItem(map); | 196 | keymaps->insertItem(map); |
195 | keymaps->setSelected(keymaps->count() - 1, true); | 197 | keymaps->setSelected(keymaps->count() - 1, true); |
196 | 198 | ||
197 | 199 | ||
198 | config.writeEntry("maps", maps.join("|")); | 200 | config.writeEntry("maps", maps.join("|")); |
199 | config.writeEntry("current", map); | 201 | config.writeEntry("current", map); |
200 | 202 | ||
201 | } | 203 | } |
202 | 204 | ||
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h index 805f0ed..8c4e666 100644 --- a/inputmethods/multikey/keyboard.h +++ b/inputmethods/multikey/keyboard.h | |||
@@ -48,49 +48,49 @@ public: | |||
48 | virtual QSize sizeHint() const; | 48 | virtual QSize sizeHint() const; |
49 | KeyboardConfig *dc; | 49 | KeyboardConfig *dc; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | 52 | ||
53 | class Keys { | 53 | class Keys { |
54 | public: | 54 | public: |
55 | 55 | ||
56 | Keys(); | 56 | Keys(); |
57 | Keys(const char * filename); | 57 | Keys(const char * filename); |
58 | ~Keys(); | 58 | ~Keys(); |
59 | ushort uni(const int row, const int col); | 59 | ushort uni(const int row, const int col); |
60 | int qcode(const int row, const int col); | 60 | int qcode(const int row, const int col); |
61 | int width(const int row, const int col); | 61 | int width(const int row, const int col); |
62 | bool pressed(const int row, const int col); | 62 | bool pressed(const int row, const int col); |
63 | bool *pressedPtr(const int row, const int col); | 63 | bool *pressedPtr(const int row, const int col); |
64 | ushort shift(const ushort); | 64 | ushort shift(const ushort); |
65 | QPixmap *pix(const int row, const int col); | 65 | QPixmap *pix(const int row, const int col); |
66 | int numKeys(const int row); | 66 | int numKeys(const int row); |
67 | void setKeysFromFile(const char *filename); | 67 | void setKeysFromFile(const char *filename); |
68 | void setKey(const int row, const int qcode, const ushort unicode, | 68 | void setKey(const int row, const int qcode, const ushort unicode, |
69 | const int width, QPixmap *pix); | 69 | const int width, QPixmap *pix); |
70 | void setPressed(const int row, const int col, const bool pressed); | 70 | void setPressed(const int row, const int col, const bool pressed); |
71 | QString lang; | 71 | QString lang; |
72 | QString title; | 72 | QString label; |
73 | 73 | ||
74 | private: | 74 | private: |
75 | 75 | ||
76 | typedef struct Key { | 76 | typedef struct Key { |
77 | int qcode; // are qt key codes just unicode values? | 77 | int qcode; // are qt key codes just unicode values? |
78 | ushort unicode; | 78 | ushort unicode; |
79 | int width; // not pixels but relative key width. normal key is 2 | 79 | int width; // not pixels but relative key width. normal key is 2 |
80 | 80 | ||
81 | // only needed for keys like ctrl that can have multiple keys pressed at once | 81 | // only needed for keys like ctrl that can have multiple keys pressed at once |
82 | bool *pressed; | 82 | bool *pressed; |
83 | QPixmap *pix; | 83 | QPixmap *pix; |
84 | }; | 84 | }; |
85 | 85 | ||
86 | QList<Key> keys[6]; | 86 | QList<Key> keys[6]; |
87 | QMap<ushort,ushort> shiftMap; | 87 | QMap<ushort,ushort> shiftMap; |
88 | 88 | ||
89 | }; | 89 | }; |
90 | 90 | ||
91 | class Keyboard : public QFrame | 91 | class Keyboard : public QFrame |
92 | { | 92 | { |
93 | Q_OBJECT | 93 | Q_OBJECT |
94 | public: | 94 | public: |
95 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 95 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
96 | ~Keyboard(); | 96 | ~Keyboard(); |