summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/atconfigdialog.cpp41
-rw-r--r--noncore/apps/opie-console/atconfigdialog.h5
-rw-r--r--noncore/apps/opie-console/io_modem.cpp16
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp6
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.cpp71
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.h6
6 files changed, 82 insertions, 63 deletions
diff --git a/noncore/apps/opie-console/atconfigdialog.cpp b/noncore/apps/opie-console/atconfigdialog.cpp
index ef6d1ae..87a08f6 100644
--- a/noncore/apps/opie-console/atconfigdialog.cpp
+++ b/noncore/apps/opie-console/atconfigdialog.cpp
@@ -1,182 +1,199 @@
1 1
2#include <qlineedit.h> 2#include <qlineedit.h>
3#include <qspinbox.h> 3#include <qspinbox.h>
4#include <qlayout.h> 4#include <qlayout.h>
5#include <qcombobox.h> 5#include <qcombobox.h>
6#include <qtabwidget.h> 6#include <qtabwidget.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <qcombobox.h> 8#include <qcombobox.h>
9#include <qscrollview.h> 9#include <qscrollview.h>
10 10
11#include "atconfigdialog.h" 11#include "atconfigdialog.h"
12 12
13 13
14ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 14ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
15 : QDialog( parent, name, modal, fl ) { 15 : QDialog( parent, name, modal, fl ) {
16 16
17 17
18 setCaption( tr( "Dialing parameter setup" ) ); 18 setCaption( tr( "Dialing parameter setup" ) );
19 19
20 QVBoxLayout *layout = new QVBoxLayout( this ); 20 QVBoxLayout *layout = new QVBoxLayout( this );
21 QTabWidget *tabWidget = new QTabWidget( this ); 21 QTabWidget *tabWidget = new QTabWidget( this );
22 22
23 tabWidget->addTab( tab0( this ), tr("Settings1") ); 23 tabWidget->addTab( tab0( this ), tr("Settings1") );
24 tabWidget->addTab( tab1( this ), tr("Settings2") ); 24 tabWidget->addTab( tab1( this ), tr("Settings2") );
25 25
26 layout->addWidget( tabWidget ); 26 layout->addWidget( tabWidget );
27 27
28} 28}
29 29
30QWidget* ATConfigDialog::tab0( QWidget* parent) { 30QWidget* ATConfigDialog::tab0( QWidget* parent) {
31 31
32 32
33 QScrollView* sv = new QScrollView( parent ); 33 QScrollView* sv = new QScrollView( parent );
34 34
35 QWidget *returnWidget = new QWidget( sv->viewport() ); 35 QWidget *returnWidget = new QWidget( sv->viewport() );
36 sv->setResizePolicy( QScrollView::AutoOneFit ); 36 sv->setResizePolicy( QScrollView::AutoOneFit );
37// sv->setHScrollBarMode( QScrollView::AlwaysOff ); 37// sv->setHScrollBarMode( QScrollView::AlwaysOff );
38// sv->setFrameShape( QFrame::NoFrame ); 38// sv->setFrameShape( QFrame::NoFrame );
39 39
40 40
41 41
42 42
43 QGridLayout *layout = new QGridLayout( returnWidget, 10, 2 ); 43 QGridLayout *layout = new QGridLayout( returnWidget, 10, 2 );
44 44
45 QLabel *initStringLabel = new QLabel( tr("Init string "), returnWidget ); 45 QLabel *initStringLabel = new QLabel( tr("Init string "), returnWidget );
46 initStringLine = new QLineEdit( returnWidget ); 46 initStringLine = new QLineEdit( returnWidget );
47 layout->addWidget( initStringLabel, 0, 0 ); 47 layout->addWidget( initStringLabel, 0, 0 );
48 layout->addWidget( initStringLine, 0, 1 ); 48 layout->addWidget( initStringLine, 0, 1 );
49 49
50 QLabel *resetStringLabel = new QLabel( tr("Reset string "), returnWidget ); 50 QLabel *resetStringLabel = new QLabel( tr("Reset string "), returnWidget );
51 resetStringLine = new QLineEdit( returnWidget ); 51 resetStringLine = new QLineEdit( returnWidget );
52 layout->addWidget( resetStringLabel, 1, 0 ); 52 layout->addWidget( resetStringLabel, 1, 0 );
53 layout->addWidget( resetStringLine, 1, 1 ); 53 layout->addWidget( resetStringLine, 1, 1 );
54 54
55 QLabel *dialPref1Label = new QLabel( tr("Dialing prefix #1 " ), returnWidget ); 55 QLabel *dialPref1Label = new QLabel( tr("Dialing prefix #1 " ), returnWidget );
56 dialPref1Line = new QLineEdit( returnWidget ); 56 dialPref1Line = new QLineEdit( returnWidget );
57 layout->addWidget( dialPref1Label, 2, 0 ); 57 layout->addWidget( dialPref1Label, 2, 0 );
58 layout->addWidget( dialPref1Line, 2, 1 ); 58 layout->addWidget( dialPref1Line, 2, 1 );
59 59
60 QLabel *dialSuf1Label = new QLabel( tr("Dialing suffix #1 " ), returnWidget ); 60 QLabel *dialSuf1Label = new QLabel( tr("Dialing suffix #1 " ), returnWidget );
61 dialSuf1Line = new QLineEdit( returnWidget ); 61 dialSuf1Line = new QLineEdit( returnWidget );
62 layout->addWidget( dialSuf1Label, 3, 0 ); 62 layout->addWidget( dialSuf1Label, 3, 0 );
63 layout->addWidget( dialSuf1Line, 3, 1 ); 63 layout->addWidget( dialSuf1Line, 3, 1 );
64 64
65 QLabel *dialPref2Label = new QLabel( tr("Dialing prefix #2 " ), returnWidget ); 65 QLabel *dialPref2Label = new QLabel( tr("Dialing prefix #2 " ), returnWidget );
66 dialPref2Line = new QLineEdit( returnWidget ); 66 dialPref2Line = new QLineEdit( returnWidget );
67 layout->addWidget( dialPref2Label, 4, 0 ); 67 layout->addWidget( dialPref2Label, 4, 0 );
68 layout->addWidget( dialPref2Line, 4, 1 ); 68 layout->addWidget( dialPref2Line, 4, 1 );
69 69
70 QLabel *dialSuf2Label = new QLabel( tr("Dialing suffix #2 " ), returnWidget ); 70 QLabel *dialSuf2Label = new QLabel( tr("Dialing suffix #2 " ), returnWidget );
71 dialSuf2Line = new QLineEdit( returnWidget ); 71 dialSuf2Line = new QLineEdit( returnWidget );
72 layout->addWidget( dialSuf2Label, 5, 0 ); 72 layout->addWidget( dialSuf2Label, 5, 0 );
73 layout->addWidget( dialSuf2Line, 5, 1 ); 73 layout->addWidget( dialSuf2Line, 5, 1 );
74 74
75 QLabel *dialPref3Label = new QLabel( tr("Dialing prefix #3 " ), returnWidget ); 75 QLabel *dialPref3Label = new QLabel( tr("Dialing prefix #3 " ), returnWidget );
76 dialPref3Line = new QLineEdit( returnWidget ); 76 dialPref3Line = new QLineEdit( returnWidget );
77 layout->addWidget( dialPref3Label, 6, 0 ); 77 layout->addWidget( dialPref3Label, 6, 0 );
78 layout->addWidget( dialPref3Line, 6, 1 ); 78 layout->addWidget( dialPref3Line, 6, 1 );
79 79
80 QLabel *dialSuf3Label = new QLabel( tr("Dialing suffix #3 " ), returnWidget ); 80 QLabel *dialSuf3Label = new QLabel( tr("Dialing suffix #3 " ), returnWidget );
81 dialSuf3Line = new QLineEdit( returnWidget ); 81 dialSuf3Line = new QLineEdit( returnWidget );
82 layout->addWidget( dialSuf3Label, 7, 0 ); 82 layout->addWidget( dialSuf3Label, 7, 0 );
83 layout->addWidget( dialSuf3Line, 7, 1 ); 83 layout->addWidget( dialSuf3Line, 7, 1 );
84 84
85 QLabel *connectLabel = new QLabel( tr("Connect string " ), returnWidget ); 85 QLabel *connectLabel = new QLabel( tr("Connect string " ), returnWidget );
86 connectLine = new QLineEdit( returnWidget ); 86 connectLine = new QLineEdit( returnWidget );
87 layout->addWidget( connectLabel, 8, 0 ); 87 layout->addWidget( connectLabel, 8, 0 );
88 layout->addWidget( connectLine, 8, 1 ); 88 layout->addWidget( connectLine, 8, 1 );
89 89
90 QLabel *hangupLabel = new QLabel( tr("Hang-up string " ), returnWidget ); 90 QLabel *hangupLabel = new QLabel( tr("Hang-up string " ), returnWidget );
91 hangupLine = new QLineEdit( returnWidget ); 91 hangupLine = new QLineEdit( returnWidget );
92 layout->addWidget( hangupLabel, 9, 0 ); 92 layout->addWidget( hangupLabel, 9, 0 );
93 layout->addWidget( hangupLine, 9, 1 ); 93 layout->addWidget( hangupLine, 9, 1 );
94 94
95 sv->addChild( returnWidget ); 95 sv->addChild( returnWidget );
96 96
97 return sv; 97 return sv;
98 98
99} 99}
100 100
101QWidget* ATConfigDialog::tab1( QWidget* parent ) { 101QWidget* ATConfigDialog::tab1( QWidget* parent ) {
102 102
103 103
104 QWidget *returnWidget = new QWidget( parent ); 104 QWidget *returnWidget = new QWidget( parent );
105 105
106 QGridLayout *layout = new QGridLayout( returnWidget, 8, 2 ); 106 QGridLayout *layout = new QGridLayout( returnWidget, 8, 2 );
107 107
108 QLabel *dialTimeLabel = new QLabel( tr("Dial time " ), returnWidget ); 108 QLabel *dialTimeLabel = new QLabel( tr("Dial time " ), returnWidget );
109 dialTimeSpin = new QSpinBox( returnWidget ); 109 dialTimeSpin = new QSpinBox( returnWidget );
110 layout->addWidget( dialTimeLabel, 0, 0 ); 110 layout->addWidget( dialTimeLabel, 0, 0 );
111 layout->addWidget( dialTimeSpin, 0, 1 ); 111 layout->addWidget( dialTimeSpin, 0, 1 );
112 112
113 QLabel *delayRedialLabel = new QLabel( tr("Delay before redial " ), returnWidget ); 113 QLabel *delayRedialLabel = new QLabel( tr("Delay before redial " ), returnWidget );
114 delayRedialSpin = new QSpinBox( returnWidget ); 114 delayRedialSpin = new QSpinBox( returnWidget );
115 layout->addWidget( delayRedialLabel, 1, 0 ); 115 layout->addWidget( delayRedialLabel, 1, 0 );
116 layout->addWidget( delayRedialSpin, 1, 1 ); 116 layout->addWidget( delayRedialSpin, 1, 1 );
117 117
118 QLabel *numberTriesLabel = new QLabel( tr("Number of tries " ), returnWidget ); 118 QLabel *numberTriesLabel = new QLabel( tr("Number of tries " ), returnWidget );
119 numberTriesSpin = new QSpinBox( returnWidget ); 119 numberTriesSpin = new QSpinBox( returnWidget );
120 layout->addWidget( numberTriesLabel, 2, 0 ); 120 layout->addWidget( numberTriesLabel, 2, 0 );
121 layout->addWidget( numberTriesSpin, 2, 1 ); 121 layout->addWidget( numberTriesSpin, 2, 1 );
122 122
123 QLabel *dtrDropTimeLabel = new QLabel( tr("DTR drop time (0=no) " ), returnWidget ); 123 QLabel *dtrDropTimeLabel = new QLabel( tr("DTR drop time (0=no) " ), returnWidget );
124 dtrDropTimeSpin = new QSpinBox( returnWidget ); 124 dtrDropTimeSpin = new QSpinBox( returnWidget );
125 layout->addWidget( dtrDropTimeLabel, 3, 0 ); 125 layout->addWidget( dtrDropTimeLabel, 3, 0 );
126 layout->addWidget( dtrDropTimeSpin, 3, 1 ); 126 layout->addWidget( dtrDropTimeSpin, 3, 1 );
127 127
128 QLabel *bpsDetectLabel = new QLabel( tr("Auto bps detect " ), returnWidget ); 128 QLabel *bpsDetectLabel = new QLabel( tr("Auto bps detect " ), returnWidget );
129 bpsDetectBox = new QComboBox( returnWidget ); 129 bpsDetectBox = new QComboBox( returnWidget );
130 layout->addWidget( bpsDetectLabel, 4, 0 ); 130 layout->addWidget( bpsDetectLabel, 4, 0 );
131 layout->addWidget( bpsDetectBox, 4, 1 ); 131 layout->addWidget( bpsDetectBox, 4, 1 );
132 bpsDetectBox->insertItem( tr("No") ); 132 bpsDetectBox->insertItem( tr("No") );
133 bpsDetectBox->insertItem( tr("Yes") ); 133 bpsDetectBox->insertItem( tr("Yes") );
134 134
135 QLabel *dcdLinesLabel = new QLabel( tr("Modem has DCD line " ), returnWidget ); 135 QLabel *dcdLinesLabel = new QLabel( tr("Modem has DCD line " ), returnWidget );
136 dcdLinesBox = new QComboBox( returnWidget ); 136 dcdLinesBox = new QComboBox( returnWidget );
137 layout->addWidget( dcdLinesLabel, 5, 0 ); 137 layout->addWidget( dcdLinesLabel, 5, 0 );
138 layout->addWidget( dcdLinesBox, 5, 1 ); 138 layout->addWidget( dcdLinesBox, 5, 1 );
139 dcdLinesBox->insertItem( tr("No") ); 139 dcdLinesBox->insertItem( tr("No") );
140 dcdLinesBox->insertItem( tr("Yes") ); 140 dcdLinesBox->insertItem( tr("Yes") );
141 141
142 QLabel *multiLineUntagLabel = new QLabel( tr("Multi-line untag " ), returnWidget ); 142 QLabel *multiLineUntagLabel = new QLabel( tr("Multi-line untag " ), returnWidget );
143 multiLineUntagBox = new QComboBox( returnWidget ); 143 multiLineUntagBox = new QComboBox( returnWidget );
144 layout->addWidget( multiLineUntagLabel, 6, 0 ); 144 layout->addWidget( multiLineUntagLabel, 6, 0 );
145 layout->addWidget( multiLineUntagBox, 6, 1 ); 145 layout->addWidget( multiLineUntagBox, 6, 1 );
146 multiLineUntagBox->insertItem( tr("No") ); 146 multiLineUntagBox->insertItem( tr("No") );
147 multiLineUntagBox->insertItem( tr("Yes") ); 147 multiLineUntagBox->insertItem( tr("Yes") );
148 148
149 return returnWidget; 149 return returnWidget;
150 150
151} 151}
152 152
153 153
154void ATConfigDialog::readConfig() { 154void ATConfigDialog::readConfig( const Profile& config ) {
155/* 155
156 initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); 156 initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) );
157 resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); 157 resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) );
158 dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 158 dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) );
159 dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 159 dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
160 dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 160 dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) );
161 dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 161 dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
162 dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 162 dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) );
163 dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 163 dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
164 connectLine->setText( config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ) ); 164 connectLine->setText( config.readEntry("DefaultConnect", MODEM_DEFAULT_CONNECT_STRING ) );
165 hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); 165 hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) );
166 dialTimeSpin; 166 dialTimeSpin->setValue( config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ) );
167 delayRedialSpin; 167 delayRedialSpin->setValue( config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ) );
168 numberTriesSpin; 168 numberTriesSpin->setValue( config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ) );
169 dtrDropTimeSpin; 169 dtrDropTimeSpin->setValue( config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ) );
170 bpsDetectBox; 170 bpsDetectBox->setCurrentItem( config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ) );
171 cdLinesBox; 171 dcdLinesBox->setCurrentItem( config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ) );
172 multiLineUntagBox; 172 multiLineUntagBox->setCurrentItem( config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ) );
173*/
174} 173}
175 174
176void ATConfigDialog::writeConfig() { 175void ATConfigDialog::writeConfig( Profile& config ) {
176
177 config.writeEntry( "InitString", initStringLine->text() );
178 config.writeEntry( "ResetString", resetStringLine->text() );
179 config.writeEntry( "DialPrefix1", dialPref1Line->text() );
180 config.writeEntry( "DialSuffix1", dialSuf1Line->text() );
181 config.writeEntry( "DialPrefix2", dialPref2Line->text() );
182 config.writeEntry( "DialSuffix2", dialSuf2Line->text() );
183 config.writeEntry( "DialPrefix3", dialPref3Line->text() );
184 config.writeEntry( "DialSuffix3", dialSuf3Line->text() );
185 config.writeEntry( "DefaultConnect", connectLine->text() );
186 config.writeEntry( "HangupString", hangupLine->text() );
187 config.writeEntry( "DialTime", dialTimeSpin->value() );
188 config.writeEntry( "DelayRedial", delayRedialSpin->value() );
189 config.writeEntry( "NumberTries", numberTriesSpin->value() );
190 config.writeEntry( "DTRDRopTime", dtrDropTimeSpin->value() );
191 config.writeEntry( "BPSDetect", bpsDetectBox->currentItem() );
192 config.writeEntry( "DCDLines", dcdLinesBox->currentItem() );
193 config.writeEntry( "MultiLineUntag", multiLineUntagBox->currentItem() );
177 194
178} 195}
179 196
180 197
181ATConfigDialog::~ATConfigDialog() { 198ATConfigDialog::~ATConfigDialog() {
182} 199}
diff --git a/noncore/apps/opie-console/atconfigdialog.h b/noncore/apps/opie-console/atconfigdialog.h
index 47ff01d..4dd033b 100644
--- a/noncore/apps/opie-console/atconfigdialog.h
+++ b/noncore/apps/opie-console/atconfigdialog.h
@@ -1,68 +1,69 @@
1 1
2#ifndef ATCONFIGDIALOG_H 2#ifndef ATCONFIGDIALOG_H
3#define ATCONFIGDIALOG_H 3#define ATCONFIGDIALOG_H
4 4
5#include <qdialog.h> 5#include <qdialog.h>
6#include "profile.h"
6 7
7#define MODEM_DEFAULT_INIT_STRING "~^M~ATZ^M~" 8#define MODEM_DEFAULT_INIT_STRING "~^M~ATZ^M~"
8#define MODEM_DEFAULT_RESET_STRING "~^M~ATZ^M~" 9#define MODEM_DEFAULT_RESET_STRING "~^M~ATZ^M~"
9#define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT" 10#define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT"
10#define MODEM_DEFAULT_DIAL_SUFFIX1 "^M" 11#define MODEM_DEFAULT_DIAL_SUFFIX1 "^M"
11#define MODEM_DEFAULT_DIAL_PREFIX2 "ATDP" 12#define MODEM_DEFAULT_DIAL_PREFIX2 "ATDP"
12#define MODEM_DEFAULT_DIAL_SUFFIX2 "^M" 13#define MODEM_DEFAULT_DIAL_SUFFIX2 "^M"
13#define MODEM_DEFAULT_DIAL_PREFIX3 "ATX1DT" 14#define MODEM_DEFAULT_DIAL_PREFIX3 "ATX1DT"
14#define MODEM_DEFAULT_DIAL_SUFFIX3 ";X4D^M" 15#define MODEM_DEFAULT_DIAL_SUFFIX3 ";X4D^M"
15#define MODEM_DEFAULT_CONNECT_STRING "CONNECT" 16#define MODEM_DEFAULT_CONNECT_STRING "CONNECT"
16#define MODEM_DEFAULT_HANGUP_STRING "~~+++~~ATH^M" 17#define MODEM_DEFAULT_HANGUP_STRING "~~+++~~ATH^M"
17#define MODEM_DEFAULT_CANCEL_STRING "^M" 18#define MODEM_DEFAULT_CANCEL_STRING "^M"
18#define MODEM_DEFAULT_DIAL_TIME 45 19#define MODEM_DEFAULT_DIAL_TIME 45
19#define MODEM_DEFAULT_DELAY_REDIAL 2 20#define MODEM_DEFAULT_DELAY_REDIAL 2
20#define MODEM_DEFAULT_NUMBER_TRIES 10 21#define MODEM_DEFAULT_NUMBER_TRIES 10
21#define MODEM_DEFAULT_DTR_DROP_TIME 1 22#define MODEM_DEFAULT_DTR_DROP_TIME 1
22#define MODEM_DEFAULT_BPS_DETECT 0 // bool 23#define MODEM_DEFAULT_BPS_DETECT 0 // bool
23#define MODEM_DEFAULT_DCD_LINES 1 //bool 24#define MODEM_DEFAULT_DCD_LINES 1 //bool
24#define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool 25#define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool
25 26
26class QLineEdit; 27class QLineEdit;
27class QSpinBox; 28class QSpinBox;
28class QComboBox; 29class QComboBox;
29 30
30class ATConfigDialog : public QDialog { 31class ATConfigDialog : public QDialog {
31 32
32 Q_OBJECT 33 Q_OBJECT
33 34
34public: 35public:
35 ATConfigDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 36 ATConfigDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
36 37
37 ~ATConfigDialog(); 38 ~ATConfigDialog();
38 39
39 void readConfig(); 40 void readConfig( const Profile& );
40 void writeConfig(); 41 void writeConfig( Profile& );
41 42
42private: 43private:
43 QWidget *tab0( QWidget* parent); 44 QWidget *tab0( QWidget* parent);
44 QWidget *tab1( QWidget* parent); 45 QWidget *tab1( QWidget* parent);
45 46
46private: 47private:
47 QLineEdit *initStringLine; 48 QLineEdit *initStringLine;
48 QLineEdit *resetStringLine; 49 QLineEdit *resetStringLine;
49 QLineEdit *dialPref1Line; 50 QLineEdit *dialPref1Line;
50 QLineEdit *dialSuf1Line; 51 QLineEdit *dialSuf1Line;
51 QLineEdit *dialPref2Line; 52 QLineEdit *dialPref2Line;
52 QLineEdit *dialSuf2Line; 53 QLineEdit *dialSuf2Line;
53 QLineEdit *dialPref3Line; 54 QLineEdit *dialPref3Line;
54 QLineEdit *dialSuf3Line; 55 QLineEdit *dialSuf3Line;
55 QLineEdit *connectLine; 56 QLineEdit *connectLine;
56 QLineEdit *hangupLine; 57 QLineEdit *hangupLine;
57 QSpinBox *dialTimeSpin; 58 QSpinBox *dialTimeSpin;
58 QSpinBox *delayRedialSpin; 59 QSpinBox *delayRedialSpin;
59 QSpinBox *numberTriesSpin; 60 QSpinBox *numberTriesSpin;
60 QSpinBox *dtrDropTimeSpin; 61 QSpinBox *dtrDropTimeSpin;
61 QComboBox *bpsDetectBox; 62 QComboBox *bpsDetectBox;
62 QComboBox *dcdLinesBox; 63 QComboBox *dcdLinesBox;
63 QComboBox *multiLineUntagBox; 64 QComboBox *multiLineUntagBox;
64 65
65}; 66};
66 67
67 68
68#endif 69#endif
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp
index 41febfb..eb0aeb7 100644
--- a/noncore/apps/opie-console/io_modem.cpp
+++ b/noncore/apps/opie-console/io_modem.cpp
@@ -1,73 +1,73 @@
1 1
2#include "io_modem.h" 2#include "io_modem.h"
3 3
4#include "dialer.h" 4#include "dialer.h"
5 5
6IOModem:IOModem( const Profile &config ) : IOSerial( config ) { 6IOModem:IOModem( const Profile &config ) : IOSerial( config ) {
7 m_config = config; 7 m_config = config;
8} 8}
9 9
10 10
11IOModem::~IOModem() { 11IOModem::~IOModem() {
12 12
13} 13}
14 14
15 15
16void IOModem::close() { 16void IOModem::close() {
17 17
18 IOSerial::close(); 18 IOSerial::close();
19 19
20} 20}
21 21
22bool IOModem::open() { 22bool IOModem::open() {
23 IOSerial::open(); 23 IOSerial::open();
24 24
25 Dialer d(m_profile); 25 Dialer d(m_profile);
26 int result = d.exec(); 26 int result = d.exec();
27 if(result == QDialog::Accepted) 27 if(result == QDialog::Accepted)
28 { 28 {
29 return true; 29 return true;
30 } 30 }
31 else return false; 31 else return false;
32} 32}
33 33
34void IOModem::reload( const Profile &config ) { 34void IOModem::reload( const Profile &config ) {
35 m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE); 35 m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE);
36 m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD); 36 m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD);
37 m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY); 37 m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY);
38 m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS); 38 m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS);
39 m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS); 39 m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS);
40 m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW); 40 m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW);
41 41
42 m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ); 42 m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING );
43 m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ); 43 m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING );
44 m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ); 44 m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 );
45 m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ); 45 m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 );
46 m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ); 46 m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 );
47 m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ); 47 m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 );
48 m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ); 48 m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 );
49 m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ); 49 m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 );
50 m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ); 50 m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING );
51 m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ); 51 m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING );
52 m_cancel = config.readEntry("CancelString" MODEM_DEFAULT_CANCEL_STRING ); 52 m_cancel = config.readEntry("CancelString", MODEM_DEFAULT_CANCEL_STRING );
53 m_dialTime = config.readEntry("DialTime" MODEM_DEFAULT_DIAL_TIME ); 53 m_dialTime = config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME );
54 m_delayRedial = config.readEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ); 54 m_delayRedial = config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL );
55 m_numberTries = config.readEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ); 55 m_numberTries = config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES );
56 m_dtrDropTime = config.readEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ); 56 m_dtrDropTime = config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME );
57 m_bpsDetect = config.readEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ); 57 m_bpsDetect = config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT );
58 m_dcdLines = config.readEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ); 58 m_dcdLines = config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES );
59 m_multiLineUntag = config.readEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ); 59 m_multiLineUntag = config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG );
60} 60}
61 61
62 62
63QString IOModem::identifier() const { 63QString IOModem::identifier() const {
64 return "modem"; 64 return "modem";
65} 65}
66 66
67QString IOModem::name() const { 67QString IOModem::name() const {
68 return "Modem IO Layer"; 68 return "Modem IO Layer";
69} 69}
70 70
71void IOIrda::slotExited(OProcess* proc ){ 71void IOIrda::slotExited(OProcess* proc ){
72 close(); 72 close();
73} 73}
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index bfd1c2e..27bcc09 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -127,212 +127,212 @@ void MainWindow::initUI() {
127 */ 127 */
128 m_openKeys = new QAction (tr("Open Keyboard..."), 128 m_openKeys = new QAction (tr("Open Keyboard..."),
129 Resource::loadPixmap( "down" ), 129 Resource::loadPixmap( "down" ),
130 QString::null, 0, this, 0); 130 QString::null, 0, this, 0);
131 131
132 m_openKeys->setToggleAction(true); 132 m_openKeys->setToggleAction(true);
133 133
134 connect (m_openKeys, SIGNAL(toggled(bool)), 134 connect (m_openKeys, SIGNAL(toggled(bool)),
135 this, SLOT(slotOpenKeb(bool))); 135 this, SLOT(slotOpenKeb(bool)));
136 m_openKeys->addTo(m_icons); 136 m_openKeys->addTo(m_icons);
137 137
138 138
139 /* insert the submenu */ 139 /* insert the submenu */
140 m_console->insertItem(tr("New from Profile"), m_sessionsPop, 140 m_console->insertItem(tr("New from Profile"), m_sessionsPop,
141 -1, 0); 141 -1, 0);
142 142
143 /* insert the connection menu */ 143 /* insert the connection menu */
144 m_bar->insertItem( tr("Connection"), m_console ); 144 m_bar->insertItem( tr("Connection"), m_console );
145 145
146 /* the scripts menu */ 146 /* the scripts menu */
147 m_bar->insertItem( tr("Scripts"), m_scripts ); 147 m_bar->insertItem( tr("Scripts"), m_scripts );
148 148
149 /* the settings menu */ 149 /* the settings menu */
150 m_bar->insertItem( tr("Settings"), m_settings ); 150 m_bar->insertItem( tr("Settings"), m_settings );
151 151
152 /* and the keyboard */ 152 /* and the keyboard */
153 m_keyBar = new QToolBar(this); 153 m_keyBar = new QToolBar(this);
154 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); 154 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
155 m_keyBar->setHorizontalStretchable( TRUE ); 155 m_keyBar->setHorizontalStretchable( TRUE );
156 m_keyBar->hide(); 156 m_keyBar->hide();
157 157
158 m_kb = new FunctionKeyboard(m_keyBar); 158 m_kb = new FunctionKeyboard(m_keyBar);
159 159
160 /* 160 /*
161 * connect to the menu activation 161 * connect to the menu activation
162 */ 162 */
163 connect( m_sessionsPop, SIGNAL(activated( int ) ), 163 connect( m_sessionsPop, SIGNAL(activated( int ) ),
164 this, SLOT(slotProfile( int ) ) ); 164 this, SLOT(slotProfile( int ) ) );
165 165
166 m_consoleWindow = new TabWidget( this, "blah"); 166 m_consoleWindow = new TabWidget( this, "blah");
167 connect(m_consoleWindow, SIGNAL(activated(Session*) ), 167 connect(m_consoleWindow, SIGNAL(activated(Session*) ),
168 this, SLOT(slotSessionChanged(Session*) ) ); 168 this, SLOT(slotSessionChanged(Session*) ) );
169 setCentralWidget( m_consoleWindow ); 169 setCentralWidget( m_consoleWindow );
170 170
171} 171}
172 172
173ProfileManager* MainWindow::manager() { 173ProfileManager* MainWindow::manager() {
174 return m_manager; 174 return m_manager;
175} 175}
176TabWidget* MainWindow::tabWidget() { 176TabWidget* MainWindow::tabWidget() {
177 return m_consoleWindow; 177 return m_consoleWindow;
178} 178}
179void MainWindow::populateProfiles() { 179void MainWindow::populateProfiles() {
180 m_sessionsPop->clear(); 180 m_sessionsPop->clear();
181 Profile::ValueList list = manager()->all(); 181 Profile::ValueList list = manager()->all();
182 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { 182 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) {
183 m_sessionsPop->insertItem( (*it).name() ); 183 m_sessionsPop->insertItem( (*it).name() );
184 } 184 }
185 185
186} 186}
187MainWindow::~MainWindow() { 187MainWindow::~MainWindow() {
188 delete m_factory; 188 delete m_factory;
189 manager()->save(); 189 manager()->save();
190} 190}
191 191
192MetaFactory* MainWindow::factory() { 192MetaFactory* MainWindow::factory() {
193 return m_factory; 193 return m_factory;
194} 194}
195 195
196Session* MainWindow::currentSession() { 196Session* MainWindow::currentSession() {
197 return m_curSession; 197 return m_curSession;
198} 198}
199 199
200QList<Session> MainWindow::sessions() { 200QList<Session> MainWindow::sessions() {
201 return m_sessions; 201 return m_sessions;
202} 202}
203 203
204void MainWindow::slotNew() { 204void MainWindow::slotNew() {
205 qWarning("New Connection"); 205 qWarning("New Connection");
206 ProfileEditorDialog dlg(factory() ); 206 ProfileEditorDialog dlg(factory() );
207 dlg.showMaximized(); 207 dlg.showMaximized();
208 int ret = dlg.exec(); 208 int ret = dlg.exec();
209 209
210 if ( ret == QDialog::Accepted ) { 210 if ( ret == QDialog::Accepted ) {
211 create( dlg.profile() ); 211 create( dlg.profile() );
212 } 212 }
213} 213}
214 214
215void MainWindow::slotRecordScript() { 215void MainWindow::slotRecordScript() {
216 if (currentSession()) { 216 if (currentSession()) {
217 currentSession()->emulationLayer()->startRecording(); 217 currentSession()->emulationLayer()->startRecording();
218 } 218 }
219} 219}
220 220
221void MainWindow::slotSaveScript() { 221void MainWindow::slotSaveScript() {
222 if (currentSession() && currentSession()->emulationLayer()->isRecording()) { 222 if (currentSession() && currentSession()->emulationLayer()->isRecording()) {
223 MimeTypes types; 223 MimeTypes types;
224 QStringList script; 224 QStringList script;
225 script << "text/plain"; 225 script << "text/plain";
226 types.insert("Script", script); 226 types.insert("Script", script);
227 QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); 227 QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types);
228 if (!filename.isEmpty()) { 228 if (!filename.isEmpty()) {
229 currentSession()->emulationLayer()->script()->saveTo(filename); 229 currentSession()->emulationLayer()->script()->saveTo(filename);
230 currentSession()->emulationLayer()->clearScript(); 230 currentSession()->emulationLayer()->clearScript();
231 } 231 }
232 } 232 }
233} 233}
234 234
235void MainWindow::slotRunScript() { 235void MainWindow::slotRunScript() {
236 if (currentSession()) { 236 if (currentSession()) {
237 MimeTypes types; 237 MimeTypes types;
238 QStringList script; 238 QStringList script;
239 script << "text/plain"; 239 script << "text/plain";
240 types.insert("Script", script); 240 types.insert("Script", script);
241 QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); 241 QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types);
242 if (!filename.isEmpty()) { 242 if (!filename.isEmpty()) {
243 Script script(DocLnk(filename).file()); 243 Script script(DocLnk(filename).file());
244 currentSession()->emulationLayer()->runScript(&script); 244 currentSession()->emulationLayer()->runScript(&script);
245 } 245 }
246 } 246 }
247} 247}
248 248
249void MainWindow::slotConnect() { 249void MainWindow::slotConnect() {
250 if ( currentSession() ) 250 if ( currentSession() )
251 currentSession()->layer()->open(); 251 currentSession()->layer()->open();
252} 252}
253 253
254void MainWindow::slotDisconnect() { 254void MainWindow::slotDisconnect() {
255 if ( currentSession() ) 255 if ( currentSession() )
256 currentSession()->layer()->close(); 256 currentSession()->layer()->close();
257} 257}
258 258
259void MainWindow::slotTerminate() { 259void MainWindow::slotTerminate() {
260 if ( currentSession() ) 260 if ( currentSession() )
261 currentSession()->layer()->close(); 261 currentSession()->layer()->close();
262 262
263 slotClose(); 263 slotClose();
264 /* FIXME move to the next session */ 264 /* FIXME move to the next session */
265} 265}
266 266
267void MainWindow::slotConfigure() { 267void MainWindow::slotConfigure() {
268 qWarning("configure"); 268 qWarning("configure");
269 ConfigDialog conf( manager()->all(), factory() ); 269 ConfigDialog conf( manager()->all(), factory() );
270 conf.showMaximized(); 270 conf.showMaximized();
271 271
272 int ret = conf.exec(); 272 int ret = conf.exec();
273 273
274 if ( QDialog::Accepted == ret ) { 274 if ( QDialog::Accepted == ret ) {
275 qWarning("conf %d", conf.list().count() ); 275 qWarning("conf %d", conf.list().count() );
276 manager()->setProfiles( conf.list() ); 276 manager()->setProfiles( conf.list() );
277 populateProfiles(); 277 populateProfiles();
278 } 278 }
279} 279}
280/* 280/*
281 * we will remove 281 * we will remove
282 * this window from the tabwidget 282 * this window from the tabwidget
283 * remove it from the list 283 * remove it from the list
284 * delete it 284 * delete it
285 * and set the currentSession() 285 * and set the currentSession()
286 */ 286 */
287void MainWindow::slotClose() { 287void MainWindow::slotClose() {
288 qWarning("close"); 288 qWarning("close");
289 if (!currentSession() ) 289 if (!currentSession() )
290 return; 290 return;
291 291
292 tabWidget()->remove( currentSession() ); 292 tabWidget()->remove( currentSession() );
293 /*it's autodelete */ 293 /*it's autodelete */
294 m_sessions.remove( m_curSession ); 294 m_sessions.remove( m_curSession );
295 m_curSession = m_sessions.first(); 295 m_curSession = m_sessions.first();
296 tabWidget()->setCurrent( m_curSession ); 296 tabWidget()->setCurrent( m_curSession );
297} 297}
298 298
299/* 299/*
300 * We will get the name 300 * We will get the name
301 * Then the profile 301 * Then the profile
302 * and then we will make a profile 302 * and then we will make a profile
303 */ 303 */
304void MainWindow::slotProfile( int id) { 304void MainWindow::slotProfile( int id) {
305 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 305 Profile prof = manager()->profile( m_sessionsPop->text( id) );
306 create( prof ); 306 create( prof );
307} 307}
308void MainWindow::create( const Profile& prof ) { 308void MainWindow::create( const Profile& prof ) {
309 Session *ses = manager()->fromProfile( prof, tabWidget() ); 309 Session *ses = manager()->fromProfile( prof, tabWidget() );
310 310
311 m_sessions.append( ses ); 311 m_sessions.append( ses );
312 tabWidget()->add( ses ); 312 tabWidget()->add( ses );
313 m_curSession = ses; 313 m_curSession = ses;
314 314
315} 315}
316 316
317void MainWindow::slotTransfer() 317void MainWindow::slotTransfer()
318{ 318{
319 if ( currentSession() ) { 319 // if ( currentSession() ) {
320 TransferDialog dlg(this); 320 TransferDialog dlg(this);
321 //dlg.showMaximized(); 321 dlg.showMaximized();
322 dlg.exec(); 322 dlg.exec();
323 } 323 // }
324} 324}
325 325
326 326
327void MainWindow::slotOpenKeb(bool state) { 327void MainWindow::slotOpenKeb(bool state) {
328 328
329 if (state) m_keyBar->show(); 329 if (state) m_keyBar->show();
330 else m_keyBar->hide(); 330 else m_keyBar->hide();
331 331
332} 332}
333void MainWindow::slotSessionChanged( Session* ses ) { 333void MainWindow::slotSessionChanged( Session* ses ) {
334 if ( ses ) { 334 if ( ses ) {
335 qWarning("changing %s", ses->name().latin1() ); 335 qWarning("changing %s", ses->name().latin1() );
336 m_curSession = ses; 336 m_curSession = ses;
337 } 337 }
338} 338}
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp
index 0968f62..ac62e45 100644
--- a/noncore/apps/opie-console/modemconfigwidget.cpp
+++ b/noncore/apps/opie-console/modemconfigwidget.cpp
@@ -1,187 +1,188 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qlayout.h> 2#include <qlayout.h>
3#include <qcombobox.h> 3#include <qcombobox.h>
4#include <qlineedit.h> 4#include <qlineedit.h>
5#include <qpushbutton.h> 5#include <qpushbutton.h>
6#include <qhbox.h> 6#include <qhbox.h>
7 7
8#include "iolayerbase.h" 8
9#include "modemconfigwidget.h" 9#include "modemconfigwidget.h"
10#include "atconfigdialog.h"
11#include "dialdialog.h" 10#include "dialdialog.h"
12 11
13namespace { 12namespace {
14 void setCurrent( const QString& str, QComboBox* bo ) { 13 void setCurrent( const QString& str, QComboBox* bo ) {
15 uint b = bo->count(); 14 uint b = bo->count();
16 for (uint i = 0; i < bo->count(); i++ ) { 15 for (uint i = 0; i < bo->count(); i++ ) {
17 if ( bo->text(i) == str ) { 16 if ( bo->text(i) == str ) {
18 bo->setCurrentItem( i ); 17 bo->setCurrentItem( i );
19 return; 18 return;
20 } 19 }
21 } 20 }
22 bo->insertItem( str ); 21 bo->insertItem( str );
23 bo->setCurrentItem( b ); 22 bo->setCurrentItem( b );
24 } 23 }
25} 24}
26 25
27ModemConfigWidget::ModemConfigWidget( const QString& name, 26ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent,
28 QWidget* parent,
29 const char* na ) 27 const char* na )
30 : ProfileDialogConnectionWidget( name, parent, na ) { 28 : ProfileDialogConnectionWidget( name, parent, na ) {
31 29
32 m_lay = new QVBoxLayout(this ); 30 m_lay = new QVBoxLayout( this );
33 m_device = new QLabel(tr("Modem is attached to:"), this ); 31 m_device = new QLabel(tr( "Modem is attached to:" ), this );
34 m_deviceCmb = new QComboBox(this ); 32 m_deviceCmb = new QComboBox(this );
35 m_deviceCmb->setEditable( TRUE ); 33 m_deviceCmb->setEditable( TRUE );
36 34
37 QLabel* telLabel = new QLabel( this ); 35 QLabel* telLabel = new QLabel( this );
38 telLabel->setText( tr("Enter telefon number here:") ); 36 telLabel->setText( tr( "Enter telefon number here:" ) );
39 m_telNumber = new QLineEdit( this ); 37 m_telNumber = new QLineEdit( this );
40 QHBox *buttonBox = new QHBox( this ); 38 QHBox *buttonBox = new QHBox( this );
41 QPushButton *atButton = new QPushButton( buttonBox ); 39 QPushButton *atButton = new QPushButton( buttonBox );
42 atButton->setText( tr("AT commands") ); 40 atButton->setText( tr( "AT commands" ) );
43 connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); 41 connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) );
44 42
45 QPushButton *dialButton = new QPushButton( buttonBox ); 43 QPushButton *dialButton = new QPushButton( buttonBox );
46 dialButton->setText( tr("Enter number") ); 44 dialButton->setText( tr( "Enter number" ) );
47 connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); 45 connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) );
48 46
49 47
50 m_base = new IOLayerBase(this, "base"); 48 m_base = new IOLayerBase( this, "base" );
51 49
52 m_lay->addWidget( m_device ); 50 m_lay->addWidget( m_device );
53 m_lay->addWidget( m_deviceCmb ); 51 m_lay->addWidget( m_deviceCmb );
54 m_lay->addWidget( telLabel ); 52 m_lay->addWidget( telLabel );
55 m_lay->addWidget( m_telNumber ); 53 m_lay->addWidget( m_telNumber );
56 m_lay->addWidget( buttonBox ); 54 m_lay->addWidget( buttonBox );
57 m_lay->addWidget( m_base ); 55 m_lay->addWidget( m_base );
58 56
59 m_deviceCmb->insertItem( "/dev/ttyS0" ); 57 m_deviceCmb->insertItem( "/dev/ttyS0" );
60 m_deviceCmb->insertItem( "/dev/ttyS1" ); 58 m_deviceCmb->insertItem( "/dev/ttyS1" );
61 m_deviceCmb->insertItem( "/dev/ttyS2" ); 59 m_deviceCmb->insertItem( "/dev/ttyS2" );
62 60
63 61 atConf = new ATConfigDialog( this, "ATConfig", true );
64} 62}
65 63
66ModemConfigWidget::~ModemConfigWidget() { 64ModemConfigWidget::~ModemConfigWidget() {
67 65
68} 66}
69void ModemConfigWidget::load( const Profile& prof ) { 67void ModemConfigWidget::load( const Profile& prof ) {
70 68
71 int rad_flow = prof.readNumEntry("Flow"); 69 int rad_flow = prof.readNumEntry( "Flow" );
72 int rad_parity = prof.readNumEntry("Parity"); 70 int rad_parity = prof.readNumEntry( "Parity" );
73 int speed = prof.readNumEntry("Speed"); 71 int speed = prof.readNumEntry( "Speed" );
74 QString number = prof.readEntry("Number"); 72 QString number = prof.readEntry( "Number" );
75 73
76 if (!number.isEmpty() ) { 74 if ( !number.isEmpty() ) {
77 m_telNumber->setText( number ); 75 m_telNumber->setText( number );
78 } 76 }
79 77
80 if (rad_flow == 1) { 78 if ( rad_flow == 1 ) {
81 m_base->setFlow( IOLayerBase::Hardware ); 79 m_base->setFlow( IOLayerBase::Hardware );
82 } else if (rad_flow == 2) { 80 } else if (rad_flow == 2) {
83 m_base->setFlow( IOLayerBase::Software ); 81 m_base->setFlow( IOLayerBase::Software );
84 } else if (rad_flow == 0) { 82 } else if (rad_flow == 0) {
85 m_base->setFlow( IOLayerBase::None ); 83 m_base->setFlow( IOLayerBase::None );
86 } 84 }
87 85
88 if (rad_parity == 1) { 86 if ( rad_parity == 1 ) {
89 m_base->setParity( IOLayerBase::Even ); 87 m_base->setParity( IOLayerBase::Even );
90 } else { 88 } else {
91 m_base->setParity( IOLayerBase::Odd ); 89 m_base->setParity( IOLayerBase::Odd );
92 } 90 }
93 91
94 switch( speed ) { 92 switch( speed ) {
95 case 115200: 93 case 115200:
96 m_base->setSpeed(IOLayerBase::Baud_115200 ); 94 m_base->setSpeed( IOLayerBase::Baud_115200 );
97 break; 95 break;
98 case 57600: 96 case 57600:
99 m_base->setSpeed( IOLayerBase::Baud_57600 ); 97 m_base->setSpeed( IOLayerBase::Baud_57600 );
100 break; 98 break;
101 case 38400: 99 case 38400:
102 m_base->setSpeed(IOLayerBase::Baud_38400 ); 100 m_base->setSpeed( IOLayerBase::Baud_38400 );
103 break; 101 break;
104 case 19200: 102 case 19200:
105 m_base->setSpeed( IOLayerBase::Baud_19200 ); 103 m_base->setSpeed( IOLayerBase::Baud_19200 );
106 break; 104 break;
107 case 9600: 105 case 9600:
108 default: 106 default:
109 m_base->setSpeed(IOLayerBase::Baud_9600 ); 107 m_base->setSpeed( IOLayerBase::Baud_9600 );
110 break; 108 break;
111 } 109 }
112 110
113 if ( prof.readEntry("Device").isEmpty() ) return; 111 if ( prof.readEntry( "Device" ).isEmpty() ) {
114 setCurrent( prof.readEntry("Device"), m_deviceCmb ); 112 return;
113 }
114 setCurrent( prof.readEntry( "Device" ), m_deviceCmb );
115 115
116 atConf->readConfig( prof );
116} 117}
118
117/* 119/*
118 * save speed, 120 * save speed,
119 * flow, 121 * flow,
120 * parity 122 * parity
121 */ 123 */
122void ModemConfigWidget::save( Profile& prof ) { 124void ModemConfigWidget::save( Profile& prof ) {
123 int flow, parity, speed; 125 int flow, parity, speed;
124 prof.writeEntry("Device", m_deviceCmb->currentText() ); 126 prof.writeEntry( "Device", m_deviceCmb->currentText() );
125 127
126 128
127 switch( m_base->flow() ) { 129 switch( m_base->flow() ) {
128 case IOLayerBase::None: 130 case IOLayerBase::None:
129 flow = 0; 131 flow = 0;
130 break; 132 break;
131 case IOLayerBase::Software: 133 case IOLayerBase::Software:
132 flow = 2; 134 flow = 2;
133 break; 135 break;
134 case IOLayerBase::Hardware: 136 case IOLayerBase::Hardware:
135 flow = 1; 137 flow = 1;
136 break; 138 break;
137 } 139 }
138 140
139 switch( m_base->parity() ) { 141 switch( m_base->parity() ) {
140 case IOLayerBase::Odd: 142 case IOLayerBase::Odd:
141 parity = 2; 143 parity = 2;
142 break; 144 break;
143 case IOLayerBase::Even: 145 case IOLayerBase::Even:
144 parity = 1; 146 parity = 1;
145 break; 147 break;
146 } 148 }
147 149
148 switch( m_base->speed() ) { 150 switch( m_base->speed() ) {
149 case IOLayerBase::Baud_115200: 151 case IOLayerBase::Baud_115200:
150 speed = 115200; 152 speed = 115200;
151 break; 153 break;
152 case IOLayerBase::Baud_57600: 154 case IOLayerBase::Baud_57600:
153 speed = 57600; 155 speed = 57600;
154 break; 156 break;
155 case IOLayerBase::Baud_38400: 157 case IOLayerBase::Baud_38400:
156 speed = 38400; 158 speed = 38400;
157 break; 159 break;
158 case IOLayerBase::Baud_19200: 160 case IOLayerBase::Baud_19200:
159 speed = 19200; 161 speed = 19200;
160 break; 162 break;
161 case IOLayerBase::Baud_9600: 163 case IOLayerBase::Baud_9600:
162 speed = 9600; 164 speed = 9600;
163 break; 165 break;
164 } 166 }
165 167
166 prof.writeEntry("Flow", flow); 168 prof.writeEntry( "Flow", flow );
167 prof.writeEntry("Parity", parity); 169 prof.writeEntry( "Parity", parity );
168 prof.writeEntry("Speed", speed); 170 prof.writeEntry( "Speed", speed );
169 prof.writeEntry("Number", m_telNumber->text() ); 171 prof.writeEntry( "Number", m_telNumber->text() );
170} 172}
171 173
172void ModemConfigWidget::slotAT() { 174void ModemConfigWidget::slotAT() {
173 ATConfigDialog conf( this, "ATConfig", true ); 175 // ATConfigDialog conf( this, "ATConfig", true );
174 conf.readConfig(); 176 atConf->showMaximized();
175 conf.showMaximized(); 177 if ( atConf->exec() == QDialog::Accepted ) {
176 if ( conf.exec() == QDialog::Accepted ) { 178 // atConf->writeConfig();
177 conf.writeConfig();
178 } 179 }
179} 180}
180 181
181void ModemConfigWidget::slotDial() { 182void ModemConfigWidget::slotDial() {
182 DialDialog dial( this, "DialConfig", true ); 183 DialDialog dial( this, "DialConfig", true );
183 dial.showMaximized(); 184 dial.showMaximized();
184 if ( dial.exec() == QDialog::Accepted ) { 185 if ( dial.exec() == QDialog::Accepted ) {
185 m_telNumber->setText( dial.number() ); 186 m_telNumber->setText( dial.number() );
186 } 187 }
187} 188}
diff --git a/noncore/apps/opie-console/modemconfigwidget.h b/noncore/apps/opie-console/modemconfigwidget.h
index 1363f78..4fdde0c 100644
--- a/noncore/apps/opie-console/modemconfigwidget.h
+++ b/noncore/apps/opie-console/modemconfigwidget.h
@@ -1,36 +1,36 @@
1#ifndef OPIE_MODEM_CONFIG_WIDGET_H 1#ifndef OPIE_MODEM_CONFIG_WIDGET_H
2#define OPIE_MODEM_CONFIG_WIDGET_H 2#define OPIE_MODEM_CONFIG_WIDGET_H
3 3
4#include "profiledialogwidget.h" 4#include "profiledialogwidget.h"
5 5#include "iolayerbase.h"
6#include "atconfigdialog.h"
6 7
7class QVBoxLayout; 8class QVBoxLayout;
8class QLabel; 9class QLabel;
9class QComboBox; 10class QComboBox;
10class QLineEdit; 11class QLineEdit;
11class IOLayerBase; 12class IOLayerBase;
12class ModemConfigWidget : public ProfileDialogConnectionWidget { 13class ModemConfigWidget : public ProfileDialogConnectionWidget {
13 14
14 Q_OBJECT 15 Q_OBJECT
15 16
16public: 17public:
17 ModemConfigWidget( const QString& name, QWidget* parent, const char* name = 0l ); 18 ModemConfigWidget( const QString& name, QWidget* parent, const char* name = 0l );
18 ~ModemConfigWidget(); 19 ~ModemConfigWidget();
19 20
20 void load( const Profile& ); 21 void load( const Profile& );
21 void save( Profile& ); 22 void save( Profile& );
22private: 23private:
23 QVBoxLayout* m_lay; 24 QVBoxLayout* m_lay;
24 QLabel* m_device; 25 QLabel* m_device;
25 QComboBox* m_deviceCmb; 26 QComboBox* m_deviceCmb;
26 IOLayerBase* m_base; 27 IOLayerBase* m_base;
27 QLineEdit* m_telNumber; 28 QLineEdit* m_telNumber;
28 29 ATConfigDialog *atConf;
29
30private slots: 30private slots:
31 void slotAT(); 31 void slotAT();
32 void slotDial(); 32 void slotDial();
33}; 33};
34 34
35 35
36#endif 36#endif