summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index be23eff..3843943 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -54,128 +54,129 @@ void ProfileEditorDialog::initUI()
54 tabconn = new QWidget(this); 54 tabconn = new QWidget(this);
55 55
56 // for the time being: fake factory 56 // for the time being: fake factory
57 57
58 m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial); 58 m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial);
59 m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda); 59 m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda);
60 m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem); 60 m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem);
61 61
62 // profile tab 62 // profile tab
63 63
64 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); 64 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
65 65
66 name_line = new QLineEdit(tabprof); 66 name_line = new QLineEdit(tabprof);
67 67
68 // connection tab, fixed part 68 // connection tab, fixed part
69 69
70 QLabel *device = new QLabel(QObject::tr("Device"), tabconn); 70 QLabel *device = new QLabel(QObject::tr("Device"), tabconn);
71 71
72 device_box = new QComboBox(tabconn); 72 device_box = new QComboBox(tabconn);
73 73
74 QStringList w = m_fact->configWidgets(); 74 QStringList w = m_fact->configWidgets();
75 for(QStringList::Iterator it = w.begin(); it != w.end(); it++) 75 for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
76 device_box->insertItem(m_fact->name((*it))); 76 device_box->insertItem(m_fact->name((*it)));
77 77
78 // connection tab, factory part 78 // connection tab, factory part
79 plugin_base = new QWidget(tabconn); 79 plugin_base = new QWidget(tabconn);
80 plugin_layout = new QHBoxLayout(plugin_base, 0); 80 plugin_layout = new QHBoxLayout(plugin_base, 0);
81 81
82 plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, &m_prof); 82 plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, &m_prof);
83 plugin_layout->add(plugin_plugin->widget()); 83 plugin_layout->add(plugin_plugin->widget());
84 84
85 // connection tab, general part 85 // connection tab, general part
86 86
87 QWidget *conn_widget = plugin_plugin->connection_widget(); 87 QWidget *conn_widget = plugin_plugin->connection_widget();
88 conn_widget->reparent(tabconn, 0, QPoint(), true); 88 conn_widget->reparent(tabconn, 0, QPoint(), true);
89 89
90 // terminal tab 90 // terminal tab
91 91
92 QWidget *term_widget = plugin_plugin->terminal_widget(); 92 QWidget *term_widget = plugin_plugin->terminal_widget();
93 term_widget->reparent(tabterm, 0, QPoint(), true); 93 term_widget->reparent(tabterm, 0, QPoint(), true);
94 94
95 // layouting 95 // layouting
96 96
97 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); 97 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
98 vbox3->add(name); 98 vbox3->add(name);
99 vbox3->add(name_line); 99 vbox3->add(name_line);
100 vbox3->addStretch(1); 100 vbox3->addStretch(1);
101 101
102 QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); 102 QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2);
103 vbox->add(device); 103 vbox->add(device);
104 vbox->add(device_box); 104 vbox->add(device_box);
105 vbox->add(plugin_base); 105 vbox->add(plugin_base);
106 vbox->add(conn_widget); 106 vbox->add(conn_widget);
107 vbox->setStretchFactor(device, 1); 107 vbox->setStretchFactor(device, 1);
108 vbox->setStretchFactor(device_box, 1); 108 vbox->setStretchFactor(device_box, 1);
109 vbox->setStretchFactor(plugin_base, 1); 109 vbox->setStretchFactor(plugin_base, 1);
110 vbox->setStretchFactor(conn_widget, 7); 110 vbox->setStretchFactor(conn_widget, 7);
111 111
112 QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2); 112 QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2);
113 vbox2->add(term_widget); 113 vbox2->add(term_widget);
114 114
115 tabWidget->addTab(tabprof, "", QObject::tr("Profile")); 115 tabWidget->addTab(tabprof, "", QObject::tr("Profile"));
116 tabWidget->addTab(tabconn, "", QObject::tr("Connection")); 116 tabWidget->addTab(tabconn, "", QObject::tr("Connection"));
117 tabWidget->addTab(tabterm, "", QObject::tr("Terminal")); 117 tabWidget->addTab(tabterm, "", QObject::tr("Terminal"));
118 tabWidget->setCurrentTab( tabprof );
118 119
119 // load profile values 120 // load profile values
120 name_line->setText(m_prof.name()); 121 name_line->setText(m_prof.name());
121 for(int i = 0; i < device_box->count(); i++) 122 for(int i = 0; i < device_box->count(); i++)
122 { 123 {
123 device_box->setCurrentItem(i); 124 device_box->setCurrentItem(i);
124 if(prof_type() == m_prof.ioLayerName()) 125 if(prof_type() == m_prof.ioLayerName())
125 { 126 {
126 slotDevice(i); 127 slotDevice(i);
127 break; 128 break;
128 } 129 }
129 } 130 }
130 131
131 // signals 132 // signals
132 connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); 133 connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int)));
133} 134}
134 135
135ProfileEditorDialog::~ProfileEditorDialog() { 136ProfileEditorDialog::~ProfileEditorDialog() {
136 137
137} 138}
138 139
139void ProfileEditorDialog::slotDevice(int id) 140void ProfileEditorDialog::slotDevice(int id)
140{ 141{
141 delete plugin_plugin; 142 delete plugin_plugin;
142 143
143 plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, &m_prof); 144 plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, &m_prof);
144 plugin_layout->add(plugin_plugin->widget()); 145 plugin_layout->add(plugin_plugin->widget());
145 146
146 // Reload profile associated to device, including e.g. conn_device() 147 // Reload profile associated to device, including e.g. conn_device()
147 // m_prof = plugin_plugin->profile() 148 // m_prof = plugin_plugin->profile()
148 // or, keeping the profile name: m_prof->reload(plugin_plugin->profile()) 149 // or, keeping the profile name: m_prof->reload(plugin_plugin->profile())
149 150
150 //plugin_plugin->show(); 151 //plugin_plugin->show();
151 plugin_plugin->widget()->show(); 152 plugin_plugin->widget()->show();
152} 153}
153 154
154void ProfileEditorDialog::accept() 155void ProfileEditorDialog::accept()
155{ 156{
156 if(prof_name().isEmpty()) 157 if(prof_name().isEmpty())
157 { 158 {
158 QMessageBox::information(this, 159 QMessageBox::information(this,
159 QObject::tr("Invalid profile"), 160 QObject::tr("Invalid profile"),
160 QObject::tr("Please enter a profile name.")); 161 QObject::tr("Please enter a profile name."));
161 return; 162 return;
162 } 163 }
163 // Save profile and plugin profile 164 // Save profile and plugin profile
164 if(plugin_plugin) plugin_plugin->save(); 165 if(plugin_plugin) plugin_plugin->save();
165 166
166 // Save general values 167 // Save general values
167 m_prof.setName(prof_name()); 168 m_prof.setName(prof_name());
168 m_prof.setIOLayer(prof_type()); 169 m_prof.setIOLayer(prof_type());
169 170
170 QDialog::accept(); 171 QDialog::accept();
171} 172}
172 173
173 174
174QString ProfileEditorDialog::prof_name() 175QString ProfileEditorDialog::prof_name()
175{ 176{
176 return name_line->text(); 177 return name_line->text();
177} 178}
178 179
179QString ProfileEditorDialog::prof_type() 180QString ProfileEditorDialog::prof_type()
180{ 181{
181 QStringList w = m_fact->configWidgets(); 182 QStringList w = m_fact->configWidgets();