author | josef <josef> | 2002-10-07 14:25:13 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-07 14:25:13 (UTC) |
commit | add436706a938a71a487db019dcd6ff236207bfc (patch) (unidiff) | |
tree | e774574de70c95f872ba190a502846c0f0bf5130 | |
parent | fa8df8b9d316f15bc089df5bde7eafb2ef10b36d (diff) | |
download | opie-add436706a938a71a487db019dcd6ff236207bfc.zip opie-add436706a938a71a487db019dcd6ff236207bfc.tar.gz opie-add436706a938a71a487db019dcd6ff236207bfc.tar.bz2 |
- first cleanups
- basic load/save works now, but none of the standard widget options is
remembered?
-rw-r--r-- | noncore/apps/opie-console/metafactory.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditorplugins.cpp | 102 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditorplugins.h | 10 |
5 files changed, 73 insertions, 59 deletions
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp index c5e614d..b69d6da 100644 --- a/noncore/apps/opie-console/metafactory.cpp +++ b/noncore/apps/opie-console/metafactory.cpp | |||
@@ -57,13 +57,13 @@ IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { | |||
57 | lay = (*laye )(conf);*/ | 57 | lay = (*laye )(conf);*/ |
58 | } | 58 | } |
59 | 59 | ||
60 | return lay; | 60 | return lay; |
61 | } | 61 | } |
62 | 62 | ||
63 | ProfileEditorPlugin *MetaFactory::newConfigPlugin ( const QString& str, QWidget *parent, const Profile& prof) { | 63 | ProfileEditorPlugin *MetaFactory::newConfigPlugin ( const QString& str, QWidget *parent, Profile *prof) { |
64 | ProfileEditorPlugin *p = NULL; | 64 | ProfileEditorPlugin *p = NULL; |
65 | configWidget c; | 65 | configWidget c; |
66 | 66 | ||
67 | c = m_confFact[str]; | 67 | c = m_confFact[str]; |
68 | if(c) p = c(parent, prof); | 68 | if(c) p = c(parent, prof); |
69 | 69 | ||
diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h index 8c714b3..216de03 100644 --- a/noncore/apps/opie-console/metafactory.h +++ b/noncore/apps/opie-console/metafactory.h | |||
@@ -15,13 +15,13 @@ | |||
15 | #include "file_layer.h" | 15 | #include "file_layer.h" |
16 | #include "profile.h" | 16 | #include "profile.h" |
17 | #include "profileeditorplugins.h" | 17 | #include "profileeditorplugins.h" |
18 | 18 | ||
19 | class MetaFactory { | 19 | class MetaFactory { |
20 | public: | 20 | public: |
21 | typedef ProfileEditorPlugin* (*configWidget)(QWidget* parent, const Profile&); | 21 | typedef ProfileEditorPlugin* (*configWidget)(QWidget* parent, Profile* prof); |
22 | typedef IOLayer* (*iolayer)(const Profile& ); | 22 | typedef IOLayer* (*iolayer)(const Profile& ); |
23 | typedef FileTransferLayer* (*filelayer)(IOLayer*); | 23 | typedef FileTransferLayer* (*filelayer)(IOLayer*); |
24 | 24 | ||
25 | MetaFactory(); | 25 | MetaFactory(); |
26 | ~MetaFactory(); | 26 | ~MetaFactory(); |
27 | 27 | ||
@@ -33,13 +33,13 @@ public: | |||
33 | void addFileTransferLayer( const QString&, | 33 | void addFileTransferLayer( const QString&, |
34 | filelayer ); | 34 | filelayer ); |
35 | QStringList ioLayers()const; | 35 | QStringList ioLayers()const; |
36 | QStringList configWidgets()const; | 36 | QStringList configWidgets()const; |
37 | QStringList fileTransferLayers()const; | 37 | QStringList fileTransferLayers()const; |
38 | IOLayer* newIOLayer( const QString&,const Profile& ); | 38 | IOLayer* newIOLayer( const QString&,const Profile& ); |
39 | ProfileEditorPlugin *newConfigPlugin ( const QString&, QWidget*, const Profile& ); | 39 | ProfileEditorPlugin *newConfigPlugin ( const QString&, QWidget*, Profile* ); |
40 | 40 | ||
41 | QString name( const QString& ); | 41 | QString name( const QString& ); |
42 | 42 | ||
43 | private: | 43 | private: |
44 | QMap<QString, configWidget> m_confFact; | 44 | QMap<QString, configWidget> m_confFact; |
45 | QMap<QString, iolayer> m_layerFact; | 45 | QMap<QString, iolayer> m_layerFact; |
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index d98e589..8e63429 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -70,13 +70,13 @@ void ProfileEditorDialog::initUI() | |||
70 | device_box->insertItem(m_fact->name((*it))); | 70 | device_box->insertItem(m_fact->name((*it))); |
71 | 71 | ||
72 | // connection tab, factory part | 72 | // connection tab, factory part |
73 | plugin_base = new QWidget(tabconn); | 73 | plugin_base = new QWidget(tabconn); |
74 | plugin_layout = new QHBoxLayout(plugin_base, 0); | 74 | plugin_layout = new QHBoxLayout(plugin_base, 0); |
75 | 75 | ||
76 | plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, m_prof); | 76 | plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, &m_prof); |
77 | plugin_layout->add(plugin_plugin->widget()); | 77 | plugin_layout->add(plugin_plugin->widget()); |
78 | 78 | ||
79 | // connection tab, general part | 79 | // connection tab, general part |
80 | 80 | ||
81 | QWidget *conn_widget = plugin_plugin->connection_widget(); | 81 | QWidget *conn_widget = plugin_plugin->connection_widget(); |
82 | conn_widget->reparent(tabconn, 0, QPoint(), true); | 82 | conn_widget->reparent(tabconn, 0, QPoint(), true); |
@@ -109,12 +109,21 @@ void ProfileEditorDialog::initUI() | |||
109 | setOkButton(QObject::tr("OK")); | 109 | setOkButton(QObject::tr("OK")); |
110 | setCancelButton(QObject::tr("Cancel")); | 110 | setCancelButton(QObject::tr("Cancel")); |
111 | 111 | ||
112 | // load profile values | 112 | // load profile values |
113 | 113 | ||
114 | name_line->setText(m_prof.name()); | 114 | name_line->setText(m_prof.name()); |
115 | for(int i = 0; i < device_box->count(); i++) | ||
116 | { | ||
117 | device_box->setCurrentItem(i); | ||
118 | if(prof_type() == m_prof.ioLayerName()) | ||
119 | { | ||
120 | slotDevice(i); | ||
121 | break; | ||
122 | } | ||
123 | } | ||
115 | 124 | ||
116 | // signals | 125 | // signals |
117 | 126 | ||
118 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); | 127 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); |
119 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); | 128 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); |
120 | } | 129 | } |
@@ -124,13 +133,13 @@ ProfileEditorDialog::~ProfileEditorDialog() { | |||
124 | } | 133 | } |
125 | 134 | ||
126 | void ProfileEditorDialog::slotDevice(int id) | 135 | void ProfileEditorDialog::slotDevice(int id) |
127 | { | 136 | { |
128 | delete plugin_plugin; | 137 | delete plugin_plugin; |
129 | 138 | ||
130 | plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, m_prof); | 139 | plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, &m_prof); |
131 | plugin_layout->add(plugin_plugin->widget()); | 140 | plugin_layout->add(plugin_plugin->widget()); |
132 | 141 | ||
133 | // Reload profile associated to device, including e.g. conn_device() | 142 | // Reload profile associated to device, including e.g. conn_device() |
134 | // m_prof = plugin_plugin->profile() | 143 | // m_prof = plugin_plugin->profile() |
135 | // or, keeping the profile name: m_prof->reload(plugin_plugin->profile()) | 144 | // or, keeping the profile name: m_prof->reload(plugin_plugin->profile()) |
136 | 145 | ||
@@ -149,12 +158,13 @@ void ProfileEditorDialog::accept() | |||
149 | } | 158 | } |
150 | // Save profile and plugin profile | 159 | // Save profile and plugin profile |
151 | if(plugin_plugin) plugin_plugin->save(); | 160 | if(plugin_plugin) plugin_plugin->save(); |
152 | 161 | ||
153 | // Save general values | 162 | // Save general values |
154 | m_prof.setName(prof_name()); | 163 | m_prof.setName(prof_name()); |
164 | m_prof.setIOLayer(prof_type()); | ||
155 | 165 | ||
156 | QDialog::accept(); | 166 | QDialog::accept(); |
157 | } | 167 | } |
158 | 168 | ||
159 | void ProfileEditorDialog::slotCancel() | 169 | void ProfileEditorDialog::slotCancel() |
160 | { | 170 | { |
diff --git a/noncore/apps/opie-console/profileeditorplugins.cpp b/noncore/apps/opie-console/profileeditorplugins.cpp index 32e8235..a0bcab8 100644 --- a/noncore/apps/opie-console/profileeditorplugins.cpp +++ b/noncore/apps/opie-console/profileeditorplugins.cpp | |||
@@ -12,13 +12,13 @@ | |||
12 | #include "qbuttongroup.h" | 12 | #include "qbuttongroup.h" |
13 | 13 | ||
14 | #include "io_serial.h" | 14 | #include "io_serial.h" |
15 | 15 | ||
16 | // Base class | 16 | // Base class |
17 | 17 | ||
18 | ProfileEditorPlugin::ProfileEditorPlugin(QWidget *parent, Profile p) | 18 | ProfileEditorPlugin::ProfileEditorPlugin(QWidget *parent, Profile *p) |
19 | { | 19 | { |
20 | m_parent = parent; | 20 | m_parent = parent; |
21 | m_profile = p; | 21 | m_profile = p; |
22 | m_widget = NULL; | 22 | m_widget = NULL; |
23 | } | 23 | } |
24 | 24 | ||
@@ -73,15 +73,16 @@ QWidget *ProfileEditorPlugin::connection_widget() | |||
73 | lroot->add(parity); | 73 | lroot->add(parity); |
74 | QHBoxLayout *hbox2 = new QHBoxLayout(lroot, 2); | 74 | QHBoxLayout *hbox2 = new QHBoxLayout(lroot, 2); |
75 | hbox2->add(parity_odd); | 75 | hbox2->add(parity_odd); |
76 | hbox2->add(parity_even); | 76 | hbox2->add(parity_even); |
77 | 77 | ||
78 | // Apply profile settings | 78 | // Apply profile settings |
79 | int rad_flow = m_profile.readNumEntry("Flow"); | 79 | |
80 | int rad_parity = m_profile.readNumEntry("Parity"); | 80 | int rad_flow = m_profile->readNumEntry("Flow"); |
81 | int speed = m_profile.readNumEntry("Speed"); | 81 | int rad_parity = m_profile->readNumEntry("Parity"); |
82 | int speed = m_profile->readNumEntry("Speed"); | ||
82 | 83 | ||
83 | if(rad_flow == IOSerial::FlowHW) flow_hw->setChecked(true); | 84 | if(rad_flow == IOSerial::FlowHW) flow_hw->setChecked(true); |
84 | else flow_sw->setChecked(true); | 85 | else flow_sw->setChecked(true); |
85 | if(rad_parity == IOSerial::ParityEven) parity_even->setChecked(true); | 86 | if(rad_parity == IOSerial::ParityEven) parity_even->setChecked(true); |
86 | else parity_odd->setChecked(true); | 87 | else parity_odd->setChecked(true); |
87 | if(speed == 115200) speed_box->setCurrentItem(id_baud_115200); | 88 | if(speed == 115200) speed_box->setCurrentItem(id_baud_115200); |
@@ -157,19 +158,20 @@ QWidget *ProfileEditorPlugin::terminal_widget() | |||
157 | lroot->add(options); | 158 | lroot->add(options); |
158 | QHBoxLayout *hbox3 = new QHBoxLayout(lroot, 2); | 159 | QHBoxLayout *hbox3 = new QHBoxLayout(lroot, 2); |
159 | hbox3->add(option_wrap); | 160 | hbox3->add(option_wrap); |
160 | hbox3->add(option_echo); | 161 | hbox3->add(option_echo); |
161 | 162 | ||
162 | // Apply profile settings | 163 | // Apply profile settings |
163 | int term = m_profile.readNumEntry("Terminal"); | 164 | |
164 | int colour = m_profile.readNumEntry("Colour"); | 165 | int term = m_profile->readNumEntry("Terminal"); |
165 | int fontsize = m_profile.readNumEntry("Font"); | 166 | int colour = m_profile->readNumEntry("Colour"); |
166 | int opt_echo = m_profile.readNumEntry("Echo"); | 167 | int fontsize = m_profile->readNumEntry("Font"); |
167 | int opt_wrap = m_profile.readNumEntry("Wrap"); | 168 | int opt_echo = m_profile->readNumEntry("Echo"); |
168 | int opt_inbound = m_profile.readNumEntry("Inbound"); | 169 | int opt_wrap = m_profile->readNumEntry("Wrap"); |
169 | int opt_outbound = m_profile.readNumEntry("Outbound"); | 170 | int opt_inbound = m_profile->readNumEntry("Inbound"); |
171 | int opt_outbound = m_profile->readNumEntry("Outbound"); | ||
170 | 172 | ||
171 | if(term == Profile::VT102) terminal_box->setCurrentItem(id_term_vt100); | 173 | if(term == Profile::VT102) terminal_box->setCurrentItem(id_term_vt100); |
172 | 174 | ||
173 | if(colour == Profile::Black) colour_box->setCurrentItem(id_term_black); | 175 | if(colour == Profile::Black) colour_box->setCurrentItem(id_term_black); |
174 | if(colour == Profile::White) colour_box->setCurrentItem(id_term_white); | 176 | if(colour == Profile::White) colour_box->setCurrentItem(id_term_white); |
175 | 177 | ||
@@ -198,128 +200,128 @@ QWidget *ProfileEditorPlugin::terminal_widget() | |||
198 | 200 | ||
199 | void ProfileEditorPlugin::slotConnFlow(int id) | 201 | void ProfileEditorPlugin::slotConnFlow(int id) |
200 | { | 202 | { |
201 | switch(id) | 203 | switch(id) |
202 | { | 204 | { |
203 | case id_flow_hw: | 205 | case id_flow_hw: |
204 | m_profile.writeEntry("Flow", IOSerial::FlowHW); | 206 | m_profile->writeEntry("Flow", IOSerial::FlowHW); |
205 | break; | 207 | break; |
206 | case id_flow_sw: | 208 | case id_flow_sw: |
207 | m_profile.writeEntry("Flow", IOSerial::FlowSW); | 209 | m_profile->writeEntry("Flow", IOSerial::FlowSW); |
208 | break; | 210 | break; |
209 | } | 211 | } |
210 | } | 212 | } |
211 | 213 | ||
212 | void ProfileEditorPlugin::slotConnParity(int id) | 214 | void ProfileEditorPlugin::slotConnParity(int id) |
213 | { | 215 | { |
214 | switch(id) | 216 | switch(id) |
215 | { | 217 | { |
216 | case id_parity_odd: | 218 | case id_parity_odd: |
217 | m_profile.writeEntry("Parity", IOSerial::ParityEven); | 219 | m_profile->writeEntry("Parity", IOSerial::ParityEven); |
218 | break; | 220 | break; |
219 | case id_parity_even: | 221 | case id_parity_even: |
220 | m_profile.writeEntry("Parity", IOSerial::ParityOdd); | 222 | m_profile->writeEntry("Parity", IOSerial::ParityOdd); |
221 | break; | 223 | break; |
222 | } | 224 | } |
223 | } | 225 | } |
224 | 226 | ||
225 | void ProfileEditorPlugin::slotConnSpeed(int id) | 227 | void ProfileEditorPlugin::slotConnSpeed(int id) |
226 | { | 228 | { |
227 | switch(id) | 229 | switch(id) |
228 | { | 230 | { |
229 | 231 | ||
230 | case id_baud_115200: | 232 | case id_baud_115200: |
231 | m_profile.writeEntry("Speed", 115200); | 233 | m_profile->writeEntry("Speed", 115200); |
232 | break; | 234 | break; |
233 | case id_baud_57600: | 235 | case id_baud_57600: |
234 | m_profile.writeEntry("Speed", 57600); | 236 | m_profile->writeEntry("Speed", 57600); |
235 | break; | 237 | break; |
236 | case id_baud_38400: | 238 | case id_baud_38400: |
237 | m_profile.writeEntry("Speed", 38400); | 239 | m_profile->writeEntry("Speed", 38400); |
238 | break; | 240 | break; |
239 | case id_baud_19200: | 241 | case id_baud_19200: |
240 | m_profile.writeEntry("Speed", 19200); | 242 | m_profile->writeEntry("Speed", 19200); |
241 | break; | 243 | break; |
242 | case id_baud_9600: | 244 | case id_baud_9600: |
243 | m_profile.writeEntry("Speed", 9600); | 245 | m_profile->writeEntry("Speed", 9600); |
244 | break; | 246 | break; |
245 | } | 247 | } |
246 | } | 248 | } |
247 | 249 | ||
248 | void ProfileEditorPlugin::slotTermTerm(int id) | 250 | void ProfileEditorPlugin::slotTermTerm(int id) |
249 | { | 251 | { |
250 | switch(id) | 252 | switch(id) |
251 | { | 253 | { |
252 | case id_term_vt100: | 254 | case id_term_vt100: |
253 | m_profile.writeEntry("Terminal", Profile::VT102); | 255 | m_profile->writeEntry("Terminal", Profile::VT102); |
254 | break; | 256 | break; |
255 | case id_term_vt220: | 257 | case id_term_vt220: |
256 | m_profile.writeEntry("Terminal", Profile::VT102); | 258 | m_profile->writeEntry("Terminal", Profile::VT102); |
257 | break; | 259 | break; |
258 | case id_term_ansi: | 260 | case id_term_ansi: |
259 | m_profile.writeEntry("Terminal", Profile::VT102); | 261 | m_profile->writeEntry("Terminal", Profile::VT102); |
260 | break; | 262 | break; |
261 | } | 263 | } |
262 | } | 264 | } |
263 | 265 | ||
264 | void ProfileEditorPlugin::slotTermColour(int id) | 266 | void ProfileEditorPlugin::slotTermColour(int id) |
265 | { | 267 | { |
266 | switch(id) | 268 | switch(id) |
267 | { | 269 | { |
268 | case id_term_black: | 270 | case id_term_black: |
269 | m_profile.writeEntry("Colour", Profile::Black); | 271 | m_profile->writeEntry("Colour", Profile::Black); |
270 | break; | 272 | break; |
271 | case id_term_white: | 273 | case id_term_white: |
272 | m_profile.writeEntry("Colour", Profile::White); | 274 | m_profile->writeEntry("Colour", Profile::White); |
273 | break; | 275 | break; |
274 | } | 276 | } |
275 | } | 277 | } |
276 | 278 | ||
277 | void ProfileEditorPlugin::slotTermFont(int id) | 279 | void ProfileEditorPlugin::slotTermFont(int id) |
278 | { | 280 | { |
279 | switch(id) | 281 | switch(id) |
280 | { | 282 | { |
281 | case id_size_small: | 283 | case id_size_small: |
282 | m_profile.writeEntry("Font", Profile::Micro); | 284 | m_profile->writeEntry("Font", Profile::Micro); |
283 | break; | 285 | break; |
284 | case id_size_medium: | 286 | case id_size_medium: |
285 | m_profile.writeEntry("Font", Profile::Small); | 287 | m_profile->writeEntry("Font", Profile::Small); |
286 | break; | 288 | break; |
287 | case id_size_large: | 289 | case id_size_large: |
288 | m_profile.writeEntry("Font", Profile::Medium); | 290 | m_profile->writeEntry("Font", Profile::Medium); |
289 | break; | 291 | break; |
290 | } | 292 | } |
291 | } | 293 | } |
292 | 294 | ||
293 | void ProfileEditorPlugin::slotTermEcho(bool on) | 295 | void ProfileEditorPlugin::slotTermEcho(bool on) |
294 | { | 296 | { |
295 | m_profile.writeEntry("Echo", on ? 1 : 0); | 297 | m_profile->writeEntry("Echo", on ? 1 : 0); |
296 | } | 298 | } |
297 | 299 | ||
298 | void ProfileEditorPlugin::slotTermWrap(bool on) | 300 | void ProfileEditorPlugin::slotTermWrap(bool on) |
299 | { | 301 | { |
300 | m_profile.writeEntry("Wrap", on ? 1 : 0); | 302 | m_profile->writeEntry("Wrap", on ? 1 : 0); |
301 | } | 303 | } |
302 | 304 | ||
303 | void ProfileEditorPlugin::slotTermInbound(bool on) | 305 | void ProfileEditorPlugin::slotTermInbound(bool on) |
304 | { | 306 | { |
305 | m_profile.writeEntry("Inbound", on ? 1 : 0); | 307 | m_profile->writeEntry("Inbound", on ? 1 : 0); |
306 | } | 308 | } |
307 | 309 | ||
308 | void ProfileEditorPlugin::slotTermOutbound(bool on) | 310 | void ProfileEditorPlugin::slotTermOutbound(bool on) |
309 | { | 311 | { |
310 | m_profile.writeEntry("Outbound", on ? 1 : 0); | 312 | m_profile->writeEntry("Outbound", on ? 1 : 0); |
311 | } | 313 | } |
312 | 314 | ||
313 | // Inherited classes | 315 | // Inherited classes |
314 | 316 | ||
315 | class ProfileEditorPluginSerial : public ProfileEditorPlugin | 317 | class ProfileEditorPluginSerial : public ProfileEditorPlugin |
316 | { | 318 | { |
317 | public: | 319 | public: |
318 | 320 | ||
319 | ProfileEditorPluginSerial(QWidget *parent, Profile p) | 321 | ProfileEditorPluginSerial(QWidget *parent, Profile *p) |
320 | : ProfileEditorPlugin(parent, p) | 322 | : ProfileEditorPlugin(parent, p) |
321 | { | 323 | { |
322 | } | 324 | } |
323 | 325 | ||
324 | ~ProfileEditorPluginSerial() | 326 | ~ProfileEditorPluginSerial() |
325 | { | 327 | { |
@@ -340,34 +342,35 @@ class ProfileEditorPluginSerial : public ProfileEditorPlugin | |||
340 | vbox_frame->add(frame_device); | 342 | vbox_frame->add(frame_device); |
341 | vbox_frame->add(device_line); | 343 | vbox_frame->add(device_line); |
342 | 344 | ||
343 | m_widget = device_frame; | 345 | m_widget = device_frame; |
344 | 346 | ||
345 | // Load special settings | 347 | // Load special settings |
346 | device_line->setText(m_profile.readEntry("Device")); | 348 | |
349 | QString dev = m_profile->readEntry("Device"); | ||
350 | if(!dev.isNull()) device_line->setText(dev); | ||
347 | } | 351 | } |
348 | 352 | ||
349 | return m_widget; | 353 | return m_widget; |
350 | } | 354 | } |
351 | 355 | ||
352 | void save() | 356 | void save() |
353 | { | 357 | { |
354 | // special settings | 358 | // special settings |
355 | Profile p = m_profile; | 359 | m_profile->writeEntry("Device", device_line->text()); |
356 | p.writeEntry("Device", device_line->text()); | ||
357 | } | 360 | } |
358 | 361 | ||
359 | private: | 362 | private: |
360 | QLineEdit *device_line; | 363 | QLineEdit *device_line; |
361 | }; | 364 | }; |
362 | 365 | ||
363 | class ProfileEditorPluginIrda : public ProfileEditorPlugin | 366 | class ProfileEditorPluginIrda : public ProfileEditorPlugin |
364 | { | 367 | { |
365 | public: | 368 | public: |
366 | 369 | ||
367 | ProfileEditorPluginIrda(QWidget *parent, Profile p) | 370 | ProfileEditorPluginIrda(QWidget *parent, Profile *p) |
368 | : ProfileEditorPlugin(parent, p) | 371 | : ProfileEditorPlugin(parent, p) |
369 | { | 372 | { |
370 | } | 373 | } |
371 | 374 | ||
372 | ~ProfileEditorPluginIrda() | 375 | ~ProfileEditorPluginIrda() |
373 | { | 376 | { |
@@ -388,34 +391,34 @@ class ProfileEditorPluginIrda : public ProfileEditorPlugin | |||
388 | vbox_frame->add(frame_device); | 391 | vbox_frame->add(frame_device); |
389 | vbox_frame->add(device_line); | 392 | vbox_frame->add(device_line); |
390 | 393 | ||
391 | m_widget = device_frame; | 394 | m_widget = device_frame; |
392 | 395 | ||
393 | // Load special settings | 396 | // Load special settings |
394 | device_line->setText(m_profile.readEntry("Device")); | 397 | QString dev = m_profile->readEntry("Device"); |
398 | if(!dev.isNull()) device_line->setText(dev); | ||
395 | } | 399 | } |
396 | 400 | ||
397 | return m_widget; | 401 | return m_widget; |
398 | } | 402 | } |
399 | 403 | ||
400 | void save() | 404 | void save() |
401 | { | 405 | { |
402 | // special settings | 406 | // special settings |
403 | Profile p = m_profile; | 407 | m_profile->writeEntry("Device", device_line->text()); |
404 | p.writeEntry("Device", device_line->text()); | ||
405 | } | 408 | } |
406 | 409 | ||
407 | private: | 410 | private: |
408 | QLineEdit *device_line; | 411 | QLineEdit *device_line; |
409 | }; | 412 | }; |
410 | 413 | ||
411 | class ProfileEditorPluginModem : public ProfileEditorPlugin | 414 | class ProfileEditorPluginModem : public ProfileEditorPlugin |
412 | { | 415 | { |
413 | public: | 416 | public: |
414 | 417 | ||
415 | ProfileEditorPluginModem(QWidget *parent, Profile p) | 418 | ProfileEditorPluginModem(QWidget *parent, Profile *p) |
416 | : ProfileEditorPlugin(parent, p) | 419 | : ProfileEditorPlugin(parent, p) |
417 | { | 420 | { |
418 | } | 421 | } |
419 | 422 | ||
420 | ~ProfileEditorPluginModem() | 423 | ~ProfileEditorPluginModem() |
421 | { | 424 | { |
@@ -440,40 +443,41 @@ class ProfileEditorPluginModem : public ProfileEditorPlugin | |||
440 | vbox_frame->add(frame_number); | 443 | vbox_frame->add(frame_number); |
441 | vbox_frame->add(number_line); | 444 | vbox_frame->add(number_line); |
442 | 445 | ||
443 | m_widget = device_frame; | 446 | m_widget = device_frame; |
444 | 447 | ||
445 | // Load special settings | 448 | // Load special settings |
446 | device_line->setText(m_profile.readEntry("Device")); | 449 | QString dev = m_profile->readEntry("Device"); |
447 | number_line->setText(m_profile.readEntry("Number")); | 450 | QString num = m_profile->readEntry("Number"); |
451 | if(!dev.isNull()) device_line->setText(dev); | ||
452 | number_line->setText(num); | ||
448 | } | 453 | } |
449 | 454 | ||
450 | return m_widget; | 455 | return m_widget; |
451 | } | 456 | } |
452 | 457 | ||
453 | void save() | 458 | void save() |
454 | { | 459 | { |
455 | // special settings | 460 | // special settings |
456 | Profile p = m_profile; | 461 | m_profile->writeEntry("Device", device_line->text()); |
457 | p.writeEntry("Device", device_line->text()); | 462 | m_profile->writeEntry("Number", number_line->text()); |
458 | p.writeEntry("Number", number_line->text()); | ||
459 | } | 463 | } |
460 | 464 | ||
461 | private: | 465 | private: |
462 | QLineEdit *device_line, *number_line; | 466 | QLineEdit *device_line, *number_line; |
463 | }; | 467 | }; |
464 | 468 | ||
465 | ProfileEditorPlugin *factory_serial(QWidget *parent, const Profile& p) | 469 | ProfileEditorPlugin *factory_serial(QWidget *parent, Profile *p) |
466 | { | 470 | { |
467 | return new ProfileEditorPluginSerial(parent, p); | 471 | return new ProfileEditorPluginSerial(parent, p); |
468 | } | 472 | } |
469 | 473 | ||
470 | ProfileEditorPlugin *factory_irda(QWidget *parent, const Profile& p) | 474 | ProfileEditorPlugin *factory_irda(QWidget *parent, Profile *p) |
471 | { | 475 | { |
472 | return new ProfileEditorPluginIrda(parent, p); | 476 | return new ProfileEditorPluginIrda(parent, p); |
473 | } | 477 | } |
474 | 478 | ||
475 | ProfileEditorPlugin *factory_modem(QWidget *parent, const Profile& p) | 479 | ProfileEditorPlugin *factory_modem(QWidget *parent, Profile *p) |
476 | { | 480 | { |
477 | return new ProfileEditorPluginModem(parent, p); | 481 | return new ProfileEditorPluginModem(parent, p); |
478 | } | 482 | } |
479 | 483 | ||
diff --git a/noncore/apps/opie-console/profileeditorplugins.h b/noncore/apps/opie-console/profileeditorplugins.h index caec7ba..591163a 100644 --- a/noncore/apps/opie-console/profileeditorplugins.h +++ b/noncore/apps/opie-console/profileeditorplugins.h | |||
@@ -8,13 +8,13 @@ | |||
8 | class QWidget; | 8 | class QWidget; |
9 | 9 | ||
10 | class ProfileEditorPlugin : public QObject | 10 | class ProfileEditorPlugin : public QObject |
11 | { | 11 | { |
12 | Q_OBJECT | 12 | Q_OBJECT |
13 | public: | 13 | public: |
14 | ProfileEditorPlugin(QWidget *parent, Profile p); | 14 | ProfileEditorPlugin(QWidget *parent, Profile *p); |
15 | 15 | ||
16 | virtual ~ProfileEditorPlugin(); | 16 | virtual ~ProfileEditorPlugin(); |
17 | 17 | ||
18 | virtual void save() = 0; | 18 | virtual void save() = 0; |
19 | 19 | ||
20 | virtual QWidget *widget() = 0; | 20 | virtual QWidget *widget() = 0; |
@@ -33,13 +33,13 @@ class ProfileEditorPlugin : public QObject | |||
33 | void slotTermWrap(bool on); | 33 | void slotTermWrap(bool on); |
34 | void slotTermInbound(bool on); | 34 | void slotTermInbound(bool on); |
35 | void slotTermOutbound(bool on); | 35 | void slotTermOutbound(bool on); |
36 | 36 | ||
37 | protected: | 37 | protected: |
38 | QWidget *m_parent, *m_widget; | 38 | QWidget *m_parent, *m_widget; |
39 | Profile m_profile; | 39 | Profile *m_profile; |
40 | 40 | ||
41 | private: | 41 | private: |
42 | enum ParityIds | 42 | enum ParityIds |
43 | { | 43 | { |
44 | id_parity_odd, | 44 | id_parity_odd, |
45 | id_parity_even | 45 | id_parity_even |
@@ -82,15 +82,15 @@ class ProfileEditorPlugin : public QObject | |||
82 | }; | 82 | }; |
83 | 83 | ||
84 | //#ifdef __cplusplus | 84 | //#ifdef __cplusplus |
85 | //extern "C" { | 85 | //extern "C" { |
86 | //#endif | 86 | //#endif |
87 | 87 | ||
88 | ProfileEditorPlugin *factory_serial(QWidget *parent, const Profile& p); | 88 | ProfileEditorPlugin *factory_serial(QWidget *parent, Profile *p); |
89 | ProfileEditorPlugin *factory_irda(QWidget *parent, const Profile& p); | 89 | ProfileEditorPlugin *factory_irda(QWidget *parent, Profile *p); |
90 | ProfileEditorPlugin *factory_modem(QWidget *parent, const Profile& p); | 90 | ProfileEditorPlugin *factory_modem(QWidget *parent, Profile *p); |
91 | 91 | ||
92 | //#ifdef __cplusplus | 92 | //#ifdef __cplusplus |
93 | //} | 93 | //} |
94 | //#endif | 94 | //#endif |
95 | 95 | ||
96 | #endif | 96 | #endif |