-rw-r--r-- | noncore/apps/opie-console/configdialog.cpp | 31 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 92 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.h | 11 |
3 files changed, 65 insertions, 69 deletions
diff --git a/noncore/apps/opie-console/configdialog.cpp b/noncore/apps/opie-console/configdialog.cpp index d09cec3..23e94b1 100644 --- a/noncore/apps/opie-console/configdialog.cpp +++ b/noncore/apps/opie-console/configdialog.cpp | |||
@@ -66,3 +66,8 @@ void ConfigDialog::slotRemove() { | |||
66 | void ConfigDialog::slotEdit() { | 66 | void ConfigDialog::slotEdit() { |
67 | ProfileEditorDialog dlg(new MetaFactory()); | 67 | Profile p; |
68 | |||
69 | // Load profile | ||
70 | // p = currentItem()->profile(); | ||
71 | |||
72 | ProfileEditorDialog dlg(new MetaFactory(), p); | ||
68 | 73 | ||
@@ -82,4 +87,2 @@ void ConfigDialog::slotEdit() { | |||
82 | void ConfigDialog::slotAdd() { | 87 | void ConfigDialog::slotAdd() { |
83 | qWarning("ConfigDialog::slotAdd"); | ||
84 | |||
85 | ProfileEditorDialog dlg(new MetaFactory()); | 88 | ProfileEditorDialog dlg(new MetaFactory()); |
@@ -92,19 +95,9 @@ void ConfigDialog::slotAdd() { | |||
92 | { | 95 | { |
93 | // defaults | 96 | // TODO: Move into general profile save part |
94 | int profile = Profile::VT102; | ||
95 | |||
96 | // assignments | 97 | // assignments |
97 | QString type = dlg.term_type(); | 98 | //QString type = dlg.term_type(); |
98 | if(type == "VT102") profile = Profile::VT102; | 99 | //if(type == "VT102") profile = Profile::VT102; |
99 | 100 | ||
100 | // new profile | 101 | // get profile from editor |
101 | Profile p(dlg.prof_name(), dlg.prof_type(), Profile::White, Profile::Black, profile); | 102 | Profile p = dlg.profile(); |
102 | |||
103 | // special settings | ||
104 | p.writeEntry("Device", dlg.conn_device()); | ||
105 | p.writeEntry("Baud", dlg.conn_baud()); | ||
106 | p.writeEntry("Parity", dlg.conn_parity()); | ||
107 | p.writeEntry("DataBits", dlg.conn_databits()); | ||
108 | p.writeEntry("StopBits", dlg.conn_stopbits()); | ||
109 | p.writeEntry("Flow", dlg.conn_flow()); | ||
110 | 103 | ||
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index 374844e..aee4051 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -67,2 +67,14 @@ static QWidget *factory_modem(QWidget *parent) | |||
67 | 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 | |||
68 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, | 80 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, |
@@ -71,5 +83,7 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, | |||
71 | { | 83 | { |
72 | // initUI(); | 84 | initUI(); |
73 | /* now set the widgets */ | ||
74 | 85 | ||
86 | // Apply current profile | ||
87 | // plugin_plugin->load(profile); | ||
88 | // ... (reset profile name line edit etc.) | ||
75 | } | 89 | } |
@@ -79,2 +93,18 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | |||
79 | { | 93 | { |
94 | // Default profile | ||
95 | m_prof = Profile("serial", QString::null, Profile::Black, Profile::White, Profile::VT102); | ||
96 | |||
97 | initUI(); | ||
98 | |||
99 | // Apply current profile | ||
100 | // plugin_plugin->load(profile); | ||
101 | } | ||
102 | |||
103 | Profile ProfileEditorDialog::profile() const | ||
104 | { | ||
105 | return m_prof; | ||
106 | } | ||
107 | |||
108 | void ProfileEditorDialog::initUI() | ||
109 | { | ||
80 | QWidget *tabterm, *tabconn, *tabprof; | 110 | QWidget *tabterm, *tabconn, *tabprof; |
@@ -176,2 +206,4 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | |||
176 | 206 | ||
207 | size_small->setChecked(true); | ||
208 | |||
177 | // layouting | 209 | // layouting |
@@ -227,3 +259,3 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | |||
227 | 259 | ||
228 | connect(this, SIGNAL(applyButtonPressed()), SLOT(slotOk())); | 260 | //connect(this, SIGNAL(applyButtonPressed()), SLOT(slotOk())); |
229 | connect(this, SIGNAL(defaultButtonPressed()), SLOT(slotOk())); | 261 | connect(this, SIGNAL(defaultButtonPressed()), SLOT(slotOk())); |
@@ -245,6 +277,11 @@ void ProfileEditorDialog::slotDevice(int id) | |||
245 | 277 | ||
278 | // Reload profile associated to device, including e.g. conn_device() | ||
279 | // m_prof = plugin_plugin->profile() | ||
280 | // or, keeping the profile name: m_prof->reload(plugin_plugin->profile()) | ||
281 | |||
246 | plugin_plugin->show(); | 282 | plugin_plugin->show(); |
283 | // This would be: plugin_plugin->widget()->show(); | ||
247 | } | 284 | } |
248 | 285 | ||
249 | void ProfileEditorDialog::slotOk() | 286 | void ProfileEditorDialog::accept() |
250 | { | 287 | { |
@@ -258,3 +295,6 @@ void ProfileEditorDialog::slotOk() | |||
258 | 295 | ||
259 | accept(); | 296 | // Save profile and plugin profile |
297 | //if(plugin_plugin) plugin_plugin->save(); | ||
298 | |||
299 | QDialog::accept(); | ||
260 | } | 300 | } |
@@ -273,14 +313,5 @@ QString ProfileEditorDialog::prof_type() | |||
273 | { | 313 | { |
274 | switch(device_box->currentItem()) | 314 | QStringList w = m_fact->configWidgets(); |
275 | { | 315 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) |
276 | case 0: | 316 | if(device_box->currentText() == m_fact->name((*it))) return (*it); |
277 | return "serial"; | ||
278 | break; | ||
279 | case 1: | ||
280 | return "irda"; | ||
281 | break; | ||
282 | case 2: | ||
283 | return "modem"; | ||
284 | break; | ||
285 | } | ||
286 | 317 | ||
@@ -292,28 +323,3 @@ QString ProfileEditorDialog::conn_device() | |||
292 | //return frame_device_line->text(); | 323 | //return frame_device_line->text(); |
293 | return "serial"; | 324 | return "/dev/ttyS0"; |
294 | } | ||
295 | |||
296 | int ProfileEditorDialog::conn_baud() | ||
297 | { | ||
298 | return speed_box->currentText().toInt(); | ||
299 | } | ||
300 | |||
301 | int ProfileEditorDialog::conn_parity() | ||
302 | { | ||
303 | return 0; | ||
304 | } | ||
305 | |||
306 | int ProfileEditorDialog::conn_databits() | ||
307 | { | ||
308 | return 0; | ||
309 | } | ||
310 | |||
311 | int ProfileEditorDialog::conn_stopbits() | ||
312 | { | ||
313 | return 0; | ||
314 | } | ||
315 | |||
316 | int ProfileEditorDialog::conn_flow() | ||
317 | { | ||
318 | return 0; | ||
319 | } | 325 | } |
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h index 00f3c99..8ebfba1 100644 --- a/noncore/apps/opie-console/profileeditordialog.h +++ b/noncore/apps/opie-console/profileeditordialog.h | |||
@@ -28,7 +28,2 @@ public: | |||
28 | QString conn_device(); | 28 | QString conn_device(); |
29 | int conn_baud(); | ||
30 | int conn_parity(); | ||
31 | int conn_databits(); | ||
32 | int conn_stopbits(); | ||
33 | int conn_flow(); | ||
34 | 29 | ||
@@ -37,3 +32,4 @@ public: | |||
37 | public slots: | 32 | public slots: |
38 | void slotOk(); | 33 | void accept(); |
34 | //void slotOk(); | ||
39 | void slotCancel(); | 35 | void slotCancel(); |
@@ -43,3 +39,4 @@ public slots: | |||
43 | private: | 39 | private: |
44 | //void initUI(); | 40 | void initUI(); |
41 | |||
45 | MetaFactory* m_fact; | 42 | MetaFactory* m_fact; |