Diffstat (limited to 'noncore/apps/opie-console/profileeditordialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
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 | { |