author | josef <josef> | 2002-10-06 14:45:20 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-06 14:45:20 (UTC) |
commit | 24393565a48df6bb65516c25c124280724af9a75 (patch) (unidiff) | |
tree | 368ae33e55b6e11d895b2f0988b16eb381fa840c | |
parent | fb0027ea0649aa5bf4c3880dc84df459425c0642 (diff) | |
download | opie-24393565a48df6bb65516c25c124280724af9a75.zip opie-24393565a48df6bb65516c25c124280724af9a75.tar.gz opie-24393565a48df6bb65516c25c124280724af9a75.tar.bz2 |
- more factorization
- use QDialog::accept() instead of applyButtonPressed()
- prepare plugin-specific load/save of data
-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 | |||
@@ -43,72 +43,65 @@ ConfigDialog::ConfigDialog( const Profile::ValueList& lis, QWidget* parent ) | |||
43 | ConfigDialog::~ConfigDialog() { | 43 | ConfigDialog::~ConfigDialog() { |
44 | 44 | ||
45 | } | 45 | } |
46 | Profile::ValueList ConfigDialog::list()const { | 46 | Profile::ValueList ConfigDialog::list()const { |
47 | /* iterate over the list */ | 47 | /* iterate over the list */ |
48 | Profile::ValueList lst; | 48 | Profile::ValueList lst; |
49 | QListViewItemIterator it(lstView); | 49 | QListViewItemIterator it(lstView); |
50 | for ( ; it.current(); ++it ) { | 50 | for ( ; it.current(); ++it ) { |
51 | ConfigListItem* item = (ConfigListItem*)it.current(); | 51 | ConfigListItem* item = (ConfigListItem*)it.current(); |
52 | lst.append( item->profile() ); | 52 | lst.append( item->profile() ); |
53 | } | 53 | } |
54 | return lst; | 54 | return lst; |
55 | } | 55 | } |
56 | /* our slots */ | 56 | /* our slots */ |
57 | void ConfigDialog::slotRemove() { | 57 | void ConfigDialog::slotRemove() { |
58 | ConfigListItem* item = (ConfigListItem*)lstView->currentItem(); | 58 | ConfigListItem* item = (ConfigListItem*)lstView->currentItem(); |
59 | if (!item ) | 59 | if (!item ) |
60 | return; | 60 | return; |
61 | 61 | ||
62 | lstView->takeItem( item ); | 62 | lstView->takeItem( item ); |
63 | delete item; | 63 | delete item; |
64 | } | 64 | } |
65 | 65 | ||
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 | ||
69 | dlg.setCaption("Edit Connection Profile"); | 74 | dlg.setCaption("Edit Connection Profile"); |
70 | dlg.showMaximized(); | 75 | dlg.showMaximized(); |
71 | int ret = dlg.exec(); | 76 | int ret = dlg.exec(); |
72 | 77 | ||
73 | if(ret == QDialog::Accepted) | 78 | if(ret == QDialog::Accepted) |
74 | { | 79 | { |
75 | // if(listView->current()) delete lstView->current(); ... | 80 | // if(listView->current()) delete lstView->current(); ... |
76 | // use dlg.terminal()! | 81 | // use dlg.terminal()! |
77 | new ConfigListItem(lstView, Profile(dlg.prof_name(), dlg.prof_type(), Profile::White, Profile::Black, Profile::VT102)); | 82 | new ConfigListItem(lstView, Profile(dlg.prof_name(), dlg.prof_type(), Profile::White, Profile::Black, Profile::VT102)); |
78 | } | 83 | } |
79 | } | 84 | } |
80 | 85 | ||
81 | 86 | ||
82 | void ConfigDialog::slotAdd() { | 87 | void ConfigDialog::slotAdd() { |
83 | qWarning("ConfigDialog::slotAdd"); | ||
84 | |||
85 | ProfileEditorDialog dlg(new MetaFactory()); | 88 | ProfileEditorDialog dlg(new MetaFactory()); |
86 | 89 | ||
87 | dlg.setCaption("New Connection"); | 90 | dlg.setCaption("New Connection"); |
88 | dlg.showMaximized(); | 91 | dlg.showMaximized(); |
89 | int ret = dlg.exec(); | 92 | int ret = dlg.exec(); |
90 | 93 | ||
91 | if(ret == QDialog::Accepted) | 94 | if(ret == QDialog::Accepted) |
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 | ||
111 | new ConfigListItem(lstView, p); | 104 | new ConfigListItem(lstView, p); |
112 | } | 105 | } |
113 | } | 106 | } |
114 | 107 | ||
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 | |||
@@ -44,60 +44,90 @@ static QWidget *factory_irda(QWidget *parent) | |||
44 | 44 | ||
45 | return device_frame; | 45 | return device_frame; |
46 | } | 46 | } |
47 | 47 | ||
48 | static QWidget *factory_modem(QWidget *parent) | 48 | static QWidget *factory_modem(QWidget *parent) |
49 | { | 49 | { |
50 | QFrame *device_frame = new QFrame(parent); | 50 | QFrame *device_frame = new QFrame(parent); |
51 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); | 51 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
52 | 52 | ||
53 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); | 53 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); |
54 | QLabel *frame_number = new QLabel(QObject::tr("Phone number"), device_frame); | 54 | QLabel *frame_number = new QLabel(QObject::tr("Phone number"), device_frame); |
55 | 55 | ||
56 | QLineEdit *frame_device_line = new QLineEdit("/dev/ttyS0", device_frame); | 56 | QLineEdit *frame_device_line = new QLineEdit("/dev/ttyS0", device_frame); |
57 | QLineEdit *frame_number_line = new QLineEdit(device_frame); | 57 | QLineEdit *frame_number_line = new QLineEdit(device_frame); |
58 | 58 | ||
59 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); | 59 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); |
60 | vbox_frame->add(frame_device); | 60 | vbox_frame->add(frame_device); |
61 | vbox_frame->add(frame_device_line); | 61 | vbox_frame->add(frame_device_line); |
62 | vbox_frame->add(frame_number); | 62 | vbox_frame->add(frame_number); |
63 | vbox_frame->add(frame_number_line); | 63 | vbox_frame->add(frame_number_line); |
64 | 64 | ||
65 | return device_frame; | 65 | return device_frame; |
66 | } | 66 | } |
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, |
69 | const Profile& prof ) | 81 | const Profile& prof ) |
70 | : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) | 82 | : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) |
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 | } |
76 | 90 | ||
77 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | 91 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) |
78 | : QTabDialog(0, 0, TRUE), m_fact( fact ) | 92 | : QTabDialog(0, 0, TRUE), m_fact( 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; |
81 | 111 | ||
82 | tabprof = new QWidget(this); | 112 | tabprof = new QWidget(this); |
83 | tabterm = new QWidget(this); | 113 | tabterm = new QWidget(this); |
84 | tabconn = new QWidget(this); | 114 | tabconn = new QWidget(this); |
85 | 115 | ||
86 | // for the time being: fake factory | 116 | // for the time being: fake factory |
87 | 117 | ||
88 | m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial); | 118 | m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial); |
89 | m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda); | 119 | m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda); |
90 | m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem); | 120 | m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem); |
91 | 121 | ||
92 | // profile tab | 122 | // profile tab |
93 | 123 | ||
94 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); | 124 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); |
95 | 125 | ||
96 | name_line = new QLineEdit(tabprof); | 126 | name_line = new QLineEdit(tabprof); |
97 | 127 | ||
98 | // connection tab, fixed part | 128 | // connection tab, fixed part |
99 | 129 | ||
100 | QLabel *device = new QLabel(QObject::tr("Device"), tabconn); | 130 | QLabel *device = new QLabel(QObject::tr("Device"), tabconn); |
101 | 131 | ||
102 | device_box = new QComboBox(tabconn); | 132 | device_box = new QComboBox(tabconn); |
103 | 133 | ||
@@ -153,48 +183,50 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | |||
153 | QLabel *colour = new QLabel(QObject::tr("Colour scheme"), tabterm); | 183 | QLabel *colour = new QLabel(QObject::tr("Colour scheme"), tabterm); |
154 | QLabel *size = new QLabel(QObject::tr("Font size"), tabterm); | 184 | QLabel *size = new QLabel(QObject::tr("Font size"), tabterm); |
155 | QLabel *options = new QLabel(QObject::tr("Options"), tabterm); | 185 | QLabel *options = new QLabel(QObject::tr("Options"), tabterm); |
156 | QLabel *conversions = new QLabel(QObject::tr("Line-break conversions"), tabterm); | 186 | QLabel *conversions = new QLabel(QObject::tr("Line-break conversions"), tabterm); |
157 | 187 | ||
158 | QComboBox *colour_box = new QComboBox(tabterm); | 188 | QComboBox *colour_box = new QComboBox(tabterm); |
159 | colour_box->insertItem(QObject::tr("black on white")); | 189 | colour_box->insertItem(QObject::tr("black on white")); |
160 | colour_box->insertItem(QObject::tr("white on black")); | 190 | colour_box->insertItem(QObject::tr("white on black")); |
161 | 191 | ||
162 | QButtonGroup *group_size = new QButtonGroup(tabterm); | 192 | QButtonGroup *group_size = new QButtonGroup(tabterm); |
163 | group_size->hide(); | 193 | group_size->hide(); |
164 | QRadioButton *size_small = new QRadioButton(QObject::tr("small"), tabterm); | 194 | QRadioButton *size_small = new QRadioButton(QObject::tr("small"), tabterm); |
165 | QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), tabterm); | 195 | QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), tabterm); |
166 | QRadioButton *size_large = new QRadioButton(QObject::tr("large"), tabterm); | 196 | QRadioButton *size_large = new QRadioButton(QObject::tr("large"), tabterm); |
167 | group_size->insert(size_small); | 197 | group_size->insert(size_small); |
168 | group_size->insert(size_medium); | 198 | group_size->insert(size_medium); |
169 | group_size->insert(size_large); | 199 | group_size->insert(size_large); |
170 | 200 | ||
171 | QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), tabterm); | 201 | QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), tabterm); |
172 | QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), tabterm); | 202 | QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), tabterm); |
173 | 203 | ||
174 | QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), tabterm); | 204 | QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), tabterm); |
175 | QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), tabterm); | 205 | QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), tabterm); |
176 | 206 | ||
207 | size_small->setChecked(true); | ||
208 | |||
177 | // layouting | 209 | // layouting |
178 | 210 | ||
179 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); | 211 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); |
180 | vbox3->add(name); | 212 | vbox3->add(name); |
181 | vbox3->add(name_line); | 213 | vbox3->add(name_line); |
182 | vbox3->addStretch(1); | 214 | vbox3->addStretch(1); |
183 | 215 | ||
184 | QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); | 216 | QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); |
185 | vbox->add(device); | 217 | vbox->add(device); |
186 | vbox->add(device_box); | 218 | vbox->add(device_box); |
187 | vbox->add(plugin_base); | 219 | vbox->add(plugin_base); |
188 | vbox->add(speed); | 220 | vbox->add(speed); |
189 | vbox->add(speed_box); | 221 | vbox->add(speed_box); |
190 | vbox->add(flow); | 222 | vbox->add(flow); |
191 | QHBoxLayout *hbox = new QHBoxLayout(vbox, 2); | 223 | QHBoxLayout *hbox = new QHBoxLayout(vbox, 2); |
192 | hbox->add(flow_hw); | 224 | hbox->add(flow_hw); |
193 | hbox->add(flow_sw); | 225 | hbox->add(flow_sw); |
194 | //vbox->add(group_flow); | 226 | //vbox->add(group_flow); |
195 | vbox->add(parity); | 227 | vbox->add(parity); |
196 | QHBoxLayout *hbox2 = new QHBoxLayout(vbox, 2); | 228 | QHBoxLayout *hbox2 = new QHBoxLayout(vbox, 2); |
197 | hbox2->add(parity_odd); | 229 | hbox2->add(parity_odd); |
198 | hbox2->add(parity_even); | 230 | hbox2->add(parity_even); |
199 | //vbox->add(group_parity); | 231 | //vbox->add(group_parity); |
200 | 232 | ||
@@ -204,122 +236,96 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | |||
204 | vbox2->add(size); | 236 | vbox2->add(size); |
205 | QHBoxLayout *hbox3 = new QHBoxLayout(vbox2, 2); | 237 | QHBoxLayout *hbox3 = new QHBoxLayout(vbox2, 2); |
206 | hbox3->add(size_small); | 238 | hbox3->add(size_small); |
207 | hbox3->add(size_medium); | 239 | hbox3->add(size_medium); |
208 | hbox3->add(size_large); | 240 | hbox3->add(size_large); |
209 | //vbox2->add(group_size); | 241 | //vbox2->add(group_size); |
210 | vbox2->add(colour); | 242 | vbox2->add(colour); |
211 | vbox2->add(colour_box); | 243 | vbox2->add(colour_box); |
212 | vbox2->add(conversions); | 244 | vbox2->add(conversions); |
213 | QHBoxLayout *hbox5 = new QHBoxLayout(vbox2, 2); | 245 | QHBoxLayout *hbox5 = new QHBoxLayout(vbox2, 2); |
214 | hbox5->add(conv_inbound); | 246 | hbox5->add(conv_inbound); |
215 | hbox5->add(conv_outbound); | 247 | hbox5->add(conv_outbound); |
216 | vbox2->add(options); | 248 | vbox2->add(options); |
217 | QHBoxLayout *hbox4 = new QHBoxLayout(vbox2, 2); | 249 | QHBoxLayout *hbox4 = new QHBoxLayout(vbox2, 2); |
218 | hbox4->add(option_wrap); | 250 | hbox4->add(option_wrap); |
219 | hbox4->add(option_echo); | 251 | hbox4->add(option_echo); |
220 | 252 | ||
221 | addTab(tabprof, QObject::tr("Profile")); | 253 | addTab(tabprof, QObject::tr("Profile")); |
222 | addTab(tabconn, QObject::tr("Connection")); | 254 | addTab(tabconn, QObject::tr("Connection")); |
223 | addTab(tabterm, QObject::tr("Terminal")); | 255 | addTab(tabterm, QObject::tr("Terminal")); |
224 | 256 | ||
225 | setOkButton(QObject::tr("OK")); | 257 | setOkButton(QObject::tr("OK")); |
226 | setCancelButton(QObject::tr("Cancel")); | 258 | setCancelButton(QObject::tr("Cancel")); |
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())); |
230 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); | 262 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); |
231 | 263 | ||
232 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); | 264 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); |
233 | } | 265 | } |
234 | 266 | ||
235 | ProfileEditorDialog::~ProfileEditorDialog() { | 267 | ProfileEditorDialog::~ProfileEditorDialog() { |
236 | 268 | ||
237 | } | 269 | } |
238 | 270 | ||
239 | void ProfileEditorDialog::slotDevice(int id) | 271 | void ProfileEditorDialog::slotDevice(int id) |
240 | { | 272 | { |
241 | delete plugin_plugin; | 273 | delete plugin_plugin; |
242 | 274 | ||
243 | plugin_plugin = m_fact->newConfigWidget(prof_type(), plugin_base); | 275 | plugin_plugin = m_fact->newConfigWidget(prof_type(), plugin_base); |
244 | plugin_layout->add(plugin_plugin); | 276 | plugin_layout->add(plugin_plugin); |
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 | { |
251 | if(prof_name().isEmpty()) | 288 | if(prof_name().isEmpty()) |
252 | { | 289 | { |
253 | QMessageBox::information(this, | 290 | QMessageBox::information(this, |
254 | QObject::tr("Invalid profile"), | 291 | QObject::tr("Invalid profile"), |
255 | QObject::tr("Please enter a profile name.")); | 292 | QObject::tr("Please enter a profile name.")); |
256 | return; | 293 | return; |
257 | } | 294 | } |
258 | 295 | ||
259 | accept(); | 296 | // Save profile and plugin profile |
297 | //if(plugin_plugin) plugin_plugin->save(); | ||
298 | |||
299 | QDialog::accept(); | ||
260 | } | 300 | } |
261 | 301 | ||
262 | void ProfileEditorDialog::slotCancel() | 302 | void ProfileEditorDialog::slotCancel() |
263 | { | 303 | { |
264 | reject(); | 304 | reject(); |
265 | } | 305 | } |
266 | 306 | ||
267 | QString ProfileEditorDialog::prof_name() | 307 | QString ProfileEditorDialog::prof_name() |
268 | { | 308 | { |
269 | return name_line->text(); | 309 | return name_line->text(); |
270 | } | 310 | } |
271 | 311 | ||
272 | QString ProfileEditorDialog::prof_type() | 312 | 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 | ||
287 | return QString::null; | 318 | return QString::null; |
288 | } | 319 | } |
289 | 320 | ||
290 | QString ProfileEditorDialog::conn_device() | 321 | QString ProfileEditorDialog::conn_device() |
291 | { | 322 | { |
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 | } |
320 | 326 | ||
321 | QString ProfileEditorDialog::term_type() | 327 | QString ProfileEditorDialog::term_type() |
322 | { | 328 | { |
323 | return terminal_box->currentText(); | 329 | return terminal_box->currentText(); |
324 | } | 330 | } |
325 | 331 | ||
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 | |||
@@ -5,55 +5,52 @@ | |||
5 | 5 | ||
6 | #include "profile.h" | 6 | #include "profile.h" |
7 | 7 | ||
8 | class MetaFactory; | 8 | class MetaFactory; |
9 | class EditBase; | 9 | class EditBase; |
10 | class QTabWidget; | 10 | class QTabWidget; |
11 | class QHBoxLayout; | 11 | class QHBoxLayout; |
12 | class QLineEdit; | 12 | class QLineEdit; |
13 | class QComboBox; | 13 | class QComboBox; |
14 | class QLabel; | 14 | class QLabel; |
15 | 15 | ||
16 | class ProfileEditorDialog : public QTabDialog { | 16 | class ProfileEditorDialog : public QTabDialog { |
17 | Q_OBJECT | 17 | Q_OBJECT |
18 | public: | 18 | public: |
19 | ProfileEditorDialog(MetaFactory* fact, | 19 | ProfileEditorDialog(MetaFactory* fact, |
20 | const Profile& prof ); | 20 | const Profile& prof ); |
21 | ProfileEditorDialog(MetaFactory* fact ); | 21 | ProfileEditorDialog(MetaFactory* fact ); |
22 | ~ProfileEditorDialog(); | 22 | ~ProfileEditorDialog(); |
23 | Profile profile()const; | 23 | Profile profile()const; |
24 | 24 | ||
25 | QString prof_name(); | 25 | QString prof_name(); |
26 | QString prof_type(); | 26 | QString prof_type(); |
27 | 27 | ||
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 | ||
35 | QString term_type(); | 30 | QString term_type(); |
36 | 31 | ||
37 | public slots: | 32 | public slots: |
38 | void slotOk(); | 33 | void accept(); |
34 | //void slotOk(); | ||
39 | void slotCancel(); | 35 | void slotCancel(); |
40 | 36 | ||
41 | void slotDevice(int id); | 37 | void slotDevice(int id); |
42 | 38 | ||
43 | private: | 39 | private: |
44 | //void initUI(); | 40 | void initUI(); |
41 | |||
45 | MetaFactory* m_fact; | 42 | MetaFactory* m_fact; |
46 | EditBase* m_base; | 43 | EditBase* m_base; |
47 | QTabWidget* m_tab; | 44 | QTabWidget* m_tab; |
48 | QHBoxLayout* m_lay; | 45 | QHBoxLayout* m_lay; |
49 | Profile m_prof; | 46 | Profile m_prof; |
50 | 47 | ||
51 | //QLabel *frame_number; | 48 | //QLabel *frame_number; |
52 | QLineEdit *name_line; | 49 | QLineEdit *name_line; |
53 | //QLineEdit *frame_device_line, *frame_number_line; | 50 | //QLineEdit *frame_device_line, *frame_number_line; |
54 | QComboBox *terminal_box, *speed_box, *device_box; | 51 | QComboBox *terminal_box, *speed_box, *device_box; |
55 | QWidget *plugin_base, *plugin_plugin; | 52 | QWidget *plugin_base, *plugin_plugin; |
56 | QHBoxLayout *plugin_layout; | 53 | QHBoxLayout *plugin_layout; |
57 | }; | 54 | }; |
58 | 55 | ||
59 | #endif | 56 | #endif |