-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 16 | ||||
-rw-r--r-- | inputmethods/multikey/opie-multikey.control | 2 |
2 files changed, 7 insertions, 11 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp index c4f7413..157714c 100644 --- a/inputmethods/multikey/configdlg.cpp +++ b/inputmethods/multikey/configdlg.cpp | |||
@@ -1,166 +1,162 @@ | |||
1 | /* | 1 | /* |
2 | * TODO | 2 | * TODO |
3 | * make a font selection thing (size too) | 3 | * make a font selection thing (size too) |
4 | * | 4 | * |
5 | * | 5 | * |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <qpe/qpeapplication.h> | 9 | #include <qpe/qpeapplication.h> |
10 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
11 | 11 | ||
12 | #include <qwidget.h> | 12 | #include <qwidget.h> |
13 | #include <qdialog.h> | 13 | #include <qdialog.h> |
14 | #include <qtabwidget.h> | 14 | #include <qtabwidget.h> |
15 | #include <qvbox.h> | 15 | #include <qvbox.h> |
16 | #include <qgrid.h> | 16 | #include <qgrid.h> |
17 | #include <qgroupbox.h> | 17 | #include <qgroupbox.h> |
18 | #include <qlabel.h> | 18 | #include <qlabel.h> |
19 | #include <qcheckbox.h> | 19 | #include <qcheckbox.h> |
20 | #include <qsizepolicy.h> | 20 | #include <qsizepolicy.h> |
21 | #include <qpushbutton.h> | 21 | #include <qpushbutton.h> |
22 | #include <qlistbox.h> | 22 | #include <qlistbox.h> |
23 | #include <qstringlist.h> | 23 | #include <qstringlist.h> |
24 | #include <opie/ofiledialog.h> | ||
25 | #include <iostream.h> | ||
24 | #include "configdlg.h" | 26 | #include "configdlg.h" |
25 | #include "keyboard.h" | 27 | #include "keyboard.h" |
26 | 28 | ||
27 | ConfigDlg::ConfigDlg () : QTabWidget () | 29 | ConfigDlg::ConfigDlg () : QTabWidget () |
28 | { | 30 | { |
29 | setCaption( tr("Multikey Configuration") ); | 31 | setCaption( tr("Multikey Configuration") ); |
30 | Config config ("multikey"); | 32 | Config config ("multikey"); |
31 | 33 | ||
32 | /* | 34 | /* |
33 | * 'general config' tab | 35 | * 'general config' tab |
34 | */ | 36 | */ |
35 | 37 | ||
36 | QVBox *gen_box = new QVBox (this); | 38 | QVBox *gen_box = new QVBox (this); |
37 | gen_box->setMargin(3); | 39 | gen_box->setMargin(3); |
38 | addTab(gen_box, tr("General Settings")); | 40 | addTab(gen_box, tr("General Settings")); |
39 | 41 | ||
40 | QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); | 42 | QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); |
41 | 43 | ||
42 | keymaps = new QListBox (map_group); | 44 | keymaps = new QListBox (map_group); |
43 | keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); | 45 | keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); |
44 | 46 | ||
45 | QString cur(tr("Current Language")); | 47 | QString cur(tr("Current Language")); |
46 | keymaps->insertItem(cur); | 48 | keymaps->insertItem(cur); |
47 | 49 | ||
48 | config.setGroup ("keymaps"); | 50 | config.setGroup ("keymaps"); |
49 | QStringList maps = config.readListEntry("maps", QChar('|')); | 51 | QStringList maps = config.readListEntry("maps", QChar('|')); |
50 | 52 | ||
51 | for (unsigned int i = 0; i < maps.count(); i++) { | 53 | for (unsigned int i = 0; i < maps.count(); i++) { |
52 | 54 | ||
53 | keymaps->insertItem(maps[i]); | 55 | keymaps->insertItem(maps[i]); |
54 | } | 56 | } |
55 | 57 | ||
56 | // have to "+1" because the "current language" listItem... remember? | 58 | // have to "+1" because the "current language" listItem... remember? |
57 | keymaps->setSelected(config.readNumEntry("current", 0) + 1, true); | 59 | keymaps->setSelected(config.readNumEntry("current", 0) + 1, true); |
58 | 60 | ||
59 | connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); | 61 | connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); |
60 | 62 | ||
61 | /* | ||
62 | QString ko(QPEApplication::qpeDir() + "/share/multikey/ko.keymap"); | ||
63 | keymaps->insertItem(ko); | ||
64 | |||
65 | QString en(QPEApplication::qpeDir() + "/share/multikey/en.keymap"); | ||
66 | keymaps->insertItem(en); | ||
67 | |||
68 | QString de(QPEApplication::qpeDir() + "/share/multikey/de.keymap"); | ||
69 | keymaps->insertItem(de); | ||
70 | */ | ||
71 | 63 | ||
72 | QGrid *add_remove_grid = new QGrid(2, map_group); | 64 | QGrid *add_remove_grid = new QGrid(2, map_group); |
73 | add_remove_grid->setMargin(3); | 65 | add_remove_grid->setMargin(3); |
74 | add_remove_grid->setSpacing(3); | 66 | add_remove_grid->setSpacing(3); |
75 | 67 | ||
76 | add_button = new QPushButton(tr("Add"), add_remove_grid); | 68 | add_button = new QPushButton(tr("Add"), add_remove_grid); |
77 | add_button->setFlat((bool)1); | 69 | add_button->setFlat((bool)1); |
70 | connect(add_button, SIGNAL(clicked()), SLOT(addMap())); | ||
78 | 71 | ||
79 | remove_button = new QPushButton(tr("Remove"), add_remove_grid); | 72 | remove_button = new QPushButton(tr("Remove"), add_remove_grid); |
80 | remove_button->setFlat((bool)1); | 73 | remove_button->setFlat((bool)1); |
81 | 74 | ||
82 | pick_button = new QCheckBox(tr("Pickboard"), gen_box); | 75 | pick_button = new QCheckBox(tr("Pickboard"), gen_box); |
83 | 76 | ||
84 | config.setGroup ("pickboard"); | 77 | config.setGroup ("pickboard"); |
85 | bool pick_open = config.readBoolEntry ("open", "0"); // default closed | 78 | bool pick_open = config.readBoolEntry ("open", "0"); // default closed |
86 | if (pick_open) { | 79 | if (pick_open) { |
87 | 80 | ||
88 | pick_button->setChecked(true); | 81 | pick_button->setChecked(true); |
89 | } | 82 | } |
90 | 83 | ||
91 | // by connecting it after checking it, the signal isn't emmited | 84 | // by connecting it after checking it, the signal isn't emmited |
92 | connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog())); | 85 | connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog())); |
93 | 86 | ||
94 | /* | 87 | /* |
95 | * 'color' tab | 88 | * 'color' tab |
96 | */ | 89 | */ |
97 | 90 | ||
98 | QGrid *color_box = new QGrid(2, this); | 91 | QGrid *color_box = new QGrid(2, this); |
99 | color_box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); | 92 | color_box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); |
100 | color_box->setMargin(3); | 93 | color_box->setMargin(3); |
101 | color_box->setSpacing(3); | 94 | color_box->setSpacing(3); |
102 | addTab(color_box, tr("Colors")); | 95 | addTab(color_box, tr("Colors")); |
103 | 96 | ||
104 | QLabel *label; | 97 | QLabel *label; |
105 | 98 | ||
106 | label = new QLabel(tr("Key Color"), color_box); | 99 | label = new QLabel(tr("Key Color"), color_box); |
107 | QPushButton *button = new QPushButton(color_box); | 100 | QPushButton *button = new QPushButton(color_box); |
108 | button->setFlat((bool)1); | 101 | button->setFlat((bool)1); |
109 | label = new QLabel(tr("Key Pressed Color"), color_box); | 102 | label = new QLabel(tr("Key Pressed Color"), color_box); |
110 | button = new QPushButton(color_box); | 103 | button = new QPushButton(color_box); |
111 | button->setFlat((bool)1); | 104 | button->setFlat((bool)1); |
112 | label = new QLabel(tr("Line Color"), color_box); | 105 | label = new QLabel(tr("Line Color"), color_box); |
113 | button = new QPushButton(color_box); | 106 | button = new QPushButton(color_box); |
114 | button->setFlat((bool)1); | 107 | button->setFlat((bool)1); |
115 | label = new QLabel(tr("Text Color"), color_box); | 108 | label = new QLabel(tr("Text Color"), color_box); |
116 | button = new QPushButton(color_box); | 109 | button = new QPushButton(color_box); |
117 | button->setFlat((bool)1); | 110 | button->setFlat((bool)1); |
118 | 111 | ||
119 | label = new QLabel("", color_box); // a spacer so the above buttons dont expand | 112 | label = new QLabel("", color_box); // a spacer so the above buttons dont expand |
120 | label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); | 113 | label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); |
121 | 114 | ||
122 | } | 115 | } |
123 | 116 | ||
124 | void ConfigDlg::pickTog() { | 117 | void ConfigDlg::pickTog() { |
125 | 118 | ||
126 | Config config ("multikey"); | 119 | Config config ("multikey"); |
127 | config.setGroup ("pickboard"); | 120 | config.setGroup ("pickboard"); |
128 | config.writeEntry ("open", pick_button->isChecked()); // default closed | 121 | config.writeEntry ("open", pick_button->isChecked()); // default closed |
129 | 122 | ||
130 | emit pickboardToggled(pick_button->isChecked()); | 123 | emit pickboardToggled(pick_button->isChecked()); |
131 | } | 124 | } |
132 | 125 | ||
133 | /* | 126 | /* |
134 | * the index is kinda screwy, because in the config file, index 0 is just the | 127 | * the index is kinda screwy, because in the config file, index 0 is just the |
135 | * first element in the QStringList, but here it's the "Current Language" | 128 | * first element in the QStringList, but here it's the "Current Language" |
136 | * listItem. therefor you have to minus one to the index before you access | 129 | * listItem. therefor you have to minus one to the index before you access |
137 | * it from the config file. | 130 | * it from the config file. |
138 | * | 131 | * |
139 | * and later on, the "current language" setting should be -1 in the config file | 132 | * and later on, the "current language" setting should be -1 in the config file |
140 | */ | 133 | */ |
141 | 134 | ||
142 | void ConfigDlg::setMap(int index) { | 135 | void ConfigDlg::setMap(int index) { |
143 | 136 | ||
144 | if (index == 0) { | 137 | if (index == 0) { |
145 | 138 | ||
146 | if (remove_button->isEnabled()) | 139 | if (remove_button->isEnabled()) |
147 | remove_button->setDisabled(true); | 140 | remove_button->setDisabled(true); |
148 | 141 | ||
149 | emit setMapToDefault(); | 142 | emit setMapToDefault(); |
150 | } | 143 | } |
151 | else { | 144 | else { |
152 | 145 | ||
153 | if (!remove_button->isEnabled()) | 146 | if (!remove_button->isEnabled()) |
154 | remove_button->setEnabled(true); | 147 | remove_button->setEnabled(true); |
155 | 148 | ||
156 | emit setMapToFile(index - 1); | 149 | emit setMapToFile(index - 1); |
157 | } | 150 | } |
158 | } | 151 | } |
159 | 152 | ||
160 | void ConfigDlg::addMap() { | 153 | void ConfigDlg::addMap() { |
161 | 154 | ||
155 | QString map = OFileDialog::getOpenFileName(2, QPEApplication::qpeDir() + "/share/multikey"); | ||
156 | cout << "added file " << map << "!\n"; | ||
157 | |||
162 | } | 158 | } |
163 | 159 | ||
164 | void ConfigDlg::removeMap(int index) { | 160 | void ConfigDlg::removeMap(int index) { |
165 | 161 | ||
166 | } | 162 | } |
diff --git a/inputmethods/multikey/opie-multikey.control b/inputmethods/multikey/opie-multikey.control index 42df4cd..ce39f36 100644 --- a/inputmethods/multikey/opie-multikey.control +++ b/inputmethods/multikey/opie-multikey.control | |||
@@ -1,9 +1,9 @@ | |||
1 | Files: plugins/inputmethods/libqmultikey.so* | 1 | Files: plugins/inputmethods/libqmultikey.so* share/multikey/* |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/inputmethods | 3 | Section: opie/inputmethods |
4 | Maintainer: Jake Richardson (jake@asdfnews.org) | 4 | Maintainer: Jake Richardson (jake@asdfnews.org) |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION) |
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. |