summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/atconfigdialog.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/atconfigdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/atconfigdialog.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/noncore/apps/opie-console/atconfigdialog.cpp b/noncore/apps/opie-console/atconfigdialog.cpp
index 8e91b9e..c998f96 100644
--- a/noncore/apps/opie-console/atconfigdialog.cpp
+++ b/noncore/apps/opie-console/atconfigdialog.cpp
@@ -1,215 +1,218 @@
1#include "atconfigdialog.h"
2#include "io_modem.h"
1 3
4/* OPIE */
5#include <opie2/odebug.h>
6using namespace Opie::Core;
7
8/* QT */
2#include <qlineedit.h> 9#include <qlineedit.h>
3#include <qspinbox.h> 10#include <qspinbox.h>
4#include <qlayout.h> 11#include <qlayout.h>
5#include <qcombobox.h> 12#include <qcombobox.h>
6#include <qtabwidget.h> 13#include <qtabwidget.h>
7#include <qlabel.h> 14#include <qlabel.h>
8#include <qscrollview.h> 15#include <qscrollview.h>
9 16
10#include "atconfigdialog.h"
11#include "io_modem.h"
12
13
14ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 17ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
15 : QDialog( parent, name, modal, fl ) { 18 : QDialog( parent, name, modal, fl ) {
16 19
17 20
18 setCaption( tr( "Dialing parameter setup" ) ); 21 setCaption( tr( "Dialing parameter setup" ) );
19 22
20 QVBoxLayout *layout = new QVBoxLayout( this ); 23 QVBoxLayout *layout = new QVBoxLayout( this );
21 QTabWidget *tabWidget = new QTabWidget( this ); 24 QTabWidget *tabWidget = new QTabWidget( this );
22 25
23 tabWidget->addTab( tab0( this ), tr("Settings1") ); 26 tabWidget->addTab( tab0( this ), tr("Settings1") );
24 tabWidget->addTab( tab1( this ), tr("Settings2") ); 27 tabWidget->addTab( tab1( this ), tr("Settings2") );
25 28
26 layout->addWidget( tabWidget ); 29 layout->addWidget( tabWidget );
27 30
28} 31}
29 32
30QWidget* ATConfigDialog::tab0( QWidget* parent) { 33QWidget* ATConfigDialog::tab0( QWidget* parent) {
31 34
32 35
33 QScrollView* sv = new QScrollView( parent ); 36 QScrollView* sv = new QScrollView( parent );
34 37
35 QWidget *returnWidget = new QWidget( sv->viewport() ); 38 QWidget *returnWidget = new QWidget( sv->viewport() );
36 sv->setResizePolicy( QScrollView::AutoOneFit ); 39 sv->setResizePolicy( QScrollView::AutoOneFit );
37// sv->setHScrollBarMode( QScrollView::AlwaysOff ); 40// sv->setHScrollBarMode( QScrollView::AlwaysOff );
38// sv->setFrameShape( QFrame::NoFrame ); 41// sv->setFrameShape( QFrame::NoFrame );
39 42
40 43
41 44
42 45
43 QGridLayout *layout = new QGridLayout( returnWidget, 10, 2 ); 46 QGridLayout *layout = new QGridLayout( returnWidget, 10, 2 );
44 47
45 QLabel *initStringLabel = new QLabel( tr("Init string "), returnWidget ); 48 QLabel *initStringLabel = new QLabel( tr("Init string "), returnWidget );
46 initStringLine = new QLineEdit( returnWidget ); 49 initStringLine = new QLineEdit( returnWidget );
47 layout->addWidget( initStringLabel, 0, 0 ); 50 layout->addWidget( initStringLabel, 0, 0 );
48 layout->addWidget( initStringLine, 0, 1 ); 51 layout->addWidget( initStringLine, 0, 1 );
49 52
50 QLabel *resetStringLabel = new QLabel( tr("Reset string "), returnWidget ); 53 QLabel *resetStringLabel = new QLabel( tr("Reset string "), returnWidget );
51 resetStringLine = new QLineEdit( returnWidget ); 54 resetStringLine = new QLineEdit( returnWidget );
52 layout->addWidget( resetStringLabel, 1, 0 ); 55 layout->addWidget( resetStringLabel, 1, 0 );
53 layout->addWidget( resetStringLine, 1, 1 ); 56 layout->addWidget( resetStringLine, 1, 1 );
54 57
55 QLabel *dialPref1Label = new QLabel( tr("Dialing prefix #1 " ), returnWidget ); 58 QLabel *dialPref1Label = new QLabel( tr("Dialing prefix #1 " ), returnWidget );
56 dialPref1Line = new QLineEdit( returnWidget ); 59 dialPref1Line = new QLineEdit( returnWidget );
57 layout->addWidget( dialPref1Label, 2, 0 ); 60 layout->addWidget( dialPref1Label, 2, 0 );
58 layout->addWidget( dialPref1Line, 2, 1 ); 61 layout->addWidget( dialPref1Line, 2, 1 );
59 62
60 QLabel *dialSuf1Label = new QLabel( tr("Dialing suffix #1 " ), returnWidget ); 63 QLabel *dialSuf1Label = new QLabel( tr("Dialing suffix #1 " ), returnWidget );
61 dialSuf1Line = new QLineEdit( returnWidget ); 64 dialSuf1Line = new QLineEdit( returnWidget );
62 layout->addWidget( dialSuf1Label, 3, 0 ); 65 layout->addWidget( dialSuf1Label, 3, 0 );
63 layout->addWidget( dialSuf1Line, 3, 1 ); 66 layout->addWidget( dialSuf1Line, 3, 1 );
64 67
65 QLabel *dialPref2Label = new QLabel( tr("Dialing prefix #2 " ), returnWidget ); 68 QLabel *dialPref2Label = new QLabel( tr("Dialing prefix #2 " ), returnWidget );
66 dialPref2Line = new QLineEdit( returnWidget ); 69 dialPref2Line = new QLineEdit( returnWidget );
67 layout->addWidget( dialPref2Label, 4, 0 ); 70 layout->addWidget( dialPref2Label, 4, 0 );
68 layout->addWidget( dialPref2Line, 4, 1 ); 71 layout->addWidget( dialPref2Line, 4, 1 );
69 72
70 QLabel *dialSuf2Label = new QLabel( tr("Dialing suffix #2 " ), returnWidget ); 73 QLabel *dialSuf2Label = new QLabel( tr("Dialing suffix #2 " ), returnWidget );
71 dialSuf2Line = new QLineEdit( returnWidget ); 74 dialSuf2Line = new QLineEdit( returnWidget );
72 layout->addWidget( dialSuf2Label, 5, 0 ); 75 layout->addWidget( dialSuf2Label, 5, 0 );
73 layout->addWidget( dialSuf2Line, 5, 1 ); 76 layout->addWidget( dialSuf2Line, 5, 1 );
74 77
75 QLabel *dialPref3Label = new QLabel( tr("Dialing prefix #3 " ), returnWidget ); 78 QLabel *dialPref3Label = new QLabel( tr("Dialing prefix #3 " ), returnWidget );
76 dialPref3Line = new QLineEdit( returnWidget ); 79 dialPref3Line = new QLineEdit( returnWidget );
77 layout->addWidget( dialPref3Label, 6, 0 ); 80 layout->addWidget( dialPref3Label, 6, 0 );
78 layout->addWidget( dialPref3Line, 6, 1 ); 81 layout->addWidget( dialPref3Line, 6, 1 );
79 82
80 QLabel *dialSuf3Label = new QLabel( tr("Dialing suffix #3 " ), returnWidget ); 83 QLabel *dialSuf3Label = new QLabel( tr("Dialing suffix #3 " ), returnWidget );
81 dialSuf3Line = new QLineEdit( returnWidget ); 84 dialSuf3Line = new QLineEdit( returnWidget );
82 layout->addWidget( dialSuf3Label, 7, 0 ); 85 layout->addWidget( dialSuf3Label, 7, 0 );
83 layout->addWidget( dialSuf3Line, 7, 1 ); 86 layout->addWidget( dialSuf3Line, 7, 1 );
84 87
85 QLabel *connectLabel = new QLabel( tr("Connect string " ), returnWidget ); 88 QLabel *connectLabel = new QLabel( tr("Connect string " ), returnWidget );
86 connectLine = new QLineEdit( returnWidget ); 89 connectLine = new QLineEdit( returnWidget );
87 layout->addWidget( connectLabel, 8, 0 ); 90 layout->addWidget( connectLabel, 8, 0 );
88 layout->addWidget( connectLine, 8, 1 ); 91 layout->addWidget( connectLine, 8, 1 );
89 92
90 QLabel *hangupLabel = new QLabel( tr("Hang-up string " ), returnWidget ); 93 QLabel *hangupLabel = new QLabel( tr("Hang-up string " ), returnWidget );
91 hangupLine = new QLineEdit( returnWidget ); 94 hangupLine = new QLineEdit( returnWidget );
92 layout->addWidget( hangupLabel, 9, 0 ); 95 layout->addWidget( hangupLabel, 9, 0 );
93 layout->addWidget( hangupLine, 9, 1 ); 96 layout->addWidget( hangupLine, 9, 1 );
94 97
95 sv->addChild( returnWidget ); 98 sv->addChild( returnWidget );
96 99
97 return sv; 100 return sv;
98 101
99} 102}
100 103
101QWidget* ATConfigDialog::tab1( QWidget* parent ) { 104QWidget* ATConfigDialog::tab1( QWidget* parent ) {
102 105
103 106
104 QWidget *returnWidget = new QWidget( parent ); 107 QWidget *returnWidget = new QWidget( parent );
105 108
106 QGridLayout *layout = new QGridLayout( returnWidget, 8, 2 ); 109 QGridLayout *layout = new QGridLayout( returnWidget, 8, 2 );
107 110
108 QLabel *dialTimeLabel = new QLabel( tr("Dial time " ), returnWidget ); 111 QLabel *dialTimeLabel = new QLabel( tr("Dial time " ), returnWidget );
109 dialTimeSpin = new QSpinBox( returnWidget ); 112 dialTimeSpin = new QSpinBox( returnWidget );
110 layout->addWidget( dialTimeLabel, 0, 0 ); 113 layout->addWidget( dialTimeLabel, 0, 0 );
111 layout->addWidget( dialTimeSpin, 0, 1 ); 114 layout->addWidget( dialTimeSpin, 0, 1 );
112 115
113 QLabel *delayRedialLabel = new QLabel( tr("Delay before redial " ), returnWidget ); 116 QLabel *delayRedialLabel = new QLabel( tr("Delay before redial " ), returnWidget );
114 delayRedialSpin = new QSpinBox( returnWidget ); 117 delayRedialSpin = new QSpinBox( returnWidget );
115 layout->addWidget( delayRedialLabel, 1, 0 ); 118 layout->addWidget( delayRedialLabel, 1, 0 );
116 layout->addWidget( delayRedialSpin, 1, 1 ); 119 layout->addWidget( delayRedialSpin, 1, 1 );
117 120
118 QLabel *numberTriesLabel = new QLabel( tr("Number of tries " ), returnWidget ); 121 QLabel *numberTriesLabel = new QLabel( tr("Number of tries " ), returnWidget );
119 numberTriesSpin = new QSpinBox( returnWidget ); 122 numberTriesSpin = new QSpinBox( returnWidget );
120 layout->addWidget( numberTriesLabel, 2, 0 ); 123 layout->addWidget( numberTriesLabel, 2, 0 );
121 layout->addWidget( numberTriesSpin, 2, 1 ); 124 layout->addWidget( numberTriesSpin, 2, 1 );
122 125
123 QLabel *dtrDropTimeLabel = new QLabel( tr("DTR drop time (0=no) " ), returnWidget ); 126 QLabel *dtrDropTimeLabel = new QLabel( tr("DTR drop time (0=no) " ), returnWidget );
124 dtrDropTimeSpin = new QSpinBox( returnWidget ); 127 dtrDropTimeSpin = new QSpinBox( returnWidget );
125 layout->addWidget( dtrDropTimeLabel, 3, 0 ); 128 layout->addWidget( dtrDropTimeLabel, 3, 0 );
126 layout->addWidget( dtrDropTimeSpin, 3, 1 ); 129 layout->addWidget( dtrDropTimeSpin, 3, 1 );
127 130
128 QLabel *bpsDetectLabel = new QLabel( tr("Auto bps detect " ), returnWidget ); 131 QLabel *bpsDetectLabel = new QLabel( tr("Auto bps detect " ), returnWidget );
129 bpsDetectBox = new QComboBox( returnWidget ); 132 bpsDetectBox = new QComboBox( returnWidget );
130 layout->addWidget( bpsDetectLabel, 4, 0 ); 133 layout->addWidget( bpsDetectLabel, 4, 0 );
131 layout->addWidget( bpsDetectBox, 4, 1 ); 134 layout->addWidget( bpsDetectBox, 4, 1 );
132 bpsDetectBox->insertItem( tr("No") ); 135 bpsDetectBox->insertItem( tr("No") );
133 bpsDetectBox->insertItem( tr("Yes") ); 136 bpsDetectBox->insertItem( tr("Yes") );
134 137
135 QLabel *dcdLinesLabel = new QLabel( tr("Modem has DCD line " ), returnWidget ); 138 QLabel *dcdLinesLabel = new QLabel( tr("Modem has DCD line " ), returnWidget );
136 dcdLinesBox = new QComboBox( returnWidget ); 139 dcdLinesBox = new QComboBox( returnWidget );
137 layout->addWidget( dcdLinesLabel, 5, 0 ); 140 layout->addWidget( dcdLinesLabel, 5, 0 );
138 layout->addWidget( dcdLinesBox, 5, 1 ); 141 layout->addWidget( dcdLinesBox, 5, 1 );
139 dcdLinesBox->insertItem( tr("No") ); 142 dcdLinesBox->insertItem( tr("No") );
140 dcdLinesBox->insertItem( tr("Yes") ); 143 dcdLinesBox->insertItem( tr("Yes") );
141 144
142 QLabel *multiLineUntagLabel = new QLabel( tr("Multi-line untag " ), returnWidget ); 145 QLabel *multiLineUntagLabel = new QLabel( tr("Multi-line untag " ), returnWidget );
143 multiLineUntagBox = new QComboBox( returnWidget ); 146 multiLineUntagBox = new QComboBox( returnWidget );
144 layout->addWidget( multiLineUntagLabel, 6, 0 ); 147 layout->addWidget( multiLineUntagLabel, 6, 0 );
145 layout->addWidget( multiLineUntagBox, 6, 1 ); 148 layout->addWidget( multiLineUntagBox, 6, 1 );
146 multiLineUntagBox->insertItem( tr("No") ); 149 multiLineUntagBox->insertItem( tr("No") );
147 multiLineUntagBox->insertItem( tr("Yes") ); 150 multiLineUntagBox->insertItem( tr("Yes") );
148 151
149 return returnWidget; 152 return returnWidget;
150 153
151} 154}
152 155
153 156
154void ATConfigDialog::readConfig( const Profile& config ) { 157void ATConfigDialog::readConfig( const Profile& config ) {
155 qWarning("config in atconfigdialog"); 158 owarn << "config in atconfigdialog" << oendl;
156 159
157 initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); 160 initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) );
158 resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); 161 resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) );
159 dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 162 dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) );
160 dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 163 dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
161 dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 164 dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) );
162 dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 165 dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
163 dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); 166 dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) );
164 dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); 167 dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
165 connectLine->setText( config.readEntry("DefaultConnect", MODEM_DEFAULT_CONNECT_STRING ) ); 168 connectLine->setText( config.readEntry("DefaultConnect", MODEM_DEFAULT_CONNECT_STRING ) );
166 hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); 169 hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) );
167 dialTimeSpin->setValue( config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ) ); 170 dialTimeSpin->setValue( config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ) );
168 delayRedialSpin->setValue( config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ) ); 171 delayRedialSpin->setValue( config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ) );
169 numberTriesSpin->setValue( config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ) ); 172 numberTriesSpin->setValue( config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ) );
170 dtrDropTimeSpin->setValue( config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ) ); 173 dtrDropTimeSpin->setValue( config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ) );
171 bpsDetectBox->setCurrentItem( config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ) ); 174 bpsDetectBox->setCurrentItem( config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ) );
172 dcdLinesBox->setCurrentItem( config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ) ); 175 dcdLinesBox->setCurrentItem( config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ) );
173 multiLineUntagBox->setCurrentItem( config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ) ); 176 multiLineUntagBox->setCurrentItem( config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ) );
174 177
175 // Not implemented yet 178 // Not implemented yet
176 resetStringLine->setEnabled(false); 179 resetStringLine->setEnabled(false);
177 dialSuf1Line->setEnabled(false); 180 dialSuf1Line->setEnabled(false);
178 dialPref2Line->setEnabled(false); 181 dialPref2Line->setEnabled(false);
179 dialSuf2Line->setEnabled(false); 182 dialSuf2Line->setEnabled(false);
180 dialPref3Line->setEnabled(false); 183 dialPref3Line->setEnabled(false);
181 dialSuf3Line->setEnabled(false); 184 dialSuf3Line->setEnabled(false);
182 dialTimeSpin->setEnabled(false); 185 dialTimeSpin->setEnabled(false);
183 delayRedialSpin->setEnabled(false); 186 delayRedialSpin->setEnabled(false);
184 numberTriesSpin->setEnabled(false); 187 numberTriesSpin->setEnabled(false);
185 dtrDropTimeSpin->setEnabled(false); 188 dtrDropTimeSpin->setEnabled(false);
186 bpsDetectBox->setEnabled(false); 189 bpsDetectBox->setEnabled(false);
187 dcdLinesBox->setEnabled(false); 190 dcdLinesBox->setEnabled(false);
188 multiLineUntagBox->setEnabled(false); 191 multiLineUntagBox->setEnabled(false);
189} 192}
190 193
191void ATConfigDialog::writeConfig( Profile& config ) { 194void ATConfigDialog::writeConfig( Profile& config ) {
192 195
193 config.writeEntry( "InitString", initStringLine->text() ); 196 config.writeEntry( "InitString", initStringLine->text() );
194 config.writeEntry( "ResetString", resetStringLine->text() ); 197 config.writeEntry( "ResetString", resetStringLine->text() );
195 config.writeEntry( "DialPrefix1", dialPref1Line->text() ); 198 config.writeEntry( "DialPrefix1", dialPref1Line->text() );
196 config.writeEntry( "DialSuffix1", dialSuf1Line->text() ); 199 config.writeEntry( "DialSuffix1", dialSuf1Line->text() );
197 config.writeEntry( "DialPrefix2", dialPref2Line->text() ); 200 config.writeEntry( "DialPrefix2", dialPref2Line->text() );
198 config.writeEntry( "DialSuffix2", dialSuf2Line->text() ); 201 config.writeEntry( "DialSuffix2", dialSuf2Line->text() );
199 config.writeEntry( "DialPrefix3", dialPref3Line->text() ); 202 config.writeEntry( "DialPrefix3", dialPref3Line->text() );
200 config.writeEntry( "DialSuffix3", dialSuf3Line->text() ); 203 config.writeEntry( "DialSuffix3", dialSuf3Line->text() );
201 config.writeEntry( "DefaultConnect", connectLine->text() ); 204 config.writeEntry( "DefaultConnect", connectLine->text() );
202 config.writeEntry( "HangupString", hangupLine->text() ); 205 config.writeEntry( "HangupString", hangupLine->text() );
203 config.writeEntry( "DialTime", dialTimeSpin->value() ); 206 config.writeEntry( "DialTime", dialTimeSpin->value() );
204 config.writeEntry( "DelayRedial", delayRedialSpin->value() ); 207 config.writeEntry( "DelayRedial", delayRedialSpin->value() );
205 config.writeEntry( "NumberTries", numberTriesSpin->value() ); 208 config.writeEntry( "NumberTries", numberTriesSpin->value() );
206 config.writeEntry( "DTRDRopTime", dtrDropTimeSpin->value() ); 209 config.writeEntry( "DTRDRopTime", dtrDropTimeSpin->value() );
207 config.writeEntry( "BPSDetect", bpsDetectBox->currentItem() ); 210 config.writeEntry( "BPSDetect", bpsDetectBox->currentItem() );
208 config.writeEntry( "DCDLines", dcdLinesBox->currentItem() ); 211 config.writeEntry( "DCDLines", dcdLinesBox->currentItem() );
209 config.writeEntry( "MultiLineUntag", multiLineUntagBox->currentItem() ); 212 config.writeEntry( "MultiLineUntag", multiLineUntagBox->currentItem() );
210 213
211} 214}
212 215
213 216
214ATConfigDialog::~ATConfigDialog() { 217ATConfigDialog::~ATConfigDialog() {
215} 218}