Diffstat (limited to 'noncore/apps/opie-console/profileeditordialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 81 |
1 files changed, 8 insertions, 73 deletions
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index aee4051..fbe0f23 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -11,72 +11,9 @@ | |||
11 | #include "qbuttongroup.h" | 11 | #include "qbuttongroup.h" |
12 | #include "qstringlist.h" | 12 | #include "qstringlist.h" |
13 | 13 | ||
14 | #include "profileeditorplugins.h" | ||
14 | #include "metafactory.h" | 15 | #include "metafactory.h" |
15 | 16 | ||
16 | static QWidget *factory_serial(QWidget *parent) | ||
17 | { | ||
18 | QFrame *device_frame = new QFrame(parent); | ||
19 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); | ||
20 | |||
21 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); | ||
22 | |||
23 | QLineEdit *frame_device_line = new QLineEdit("/dev/ttyS0", device_frame); | ||
24 | |||
25 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); | ||
26 | vbox_frame->add(frame_device); | ||
27 | vbox_frame->add(frame_device_line); | ||
28 | |||
29 | return device_frame; | ||
30 | } | ||
31 | |||
32 | static QWidget *factory_irda(QWidget *parent) | ||
33 | { | ||
34 | QFrame *device_frame = new QFrame(parent); | ||
35 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); | ||
36 | |||
37 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); | ||
38 | |||
39 | QLineEdit *frame_device_line = new QLineEdit("/dev/ircomm0", device_frame); | ||
40 | |||
41 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); | ||
42 | vbox_frame->add(frame_device); | ||
43 | vbox_frame->add(frame_device_line); | ||
44 | |||
45 | return device_frame; | ||
46 | } | ||
47 | |||
48 | static QWidget *factory_modem(QWidget *parent) | ||
49 | { | ||
50 | QFrame *device_frame = new QFrame(parent); | ||
51 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); | ||
52 | |||
53 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); | ||
54 | QLabel *frame_number = new QLabel(QObject::tr("Phone number"), device_frame); | ||
55 | |||
56 | QLineEdit *frame_device_line = new QLineEdit("/dev/ttyS0", device_frame); | ||
57 | QLineEdit *frame_number_line = new QLineEdit(device_frame); | ||
58 | |||
59 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); | ||
60 | vbox_frame->add(frame_device); | ||
61 | vbox_frame->add(frame_device_line); | ||
62 | vbox_frame->add(frame_number); | ||
63 | vbox_frame->add(frame_number_line); | ||
64 | |||
65 | return device_frame; | ||
66 | } | ||
67 | |||
68 | // Something like that must be called upon plugin_plugin->save() | ||
69 | //void save_modem() | ||
70 | //{ | ||
71 | //// special settings | ||
72 | //p.writeEntry("Device", dlg.conn_device()); | ||
73 | //p.writeEntry("Baud", dlg.conn_baud()); | ||
74 | //p.writeEntry("Parity", dlg.conn_parity()); | ||
75 | //p.writeEntry("DataBits", dlg.conn_databits()); | ||
76 | //p.writeEntry("StopBits", dlg.conn_stopbits()); | ||
77 | //p.writeEntry("Flow", dlg.conn_flow()); | ||
78 | //} | ||
79 | |||
80 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, | 17 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, |
81 | const Profile& prof ) | 18 | const Profile& prof ) |
82 | : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) | 19 | : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) |
@@ -139,8 +76,8 @@ void ProfileEditorDialog::initUI() | |||
139 | plugin_base = new QWidget(tabconn); | 76 | plugin_base = new QWidget(tabconn); |
140 | plugin_layout = new QHBoxLayout(plugin_base, 0); | 77 | plugin_layout = new QHBoxLayout(plugin_base, 0); |
141 | 78 | ||
142 | plugin_plugin = m_fact->newConfigWidget("serial", plugin_base); | 79 | plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, m_prof); |
143 | plugin_layout->add(plugin_plugin); | 80 | plugin_layout->add(plugin_plugin->widget()); |
144 | 81 | ||
145 | // connection tab, general part | 82 | // connection tab, general part |
146 | 83 | ||
@@ -257,8 +194,6 @@ void ProfileEditorDialog::initUI() | |||
257 | setOkButton(QObject::tr("OK")); | 194 | setOkButton(QObject::tr("OK")); |
258 | setCancelButton(QObject::tr("Cancel")); | 195 | setCancelButton(QObject::tr("Cancel")); |
259 | 196 | ||
260 | //connect(this, SIGNAL(applyButtonPressed()), SLOT(slotOk())); | ||
261 | connect(this, SIGNAL(defaultButtonPressed()), SLOT(slotOk())); | ||
262 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); | 197 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); |
263 | 198 | ||
264 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); | 199 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); |
@@ -272,15 +207,15 @@ void ProfileEditorDialog::slotDevice(int id) | |||
272 | { | 207 | { |
273 | delete plugin_plugin; | 208 | delete plugin_plugin; |
274 | 209 | ||
275 | plugin_plugin = m_fact->newConfigWidget(prof_type(), plugin_base); | 210 | plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, m_prof); |
276 | plugin_layout->add(plugin_plugin); | 211 | plugin_layout->add(plugin_plugin->widget()); |
277 | 212 | ||
278 | // Reload profile associated to device, including e.g. conn_device() | 213 | // Reload profile associated to device, including e.g. conn_device() |
279 | // m_prof = plugin_plugin->profile() | 214 | // m_prof = plugin_plugin->profile() |
280 | // or, keeping the profile name: m_prof->reload(plugin_plugin->profile()) | 215 | // or, keeping the profile name: m_prof->reload(plugin_plugin->profile()) |
281 | 216 | ||
282 | plugin_plugin->show(); | 217 | //plugin_plugin->show(); |
283 | // This would be: plugin_plugin->widget()->show(); | 218 | plugin_plugin->widget()->show(); |
284 | } | 219 | } |
285 | 220 | ||
286 | void ProfileEditorDialog::accept() | 221 | void ProfileEditorDialog::accept() |
@@ -294,7 +229,7 @@ void ProfileEditorDialog::accept() | |||
294 | } | 229 | } |
295 | 230 | ||
296 | // Save profile and plugin profile | 231 | // Save profile and plugin profile |
297 | //if(plugin_plugin) plugin_plugin->save(); | 232 | if(plugin_plugin) plugin_plugin->save(); |
298 | 233 | ||
299 | QDialog::accept(); | 234 | QDialog::accept(); |
300 | } | 235 | } |