-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 60 | ||||
-rw-r--r-- | inputmethods/multikey/configdlg.h | 9 | ||||
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 10 | ||||
-rw-r--r-- | inputmethods/multikey/keyboard.h | 1 |
4 files changed, 56 insertions, 24 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp index f23bf1c..7bea589 100644 --- a/inputmethods/multikey/configdlg.cpp +++ b/inputmethods/multikey/configdlg.cpp | |||
@@ -2,7 +2,4 @@ | |||
2 | * TODO | 2 | * TODO |
3 | * make a font selection thing | 3 | * make a font selection thing (size too) |
4 | * | 4 | * |
5 | * FIXME | ||
6 | * if you open the config dialog and close it from the little (x) button on the title bar, | ||
7 | * you have to hit the button on the keyboard twice for it to open the next time | ||
8 | * | 5 | * |
@@ -24,3 +21,3 @@ | |||
24 | #include <qpushbutton.h> | 21 | #include <qpushbutton.h> |
25 | #include <qcombobox.h> | 22 | #include <qlistbox.h> |
26 | #include "configdlg.h" | 23 | #include "configdlg.h" |
@@ -40,22 +37,30 @@ ConfigDlg::ConfigDlg () : QTabWidget () | |||
40 | 37 | ||
41 | QGroupBox *map_group = new QGroupBox (2, Qt::Horizontal, tr("Keymap File"), gen_box); | 38 | QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); |
42 | 39 | ||
43 | map_combo = new QComboBox ((bool)0, map_group); | 40 | keymaps = new QListBox (map_group); |
44 | map_combo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); | 41 | keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); |
42 | //keymaps->setMaximumHeight(150); | ||
45 | 43 | ||
46 | QString cur(tr("Current Language")); | 44 | QString cur(tr("Current Language")); |
47 | map_combo->insertItem(cur); | 45 | keymaps->insertItem(cur); |
48 | connect(map_combo, SIGNAL(activated(int)), SLOT(setMap(int))); | 46 | connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); |
49 | 47 | ||
50 | QString ko(tr(QPEApplication::qpeDir() + "/share/multikey/ko.keymap")); | 48 | QString ko(QPEApplication::qpeDir() + "/share/multikey/ko.keymap"); |
51 | map_combo->insertItem(ko); | 49 | keymaps->insertItem(ko); |
52 | 50 | ||
53 | QString en(tr(QPEApplication::qpeDir() + "/share/multikey/en.keymap")); | 51 | QString en(QPEApplication::qpeDir() + "/share/multikey/en.keymap"); |
54 | map_combo->insertItem(en); | 52 | keymaps->insertItem(en); |
55 | 53 | ||
56 | QString de(tr(QPEApplication::qpeDir() + "/share/multikey/de.keymap")); | 54 | QString de(QPEApplication::qpeDir() + "/share/multikey/de.keymap"); |
57 | map_combo->insertItem(de); | 55 | keymaps->insertItem(de); |
58 | 56 | ||
59 | QPushButton *button = new QPushButton(tr("Browse..."), map_group); | 57 | QGrid *add_remove_grid = new QGrid(2, map_group); |
60 | button->setFlat((bool)1); | 58 | add_remove_grid->setMargin(3); |
59 | add_remove_grid->setSpacing(3); | ||
60 | |||
61 | add_button = new QPushButton(tr("Add"), add_remove_grid); | ||
62 | add_button->setFlat((bool)1); | ||
63 | |||
64 | remove_button = new QPushButton(tr("Remove"), add_remove_grid); | ||
65 | remove_button->setFlat((bool)1); | ||
61 | 66 | ||
@@ -81,2 +86,3 @@ ConfigDlg::ConfigDlg () : QTabWidget () | |||
81 | color_box->setMargin(3); | 86 | color_box->setMargin(3); |
87 | color_box->setSpacing(3); | ||
82 | addTab(color_box, tr("Colors")); | 88 | addTab(color_box, tr("Colors")); |
@@ -86,3 +92,3 @@ ConfigDlg::ConfigDlg () : QTabWidget () | |||
86 | label = new QLabel(tr("Key Color"), color_box); | 92 | label = new QLabel(tr("Key Color"), color_box); |
87 | button = new QPushButton(color_box); | 93 | QPushButton *button = new QPushButton(color_box); |
88 | button->setFlat((bool)1); | 94 | button->setFlat((bool)1); |
@@ -116,2 +122,5 @@ void ConfigDlg::setMap(int index) { | |||
116 | 122 | ||
123 | if (remove_button->isEnabled()) | ||
124 | remove_button->setDisabled(true); | ||
125 | |||
117 | emit setMapToDefault(); | 126 | emit setMapToDefault(); |
@@ -120,4 +129,15 @@ void ConfigDlg::setMap(int index) { | |||
120 | 129 | ||
121 | emit setMapToFile(map_combo->text(index)); | 130 | if (!remove_button->isEnabled()) |
131 | remove_button->setEnabled(true); | ||
132 | |||
133 | emit setMapToFile(keymaps->text(index)); | ||
122 | } | 134 | } |
123 | } | 135 | } |
136 | |||
137 | void ConfigDlg::addMap() { | ||
138 | |||
139 | } | ||
140 | |||
141 | void ConfigDlg::removeMap(int index) { | ||
142 | |||
143 | } | ||
diff --git a/inputmethods/multikey/configdlg.h b/inputmethods/multikey/configdlg.h index 54127a0..1a64764 100644 --- a/inputmethods/multikey/configdlg.h +++ b/inputmethods/multikey/configdlg.h | |||
@@ -3,3 +3,4 @@ | |||
3 | #include <qcheckbox.h> | 3 | #include <qcheckbox.h> |
4 | #include <qcombobox.h> | 4 | #include <qlistbox.h> |
5 | #include <qpushbutton.h> | ||
5 | 6 | ||
@@ -23,2 +24,4 @@ private slots: | |||
23 | void setMap(int index); | 24 | void setMap(int index); |
25 | void addMap(); | ||
26 | void removeMap(int index); | ||
24 | 27 | ||
@@ -26,3 +29,5 @@ private: | |||
26 | QCheckBox *pick_button; | 29 | QCheckBox *pick_button; |
27 | QComboBox *map_combo; | 30 | QListBox *keymaps; |
31 | QPushButton *add_button; | ||
32 | QPushButton *remove_button; | ||
28 | 33 | ||
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 2a80f1e..b71f929 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -35,3 +35,2 @@ | |||
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <iostream.h> | ||
37 | 36 | ||
@@ -79,2 +78,10 @@ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | |||
79 | } | 78 | } |
79 | Keyboard::~Keyboard() { | ||
80 | |||
81 | if ( configdlg ) { | ||
82 | delete (ConfigDlg *) configdlg; | ||
83 | configdlg = 0; | ||
84 | } | ||
85 | |||
86 | } | ||
80 | 87 | ||
@@ -961,3 +968,2 @@ void Keys::setKeysFromFile(const char * filename) { | |||
961 | 968 | ||
962 | cout << name << " = " << value << "\n"; | ||
963 | buf = t.readLine(); | 969 | buf = t.readLine(); |
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h index c2efe10..8ca50ea 100644 --- a/inputmethods/multikey/keyboard.h +++ b/inputmethods/multikey/keyboard.h | |||
@@ -94,2 +94,3 @@ public: | |||
94 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 94 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
95 | ~Keyboard(); | ||
95 | 96 | ||