-rw-r--r-- | inputmethods/multikey/config.in | 2 | ||||
-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 13 | ||||
-rw-r--r-- | inputmethods/multikey/multikey.pro | 2 | ||||
-rw-r--r-- | inputmethods/multikey/opie-multikey.control | 2 |
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,328 +1,331 @@ | |||
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 | ||
36 | using namespace Opie; | 37 | using namespace Opie; |
37 | using namespace Opie::Ui; | 38 | using namespace Opie::Ui; |
38 | // ConfigDlg::ConfigDlg() {{{1 | 39 | // ConfigDlg::ConfigDlg() {{{1 |
39 | ConfigDlg::ConfigDlg () : QDialog () | 40 | ConfigDlg::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 | ||
247 | QStringList ConfigDlg::loadSw() | 250 | QStringList 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 | ||
288 | void ConfigDlg::accept() | 291 | void 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 | ||
326 | void ConfigDlg::moveSelectedUp() | 329 | void ConfigDlg::moveSelectedUp() |
327 | { | 330 | { |
328 | int i = keymaps->currentItem(); | 331 | int i = keymaps->currentItem(); |
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 |
11 | INCLUDEPATH += $(OPIEDIR)/include | 11 | INCLUDEPATH += $(OPIEDIR)/include |
12 | DEPENDPATH += ../../launcher | 12 | DEPENDPATH += ../../launcher |
13 | LIBS += -lqpe -L$(OPIEDIR)/plugins/inputmethods -lqpickboard -lqtaux2 -lopieui2 | 13 | LIBS += -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 | ||
17 | include( $(OPIEDIR)/include.pro ) | 17 | include( $(OPIEDIR)/include.pro ) |
18 | target.path = $$prefix/plugins/inputmethods | 18 | target.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 @@ | |||
1 | Package: opie-multikey | 1 | Package: opie-multikey |
2 | Files: plugins/inputmethods/libqmultikey.so* share/multikey/* | 2 | Files: plugins/inputmethods/libqmultikey.so* share/multikey/* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/inputmethods | 4 | Section: opie/inputmethods |
5 | Maintainer: Jake Richardson (jake@asdfnews.org) | 5 | Maintainer: Jake Richardson (jake@asdfnews.org) |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal, opie-pickboard, libqtaux2 | 7 | Depends: task-opie-minimal, opie-pickboard, libqtaux2, libopiecore2, libopieui2 |
8 | Description: Multiple language keyboard | 8 | Description: Multiple language keyboard |
9 | Keyboard for inputing multiple languages in the Opie environment. | 9 | Keyboard for inputing multiple languages in the Opie environment. |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | Version: $QPE_VERSION$EXTRAVERSION |