author | josef <josef> | 2002-10-07 11:19:00 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-07 11:19:00 (UTC) |
commit | 4fad0b73ae2940099bbb6f20bb94ed1f29e6d05b (patch) (unidiff) | |
tree | 892db7b819261208d0bc288d88b5d1c4a58ec486 | |
parent | 198ccce69447b515876e68cf7067e70da88cfb70 (diff) | |
download | opie-4fad0b73ae2940099bbb6f20bb94ed1f29e6d05b.zip opie-4fad0b73ae2940099bbb6f20bb94ed1f29e6d05b.tar.gz opie-4fad0b73ae2940099bbb6f20bb94ed1f29e6d05b.tar.bz2 |
- when editing, replace edited profile instead of inserting new one
- now save nearly all settings (not loaded yet)
-rw-r--r-- | noncore/apps/opie-console/configdialog.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 95 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.h | 30 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditorplugins.cpp | 20 |
4 files changed, 117 insertions, 35 deletions
diff --git a/noncore/apps/opie-console/configdialog.cpp b/noncore/apps/opie-console/configdialog.cpp index 655d649..ee1ffb4 100644 --- a/noncore/apps/opie-console/configdialog.cpp +++ b/noncore/apps/opie-console/configdialog.cpp | |||
@@ -1,109 +1,112 @@ | |||
1 | 1 | ||
2 | #include "profile.h" | 2 | #include "profile.h" |
3 | #include "qlistview.h" | 3 | #include "qlistview.h" |
4 | #include "configdialog.h" | 4 | #include "configdialog.h" |
5 | #include "profileeditordialog.h" | 5 | #include "profileeditordialog.h" |
6 | #include "metafactory.h" | 6 | #include "metafactory.h" |
7 | #include "qdialog.h" | 7 | #include "qdialog.h" |
8 | 8 | ||
9 | class ConfigListItem : public QListViewItem { | 9 | class ConfigListItem : public QListViewItem { |
10 | public: | 10 | public: |
11 | ConfigListItem( QListView* item, const Profile& ); | 11 | ConfigListItem( QListView* item, const Profile& ); |
12 | ~ConfigListItem(); | 12 | ~ConfigListItem(); |
13 | Profile profile()const; | 13 | Profile profile()const; |
14 | 14 | ||
15 | private: | 15 | private: |
16 | Profile m_prof; | 16 | Profile m_prof; |
17 | }; | 17 | }; |
18 | ConfigListItem::ConfigListItem( QListView* item, const Profile& prof ) | 18 | ConfigListItem::ConfigListItem( QListView* item, const Profile& prof ) |
19 | : QListViewItem( item ), m_prof( prof ) | 19 | : QListViewItem( item ), m_prof( prof ) |
20 | { | 20 | { |
21 | setText(0, prof.name() ); | 21 | setText(0, prof.name() ); |
22 | } | 22 | } |
23 | ConfigListItem::~ConfigListItem() { | 23 | ConfigListItem::~ConfigListItem() { |
24 | 24 | ||
25 | } | 25 | } |
26 | Profile ConfigListItem::profile()const { | 26 | Profile ConfigListItem::profile()const { |
27 | return m_prof; | 27 | return m_prof; |
28 | } | 28 | } |
29 | 29 | ||
30 | /* Dialog */ | 30 | /* Dialog */ |
31 | 31 | ||
32 | ConfigDialog::ConfigDialog( const Profile::ValueList& lis, QWidget* parent ) | 32 | ConfigDialog::ConfigDialog( const Profile::ValueList& lis, QWidget* parent ) |
33 | : ConfigureBase( parent, 0, TRUE ) | 33 | : ConfigureBase( parent, 0, TRUE ) |
34 | { | 34 | { |
35 | //init(); | 35 | //init(); |
36 | { | 36 | { |
37 | Profile::ValueList::ConstIterator it; | 37 | Profile::ValueList::ConstIterator it; |
38 | for (it = lis.begin(); it != lis.end(); ++it ) { | 38 | for (it = lis.begin(); it != lis.end(); ++it ) { |
39 | new ConfigListItem( lstView, (*it) ); | 39 | new ConfigListItem( lstView, (*it) ); |
40 | } | 40 | } |
41 | } | 41 | } |
42 | } | 42 | } |
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 | Profile p; | 67 | Profile p; |
68 | 68 | ||
69 | if(!lstView->currentItem()) return; | 69 | if(!lstView->currentItem()) return; |
70 | 70 | ||
71 | // Load profile | 71 | // Load profile |
72 | p = ((ConfigListItem*)lstView->currentItem())->profile(); | 72 | p = ((ConfigListItem*)lstView->currentItem())->profile(); |
73 | 73 | ||
74 | ProfileEditorDialog dlg(new MetaFactory(), p); | 74 | ProfileEditorDialog dlg(new MetaFactory(), p); |
75 | 75 | ||
76 | dlg.setCaption("Edit Connection Profile"); | 76 | dlg.setCaption("Edit Connection Profile"); |
77 | dlg.showMaximized(); | 77 | dlg.showMaximized(); |
78 | int ret = dlg.exec(); | 78 | int ret = dlg.exec(); |
79 | 79 | ||
80 | if(ret == QDialog::Accepted) | 80 | if(ret == QDialog::Accepted) |
81 | { | 81 | { |
82 | // if(listView->current()) delete lstView->current(); ... | 82 | if(lstView->currentItem()) delete lstView->currentItem(); |
83 | |||
83 | // use dlg.terminal()! | 84 | // use dlg.terminal()! |
84 | new ConfigListItem(lstView, Profile(dlg.prof_name(), dlg.prof_type(), Profile::White, Profile::Black, Profile::VT102)); | 85 | Profile p = dlg.profile(); |
86 | |||
87 | new ConfigListItem(lstView, p); | ||
85 | } | 88 | } |
86 | } | 89 | } |
87 | 90 | ||
88 | 91 | ||
89 | void ConfigDialog::slotAdd() { | 92 | void ConfigDialog::slotAdd() { |
90 | ProfileEditorDialog dlg(new MetaFactory()); | 93 | ProfileEditorDialog dlg(new MetaFactory()); |
91 | 94 | ||
92 | dlg.setCaption("New Connection"); | 95 | dlg.setCaption("New Connection"); |
93 | dlg.showMaximized(); | 96 | dlg.showMaximized(); |
94 | int ret = dlg.exec(); | 97 | int ret = dlg.exec(); |
95 | 98 | ||
96 | if(ret == QDialog::Accepted) | 99 | if(ret == QDialog::Accepted) |
97 | { | 100 | { |
98 | // TODO: Move into general profile save part | 101 | // TODO: Move into general profile save part |
99 | // assignments | 102 | // assignments |
100 | //QString type = dlg.term_type(); | 103 | //QString type = dlg.term_type(); |
101 | //if(type == "VT102") profile = Profile::VT102; | 104 | //if(type == "VT102") profile = Profile::VT102; |
102 | 105 | ||
103 | // get profile from editor | 106 | // get profile from editor |
104 | Profile p = dlg.profile(); | 107 | Profile p = dlg.profile(); |
105 | 108 | ||
106 | new ConfigListItem(lstView, p); | 109 | new ConfigListItem(lstView, p); |
107 | } | 110 | } |
108 | } | 111 | } |
109 | 112 | ||
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index fc95e56..5b7f851 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -1,274 +1,325 @@ | |||
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 "qradiobutton.h" | 7 | #include "qradiobutton.h" |
8 | #include "qcombobox.h" | 8 | #include "qcombobox.h" |
9 | #include "qcheckbox.h" | 9 | #include "qcheckbox.h" |
10 | #include "qmessagebox.h" | 10 | #include "qmessagebox.h" |
11 | #include "qbuttongroup.h" | 11 | #include "qbuttongroup.h" |
12 | #include "qstringlist.h" | 12 | #include "qstringlist.h" |
13 | 13 | ||
14 | #include "profileeditorplugins.h" | 14 | #include "profileeditorplugins.h" |
15 | #include "metafactory.h" | 15 | #include "metafactory.h" |
16 | 16 | ||
17 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, | 17 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, |
18 | const Profile& prof ) | 18 | const Profile& prof ) |
19 | : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) | 19 | : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) |
20 | { | 20 | { |
21 | initUI(); | 21 | initUI(); |
22 | 22 | ||
23 | // Apply current profile | 23 | // Apply current profile |
24 | // plugin_plugin->load(profile); | 24 | // plugin_plugin->load(profile); |
25 | // ... (reset profile name line edit etc.) | 25 | // ... (reset profile name line edit etc.) |
26 | } | 26 | } |
27 | 27 | ||
28 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | 28 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) |
29 | : QTabDialog(0, 0, TRUE), m_fact( fact ) | 29 | : QTabDialog(0, 0, TRUE), m_fact( fact ) |
30 | { | 30 | { |
31 | // Default profile | 31 | // Default profile |
32 | m_prof = Profile(QString::null, "serial", Profile::Black, Profile::White, Profile::VT102); | 32 | m_prof = Profile(QString::null, "serial", Profile::Black, Profile::White, Profile::VT102); |
33 | 33 | ||
34 | initUI(); | 34 | initUI(); |
35 | 35 | ||
36 | // Apply current profile | 36 | // Apply current profile |
37 | // plugin_plugin->load(profile); | 37 | // plugin_plugin->load(profile); |
38 | } | 38 | } |
39 | 39 | ||
40 | Profile ProfileEditorDialog::profile() const | 40 | Profile ProfileEditorDialog::profile() const |
41 | { | 41 | { |
42 | return m_prof; | 42 | return m_prof; |
43 | } | 43 | } |
44 | 44 | ||
45 | void ProfileEditorDialog::initUI() | 45 | void ProfileEditorDialog::initUI() |
46 | { | 46 | { |
47 | QWidget *tabterm, *tabconn, *tabprof; | 47 | QWidget *tabterm, *tabconn, *tabprof; |
48 | 48 | ||
49 | tabprof = new QWidget(this); | 49 | tabprof = new QWidget(this); |
50 | tabterm = new QWidget(this); | 50 | tabterm = new QWidget(this); |
51 | tabconn = new QWidget(this); | 51 | tabconn = new QWidget(this); |
52 | 52 | ||
53 | // for the time being: fake factory | 53 | // for the time being: fake factory |
54 | 54 | ||
55 | m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial); | 55 | m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial); |
56 | m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda); | 56 | m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda); |
57 | m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem); | 57 | m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem); |
58 | 58 | ||
59 | // profile tab | 59 | // profile tab |
60 | 60 | ||
61 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); | 61 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); |
62 | 62 | ||
63 | name_line = new QLineEdit(tabprof); | 63 | name_line = new QLineEdit(tabprof); |
64 | 64 | ||
65 | // connection tab, fixed part | 65 | // connection tab, fixed part |
66 | 66 | ||
67 | QLabel *device = new QLabel(QObject::tr("Device"), tabconn); | 67 | QLabel *device = new QLabel(QObject::tr("Device"), tabconn); |
68 | 68 | ||
69 | device_box = new QComboBox(tabconn); | 69 | device_box = new QComboBox(tabconn); |
70 | 70 | ||
71 | QStringList w = m_fact->configWidgets(); | 71 | QStringList w = m_fact->configWidgets(); |
72 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) | 72 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) |
73 | device_box->insertItem(m_fact->name((*it))); | 73 | device_box->insertItem(m_fact->name((*it))); |
74 | 74 | ||
75 | // connection tab, factory part | 75 | // connection tab, factory part |
76 | plugin_base = new QWidget(tabconn); | 76 | plugin_base = new QWidget(tabconn); |
77 | plugin_layout = new QHBoxLayout(plugin_base, 0); | 77 | plugin_layout = new QHBoxLayout(plugin_base, 0); |
78 | 78 | ||
79 | plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, m_prof); | 79 | plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, m_prof); |
80 | plugin_layout->add(plugin_plugin->widget()); | 80 | plugin_layout->add(plugin_plugin->widget()); |
81 | 81 | ||
82 | // connection tab, general part | 82 | // connection tab, general part |
83 | 83 | ||
84 | speed_box = new QComboBox(tabconn); | 84 | QComboBox *speed_box = new QComboBox(tabconn); |
85 | speed_box->insertItem("115200 baud"); | 85 | speed_box->insertItem("115200 baud", id_baud_115200); |
86 | speed_box->insertItem("57600 baud"); | 86 | speed_box->insertItem("57600 baud", id_baud_57600); |
87 | speed_box->insertItem("38400 baud"); | 87 | speed_box->insertItem("38400 baud", id_baud_38400); |
88 | speed_box->insertItem("19200 baud"); | 88 | speed_box->insertItem("19200 baud", id_baud_19200); |
89 | speed_box->insertItem("9600 baud"); | 89 | speed_box->insertItem("9600 baud", id_baud_9600); |
90 | 90 | ||
91 | QLabel *speed = new QLabel(QObject::tr("Speed"), tabconn); | 91 | QLabel *speed = new QLabel(QObject::tr("Speed"), tabconn); |
92 | QLabel *flow = new QLabel(QObject::tr("Flow control"), tabconn); | 92 | QLabel *flow = new QLabel(QObject::tr("Flow control"), tabconn); |
93 | QLabel *parity = new QLabel(QObject::tr("Parity"), tabconn); | 93 | QLabel *parity = new QLabel(QObject::tr("Parity"), tabconn); |
94 | 94 | ||
95 | QButtonGroup *group_flow = new QButtonGroup(tabconn); | 95 | QButtonGroup *group_flow = new QButtonGroup(tabconn); |
96 | group_flow->hide(); | 96 | group_flow->hide(); |
97 | QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), tabconn); | 97 | QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), tabconn); |
98 | QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), tabconn); | 98 | QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), tabconn); |
99 | group_flow->insert(flow_hw); | 99 | group_flow->insert(flow_hw, id_flow_hw); |
100 | group_flow->insert(flow_sw); | 100 | group_flow->insert(flow_sw, id_flow_sw); |
101 | 101 | ||
102 | QButtonGroup *group_parity = new QButtonGroup(tabconn); | 102 | QButtonGroup *group_parity = new QButtonGroup(tabconn); |
103 | group_parity->hide(); | 103 | group_parity->hide(); |
104 | QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), tabconn); | 104 | QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), tabconn); |
105 | QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), tabconn); | 105 | QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), tabconn); |
106 | group_parity->insert(parity_odd); | 106 | group_parity->insert(parity_odd, id_parity_odd); |
107 | group_parity->insert(parity_even); | 107 | group_parity->insert(parity_even, id_parity_even); |
108 | 108 | ||
109 | flow_sw->setChecked(true); | 109 | flow_sw->setChecked(true); |
110 | parity_odd->setChecked(true); | 110 | parity_odd->setChecked(true); |
111 | 111 | ||
112 | // terminal tab | 112 | // terminal tab |
113 | 113 | ||
114 | terminal_box = new QComboBox(tabterm); | 114 | QComboBox *terminal_box = new QComboBox(tabterm); |
115 | terminal_box->insertItem("VT 100"); | 115 | terminal_box->insertItem("VT 100", id_term_vt100); |
116 | terminal_box->insertItem("VT 220"); | 116 | terminal_box->insertItem("VT 220", id_term_vt220); |
117 | terminal_box->insertItem("ANSI"); | 117 | terminal_box->insertItem("ANSI", id_term_ansi); |
118 | 118 | ||
119 | QLabel *terminal = new QLabel(QObject::tr("Terminal type"), tabterm); | 119 | QLabel *terminal = new QLabel(QObject::tr("Terminal type"), tabterm); |
120 | QLabel *colour = new QLabel(QObject::tr("Colour scheme"), tabterm); | 120 | QLabel *colour = new QLabel(QObject::tr("Colour scheme"), tabterm); |
121 | QLabel *size = new QLabel(QObject::tr("Font size"), tabterm); | 121 | QLabel *size = new QLabel(QObject::tr("Font size"), tabterm); |
122 | QLabel *options = new QLabel(QObject::tr("Options"), tabterm); | 122 | QLabel *options = new QLabel(QObject::tr("Options"), tabterm); |
123 | QLabel *conversions = new QLabel(QObject::tr("Line-break conversions"), tabterm); | 123 | QLabel *conversions = new QLabel(QObject::tr("Line-break conversions"), tabterm); |
124 | 124 | ||
125 | QComboBox *colour_box = new QComboBox(tabterm); | 125 | QComboBox *colour_box = new QComboBox(tabterm); |
126 | colour_box->insertItem(QObject::tr("black on white")); | 126 | colour_box->insertItem(QObject::tr("black on white")); |
127 | colour_box->insertItem(QObject::tr("white on black")); | 127 | colour_box->insertItem(QObject::tr("white on black")); |
128 | 128 | ||
129 | QButtonGroup *group_size = new QButtonGroup(tabterm); | 129 | QButtonGroup *group_size = new QButtonGroup(tabterm); |
130 | group_size->hide(); | 130 | group_size->hide(); |
131 | QRadioButton *size_small = new QRadioButton(QObject::tr("small"), tabterm); | 131 | QRadioButton *size_small = new QRadioButton(QObject::tr("small"), tabterm); |
132 | QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), tabterm); | 132 | QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), tabterm); |
133 | QRadioButton *size_large = new QRadioButton(QObject::tr("large"), tabterm); | 133 | QRadioButton *size_large = new QRadioButton(QObject::tr("large"), tabterm); |
134 | group_size->insert(size_small); | 134 | group_size->insert(size_small); |
135 | group_size->insert(size_medium); | 135 | group_size->insert(size_medium); |
136 | group_size->insert(size_large); | 136 | group_size->insert(size_large); |
137 | 137 | ||
138 | QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), tabterm); | 138 | QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), tabterm); |
139 | QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), tabterm); | 139 | QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), tabterm); |
140 | 140 | ||
141 | QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), tabterm); | 141 | QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), tabterm); |
142 | QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), tabterm); | 142 | QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), tabterm); |
143 | 143 | ||
144 | size_small->setChecked(true); | 144 | size_small->setChecked(true); |
145 | 145 | ||
146 | // layouting | 146 | // layouting |
147 | 147 | ||
148 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); | 148 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); |
149 | vbox3->add(name); | 149 | vbox3->add(name); |
150 | vbox3->add(name_line); | 150 | vbox3->add(name_line); |
151 | vbox3->addStretch(1); | 151 | vbox3->addStretch(1); |
152 | 152 | ||
153 | QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); | 153 | QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); |
154 | vbox->add(device); | 154 | vbox->add(device); |
155 | vbox->add(device_box); | 155 | vbox->add(device_box); |
156 | vbox->add(plugin_base); | 156 | vbox->add(plugin_base); |
157 | vbox->add(speed); | 157 | vbox->add(speed); |
158 | vbox->add(speed_box); | 158 | vbox->add(speed_box); |
159 | vbox->add(flow); | 159 | vbox->add(flow); |
160 | QHBoxLayout *hbox = new QHBoxLayout(vbox, 2); | 160 | QHBoxLayout *hbox = new QHBoxLayout(vbox, 2); |
161 | hbox->add(flow_hw); | 161 | hbox->add(flow_hw); |
162 | hbox->add(flow_sw); | 162 | hbox->add(flow_sw); |
163 | //vbox->add(group_flow); | 163 | //vbox->add(group_flow); |
164 | vbox->add(parity); | 164 | vbox->add(parity); |
165 | QHBoxLayout *hbox2 = new QHBoxLayout(vbox, 2); | 165 | QHBoxLayout *hbox2 = new QHBoxLayout(vbox, 2); |
166 | hbox2->add(parity_odd); | 166 | hbox2->add(parity_odd); |
167 | hbox2->add(parity_even); | 167 | hbox2->add(parity_even); |
168 | //vbox->add(group_parity); | 168 | //vbox->add(group_parity); |
169 | 169 | ||
170 | QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2); | 170 | QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2); |
171 | vbox2->add(terminal); | 171 | vbox2->add(terminal); |
172 | vbox2->add(terminal_box); | 172 | vbox2->add(terminal_box); |
173 | vbox2->add(size); | 173 | vbox2->add(size); |
174 | QHBoxLayout *hbox3 = new QHBoxLayout(vbox2, 2); | 174 | QHBoxLayout *hbox3 = new QHBoxLayout(vbox2, 2); |
175 | hbox3->add(size_small); | 175 | hbox3->add(size_small); |
176 | hbox3->add(size_medium); | 176 | hbox3->add(size_medium); |
177 | hbox3->add(size_large); | 177 | hbox3->add(size_large); |
178 | //vbox2->add(group_size); | 178 | //vbox2->add(group_size); |
179 | vbox2->add(colour); | 179 | vbox2->add(colour); |
180 | vbox2->add(colour_box); | 180 | vbox2->add(colour_box); |
181 | vbox2->add(conversions); | 181 | vbox2->add(conversions); |
182 | QHBoxLayout *hbox5 = new QHBoxLayout(vbox2, 2); | 182 | QHBoxLayout *hbox5 = new QHBoxLayout(vbox2, 2); |
183 | hbox5->add(conv_inbound); | 183 | hbox5->add(conv_inbound); |
184 | hbox5->add(conv_outbound); | 184 | hbox5->add(conv_outbound); |
185 | vbox2->add(options); | 185 | vbox2->add(options); |
186 | QHBoxLayout *hbox4 = new QHBoxLayout(vbox2, 2); | 186 | QHBoxLayout *hbox4 = new QHBoxLayout(vbox2, 2); |
187 | hbox4->add(option_wrap); | 187 | hbox4->add(option_wrap); |
188 | hbox4->add(option_echo); | 188 | hbox4->add(option_echo); |
189 | 189 | ||
190 | addTab(tabprof, QObject::tr("Profile")); | 190 | addTab(tabprof, QObject::tr("Profile")); |
191 | addTab(tabconn, QObject::tr("Connection")); | 191 | addTab(tabconn, QObject::tr("Connection")); |
192 | addTab(tabterm, QObject::tr("Terminal")); | 192 | addTab(tabterm, QObject::tr("Terminal")); |
193 | 193 | ||
194 | setOkButton(QObject::tr("OK")); | 194 | setOkButton(QObject::tr("OK")); |
195 | setCancelButton(QObject::tr("Cancel")); | 195 | setCancelButton(QObject::tr("Cancel")); |
196 | 196 | ||
197 | // load profile values | 197 | // load profile values |
198 | 198 | ||
199 | name_line->setText(m_prof.name()); | 199 | name_line->setText(m_prof.name()); |
200 | 200 | ||
201 | // signals | 201 | // signals |
202 | 202 | ||
203 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); | 203 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); |
204 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); | 204 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); |
205 | |||
206 | connect(group_flow, SIGNAL(clicked(int)), SLOT(slotConn(int))); | ||
207 | connect(group_parity, SIGNAL(clicked(int)), SLOT(slotConn(int))); | ||
208 | connect(speed_box, SIGNAL(clicked(int)), SLOT(slotConn(int))); | ||
209 | |||
210 | connect(terminal_box, SIGNAL(clicked(int)), SLOT(slotConn(int))); | ||
211 | connect(group_size, SIGNAL(clicked(int)), SLOT(slotConn(int))); | ||
205 | } | 212 | } |
206 | 213 | ||
207 | ProfileEditorDialog::~ProfileEditorDialog() { | 214 | ProfileEditorDialog::~ProfileEditorDialog() { |
208 | 215 | ||
209 | } | 216 | } |
210 | 217 | ||
211 | void ProfileEditorDialog::slotDevice(int id) | 218 | void ProfileEditorDialog::slotDevice(int id) |
212 | { | 219 | { |
213 | delete plugin_plugin; | 220 | delete plugin_plugin; |
214 | 221 | ||
215 | plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, m_prof); | 222 | plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, m_prof); |
216 | plugin_layout->add(plugin_plugin->widget()); | 223 | plugin_layout->add(plugin_plugin->widget()); |
217 | 224 | ||
218 | // Reload profile associated to device, including e.g. conn_device() | 225 | // Reload profile associated to device, including e.g. conn_device() |
219 | // m_prof = plugin_plugin->profile() | 226 | // m_prof = plugin_plugin->profile() |
220 | // or, keeping the profile name: m_prof->reload(plugin_plugin->profile()) | 227 | // or, keeping the profile name: m_prof->reload(plugin_plugin->profile()) |
221 | 228 | ||
222 | //plugin_plugin->show(); | 229 | //plugin_plugin->show(); |
223 | plugin_plugin->widget()->show(); | 230 | plugin_plugin->widget()->show(); |
224 | } | 231 | } |
225 | 232 | ||
226 | void ProfileEditorDialog::accept() | 233 | void ProfileEditorDialog::accept() |
227 | { | 234 | { |
228 | if(prof_name().isEmpty()) | 235 | if(prof_name().isEmpty()) |
229 | { | 236 | { |
230 | QMessageBox::information(this, | 237 | QMessageBox::information(this, |
231 | QObject::tr("Invalid profile"), | 238 | QObject::tr("Invalid profile"), |
232 | QObject::tr("Please enter a profile name.")); | 239 | QObject::tr("Please enter a profile name.")); |
233 | return; | 240 | return; |
234 | } | 241 | } |
235 | |||
236 | // Save profile and plugin profile | 242 | // Save profile and plugin profile |
237 | if(plugin_plugin) plugin_plugin->save(); | 243 | if(plugin_plugin) plugin_plugin->save(); |
238 | 244 | ||
239 | // Save general values | 245 | // Save general values |
240 | m_prof.setName(prof_name()); | 246 | m_prof.setName(prof_name()); |
241 | 247 | ||
242 | QDialog::accept(); | 248 | QDialog::accept(); |
243 | } | 249 | } |
244 | 250 | ||
245 | void ProfileEditorDialog::slotCancel() | 251 | void ProfileEditorDialog::slotCancel() |
246 | { | 252 | { |
247 | reject(); | 253 | reject(); |
248 | } | 254 | } |
249 | 255 | ||
250 | QString ProfileEditorDialog::prof_name() | 256 | QString ProfileEditorDialog::prof_name() |
251 | { | 257 | { |
252 | return name_line->text(); | 258 | return name_line->text(); |
253 | } | 259 | } |
254 | 260 | ||
255 | QString ProfileEditorDialog::prof_type() | 261 | QString ProfileEditorDialog::prof_type() |
256 | { | 262 | { |
257 | QStringList w = m_fact->configWidgets(); | 263 | QStringList w = m_fact->configWidgets(); |
258 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) | 264 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) |
259 | if(device_box->currentText() == m_fact->name((*it))) return (*it); | 265 | if(device_box->currentText() == m_fact->name((*it))) return (*it); |
260 | 266 | ||
261 | return QString::null; | 267 | return QString::null; |
262 | } | 268 | } |
263 | 269 | ||
264 | QString ProfileEditorDialog::conn_device() | 270 | void ProfileEditorDialog::slotConn(int id) |
265 | { | 271 | { |
266 | //return frame_device_line->text(); | 272 | switch(id) |
267 | return "/dev/ttyS0"; | 273 | { |
274 | case id_flow_hw: | ||
275 | m_prof.writeEntry("Flow", 0x01); | ||
276 | break; | ||
277 | case id_flow_sw: | ||
278 | m_prof.writeEntry("Flow", 0x02); | ||
279 | break; | ||
280 | case id_parity_odd: | ||
281 | m_prof.writeEntry("Parity", 2); | ||
282 | break; | ||
283 | case id_parity_even: | ||
284 | m_prof.writeEntry("Parity", 1); | ||
285 | break; | ||
286 | |||
287 | case id_baud_115200: | ||
288 | m_prof.writeEntry("Speed", 115200); | ||
289 | break; | ||
290 | case id_baud_57600: | ||
291 | m_prof.writeEntry("Speed", 57600); | ||
292 | break; | ||
293 | case id_baud_38400: | ||
294 | m_prof.writeEntry("Speed", 38400); | ||
295 | break; | ||
296 | case id_baud_19200: | ||
297 | m_prof.writeEntry("Speed", 19200); | ||
298 | break; | ||
299 | case id_baud_9600: | ||
300 | m_prof.writeEntry("Speed", 9600); | ||
301 | break; | ||
302 | |||
303 | case id_term_vt100: | ||
304 | m_prof.writeEntry("Terminal", 2); | ||
305 | break; | ||
306 | case id_term_vt220: | ||
307 | m_prof.writeEntry("Terminal", 1); | ||
308 | break; | ||
309 | case id_term_ansi: | ||
310 | m_prof.writeEntry("Terminal", 0); | ||
311 | break; | ||
312 | |||
313 | case id_size_small: | ||
314 | m_prof.writeEntry("Font", 0); | ||
315 | break; | ||
316 | case id_size_medium: | ||
317 | m_prof.writeEntry("Font", 1); | ||
318 | break; | ||
319 | case id_size_large: | ||
320 | m_prof.writeEntry("Font", 2); | ||
321 | break; | ||
322 | } | ||
268 | } | 323 | } |
269 | 324 | ||
270 | QString ProfileEditorDialog::term_type() | ||
271 | { | ||
272 | return terminal_box->currentText(); | ||
273 | } | ||
274 | 325 | ||
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h index faabda0..0637f44 100644 --- a/noncore/apps/opie-console/profileeditordialog.h +++ b/noncore/apps/opie-console/profileeditordialog.h | |||
@@ -1,58 +1,74 @@ | |||
1 | #ifndef PROFILE_EDITOR_DIALOG | 1 | #ifndef PROFILE_EDITOR_DIALOG |
2 | #define PROFILE_EDITOR_DIALOG | 2 | #define PROFILE_EDITOR_DIALOG |
3 | 3 | ||
4 | #include <qtabdialog.h> | 4 | #include <qtabdialog.h> |
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 | class ProfileEditorPlugin; | 15 | class ProfileEditorPlugin; |
16 | 16 | ||
17 | class ProfileEditorDialog : public QTabDialog { | 17 | class ProfileEditorDialog : public QTabDialog { |
18 | Q_OBJECT | 18 | Q_OBJECT |
19 | public: | 19 | public: |
20 | ProfileEditorDialog(MetaFactory* fact, | 20 | ProfileEditorDialog(MetaFactory* fact, |
21 | const Profile& prof ); | 21 | const Profile& prof ); |
22 | ProfileEditorDialog(MetaFactory* fact ); | 22 | ProfileEditorDialog(MetaFactory* fact ); |
23 | ~ProfileEditorDialog(); | 23 | ~ProfileEditorDialog(); |
24 | Profile profile()const; | 24 | Profile profile()const; |
25 | 25 | ||
26 | QString prof_name(); | 26 | QString prof_name(); |
27 | QString prof_type(); | 27 | QString prof_type(); |
28 | 28 | ||
29 | QString conn_device(); | ||
30 | |||
31 | QString term_type(); | ||
32 | |||
33 | public slots: | 29 | public slots: |
34 | void accept(); | 30 | void accept(); |
35 | //void slotOk(); | 31 | //void slotOk(); |
36 | void slotCancel(); | 32 | void slotCancel(); |
37 | 33 | ||
38 | void slotDevice(int id); | 34 | void slotDevice(int id); |
39 | 35 | ||
36 | void slotConn(int id); | ||
37 | |||
40 | private: | 38 | private: |
41 | void initUI(); | 39 | void initUI(); |
42 | 40 | ||
43 | MetaFactory* m_fact; | 41 | MetaFactory* m_fact; |
44 | EditBase* m_base; | 42 | EditBase* m_base; |
45 | QTabWidget* m_tab; | 43 | QTabWidget* m_tab; |
46 | QHBoxLayout* m_lay; | 44 | QHBoxLayout* m_lay; |
47 | Profile m_prof; | 45 | Profile m_prof; |
48 | 46 | ||
49 | //QLabel *frame_number; | ||
50 | QLineEdit *name_line; | 47 | QLineEdit *name_line; |
51 | //QLineEdit *frame_device_line, *frame_number_line; | 48 | QComboBox *device_box; |
52 | QComboBox *terminal_box, *speed_box, *device_box; | 49 | |
53 | QWidget *plugin_base; | 50 | QWidget *plugin_base; |
54 | ProfileEditorPlugin *plugin_plugin; | 51 | ProfileEditorPlugin *plugin_plugin; |
55 | QHBoxLayout *plugin_layout; | 52 | QHBoxLayout *plugin_layout; |
53 | |||
54 | enum Ids | ||
55 | { | ||
56 | id_parity_odd, | ||
57 | id_parity_even, | ||
58 | id_flow_hw, | ||
59 | id_flow_sw, | ||
60 | id_baud_115200, | ||
61 | id_baud_57600, | ||
62 | id_baud_38400, | ||
63 | id_baud_19200, | ||
64 | id_baud_9600, | ||
65 | id_term_vt100, | ||
66 | id_term_vt220, | ||
67 | id_term_ansi, | ||
68 | id_size_small, | ||
69 | id_size_medium, | ||
70 | id_size_large | ||
71 | }; | ||
56 | }; | 72 | }; |
57 | 73 | ||
58 | #endif | 74 | #endif |
diff --git a/noncore/apps/opie-console/profileeditorplugins.cpp b/noncore/apps/opie-console/profileeditorplugins.cpp index 54eee3f..a11d6b0 100644 --- a/noncore/apps/opie-console/profileeditorplugins.cpp +++ b/noncore/apps/opie-console/profileeditorplugins.cpp | |||
@@ -1,164 +1,176 @@ | |||
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 | 9 | ||
10 | ProfileEditorPlugin::ProfileEditorPlugin(QWidget *parent, Profile p) | 10 | ProfileEditorPlugin::ProfileEditorPlugin(QWidget *parent, Profile p) |
11 | { | 11 | { |
12 | m_parent = parent; | 12 | m_parent = parent; |
13 | m_profile = p; | 13 | m_profile = p; |
14 | m_widget = NULL; | 14 | m_widget = NULL; |
15 | } | 15 | } |
16 | 16 | ||
17 | ProfileEditorPlugin::~ProfileEditorPlugin() | 17 | ProfileEditorPlugin::~ProfileEditorPlugin() |
18 | { | 18 | { |
19 | if(m_widget) delete m_widget; | 19 | if(m_widget) delete m_widget; |
20 | } | 20 | } |
21 | 21 | ||
22 | class ProfileEditorPluginSerial : public ProfileEditorPlugin | 22 | class ProfileEditorPluginSerial : public ProfileEditorPlugin |
23 | { | 23 | { |
24 | public: | 24 | public: |
25 | 25 | ||
26 | ProfileEditorPluginSerial(QWidget *parent, Profile p) | 26 | ProfileEditorPluginSerial(QWidget *parent, Profile p) |
27 | : ProfileEditorPlugin(parent, p) | 27 | : ProfileEditorPlugin(parent, p) |
28 | { | 28 | { |
29 | } | 29 | } |
30 | 30 | ||
31 | ~ProfileEditorPluginSerial() | 31 | ~ProfileEditorPluginSerial() |
32 | { | 32 | { |
33 | } | 33 | } |
34 | 34 | ||
35 | QWidget *widget() | 35 | QWidget *widget() |
36 | { | 36 | { |
37 | if(!m_widget) | 37 | if(!m_widget) |
38 | { | 38 | { |
39 | QFrame *device_frame = new QFrame(m_parent); | 39 | QFrame *device_frame = new QFrame(m_parent); |
40 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); | 40 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
41 | 41 | ||
42 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); | 42 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); |
43 | 43 | ||
44 | QLineEdit *frame_device_line = new QLineEdit("/dev/ttyS0", device_frame); | 44 | device_line = new QLineEdit("/dev/ttyS0", device_frame); |
45 | 45 | ||
46 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); | 46 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); |
47 | vbox_frame->add(frame_device); | 47 | vbox_frame->add(frame_device); |
48 | vbox_frame->add(frame_device_line); | 48 | vbox_frame->add(device_line); |
49 | 49 | ||
50 | m_widget = device_frame; | 50 | m_widget = device_frame; |
51 | } | 51 | } |
52 | 52 | ||
53 | return m_widget; | 53 | return m_widget; |
54 | } | 54 | } |
55 | 55 | ||
56 | void save() | 56 | void save() |
57 | { | 57 | { |
58 | // special settings | ||
59 | Profile p = m_profile; | ||
60 | p.writeEntry("Device", device_line->text()); | ||
58 | } | 61 | } |
62 | |||
63 | private: | ||
64 | QLineEdit *device_line; | ||
59 | }; | 65 | }; |
60 | 66 | ||
61 | class ProfileEditorPluginIrda : public ProfileEditorPlugin | 67 | class ProfileEditorPluginIrda : public ProfileEditorPlugin |
62 | { | 68 | { |
63 | public: | 69 | public: |
64 | 70 | ||
65 | ProfileEditorPluginIrda(QWidget *parent, Profile p) | 71 | ProfileEditorPluginIrda(QWidget *parent, Profile p) |
66 | : ProfileEditorPlugin(parent, p) | 72 | : ProfileEditorPlugin(parent, p) |
67 | { | 73 | { |
68 | } | 74 | } |
69 | 75 | ||
70 | ~ProfileEditorPluginIrda() | 76 | ~ProfileEditorPluginIrda() |
71 | { | 77 | { |
72 | } | 78 | } |
73 | 79 | ||
74 | QWidget *widget() | 80 | QWidget *widget() |
75 | { | 81 | { |
76 | if(!m_widget) | 82 | if(!m_widget) |
77 | { | 83 | { |
78 | QFrame *device_frame = new QFrame(m_parent); | 84 | QFrame *device_frame = new QFrame(m_parent); |
79 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); | 85 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
80 | 86 | ||
81 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); | 87 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); |
82 | 88 | ||
83 | QLineEdit *frame_device_line = new QLineEdit("/dev/ircomm0", device_frame); | 89 | device_line = new QLineEdit("/dev/ircomm0", device_frame); |
84 | 90 | ||
85 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); | 91 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); |
86 | vbox_frame->add(frame_device); | 92 | vbox_frame->add(frame_device); |
87 | vbox_frame->add(frame_device_line); | 93 | vbox_frame->add(device_line); |
88 | 94 | ||
89 | m_widget = device_frame; | 95 | m_widget = device_frame; |
90 | } | 96 | } |
91 | 97 | ||
92 | return m_widget; | 98 | return m_widget; |
93 | } | 99 | } |
94 | 100 | ||
95 | void save() | 101 | void save() |
96 | { | 102 | { |
103 | // special settings | ||
104 | Profile p = m_profile; | ||
105 | p.writeEntry("Device", device_line->text()); | ||
97 | } | 106 | } |
107 | |||
108 | private: | ||
109 | QLineEdit *device_line; | ||
98 | }; | 110 | }; |
99 | 111 | ||
100 | class ProfileEditorPluginModem : public ProfileEditorPlugin | 112 | class ProfileEditorPluginModem : public ProfileEditorPlugin |
101 | { | 113 | { |
102 | public: | 114 | public: |
103 | 115 | ||
104 | ProfileEditorPluginModem(QWidget *parent, Profile p) | 116 | ProfileEditorPluginModem(QWidget *parent, Profile p) |
105 | : ProfileEditorPlugin(parent, p) | 117 | : ProfileEditorPlugin(parent, p) |
106 | { | 118 | { |
107 | } | 119 | } |
108 | 120 | ||
109 | ~ProfileEditorPluginModem() | 121 | ~ProfileEditorPluginModem() |
110 | { | 122 | { |
111 | } | 123 | } |
112 | 124 | ||
113 | QWidget *widget() | 125 | QWidget *widget() |
114 | { | 126 | { |
115 | if(!m_widget) | 127 | if(!m_widget) |
116 | { | 128 | { |
117 | QFrame *device_frame = new QFrame(m_parent); | 129 | QFrame *device_frame = new QFrame(m_parent); |
118 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); | 130 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
119 | 131 | ||
120 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); | 132 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); |
121 | QLabel *frame_number = new QLabel(QObject::tr("Phone number"), device_frame); | 133 | QLabel *frame_number = new QLabel(QObject::tr("Phone number"), device_frame); |
122 | 134 | ||
123 | device_line = new QLineEdit("/dev/ttyS0", device_frame); | 135 | device_line = new QLineEdit("/dev/ttyS0", device_frame); |
124 | number_line = new QLineEdit(device_frame); | 136 | number_line = new QLineEdit(device_frame); |
125 | 137 | ||
126 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); | 138 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); |
127 | vbox_frame->add(frame_device); | 139 | vbox_frame->add(frame_device); |
128 | vbox_frame->add(device_line); | 140 | vbox_frame->add(device_line); |
129 | vbox_frame->add(frame_number); | 141 | vbox_frame->add(frame_number); |
130 | vbox_frame->add(number_line); | 142 | vbox_frame->add(number_line); |
131 | 143 | ||
132 | m_widget = device_frame; | 144 | m_widget = device_frame; |
133 | } | 145 | } |
134 | 146 | ||
135 | return m_widget; | 147 | return m_widget; |
136 | } | 148 | } |
137 | 149 | ||
138 | void save() | 150 | void save() |
139 | { | 151 | { |
140 | // special settings | 152 | // special settings |
141 | Profile p = m_profile; | 153 | Profile p = m_profile; |
142 | p.writeEntry("Device", device_line->text()); | 154 | p.writeEntry("Device", device_line->text()); |
143 | p.writeEntry("Number", number_line->text()); | 155 | p.writeEntry("Number", number_line->text()); |
144 | } | 156 | } |
145 | 157 | ||
146 | private: | 158 | private: |
147 | QLineEdit *device_line, *number_line; | 159 | QLineEdit *device_line, *number_line; |
148 | }; | 160 | }; |
149 | 161 | ||
150 | ProfileEditorPlugin *factory_serial(QWidget *parent, const Profile& p) | 162 | ProfileEditorPlugin *factory_serial(QWidget *parent, const Profile& p) |
151 | { | 163 | { |
152 | return new ProfileEditorPluginSerial(parent, p); | 164 | return new ProfileEditorPluginSerial(parent, p); |
153 | } | 165 | } |
154 | 166 | ||
155 | ProfileEditorPlugin *factory_irda(QWidget *parent, const Profile& p) | 167 | ProfileEditorPlugin *factory_irda(QWidget *parent, const Profile& p) |
156 | { | 168 | { |
157 | return new ProfileEditorPluginIrda(parent, p); | 169 | return new ProfileEditorPluginIrda(parent, p); |
158 | } | 170 | } |
159 | 171 | ||
160 | ProfileEditorPlugin *factory_modem(QWidget *parent, const Profile& p) | 172 | ProfileEditorPlugin *factory_modem(QWidget *parent, const Profile& p) |
161 | { | 173 | { |
162 | return new ProfileEditorPluginModem(parent, p); | 174 | return new ProfileEditorPluginModem(parent, p); |
163 | } | 175 | } |
164 | 176 | ||