summaryrefslogtreecommitdiff
authorjosef <josef>2002-10-07 14:25:13 (UTC)
committer josef <josef>2002-10-07 14:25:13 (UTC)
commitadd436706a938a71a487db019dcd6ff236207bfc (patch) (unidiff)
treee774574de70c95f872ba190a502846c0f0bf5130
parentfa8df8b9d316f15bc089df5bde7eafb2ef10b36d (diff)
downloadopie-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?
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/metafactory.cpp2
-rw-r--r--noncore/apps/opie-console/metafactory.h4
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp14
-rw-r--r--noncore/apps/opie-console/profileeditorplugins.cpp102
-rw-r--r--noncore/apps/opie-console/profileeditorplugins.h10
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
@@ -1,76 +1,76 @@
1#include <qpe/config.h> 1#include <qpe/config.h>
2#include "metafactory.h" 2#include "metafactory.h"
3 3
4MetaFactory::MetaFactory() { 4MetaFactory::MetaFactory() {
5} 5}
6MetaFactory::~MetaFactory() { 6MetaFactory::~MetaFactory() {
7 7
8} 8}
9void MetaFactory::addConfigWidgetFactory( const QString& str, 9void MetaFactory::addConfigWidgetFactory( const QString& str,
10 const QString& name, 10 const QString& name,
11 configWidget wid) { 11 configWidget wid) {
12 m_namemap.insert ( str, name ); 12 m_namemap.insert ( str, name );
13 m_confFact.insert( str, wid ); 13 m_confFact.insert( str, wid );
14} 14}
15void MetaFactory::addIOLayerFactory( const QString& str, 15void MetaFactory::addIOLayerFactory( const QString& str,
16 iolayer lay) { 16 iolayer lay) {
17 m_layerFact.insert( str, lay ); 17 m_layerFact.insert( str, lay );
18} 18}
19void MetaFactory::addFileTransferLayer( const QString& str, 19void MetaFactory::addFileTransferLayer( const QString& str,
20 filelayer lay) { 20 filelayer lay) {
21 m_fileFact.insert( str, lay ); 21 m_fileFact.insert( str, lay );
22} 22}
23QStringList MetaFactory::ioLayers()const { 23QStringList MetaFactory::ioLayers()const {
24 QStringList list; 24 QStringList list;
25 QMap<QString, iolayer>::ConstIterator it; 25 QMap<QString, iolayer>::ConstIterator it;
26 for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) { 26 for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) {
27 list << it.key(); 27 list << it.key();
28 } 28 }
29 return list; 29 return list;
30} 30}
31QStringList MetaFactory::configWidgets()const { 31QStringList MetaFactory::configWidgets()const {
32 QStringList list; 32 QStringList list;
33 QMap<QString, configWidget>::ConstIterator it; 33 QMap<QString, configWidget>::ConstIterator it;
34 for ( it = m_confFact.begin(); it != m_confFact.end(); ++it ) { 34 for ( it = m_confFact.begin(); it != m_confFact.end(); ++it ) {
35 list << it.key(); 35 list << it.key();
36 } 36 }
37 return list; 37 return list;
38} 38}
39QStringList MetaFactory::fileTransferLayers()const { 39QStringList MetaFactory::fileTransferLayers()const {
40 QStringList list; 40 QStringList list;
41 QMap<QString, filelayer>::ConstIterator it; 41 QMap<QString, filelayer>::ConstIterator it;
42 for ( it = m_fileFact.begin(); it != m_fileFact.end(); ++it ) { 42 for ( it = m_fileFact.begin(); it != m_fileFact.end(); ++it ) {
43 list << it.key(); 43 list << it.key();
44 } 44 }
45 return list; 45 return list;
46} 46}
47 47
48IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { 48IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) {
49 IOLayer* lay = 0l; 49 IOLayer* lay = 0l;
50 50
51 QMap<QString, iolayer>::Iterator it; 51 QMap<QString, iolayer>::Iterator it;
52 it = m_layerFact.find( str ); 52 it = m_layerFact.find( str );
53 if ( it != m_layerFact.end() ) { 53 if ( it != m_layerFact.end() ) {
54 lay = (*(it.data()))(prof); 54 lay = (*(it.data()))(prof);
55 /* 55 /*
56 iolayer laye = it.data(); 56 iolayer laye = it.data();
57 lay = (*laye )(conf);*/ 57 lay = (*laye )(conf);*/
58 } 58 }
59 59
60 return lay; 60 return lay;
61} 61}
62 62
63ProfileEditorPlugin *MetaFactory::newConfigPlugin ( const QString& str, QWidget *parent, const Profile& prof) { 63ProfileEditorPlugin *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
70 return p; 70 return p;
71} 71}
72 72
73QString MetaFactory::name( const QString& str ) { 73QString MetaFactory::name( const QString& str ) {
74 return m_namemap[str]; 74 return m_namemap[str];
75} 75}
76 76
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
@@ -1,51 +1,51 @@
1#ifndef OPIE_META_FACTORY_H 1#ifndef OPIE_META_FACTORY_H
2#define OPIE_META_FACTORY_H 2#define OPIE_META_FACTORY_H
3 3
4/** 4/**
5 * The MetaFactory is used to keep track of all IOLayers, FileTransferLayers and ConfigWidgets 5 * The MetaFactory is used to keep track of all IOLayers, FileTransferLayers and ConfigWidgets
6 * and to instantiate these implementations on demand 6 * and to instantiate these implementations on demand
7 */ 7 */
8 8
9#include <qwidget.h> 9#include <qwidget.h>
10#include <qmap.h> 10#include <qmap.h>
11 11
12#include <qpe/config.h> 12#include <qpe/config.h>
13 13
14#include "io_layer.h" 14#include "io_layer.h"
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
19class MetaFactory { 19class MetaFactory {
20public: 20public:
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
28 void addConfigWidgetFactory( const QString&, 28 void addConfigWidgetFactory( const QString&,
29 const QString&, 29 const QString&,
30 configWidget ); 30 configWidget );
31 void addIOLayerFactory(const QString&, 31 void addIOLayerFactory(const QString&,
32 iolayer ); 32 iolayer );
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
43private: 43private:
44 QMap<QString, configWidget> m_confFact; 44 QMap<QString, configWidget> m_confFact;
45 QMap<QString, iolayer> m_layerFact; 45 QMap<QString, iolayer> m_layerFact;
46 QMap<QString, filelayer> m_fileFact; 46 QMap<QString, filelayer> m_fileFact;
47 QMap<QString, QString> m_namemap; 47 QMap<QString, QString> m_namemap;
48}; 48};
49 49
50 50
51#endif 51#endif
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
@@ -1,178 +1,188 @@
1 1
2#include "profileeditordialog.h" 2#include "profileeditordialog.h"
3 3
4#include "qlayout.h" 4#include "qlayout.h"
5#include "qlineedit.h" 5#include "qlineedit.h"
6#include "qlabel.h" 6#include "qlabel.h"
7#include "qmessagebox.h" 7#include "qmessagebox.h"
8#include "qstringlist.h" 8#include "qstringlist.h"
9#include "qcombobox.h" 9#include "qcombobox.h"
10 10
11#include "profileeditorplugins.h" 11#include "profileeditorplugins.h"
12#include "metafactory.h" 12#include "metafactory.h"
13 13
14ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, 14ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact,
15 const Profile& prof ) 15 const Profile& prof )
16 : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) 16 : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof )
17{ 17{
18 initUI(); 18 initUI();
19 19
20 // Apply current profile 20 // Apply current profile
21 // plugin_plugin->load(profile); 21 // plugin_plugin->load(profile);
22 // ... (reset profile name line edit etc.) 22 // ... (reset profile name line edit etc.)
23} 23}
24 24
25ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) 25ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
26 : QTabDialog(0, 0, TRUE), m_fact( fact ) 26 : QTabDialog(0, 0, TRUE), m_fact( fact )
27{ 27{
28 // Default profile 28 // Default profile
29 m_prof = Profile(QString::null, "serial", Profile::Black, Profile::White, Profile::VT102); 29 m_prof = Profile(QString::null, "serial", Profile::Black, Profile::White, Profile::VT102);
30 30
31 initUI(); 31 initUI();
32 32
33 // Apply current profile 33 // Apply current profile
34 // plugin_plugin->load(profile); 34 // plugin_plugin->load(profile);
35} 35}
36 36
37Profile ProfileEditorDialog::profile() const 37Profile ProfileEditorDialog::profile() const
38{ 38{
39 return m_prof; 39 return m_prof;
40} 40}
41 41
42void ProfileEditorDialog::initUI() 42void ProfileEditorDialog::initUI()
43{ 43{
44 QWidget *tabterm, *tabconn, *tabprof; 44 QWidget *tabterm, *tabconn, *tabprof;
45 45
46 tabprof = new QWidget(this); 46 tabprof = new QWidget(this);
47 tabterm = new QWidget(this); 47 tabterm = new QWidget(this);
48 tabconn = new QWidget(this); 48 tabconn = new QWidget(this);
49 49
50 // for the time being: fake factory 50 // for the time being: fake factory
51 51
52 m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial); 52 m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial);
53 m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda); 53 m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda);
54 m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem); 54 m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem);
55 55
56 // profile tab 56 // profile tab
57 57
58 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); 58 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
59 59
60 name_line = new QLineEdit(tabprof); 60 name_line = new QLineEdit(tabprof);
61 61
62 // connection tab, fixed part 62 // connection tab, fixed part
63 63
64 QLabel *device = new QLabel(QObject::tr("Device"), tabconn); 64 QLabel *device = new QLabel(QObject::tr("Device"), tabconn);
65 65
66 device_box = new QComboBox(tabconn); 66 device_box = new QComboBox(tabconn);
67 67
68 QStringList w = m_fact->configWidgets(); 68 QStringList w = m_fact->configWidgets();
69 for(QStringList::Iterator it = w.begin(); it != w.end(); it++) 69 for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
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);
83 83
84 // terminal tab 84 // terminal tab
85 85
86 QWidget *term_widget = plugin_plugin->terminal_widget(); 86 QWidget *term_widget = plugin_plugin->terminal_widget();
87 term_widget->reparent(tabterm, 0, QPoint(), true); 87 term_widget->reparent(tabterm, 0, QPoint(), true);
88 88
89 // layouting 89 // layouting
90 90
91 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); 91 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
92 vbox3->add(name); 92 vbox3->add(name);
93 vbox3->add(name_line); 93 vbox3->add(name_line);
94 vbox3->addStretch(1); 94 vbox3->addStretch(1);
95 95
96 QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); 96 QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2);
97 vbox->add(device); 97 vbox->add(device);
98 vbox->add(device_box); 98 vbox->add(device_box);
99 vbox->add(plugin_base); 99 vbox->add(plugin_base);
100 vbox->add(conn_widget); 100 vbox->add(conn_widget);
101 101
102 QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2); 102 QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2);
103 vbox2->add(term_widget); 103 vbox2->add(term_widget);
104 104
105 addTab(tabprof, QObject::tr("Profile")); 105 addTab(tabprof, QObject::tr("Profile"));
106 addTab(tabconn, QObject::tr("Connection")); 106 addTab(tabconn, QObject::tr("Connection"));
107 addTab(tabterm, QObject::tr("Terminal")); 107 addTab(tabterm, QObject::tr("Terminal"));
108 108
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}
121 130
122ProfileEditorDialog::~ProfileEditorDialog() { 131ProfileEditorDialog::~ProfileEditorDialog() {
123 132
124} 133}
125 134
126void ProfileEditorDialog::slotDevice(int id) 135void 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
137 //plugin_plugin->show(); 146 //plugin_plugin->show();
138 plugin_plugin->widget()->show(); 147 plugin_plugin->widget()->show();
139} 148}
140 149
141void ProfileEditorDialog::accept() 150void ProfileEditorDialog::accept()
142{ 151{
143 if(prof_name().isEmpty()) 152 if(prof_name().isEmpty())
144 { 153 {
145 QMessageBox::information(this, 154 QMessageBox::information(this,
146 QObject::tr("Invalid profile"), 155 QObject::tr("Invalid profile"),
147 QObject::tr("Please enter a profile name.")); 156 QObject::tr("Please enter a profile name."));
148 return; 157 return;
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
159void ProfileEditorDialog::slotCancel() 169void ProfileEditorDialog::slotCancel()
160{ 170{
161 reject(); 171 reject();
162} 172}
163 173
164QString ProfileEditorDialog::prof_name() 174QString ProfileEditorDialog::prof_name()
165{ 175{
166 return name_line->text(); 176 return name_line->text();
167} 177}
168 178
169QString ProfileEditorDialog::prof_type() 179QString ProfileEditorDialog::prof_type()
170{ 180{
171 QStringList w = m_fact->configWidgets(); 181 QStringList w = m_fact->configWidgets();
172 for(QStringList::Iterator it = w.begin(); it != w.end(); it++) 182 for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
173 if(device_box->currentText() == m_fact->name((*it))) return (*it); 183 if(device_box->currentText() == m_fact->name((*it))) return (*it);
174 184
175 return QString::null; 185 return QString::null;
176} 186}
177 187
178 188
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
@@ -1,479 +1,483 @@
1 1
2#include "profileeditorplugins.h" 2#include "profileeditorplugins.h"
3#include "profile.h" 3#include "profile.h"
4 4
5#include "qframe.h" 5#include "qframe.h"
6#include "qlabel.h" 6#include "qlabel.h"
7#include "qlineedit.h" 7#include "qlineedit.h"
8#include "qlayout.h" 8#include "qlayout.h"
9#include "qcombobox.h" 9#include "qcombobox.h"
10#include "qradiobutton.h" 10#include "qradiobutton.h"
11#include "qcheckbox.h" 11#include "qcheckbox.h"
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
18ProfileEditorPlugin::ProfileEditorPlugin(QWidget *parent, Profile p) 18ProfileEditorPlugin::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
25ProfileEditorPlugin::~ProfileEditorPlugin() 25ProfileEditorPlugin::~ProfileEditorPlugin()
26{ 26{
27 if(m_widget) delete m_widget; 27 if(m_widget) delete m_widget;
28} 28}
29 29
30QWidget *ProfileEditorPlugin::connection_widget() 30QWidget *ProfileEditorPlugin::connection_widget()
31{ 31{
32 QWidget *root; 32 QWidget *root;
33 QVBoxLayout *lroot; 33 QVBoxLayout *lroot;
34 34
35 root = new QWidget(); 35 root = new QWidget();
36 36
37 // Build GUI 37 // Build GUI
38 38
39 QComboBox *speed_box = new QComboBox(root); 39 QComboBox *speed_box = new QComboBox(root);
40 speed_box->insertItem("115200 baud", id_baud_115200); 40 speed_box->insertItem("115200 baud", id_baud_115200);
41 speed_box->insertItem("57600 baud", id_baud_57600); 41 speed_box->insertItem("57600 baud", id_baud_57600);
42 speed_box->insertItem("38400 baud", id_baud_38400); 42 speed_box->insertItem("38400 baud", id_baud_38400);
43 speed_box->insertItem("19200 baud", id_baud_19200); 43 speed_box->insertItem("19200 baud", id_baud_19200);
44 speed_box->insertItem("9600 baud", id_baud_9600); 44 speed_box->insertItem("9600 baud", id_baud_9600);
45 45
46 QLabel *speedlabel = new QLabel(QObject::tr("Speed"), root); 46 QLabel *speedlabel = new QLabel(QObject::tr("Speed"), root);
47 QLabel *flow = new QLabel(QObject::tr("Flow control"), root); 47 QLabel *flow = new QLabel(QObject::tr("Flow control"), root);
48 QLabel *parity = new QLabel(QObject::tr("Parity"), root); 48 QLabel *parity = new QLabel(QObject::tr("Parity"), root);
49 49
50 QButtonGroup *group_flow = new QButtonGroup(root); 50 QButtonGroup *group_flow = new QButtonGroup(root);
51 group_flow->hide(); 51 group_flow->hide();
52 QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), root); 52 QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), root);
53 QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), root); 53 QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), root);
54 group_flow->insert(flow_hw, id_flow_hw); 54 group_flow->insert(flow_hw, id_flow_hw);
55 group_flow->insert(flow_sw, id_flow_sw); 55 group_flow->insert(flow_sw, id_flow_sw);
56 56
57 QButtonGroup *group_parity = new QButtonGroup(root); 57 QButtonGroup *group_parity = new QButtonGroup(root);
58 group_parity->hide(); 58 group_parity->hide();
59 QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), root); 59 QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), root);
60 QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), root); 60 QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), root);
61 group_parity->insert(parity_odd, id_parity_odd); 61 group_parity->insert(parity_odd, id_parity_odd);
62 group_parity->insert(parity_even, id_parity_even); 62 group_parity->insert(parity_even, id_parity_even);
63 63
64 // Build Layout 64 // Build Layout
65 65
66 lroot = new QVBoxLayout(root); 66 lroot = new QVBoxLayout(root);
67 lroot->add(speedlabel); 67 lroot->add(speedlabel);
68 lroot->add(speed_box); 68 lroot->add(speed_box);
69 lroot->add(flow); 69 lroot->add(flow);
70 QHBoxLayout *hbox = new QHBoxLayout(lroot, 2); 70 QHBoxLayout *hbox = new QHBoxLayout(lroot, 2);
71 hbox->add(flow_hw); 71 hbox->add(flow_hw);
72 hbox->add(flow_sw); 72 hbox->add(flow_sw);
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);
88 if(speed == 57600) speed_box->setCurrentItem(id_baud_57600); 89 if(speed == 57600) speed_box->setCurrentItem(id_baud_57600);
89 if(speed == 38400) speed_box->setCurrentItem(id_baud_38400); 90 if(speed == 38400) speed_box->setCurrentItem(id_baud_38400);
90 if(speed == 19200) speed_box->setCurrentItem(id_baud_19200); 91 if(speed == 19200) speed_box->setCurrentItem(id_baud_19200);
91 if(speed == 9600) speed_box->setCurrentItem(id_baud_9600); 92 if(speed == 9600) speed_box->setCurrentItem(id_baud_9600);
92 93
93 // Signals 94 // Signals
94 95
95 connect(group_flow, SIGNAL(clicked(int)), SLOT(slotConnFlow(int))); 96 connect(group_flow, SIGNAL(clicked(int)), SLOT(slotConnFlow(int)));
96 connect(group_parity, SIGNAL(clicked(int)), SLOT(slotConnParity(int))); 97 connect(group_parity, SIGNAL(clicked(int)), SLOT(slotConnParity(int)));
97 connect(speed_box, SIGNAL(activated(int)), SLOT(slotConnSpeed(int))); 98 connect(speed_box, SIGNAL(activated(int)), SLOT(slotConnSpeed(int)));
98 99
99 return root; 100 return root;
100} 101}
101 102
102QWidget *ProfileEditorPlugin::terminal_widget() 103QWidget *ProfileEditorPlugin::terminal_widget()
103{ 104{
104 QWidget *root; 105 QWidget *root;
105 QVBoxLayout *lroot; 106 QVBoxLayout *lroot;
106 107
107 root = new QWidget(); 108 root = new QWidget();
108 109
109 // Build GUI 110 // Build GUI
110 111
111 QComboBox *terminal_box = new QComboBox(root); 112 QComboBox *terminal_box = new QComboBox(root);
112 terminal_box->insertItem("VT 100", id_term_vt100); 113 terminal_box->insertItem("VT 100", id_term_vt100);
113 terminal_box->insertItem("VT 220", id_term_vt220); 114 terminal_box->insertItem("VT 220", id_term_vt220);
114 terminal_box->insertItem("ANSI", id_term_ansi); 115 terminal_box->insertItem("ANSI", id_term_ansi);
115 116
116 QLabel *terminal = new QLabel(QObject::tr("Terminal type"), root); 117 QLabel *terminal = new QLabel(QObject::tr("Terminal type"), root);
117 QLabel *colourlabel = new QLabel(QObject::tr("Colour scheme"), root); 118 QLabel *colourlabel = new QLabel(QObject::tr("Colour scheme"), root);
118 QLabel *sizelabel = new QLabel(QObject::tr("Font size"), root); 119 QLabel *sizelabel = new QLabel(QObject::tr("Font size"), root);
119 QLabel *options = new QLabel(QObject::tr("Options"), root); 120 QLabel *options = new QLabel(QObject::tr("Options"), root);
120 QLabel *conversions = new QLabel(QObject::tr("Line-break conversions"), root); 121 QLabel *conversions = new QLabel(QObject::tr("Line-break conversions"), root);
121 122
122 QComboBox *colour_box = new QComboBox(root); 123 QComboBox *colour_box = new QComboBox(root);
123 colour_box->insertItem(QObject::tr("black on white"), id_term_black); 124 colour_box->insertItem(QObject::tr("black on white"), id_term_black);
124 colour_box->insertItem(QObject::tr("white on black"), id_term_white); 125 colour_box->insertItem(QObject::tr("white on black"), id_term_white);
125 126
126 QButtonGroup *group_size = new QButtonGroup(root); 127 QButtonGroup *group_size = new QButtonGroup(root);
127 group_size->hide(); 128 group_size->hide();
128 QRadioButton *size_small = new QRadioButton(QObject::tr("small"), root); 129 QRadioButton *size_small = new QRadioButton(QObject::tr("small"), root);
129 QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), root); 130 QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), root);
130 QRadioButton *size_large = new QRadioButton(QObject::tr("large"), root); 131 QRadioButton *size_large = new QRadioButton(QObject::tr("large"), root);
131 group_size->insert(size_small); 132 group_size->insert(size_small);
132 group_size->insert(size_medium); 133 group_size->insert(size_medium);
133 group_size->insert(size_large); 134 group_size->insert(size_large);
134 135
135 QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), root); 136 QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), root);
136 QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), root); 137 QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), root);
137 138
138 QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), root); 139 QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), root);
139 QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), root); 140 QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), root);
140 141
141 // Build Layout 142 // Build Layout
142 143
143 lroot = new QVBoxLayout(root, 2); 144 lroot = new QVBoxLayout(root, 2);
144 lroot->add(terminal); 145 lroot->add(terminal);
145 lroot->add(terminal_box); 146 lroot->add(terminal_box);
146 lroot->add(sizelabel); 147 lroot->add(sizelabel);
147 QHBoxLayout *hbox = new QHBoxLayout(lroot, 2); 148 QHBoxLayout *hbox = new QHBoxLayout(lroot, 2);
148 hbox->add(size_small); 149 hbox->add(size_small);
149 hbox->add(size_medium); 150 hbox->add(size_medium);
150 hbox->add(size_large); 151 hbox->add(size_large);
151 lroot->add(colourlabel); 152 lroot->add(colourlabel);
152 lroot->add(colour_box); 153 lroot->add(colour_box);
153 lroot->add(conversions); 154 lroot->add(conversions);
154 QHBoxLayout *hbox2 = new QHBoxLayout(lroot, 2); 155 QHBoxLayout *hbox2 = new QHBoxLayout(lroot, 2);
155 hbox2->add(conv_inbound); 156 hbox2->add(conv_inbound);
156 hbox2->add(conv_outbound); 157 hbox2->add(conv_outbound);
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
176 if(fontsize == Profile::Micro) size_small->setChecked(true); 178 if(fontsize == Profile::Micro) size_small->setChecked(true);
177 if(fontsize == Profile::Small) size_medium->setChecked(true); 179 if(fontsize == Profile::Small) size_medium->setChecked(true);
178 if(fontsize == Profile::Medium) size_large->setChecked(true); 180 if(fontsize == Profile::Medium) size_large->setChecked(true);
179 181
180 if(opt_echo) option_echo->setChecked(true); 182 if(opt_echo) option_echo->setChecked(true);
181 if(opt_wrap) option_wrap->setChecked(true); 183 if(opt_wrap) option_wrap->setChecked(true);
182 if(opt_inbound) conv_inbound->setChecked(true); 184 if(opt_inbound) conv_inbound->setChecked(true);
183 if(opt_outbound) conv_outbound->setChecked(true); 185 if(opt_outbound) conv_outbound->setChecked(true);
184 186
185 // Signals 187 // Signals
186 188
187 connect(terminal_box, SIGNAL(activated(int)), SLOT(slotTermTerm(int))); 189 connect(terminal_box, SIGNAL(activated(int)), SLOT(slotTermTerm(int)));
188 connect(colour_box, SIGNAL(activated(int)), SLOT(slotTermColour(int))); 190 connect(colour_box, SIGNAL(activated(int)), SLOT(slotTermColour(int)));
189 connect(group_size, SIGNAL(clicked(int)), SLOT(slotTermFont(int))); 191 connect(group_size, SIGNAL(clicked(int)), SLOT(slotTermFont(int)));
190 192
191 connect(option_echo, SIGNAL(toggled(bool)), SLOT(slotTermEcho(bool))); 193 connect(option_echo, SIGNAL(toggled(bool)), SLOT(slotTermEcho(bool)));
192 connect(option_wrap, SIGNAL(toggled(bool)), SLOT(slotTermWrap(bool))); 194 connect(option_wrap, SIGNAL(toggled(bool)), SLOT(slotTermWrap(bool)));
193 connect(conv_inbound, SIGNAL(toggled(bool)), SLOT(slotTermInbound(bool))); 195 connect(conv_inbound, SIGNAL(toggled(bool)), SLOT(slotTermInbound(bool)));
194 connect(conv_outbound, SIGNAL(toggled(bool)), SLOT(slotTermOutbound(bool))); 196 connect(conv_outbound, SIGNAL(toggled(bool)), SLOT(slotTermOutbound(bool)));
195 197
196 return root; 198 return root;
197} 199}
198 200
199void ProfileEditorPlugin::slotConnFlow(int id) 201void 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
212void ProfileEditorPlugin::slotConnParity(int id) 214void 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
225void ProfileEditorPlugin::slotConnSpeed(int id) 227void 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
248void ProfileEditorPlugin::slotTermTerm(int id) 250void 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
264void ProfileEditorPlugin::slotTermColour(int id) 266void 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
277void ProfileEditorPlugin::slotTermFont(int id) 279void 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
293void ProfileEditorPlugin::slotTermEcho(bool on) 295void 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
298void ProfileEditorPlugin::slotTermWrap(bool on) 300void 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
303void ProfileEditorPlugin::slotTermInbound(bool on) 305void 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
308void ProfileEditorPlugin::slotTermOutbound(bool on) 310void 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
315class ProfileEditorPluginSerial : public ProfileEditorPlugin 317class 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 {
326 } 328 }
327 329
328 QWidget *widget() 330 QWidget *widget()
329 { 331 {
330 if(!m_widget) 332 if(!m_widget)
331 { 333 {
332 QFrame *device_frame = new QFrame(m_parent); 334 QFrame *device_frame = new QFrame(m_parent);
333 device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); 335 device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken);
334 336
335 QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); 337 QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame);
336 338
337 device_line = new QLineEdit("/dev/ttyS0", device_frame); 339 device_line = new QLineEdit("/dev/ttyS0", device_frame);
338 340
339 QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); 341 QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2);
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
363class ProfileEditorPluginIrda : public ProfileEditorPlugin 366class 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 {
374 } 377 }
375 378
376 QWidget *widget() 379 QWidget *widget()
377 { 380 {
378 if(!m_widget) 381 if(!m_widget)
379 { 382 {
380 QFrame *device_frame = new QFrame(m_parent); 383 QFrame *device_frame = new QFrame(m_parent);
381 device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); 384 device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken);
382 385
383 QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); 386 QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame);
384 387
385 device_line = new QLineEdit("/dev/ircomm0", device_frame); 388 device_line = new QLineEdit("/dev/ircomm0", device_frame);
386 389
387 QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); 390 QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2);
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
411class ProfileEditorPluginModem : public ProfileEditorPlugin 414class 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 {
422 } 425 }
423 426
424 QWidget *widget() 427 QWidget *widget()
425 { 428 {
426 if(!m_widget) 429 if(!m_widget)
427 { 430 {
428 QFrame *device_frame = new QFrame(m_parent); 431 QFrame *device_frame = new QFrame(m_parent);
429 device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); 432 device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken);
430 433
431 QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); 434 QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame);
432 QLabel *frame_number = new QLabel(QObject::tr("Phone number"), device_frame); 435 QLabel *frame_number = new QLabel(QObject::tr("Phone number"), device_frame);
433 436
434 device_line = new QLineEdit("/dev/ttyS0", device_frame); 437 device_line = new QLineEdit("/dev/ttyS0", device_frame);
435 number_line = new QLineEdit(device_frame); 438 number_line = new QLineEdit(device_frame);
436 439
437 QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); 440 QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2);
438 vbox_frame->add(frame_device); 441 vbox_frame->add(frame_device);
439 vbox_frame->add(device_line); 442 vbox_frame->add(device_line);
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
465ProfileEditorPlugin *factory_serial(QWidget *parent, const Profile& p) 469ProfileEditorPlugin *factory_serial(QWidget *parent, Profile *p)
466{ 470{
467 return new ProfileEditorPluginSerial(parent, p); 471 return new ProfileEditorPluginSerial(parent, p);
468} 472}
469 473
470ProfileEditorPlugin *factory_irda(QWidget *parent, const Profile& p) 474ProfileEditorPlugin *factory_irda(QWidget *parent, Profile *p)
471{ 475{
472 return new ProfileEditorPluginIrda(parent, p); 476 return new ProfileEditorPluginIrda(parent, p);
473} 477}
474 478
475ProfileEditorPlugin *factory_modem(QWidget *parent, const Profile& p) 479ProfileEditorPlugin *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
@@ -1,97 +1,97 @@
1#ifndef PROFILE_EDITOR_PLUGINS_H 1#ifndef PROFILE_EDITOR_PLUGINS_H
2#define PROFILE_EDITOR_PLUGINS_H 2#define PROFILE_EDITOR_PLUGINS_H
3 3
4#include "profile.h" 4#include "profile.h"
5 5
6#include "qobject.h" 6#include "qobject.h"
7 7
8class QWidget; 8class QWidget;
9 9
10class ProfileEditorPlugin : public QObject 10class 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;
21 21
22 QWidget *connection_widget(); 22 QWidget *connection_widget();
23 QWidget *terminal_widget(); 23 QWidget *terminal_widget();
24 24
25 public slots: 25 public slots:
26 void slotConnFlow(int id); 26 void slotConnFlow(int id);
27 void slotConnParity(int id); 27 void slotConnParity(int id);
28 void slotConnSpeed(int id); 28 void slotConnSpeed(int id);
29 void slotTermTerm(int id); 29 void slotTermTerm(int id);
30 void slotTermColour(int id); 30 void slotTermColour(int id);
31 void slotTermFont(int id); 31 void slotTermFont(int id);
32 void slotTermEcho(bool on); 32 void slotTermEcho(bool on);
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
46 }; 46 };
47 47
48 enum FlowIds 48 enum FlowIds
49 { 49 {
50 id_flow_hw, 50 id_flow_hw,
51 id_flow_sw 51 id_flow_sw
52 }; 52 };
53 53
54 enum SpeedIds 54 enum SpeedIds
55 { 55 {
56 id_baud_115200, 56 id_baud_115200,
57 id_baud_57600, 57 id_baud_57600,
58 id_baud_38400, 58 id_baud_38400,
59 id_baud_19200, 59 id_baud_19200,
60 id_baud_9600 60 id_baud_9600
61 }; 61 };
62 62
63 enum TermIds 63 enum TermIds
64 { 64 {
65 id_term_vt100, 65 id_term_vt100,
66 id_term_vt220, 66 id_term_vt220,
67 id_term_ansi 67 id_term_ansi
68 }; 68 };
69 69
70 enum ColourIds 70 enum ColourIds
71 { 71 {
72 id_term_black, 72 id_term_black,
73 id_term_white 73 id_term_white
74 }; 74 };
75 75
76 enum FontIds 76 enum FontIds
77 { 77 {
78 id_size_small, 78 id_size_small,
79 id_size_medium, 79 id_size_medium,
80 id_size_large 80 id_size_large
81 }; 81 };
82}; 82};
83 83
84//#ifdef __cplusplus 84//#ifdef __cplusplus
85//extern "C" { 85//extern "C" {
86//#endif 86//#endif
87 87
88ProfileEditorPlugin *factory_serial(QWidget *parent, const Profile& p); 88ProfileEditorPlugin *factory_serial(QWidget *parent, Profile *p);
89ProfileEditorPlugin *factory_irda(QWidget *parent, const Profile& p); 89ProfileEditorPlugin *factory_irda(QWidget *parent, Profile *p);
90ProfileEditorPlugin *factory_modem(QWidget *parent, const Profile& p); 90ProfileEditorPlugin *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
97 97