summaryrefslogtreecommitdiff
path: root/inputmethods/multikey
authordrw <drw>2005-06-15 22:54:50 (UTC)
committer drw <drw>2005-06-15 22:54:50 (UTC)
commit7ff2e7bd4620a574f3ff22a951a5904310cfd920 (patch) (unidiff)
tree6d8ffd28aadf00901b3ab560464794aded3efc76 /inputmethods/multikey
parente0205bac48b9d23af9feb48004c24fcf7a5e8200 (diff)
downloadopie-7ff2e7bd4620a574f3ff22a951a5904310cfd920.zip
opie-7ff2e7bd4620a574f3ff22a951a5904310cfd920.tar.gz
opie-7ff2e7bd4620a574f3ff22a951a5904310cfd920.tar.bz2
Resource -> OResource
Diffstat (limited to 'inputmethods/multikey') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/config.in2
-rw-r--r--inputmethods/multikey/configdlg.cpp13
-rw-r--r--inputmethods/multikey/multikey.pro2
-rw-r--r--inputmethods/multikey/opie-multikey.control2
4 files changed, 11 insertions, 8 deletions
diff --git a/inputmethods/multikey/config.in b/inputmethods/multikey/config.in
index 4eeb326..dd3192b 100644
--- a/inputmethods/multikey/config.in
+++ b/inputmethods/multikey/config.in
@@ -1,4 +1,4 @@
1 config MULTIKEY 1 config MULTIKEY
2 boolean "opie-multikey (OnScreen keyboard for multiple languages)" 2 boolean "opie-multikey (OnScreen keyboard for multiple languages)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && PICKBOARD && LIBQTAUX && LIBOPIE2UI 4 depends ( LIBQPE || LIBQPE-X11 ) && PICKBOARD && LIBQTAUX && LIBOPIE2CORE && LIBOPIE2UI
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp
index fe5051d..52c498b 100644
--- a/inputmethods/multikey/configdlg.cpp
+++ b/inputmethods/multikey/configdlg.cpp
@@ -1,456 +1,459 @@
1/* 1/*
2 * TODO 2 * TODO
3 * make a font selection thing (size too) 3 * make a font selection thing (size too)
4 * make a keymap editor 4 * make a keymap editor
5 * make keys translucent 5 * make keys translucent
6 * make vertical keys possible 6 * make vertical keys possible
7 * 7 *
8 * 8 *
9 */ 9 */
10 10
11#include <opie2/ofiledialog.h>
12#include <opie2/qcolordialog.h>
13#include <opie2/oresource.h>
14
11#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
12#include <qpe/config.h> 16#include <qpe/config.h>
13#include <qpe/resource.h>
14 17
15#include <qlayout.h> 18#include <qlayout.h>
16#include <qwidget.h> 19#include <qwidget.h>
17#include <qdialog.h> 20#include <qdialog.h>
18#include <qtabwidget.h> 21#include <qtabwidget.h>
19#include <qvbox.h> 22#include <qvbox.h>
20#include <qgrid.h> 23#include <qgrid.h>
21#include <qgroupbox.h> 24#include <qgroupbox.h>
22#include <qlabel.h> 25#include <qlabel.h>
23#include <qcheckbox.h> 26#include <qcheckbox.h>
24#include <qsizepolicy.h> 27#include <qsizepolicy.h>
25#include <qpushbutton.h> 28#include <qpushbutton.h>
26#include <qlistbox.h> 29#include <qlistbox.h>
27#include <qstringlist.h> 30#include <qstringlist.h>
28#include <qtoolbutton.h> 31#include <qtoolbutton.h>
29#include <opie2/ofiledialog.h>
30#include <opie2/qcolordialog.h>
31#include <qdir.h> 32#include <qdir.h>
32#include <qfileinfo.h> 33#include <qfileinfo.h>
33#include "configdlg.h" 34#include "configdlg.h"
34#include "keyboard.h" 35#include "keyboard.h"
35 36
36using namespace Opie; 37using namespace Opie;
37using namespace Opie::Ui; 38using namespace Opie::Ui;
38// ConfigDlg::ConfigDlg() {{{1 39// ConfigDlg::ConfigDlg() {{{1
39ConfigDlg::ConfigDlg () : QDialog () 40ConfigDlg::ConfigDlg () : QDialog ()
40{ 41{
41 setCaption( tr("Multikey Configuration") ); 42 setCaption( tr("Multikey Configuration") );
42 Config config ("multikey"); 43 Config config ("multikey");
43 config.setGroup("keymaps"); 44 config.setGroup("keymaps");
44 QString current_map = config.readEntry("current", 0); 45 QString current_map = config.readEntry("current", 0);
45 46
46 /* 47 /*
47 * 'general config' tab 48 * 'general config' tab
48 */ 49 */
49 50
50 QVBoxLayout *base_lay = new QVBoxLayout(this); 51 QVBoxLayout *base_lay = new QVBoxLayout(this);
51 52
52 QTabWidget *tabs = new QTabWidget(this, "tabs"); 53 QTabWidget *tabs = new QTabWidget(this, "tabs");
53 54
54 QWidget *gen_box = new QWidget(tabs, "gen_tab"); 55 QWidget *gen_box = new QWidget(tabs, "gen_tab");
55 QVBoxLayout *gen_lay = new QVBoxLayout(gen_box); 56 QVBoxLayout *gen_lay = new QVBoxLayout(gen_box);
56 gen_lay->setMargin(3); 57 gen_lay->setMargin(3);
57 QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); 58 QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box);
58 59
59 QHBox *hbox1 = new QHBox(map_group); 60 QHBox *hbox1 = new QHBox(map_group);
60 keymaps = new QListBox(hbox1); 61 keymaps = new QListBox(hbox1);
61 keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); 62 keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
62 QVBox *vbox1 = new QVBox(hbox1); 63 QVBox *vbox1 = new QVBox(hbox1);
63 64
64 QToolButton *tb1 = new QToolButton(vbox1, tr("Move Up")); 65 QToolButton *tb1 = new QToolButton(vbox1, tr("Move Up"));
65 tb1->setPixmap(Resource::loadPixmap("up")); 66 tb1->setUsesBigPixmap( qApp->desktop()->size().width() > 330 );
67 tb1->setPixmap(Opie::Core::OResource::loadPixmap("up", Opie::Core::OResource::SmallIcon));
66 tb1->setAutoRaise(TRUE); 68 tb1->setAutoRaise(TRUE);
67 tb1->setFocusPolicy(QWidget::NoFocus); 69 tb1->setFocusPolicy(QWidget::NoFocus);
68 tb1->setToggleButton(FALSE); 70 tb1->setToggleButton(FALSE);
69 connect(tb1, SIGNAL(clicked()), this, SLOT(moveSelectedUp())); 71 connect(tb1, SIGNAL(clicked()), this, SLOT(moveSelectedUp()));
70 72
71 QToolButton *tb2 = new QToolButton(vbox1, tr("Move Down")); 73 QToolButton *tb2 = new QToolButton(vbox1, tr("Move Down"));
72 tb2->setPixmap(Resource::loadPixmap("down")); 74 tb2->setUsesBigPixmap( qApp->desktop()->size().width() > 330 );
75 tb2->setPixmap(Opie::Core::OResource::loadPixmap("down", Opie::Core::OResource::SmallIcon));
73 tb2->setAutoRaise(TRUE); 76 tb2->setAutoRaise(TRUE);
74 tb2->setFocusPolicy(QWidget::NoFocus); 77 tb2->setFocusPolicy(QWidget::NoFocus);
75 tb2->setToggleButton(FALSE); 78 tb2->setToggleButton(FALSE);
76 connect(tb2, SIGNAL(clicked()), this, SLOT(moveSelectedDown())); 79 connect(tb2, SIGNAL(clicked()), this, SLOT(moveSelectedDown()));
77 80
78 QString cur(tr("Current Language")); 81 QString cur(tr("Current Language"));
79 keymaps->insertItem(cur); 82 keymaps->insertItem(cur);
80 keymaps->setSelected(0, true); 83 keymaps->setSelected(0, true);
81 84
82 QDir map_dir(QPEApplication::qpeDir() + "share/multikey", "*.keymap"); 85 QDir map_dir(QPEApplication::qpeDir() + "share/multikey", "*.keymap");
83 default_maps = map_dir.entryList(); // so i can access it in other places 86 default_maps = map_dir.entryList(); // so i can access it in other places
84 custom_maps = config.readListEntry("maps", QChar('|')); 87 custom_maps = config.readListEntry("maps", QChar('|'));
85 sw_maps = ConfigDlg::loadSw(); 88 sw_maps = ConfigDlg::loadSw();
86 89
87 QStringList sw_copy(sw_maps); 90 QStringList sw_copy(sw_maps);
88 for (uint i = 0; i < sw_copy.count(); i++) { 91 for (uint i = 0; i < sw_copy.count(); i++) {
89 92
90 QString keymap_map; 93 QString keymap_map;
91 if (sw_copy[i][0] != '/') { /* share/multikey */ 94 if (sw_copy[i][0] != '/') { /* share/multikey */
92 95
93 keymap_map = map_dir.absPath() + "/" + sw_copy[i]; 96 keymap_map = map_dir.absPath() + "/" + sw_copy[i];
94 } else { 97 } else {
95 98
96 if (map_dir.exists(QFileInfo(sw_copy[i]).fileName(), false) 99 if (map_dir.exists(QFileInfo(sw_copy[i]).fileName(), false)
97 || !QFile::exists(sw_copy[i])) { 100 || !QFile::exists(sw_copy[i])) {
98 101
99 custom_maps.remove(sw_copy[i]); 102 custom_maps.remove(sw_copy[i]);
100 sw_maps.remove(sw_copy[i]); 103 sw_maps.remove(sw_copy[i]);
101 104
102 // remove it from the list too 105 // remove it from the list too
103 config.writeEntry("maps", custom_maps.join("|")); 106 config.writeEntry("maps", custom_maps.join("|"));
104 107
105 continue; 108 continue;
106 } 109 }
107 keymap_map = sw_copy[i]; 110 keymap_map = sw_copy[i];
108 } 111 }
109 112
110 QFile map(keymap_map); 113 QFile map(keymap_map);
111 if (map.open(IO_ReadOnly)) { 114 if (map.open(IO_ReadOnly)) {
112 115
113 QString line; bool found = 0; 116 QString line; bool found = 0;
114 117
115 map.readLine(line, 1024); 118 map.readLine(line, 1024);
116 while (!map.atEnd()) { 119 while (!map.atEnd()) {
117 120
118 if (line.find(QRegExp("^title\\s*=\\s*")) != -1) { 121 if (line.find(QRegExp("^title\\s*=\\s*")) != -1) {
119 122
120 keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); 123 keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace());
121 found = 1; 124 found = 1;
122 break; 125 break;
123 } 126 }
124 map.readLine(line, 1024); 127 map.readLine(line, 1024);
125 } 128 }
126 if (!found) 129 if (!found)
127 keymaps->insertItem(keymap_map); 130 keymaps->insertItem(keymap_map);
128 131
129 map.close(); 132 map.close();
130 } 133 }
131 134
132 if (keymap_map == current_map) { 135 if (keymap_map == current_map) {
133 keymaps->setSelected(i + 1, true); 136 keymaps->setSelected(i + 1, true);
134 } 137 }
135 } 138 }
136 139
137 // have to "+1" because the "current language" listItem... remember? 140 // have to "+1" because the "current language" listItem... remember?
138 connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); 141 connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int)));
139 142
140 QGrid *add_remove_grid = new QGrid(2, map_group); 143 QGrid *add_remove_grid = new QGrid(2, map_group);
141 add_remove_grid->setMargin(3); 144 add_remove_grid->setMargin(3);
142 add_remove_grid->setSpacing(3); 145 add_remove_grid->setSpacing(3);
143 146
144 add_button = new QPushButton(tr("Add"), add_remove_grid); 147 add_button = new QPushButton(tr("Add"), add_remove_grid);
145 add_button->setFlat(TRUE); 148 add_button->setFlat(TRUE);
146 connect(add_button, SIGNAL(clicked()), SLOT(addMap())); 149 connect(add_button, SIGNAL(clicked()), SLOT(addMap()));
147 150
148 remove_button = new QPushButton(tr("Remove"), add_remove_grid); 151 remove_button = new QPushButton(tr("Remove"), add_remove_grid);
149 remove_button->setFlat(TRUE); 152 remove_button->setFlat(TRUE);
150 if (keymaps->currentItem() == 0 || default_maps.find(QFileInfo(current_map).fileName()) != default_maps.end()) 153 if (keymaps->currentItem() == 0 || default_maps.find(QFileInfo(current_map).fileName()) != default_maps.end())
151 remove_button->setDisabled(true); 154 remove_button->setDisabled(true);
152 connect(remove_button, SIGNAL(clicked()), SLOT(removeMap())); 155 connect(remove_button, SIGNAL(clicked()), SLOT(removeMap()));
153 156
154 gen_lay->addWidget(map_group); 157 gen_lay->addWidget(map_group);
155 158
156 // make a box that will contain the buttons on the bottom 159 // make a box that will contain the buttons on the bottom
157 QGrid *other_grid = new QGrid(2, gen_box); 160 QGrid *other_grid = new QGrid(2, gen_box);
158 pick_button = new QCheckBox(tr("Pickboard"), other_grid); 161 pick_button = new QCheckBox(tr("Pickboard"), other_grid);
159 162
160 config.setGroup ("general"); 163 config.setGroup ("general");
161 bool pick_open = config.readBoolEntry ("usePickboard", FALSE); // default closed 164 bool pick_open = config.readBoolEntry ("usePickboard", FALSE); // default closed
162 if (pick_open) { 165 if (pick_open) {
163 166
164 pick_button->setChecked(true); 167 pick_button->setChecked(true);
165 } 168 }
166 169
167 repeat_button = new QCheckBox(tr("Key Repeat"), other_grid); 170 repeat_button = new QCheckBox(tr("Key Repeat"), other_grid);
168 bool repeat_on = config.readBoolEntry ("useRepeat", TRUE); 171 bool repeat_on = config.readBoolEntry ("useRepeat", TRUE);
169 172
170 if (repeat_on) { 173 if (repeat_on) {
171 174
172 repeat_button->setChecked(true); 175 repeat_button->setChecked(true);
173 } 176 }
174 177
175 gen_lay->addWidget(other_grid); 178 gen_lay->addWidget(other_grid);
176 tabs->addTab(gen_box, tr("General Settings")); 179 tabs->addTab(gen_box, tr("General Settings"));
177 180
178 /* 181 /*
179 * 'color' tab 182 * 'color' tab
180 */ 183 */
181 184
182 QWidget *color_box = new QWidget(tabs, "color_tab"); 185 QWidget *color_box = new QWidget(tabs, "color_tab");
183 186
184 QGridLayout *color_lay = new QGridLayout(color_box); 187 QGridLayout *color_lay = new QGridLayout(color_box);
185 QGrid *color_grid = new QGrid(2, color_box); 188 QGrid *color_grid = new QGrid(2, color_box);
186 color_lay->setAlignment(Qt::AlignTop); 189 color_lay->setAlignment(Qt::AlignTop);
187 color_grid->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); 190 color_grid->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
188 color_grid->layout()->setAlignment(Qt::AlignTop); 191 color_grid->layout()->setAlignment(Qt::AlignTop);
189 color_grid->setMargin(3); 192 color_grid->setMargin(3);
190 color_grid->setSpacing(3); 193 color_grid->setSpacing(3);
191 194
192 QLabel *label; 195 QLabel *label;
193 QStringList color; 196 QStringList color;
194 config.setGroup("colors"); 197 config.setGroup("colors");
195 198
196 label = new QLabel(tr("Key Color"), color_grid); 199 label = new QLabel(tr("Key Color"), color_grid);
197 keycolor_button = new QPushButton(color_grid); 200 keycolor_button = new QPushButton(color_grid);
198 connect(keycolor_button, SIGNAL(clicked()), SLOT(keyColorClicked())); 201 connect(keycolor_button, SIGNAL(clicked()), SLOT(keyColorClicked()));
199 keycolor_button->setFlat(TRUE); 202 keycolor_button->setFlat(TRUE);
200 color = config.readListEntry("keycolor", QChar(',')); 203 color = config.readListEntry("keycolor", QChar(','));
201 /* 204 /*
202 * hopefully not required 205 * hopefully not required
203 206
204 if (color.isEmpty()) { 207 if (color.isEmpty()) {
205 color = QStringList::split(",", "240,240,240"); 208 color = QStringList::split(",", "240,240,240");
206 config.writeEntry("keycolor", color.join(",")); 209 config.writeEntry("keycolor", color.join(","));
207 210
208 } 211 }
209 */ 212 */
210 keycolor_button->setPalette(QPalette(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))); 213 keycolor_button->setPalette(QPalette(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())));
211 214
212 215
213 label = new QLabel(tr("Key Pressed Color"), color_grid); 216 label = new QLabel(tr("Key Pressed Color"), color_grid);
214 keycolor_pressed_button = new QPushButton(color_grid); 217 keycolor_pressed_button = new QPushButton(color_grid);
215 connect(keycolor_pressed_button, SIGNAL(clicked()), SLOT(keyColorPressedClicked())); 218 connect(keycolor_pressed_button, SIGNAL(clicked()), SLOT(keyColorPressedClicked()));
216 keycolor_pressed_button->setFlat(TRUE); 219 keycolor_pressed_button->setFlat(TRUE);
217 color = config.readListEntry("keycolor_pressed", QChar(',')); 220 color = config.readListEntry("keycolor_pressed", QChar(','));
218 keycolor_pressed_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); 221 keycolor_pressed_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))));
219 222
220 label = new QLabel(tr("Line Color"), color_grid); 223 label = new QLabel(tr("Line Color"), color_grid);
221 keycolor_lines_button = new QPushButton(color_grid); 224 keycolor_lines_button = new QPushButton(color_grid);
222 connect(keycolor_lines_button, SIGNAL(clicked()), SLOT(keyColorLinesClicked())); 225 connect(keycolor_lines_button, SIGNAL(clicked()), SLOT(keyColorLinesClicked()));
223 keycolor_lines_button->setFlat(TRUE); 226 keycolor_lines_button->setFlat(TRUE);
224 color = config.readListEntry("keycolor_lines", QChar(',')); 227 color = config.readListEntry("keycolor_lines", QChar(','));
225 keycolor_lines_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); 228 keycolor_lines_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))));
226 229
227 230
228 label = new QLabel(tr("Text Color"), color_grid); 231 label = new QLabel(tr("Text Color"), color_grid);
229 textcolor_button = new QPushButton(color_grid); 232 textcolor_button = new QPushButton(color_grid);
230 connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked())); 233 connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked()));
231 textcolor_button->setFlat(TRUE); 234 textcolor_button->setFlat(TRUE);
232 color = config.readListEntry("textcolor", QChar(',')); 235 color = config.readListEntry("textcolor", QChar(','));
233 textcolor_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); 236 textcolor_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))));
234 237
235 label = new QLabel("", color_grid); // a spacer so the above buttons dont expand 238 label = new QLabel("", color_grid); // a spacer so the above buttons dont expand
236 label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); 239 label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
237 /* FIXME: hacked spacer height */ 240 /* FIXME: hacked spacer height */
238 QSpacerItem *spacer = new QSpacerItem(0, 300, QSizePolicy::Expanding, QSizePolicy::Maximum); 241 QSpacerItem *spacer = new QSpacerItem(0, 300, QSizePolicy::Expanding, QSizePolicy::Maximum);
239 242
240 color_lay->addWidget(color_grid, 0, 0); 243 color_lay->addWidget(color_grid, 0, 0);
241 color_lay->addItem(spacer); 244 color_lay->addItem(spacer);
242 245
243 tabs->addTab(color_box, tr("Colors")); 246 tabs->addTab(color_box, tr("Colors"));
244 base_lay->addWidget(tabs); 247 base_lay->addWidget(tabs);
245} 248}
246 249
247QStringList ConfigDlg::loadSw() 250QStringList ConfigDlg::loadSw()
248{ 251{
249 Config *config = new Config("multikey"); 252 Config *config = new Config("multikey");
250 config->setGroup("keymaps"); 253 config->setGroup("keymaps");
251 QDir map_dir(QPEApplication::qpeDir() + "share/multikey", "*.keymap"); 254 QDir map_dir(QPEApplication::qpeDir() + "share/multikey", "*.keymap");
252 QStringList d_maps = map_dir.entryList(); // so i can access it in other places 255 QStringList d_maps = map_dir.entryList(); // so i can access it in other places
253 QStringList c_maps = config->readListEntry("maps", QChar('|')); 256 QStringList c_maps = config->readListEntry("maps", QChar('|'));
254 QStringList s_maps = config->readListEntry("sw", QChar('|')); 257 QStringList s_maps = config->readListEntry("sw", QChar('|'));
255 delete config; 258 delete config;
256 259
257 if (!s_maps.count()) 260 if (!s_maps.count())
258 { 261 {
259 s_maps = d_maps+c_maps; 262 s_maps = d_maps+c_maps;
260 } 263 }
261 else 264 else
262 { 265 {
263 /* Clear non existents entries */ 266 /* Clear non existents entries */
264 QStringList s_copy(s_maps); 267 QStringList s_copy(s_maps);
265 for (uint i = 0; i < s_copy.count(); ++i) { 268 for (uint i = 0; i < s_copy.count(); ++i) {
266 if (d_maps.find(s_copy[i]) == d_maps.end() 269 if (d_maps.find(s_copy[i]) == d_maps.end()
267 && c_maps.find(s_copy[i]) == c_maps.end()) { 270 && c_maps.find(s_copy[i]) == c_maps.end()) {
268 s_maps.remove(s_copy[i]); 271 s_maps.remove(s_copy[i]);
269 } 272 }
270 } 273 }
271 /* Update sw_maps from default_maps */ 274 /* Update sw_maps from default_maps */
272 for (uint i = 0; i < d_maps.count(); ++i) { 275 for (uint i = 0; i < d_maps.count(); ++i) {
273 if (s_maps.find(d_maps[i]) == s_maps.end()) { 276 if (s_maps.find(d_maps[i]) == s_maps.end()) {
274 s_maps.append(d_maps[i]); 277 s_maps.append(d_maps[i]);
275 } 278 }
276 } 279 }
277 /* Update sw_maps from custom_maps */ 280 /* Update sw_maps from custom_maps */
278 for (uint i = 0; i < c_maps.count(); ++i) { 281 for (uint i = 0; i < c_maps.count(); ++i) {
279 if (s_maps.find(c_maps[i]) == s_maps.end()) { 282 if (s_maps.find(c_maps[i]) == s_maps.end()) {
280 s_maps.append(c_maps[i]); 283 s_maps.append(c_maps[i]);
281 } 284 }
282 } 285 }
283 } 286 }
284 287
285 return s_maps; 288 return s_maps;
286} 289}
287 290
288void ConfigDlg::accept() 291void ConfigDlg::accept()
289{ 292{
290 /* Writing all stuffs to config */ 293 /* Writing all stuffs to config */
291 Config *config = new Config("multikey"); 294 Config *config = new Config("multikey");
292 config->setGroup("general"); 295 config->setGroup("general");
293 config->writeEntry("usePickboard", pick_button->isChecked()); // default closed 296 config->writeEntry("usePickboard", pick_button->isChecked()); // default closed
294 config->writeEntry("useRepeat", repeat_button->isChecked()); // default closed 297 config->writeEntry("useRepeat", repeat_button->isChecked()); // default closed
295 298
296 config->setGroup("keymaps"); 299 config->setGroup("keymaps");
297 config->writeEntry("sw", sw_maps, QChar('|')); 300 config->writeEntry("sw", sw_maps, QChar('|'));
298 config->writeEntry("maps", custom_maps, QChar('|')); 301 config->writeEntry("maps", custom_maps, QChar('|'));
299 delete config; 302 delete config;
300 303
301 int index = keymaps->currentItem(); 304 int index = keymaps->currentItem();
302 if (index == 0) { 305 if (index == 0) {
303 306
304 remove_button->setDisabled(true); 307 remove_button->setDisabled(true);
305 emit setMapToDefault(); 308 emit setMapToDefault();
306 } 309 }
307 else if (default_maps.find(sw_maps[index-1]) != default_maps.end()) { 310 else if (default_maps.find(sw_maps[index-1]) != default_maps.end()) {
308 311
309 remove_button->setDisabled(true); 312 remove_button->setDisabled(true);
310 emit setMapToFile(QPEApplication::qpeDir() + "share/multikey/" + sw_maps[index - 1]); 313 emit setMapToFile(QPEApplication::qpeDir() + "share/multikey/" + sw_maps[index - 1]);
311 314
312 } else { 315 } else {
313 316
314 remove_button->setEnabled(true); 317 remove_button->setEnabled(true);
315 emit setMapToFile(sw_maps[index - 1]); 318 emit setMapToFile(sw_maps[index - 1]);
316 } 319 }
317 320
318 emit pickboardToggled(pick_button->isChecked()); 321 emit pickboardToggled(pick_button->isChecked());
319 emit repeatToggled(repeat_button->isChecked()); 322 emit repeatToggled(repeat_button->isChecked());
320 emit reloadSw(); 323 emit reloadSw();
321 324
322 QDialog::accept(); 325 QDialog::accept();
323 emit configDlgClosed(); 326 emit configDlgClosed();
324} 327}
325 328
326void ConfigDlg::moveSelectedUp() 329void ConfigDlg::moveSelectedUp()
327{ 330{
328 int i = keymaps->currentItem(); 331 int i = keymaps->currentItem();
329 /* Ignore Current Language */ 332 /* Ignore Current Language */
330 if (i > 1) { 333 if (i > 1) {
331 QString t = sw_maps[i-1]; 334 QString t = sw_maps[i-1];
332 sw_maps[i-1] = sw_maps[i-2]; 335 sw_maps[i-1] = sw_maps[i-2];
333 sw_maps[i-2] = t; 336 sw_maps[i-2] = t;
334 337
335 QString item = keymaps->currentText(); 338 QString item = keymaps->currentText();
336 keymaps->removeItem(i); 339 keymaps->removeItem(i);
337 keymaps->insertItem(item, i-1); 340 keymaps->insertItem(item, i-1);
338 keymaps->setCurrentItem(i-1); 341 keymaps->setCurrentItem(i-1);
339 } 342 }
340} 343}
341 344
342void ConfigDlg::moveSelectedDown() 345void ConfigDlg::moveSelectedDown()
343{ 346{
344 int i = keymaps->currentItem(); 347 int i = keymaps->currentItem();
345 /* Ignore Current Language */ 348 /* Ignore Current Language */
346 if (i > 0 && i < (int)keymaps->count() - 1) { 349 if (i > 0 && i < (int)keymaps->count() - 1) {
347 QString t = sw_maps[i-1]; 350 QString t = sw_maps[i-1];
348 sw_maps[i-1] = sw_maps[i]; 351 sw_maps[i-1] = sw_maps[i];
349 sw_maps[i] = t; 352 sw_maps[i] = t;
350 353
351 QString item = keymaps->currentText(); 354 QString item = keymaps->currentText();
352 keymaps->removeItem(i); 355 keymaps->removeItem(i);
353 keymaps->insertItem(item, i+1); 356 keymaps->insertItem(item, i+1);
354 keymaps->setCurrentItem(i+1); 357 keymaps->setCurrentItem(i+1);
355 } 358 }
356} 359}
357 360
358void ConfigDlg::closeEvent(QCloseEvent *) { 361void ConfigDlg::closeEvent(QCloseEvent *) {
359 362
360 // tell the parent it was closed, so delete me 363 // tell the parent it was closed, so delete me
361 emit configDlgClosed(); 364 emit configDlgClosed();
362} 365}
363 366
364void ConfigDlg::setMap(int index) { 367void ConfigDlg::setMap(int index) {
365 368
366 if (index == 0 || default_maps.find(sw_maps[index-1]) != default_maps.end()) { 369 if (index == 0 || default_maps.find(sw_maps[index-1]) != default_maps.end()) {
367 remove_button->setDisabled(true); 370 remove_button->setDisabled(true);
368 } else { 371 } else {
369 remove_button->setEnabled(true); 372 remove_button->setEnabled(true);
370 } 373 }
371} 374}
372 375
373// ConfigDlg::addMap() {{{1 376// ConfigDlg::addMap() {{{1
374void ConfigDlg::addMap() { 377void ConfigDlg::addMap() {
375 378
376 QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); 379 QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath());
377 380
378 if (map.isNull()) return; 381 if (map.isNull()) return;
379 382
380 Config config ("multikey"); 383 Config config ("multikey");
381 config.setGroup("keymaps"); 384 config.setGroup("keymaps");
382 QStringList maps = config.readListEntry("maps", QChar('|')); 385 QStringList maps = config.readListEntry("maps", QChar('|'));
383 maps.append(map); 386 maps.append(map);
384 custom_maps.append(map); 387 custom_maps.append(map);
385 if (sw_maps.find(map) == sw_maps.end()) 388 if (sw_maps.find(map) == sw_maps.end())
386 sw_maps.append(map); 389 sw_maps.append(map);
387 390
388 QFile map_file (map); 391 QFile map_file (map);
389 if (map_file.open(IO_ReadOnly)) { 392 if (map_file.open(IO_ReadOnly)) {
390 393
391 QString line; bool found = 0; 394 QString line; bool found = 0;
392 395
393 map_file.readLine(line, 1024); 396 map_file.readLine(line, 1024);
394 while (!map_file.atEnd()) { 397 while (!map_file.atEnd()) {
395 398
396 if (line.find(QRegExp("^title\\s*=\\s*")) != -1) { 399 if (line.find(QRegExp("^title\\s*=\\s*")) != -1) {
397 400
398 keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); 401 keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace());
399 found = 1; 402 found = 1;
400 break; 403 break;
401 } 404 }
402 map_file.readLine(line, 1024); 405 map_file.readLine(line, 1024);
403 } 406 }
404 if (!found) keymaps->insertItem(map); 407 if (!found) keymaps->insertItem(map);
405 408
406 map_file.close(); 409 map_file.close();
407 } 410 }
408 411
409 keymaps->setSelected(keymaps->count() - 1, true); 412 keymaps->setSelected(keymaps->count() - 1, true);
410} 413}
411 414
412// ConfigDlg::removeMap() {{{1 415// ConfigDlg::removeMap() {{{1
413void ConfigDlg::removeMap() { 416void ConfigDlg::removeMap() {
414 417
415 // move selection up one 418 // move selection up one
416 keymaps->setSelected(keymaps->currentItem() - 1, true); 419 keymaps->setSelected(keymaps->currentItem() - 1, true);
417 // delete the next selected item cus you just moved it up 420 // delete the next selected item cus you just moved it up
418 keymaps->removeItem(keymaps->currentItem() + 1); 421 keymaps->removeItem(keymaps->currentItem() + 1);
419 422
420 custom_maps.remove(sw_maps[keymaps->currentItem()]); 423 custom_maps.remove(sw_maps[keymaps->currentItem()]);
421 sw_maps.remove(sw_maps.at(keymaps->currentItem())); 424 sw_maps.remove(sw_maps.at(keymaps->currentItem()));
422} 425}
423 426
424/* ConfigDlg::slots for the color buttons {{{1 427/* ConfigDlg::slots for the color buttons {{{1
425 * 428 *
426 * these four slots are almost the same, except for the names. i was thinking 429 * these four slots are almost the same, except for the names. i was thinking
427 * of making a map with pointers to the buttons and names of the configEntry 430 * of making a map with pointers to the buttons and names of the configEntry
428 * so it could be one slot, but then there would be no way of telling which 431 * so it could be one slot, but then there would be no way of telling which
429 * of the buttons was clicked if they all connect to the same slot. 432 * of the buttons was clicked if they all connect to the same slot.
430 * 433 *
431 */ 434 */
432 435
433void ConfigDlg::keyColorClicked() { 436void ConfigDlg::keyColorClicked() {
434 437
435 Config config ("multikey"); 438 Config config ("multikey");
436 config.setGroup ("colors"); 439 config.setGroup ("colors");
437 440
438 QStringList color = config.readListEntry("keycolor", QChar(',')); 441 QStringList color = config.readListEntry("keycolor", QChar(','));
439 442
440 QColor newcolor = QColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); 443 QColor newcolor = QColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
441 444
442 color[0].setNum(newcolor.red()); 445 color[0].setNum(newcolor.red());
443 color[1].setNum(newcolor.green()); 446 color[1].setNum(newcolor.green());
444 color[2].setNum(newcolor.blue()); 447 color[2].setNum(newcolor.blue());
445 448
446 config.writeEntry("keycolor", color, QChar(',')); 449 config.writeEntry("keycolor", color, QChar(','));
447 config.write(); 450 config.write();
448 451
449 keycolor_button->setPalette(QPalette(newcolor)); 452 keycolor_button->setPalette(QPalette(newcolor));
450 emit reloadKeyboard(); 453 emit reloadKeyboard();
451} 454}
452void ConfigDlg::keyColorPressedClicked() { 455void ConfigDlg::keyColorPressedClicked() {
453 456
454 Config config ("multikey"); 457 Config config ("multikey");
455 config.setGroup ("colors"); 458 config.setGroup ("colors");
456 459
diff --git a/inputmethods/multikey/multikey.pro b/inputmethods/multikey/multikey.pro
index 3fd621f..4ad1923 100644
--- a/inputmethods/multikey/multikey.pro
+++ b/inputmethods/multikey/multikey.pro
@@ -1,18 +1,18 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt plugin warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= keyboard.h \ 3 HEADERS= keyboard.h \
4 configdlg.h \ 4 configdlg.h \
5 keyboardimpl.h 5 keyboardimpl.h
6 SOURCES= keyboard.cpp \ 6 SOURCES= keyboard.cpp \
7 configdlg.cpp \ 7 configdlg.cpp \
8 keyboardimpl.cpp 8 keyboardimpl.cpp
9 TARGET = qmultikey 9 TARGET = qmultikey
10 DESTDIR = $(OPIEDIR)/plugins/inputmethods 10 DESTDIR = $(OPIEDIR)/plugins/inputmethods
11INCLUDEPATH += $(OPIEDIR)/include 11INCLUDEPATH += $(OPIEDIR)/include
12DEPENDPATH += ../../launcher 12DEPENDPATH += ../../launcher
13LIBS += -lqpe -L$(OPIEDIR)/plugins/inputmethods -lqpickboard -lqtaux2 -lopieui2 13LIBS += -lqpe -L$(OPIEDIR)/plugins/inputmethods -lqpickboard -lqtaux2 -lopiecore2 -lopieui2
14 QMAKE_LFLAGS+= -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods 14 QMAKE_LFLAGS+= -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods
15 VERSION = 1.0.0 15 VERSION = 1.0.0
16 16
17include( $(OPIEDIR)/include.pro ) 17include( $(OPIEDIR)/include.pro )
18target.path = $$prefix/plugins/inputmethods 18target.path = $$prefix/plugins/inputmethods
diff --git a/inputmethods/multikey/opie-multikey.control b/inputmethods/multikey/opie-multikey.control
index 5a5ce77..fc7d56c 100644
--- a/inputmethods/multikey/opie-multikey.control
+++ b/inputmethods/multikey/opie-multikey.control
@@ -1,10 +1,10 @@
1Package: opie-multikey 1Package: opie-multikey
2Files: plugins/inputmethods/libqmultikey.so* share/multikey/* 2Files: plugins/inputmethods/libqmultikey.so* share/multikey/*
3Priority: optional 3Priority: optional
4Section: opie/inputmethods 4Section: opie/inputmethods
5Maintainer: Jake Richardson (jake@asdfnews.org) 5Maintainer: Jake Richardson (jake@asdfnews.org)
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal, opie-pickboard, libqtaux2 7Depends: task-opie-minimal, opie-pickboard, libqtaux2, libopiecore2, libopieui2
8Description: Multiple language keyboard 8Description: Multiple language keyboard
9 Keyboard for inputing multiple languages in the Opie environment. 9 Keyboard for inputing multiple languages in the Opie environment.
10Version: $QPE_VERSION$EXTRAVERSION 10Version: $QPE_VERSION$EXTRAVERSION