author | zecke <zecke> | 2002-10-29 19:07:22 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-29 19:07:22 (UTC) |
commit | a575fd4c862693705018902b4482c5135a8cb6a2 (patch) (unidiff) | |
tree | bcdfd7b2b8f62b2fb766b8b8808e17c96668563c | |
parent | 5ac67b8aece5aca20419f8953f88a36fd729adfc (diff) | |
download | opie-a575fd4c862693705018902b4482c5135a8cb6a2.zip opie-a575fd4c862693705018902b4482c5135a8cb6a2.tar.gz opie-a575fd4c862693705018902b4482c5135a8cb6a2.tar.bz2 |
Make the Modem take custom Ats again
Supply default values
set labels to richtext this way we achieve word wrap
IO_Layer added a closed(IOLayer*) signal
ProfileEditorDialog make Horizontal scrolling on the QScrollView
possible. Once the Vertical Scrollbar is there the Modem dialog
does not have enough space
-rw-r--r-- | noncore/apps/opie-console/atconfigdialog.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/dialdialog.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/dialer.cpp | 26 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_layer.h | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_modem.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_serial.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/modemconfigwidget.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 4 |
8 files changed, 30 insertions, 25 deletions
diff --git a/noncore/apps/opie-console/atconfigdialog.cpp b/noncore/apps/opie-console/atconfigdialog.cpp index 5c02692..e683ab3 100644 --- a/noncore/apps/opie-console/atconfigdialog.cpp +++ b/noncore/apps/opie-console/atconfigdialog.cpp | |||
@@ -152,8 +152,9 @@ QWidget* ATConfigDialog::tab1( QWidget* parent ) { | |||
152 | } | 152 | } |
153 | 153 | ||
154 | 154 | ||
155 | void ATConfigDialog::readConfig( const Profile& config ) { | 155 | void ATConfigDialog::readConfig( const Profile& config ) { |
156 | qWarning("config in atconfigdialog"); | ||
156 | 157 | ||
157 | initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); | 158 | initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); |
158 | resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); | 159 | resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); |
159 | dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); | 160 | dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); |
diff --git a/noncore/apps/opie-console/dialdialog.cpp b/noncore/apps/opie-console/dialdialog.cpp index ac1e1db..b91727b 100644 --- a/noncore/apps/opie-console/dialdialog.cpp +++ b/noncore/apps/opie-console/dialdialog.cpp | |||
@@ -19,8 +19,9 @@ DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags f | |||
19 | 19 | ||
20 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); | 20 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); |
21 | 21 | ||
22 | QLabel *textLabel = new QLabel( this ); | 22 | QLabel *textLabel = new QLabel( this ); |
23 | textLabel->setTextFormat( QLabel::RichText ); | ||
23 | textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") ); | 24 | textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") ); |
24 | 25 | ||
25 | m_dialLine = new QLineEdit( this ); | 26 | m_dialLine = new QLineEdit( this ); |
26 | m_dialLine->setReadOnly( true ); | 27 | m_dialLine->setReadOnly( true ); |
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp index 8524422..67ad10e 100644 --- a/noncore/apps/opie-console/dialer.cpp +++ b/noncore/apps/opie-console/dialer.cpp | |||
@@ -12,8 +12,10 @@ | |||
12 | #include <string.h> | 12 | #include <string.h> |
13 | #include <fcntl.h> | 13 | #include <fcntl.h> |
14 | #include <errno.h> | 14 | #include <errno.h> |
15 | 15 | ||
16 | #include "io_modem.h" | ||
17 | |||
16 | // State machine: | When an error occurs, we don't have to | 18 | // State machine: | When an error occurs, we don't have to |
17 | // | reset everything. | 19 | // | reset everything. |
18 | // (init) <------+ | But if the user wants to reset, | 20 | // (init) <------+ | But if the user wants to reset, |
19 | // | | | we stop dialing immediately. | 21 | // | | | we stop dialing immediately. |
@@ -52,16 +54,12 @@ Dialer::Dialer(const Profile& profile, int fd, QWidget *parent, const char *name | |||
52 | { | 54 | { |
53 | QVBoxLayout *vbox; | 55 | QVBoxLayout *vbox; |
54 | QLabel *desc; | 56 | QLabel *desc; |
55 | 57 | ||
56 | //m_profile.writeEntry("InitString", "ATZ"); | ||
57 | //m_profile.writeEntry("DialPrefix1", "ATDT"); | ||
58 | //m_profile.writeEntry("Termination", "\n"); | ||
59 | 58 | ||
60 | usercancel = 0; | 59 | usercancel = 0; |
61 | cleanshutdown = 0; | 60 | cleanshutdown = 0; |
62 | 61 | ||
63 | //fcntl(m_fd, F_SETFL, O_NONBLOCK); | ||
64 | 62 | ||
65 | desc = new QLabel(QObject::tr("Dialing number: %1").arg(m_profile.readEntry("Number")), this); | 63 | desc = new QLabel(QObject::tr("Dialing number: %1").arg(m_profile.readEntry("Number")), this); |
66 | progress = new QProgressBar(this); | 64 | progress = new QProgressBar(this); |
67 | status = new QLabel("", this); | 65 | status = new QLabel("", this); |
@@ -88,9 +86,9 @@ Dialer::~Dialer() | |||
88 | void Dialer::setHangupOnly() | 86 | void Dialer::setHangupOnly() |
89 | { | 87 | { |
90 | state = state_cancel; | 88 | state = state_cancel; |
91 | usercancel = 1; | 89 | usercancel = 1; |
92 | send("+++ATH\r"); | 90 | send( m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING )+"\r" ); |
93 | } | 91 | } |
94 | 92 | ||
95 | void Dialer::slotCancel() | 93 | void Dialer::slotCancel() |
96 | { | 94 | { |
@@ -141,21 +139,17 @@ void Dialer::trydial(const QString& number) | |||
141 | qWarning("TryDial:%s", number.latin1() ); | 139 | qWarning("TryDial:%s", number.latin1() ); |
142 | if(state != state_cancel) switchState(state_preinit); | 140 | if(state != state_cancel) switchState(state_preinit); |
143 | if(cleanshutdown) | 141 | if(cleanshutdown) |
144 | { | 142 | { |
145 | qWarning("HangupString " + m_profile.readEntry("HangupString")); | 143 | qWarning("HangupString " + m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING)); |
146 | //send(m_profile.readEntry("HangupString")); | 144 | send(m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) + "\r"); |
147 | send("+++ATH\r"); | ||
148 | //send(""); | ||
149 | } | 145 | } |
150 | 146 | ||
151 | if(state != state_cancel) | 147 | if(state != state_cancel) |
152 | { | 148 | { |
153 | switchState(state_init); | 149 | switchState(state_init); |
154 | //send("ATZ"); | 150 | // qWarning("Init String " + m_profile.readEntry("InitString") ); |
155 | qWarning("Init String " + m_profile.readEntry("InitString") ); | 151 | send(m_profile.readEntry("InitString",MODEM_DEFAULT_INIT_STRING ) + "\r"); |
156 | // send(m_profile.readEntry("InitString", "AT")); | ||
157 | send("AT\r"); | ||
158 | QString response2 = receive(); | 152 | QString response2 = receive(); |
159 | if(!response2.contains("\nOK\r")) | 153 | if(!response2.contains("\nOK\r")) |
160 | reset(); | 154 | reset(); |
161 | } | 155 | } |
@@ -186,10 +180,12 @@ void Dialer::trydial(const QString& number) | |||
186 | { | 180 | { |
187 | qWarning("progress"); | 181 | qWarning("progress"); |
188 | switchState(state_dialing); | 182 | switchState(state_dialing); |
189 | 183 | ||
190 | send(QString("ATDT %1\r").arg(number)); | 184 | // send(QString("ATDT %1\r").arg(number)); |
191 | // send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number)); | 185 | send(QString("%1 %2\r").arg(m_profile.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 )) |
186 | .arg(number)); | ||
187 | |||
192 | QString response5 = receive(); | 188 | QString response5 = receive(); |
193 | if(!response5.contains("CONNECT") ) | 189 | if(!response5.contains("CONNECT") ) |
194 | { | 190 | { |
195 | if(response5.contains("BUSY")) | 191 | if(response5.contains("BUSY")) |
diff --git a/noncore/apps/opie-console/io_layer.h b/noncore/apps/opie-console/io_layer.h index af61099..ed4478b 100644 --- a/noncore/apps/opie-console/io_layer.h +++ b/noncore/apps/opie-console/io_layer.h | |||
@@ -93,9 +93,15 @@ signals: | |||
93 | * and QString for a text | 93 | * and QString for a text |
94 | */ | 94 | */ |
95 | virtual void error( int, const QString& ); | 95 | virtual void error( int, const QString& ); |
96 | 96 | ||
97 | |||
97 | virtual void closed(); | 98 | virtual void closed(); |
99 | |||
100 | /* signal emitted for closure of the IOLayer | ||
101 | * for some reasons | ||
102 | */ | ||
103 | virtual void closed(IOLayer*); | ||
98 | public slots: | 104 | public slots: |
99 | /** | 105 | /** |
100 | * send a QCString to the device | 106 | * send a QCString to the device |
101 | */ | 107 | */ |
diff --git a/noncore/apps/opie-console/io_modem.h b/noncore/apps/opie-console/io_modem.h index 1328706..17228bd 100644 --- a/noncore/apps/opie-console/io_modem.h +++ b/noncore/apps/opie-console/io_modem.h | |||
@@ -12,9 +12,9 @@ | |||
12 | #define MODEM_DEFAULT_DBITS 8 | 12 | #define MODEM_DEFAULT_DBITS 8 |
13 | #define MODEM_DEFAULT_SBITS 1 | 13 | #define MODEM_DEFAULT_SBITS 1 |
14 | #define MODEM_DEFAULT_FLOW 0 | 14 | #define MODEM_DEFAULT_FLOW 0 |
15 | 15 | ||
16 | #define MODEM_DEFAULT_INIT_STRING "ATZ" | 16 | #define MODEM_DEFAULT_INIT_STRING "AT" |
17 | #define MODEM_DEFAULT_RESET_STRING "ATZ~" | 17 | #define MODEM_DEFAULT_RESET_STRING "ATZ~" |
18 | #define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT" | 18 | #define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT" |
19 | #define MODEM_DEFAULT_DIAL_SUFFIX1 "" | 19 | #define MODEM_DEFAULT_DIAL_SUFFIX1 "" |
20 | #define MODEM_DEFAULT_DIAL_PREFIX2 "" | 20 | #define MODEM_DEFAULT_DIAL_PREFIX2 "" |
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp index 03e92dd..ddd4994 100644 --- a/noncore/apps/opie-console/io_serial.cpp +++ b/noncore/apps/opie-console/io_serial.cpp | |||
@@ -165,13 +165,9 @@ void IOSerial::dataArrived() { | |||
165 | if (len == 0) | 165 | if (len == 0) |
166 | close(); | 166 | close(); |
167 | if (len < 0) | 167 | if (len < 0) |
168 | return; | 168 | return; |
169 | qWarning("got from layer"); | 169 | |
170 | for (int i = 0; i < len; i++ ) { | ||
171 | printf("%c", array[i] ); | ||
172 | } | ||
173 | printf("\n"); | ||
174 | array.resize( len ); | 170 | array.resize( len ); |
175 | emit received(array); | 171 | emit received(array); |
176 | } | 172 | } |
177 | 173 | ||
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index 37eb184..f7fb6f3 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp | |||
@@ -131,15 +131,16 @@ void ModemConfigWidget::load( const Profile& prof ) { | |||
131 | m_base->setStop( IOLayerBase::Stop_One ); | 131 | m_base->setStop( IOLayerBase::Stop_One ); |
132 | } | 132 | } |
133 | 133 | ||
134 | 134 | ||
135 | 135 | atConf->readConfig( prof ); | |
136 | if ( prof.readEntry( "Device" ).isEmpty() ) { | 136 | if ( prof.readEntry( "Device" ).isEmpty() ) { |
137 | qWarning("device empty!"); | ||
137 | return; | 138 | return; |
138 | } | 139 | } |
139 | setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); | 140 | setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); |
140 | 141 | ||
141 | atConf->readConfig( prof ); | 142 | |
142 | } | 143 | } |
143 | 144 | ||
144 | /* | 145 | /* |
145 | * save speed, | 146 | * save speed, |
@@ -233,8 +234,12 @@ void ModemConfigWidget::save( Profile& prof ) { | |||
233 | } | 234 | } |
234 | 235 | ||
235 | void ModemConfigWidget::slotAT() { | 236 | void ModemConfigWidget::slotAT() { |
236 | // ATConfigDialog conf( this, "ATConfig", true ); | 237 | // ATConfigDialog conf( this, "ATConfig", true ); |
238 | // josef/Max I know why don't you create the stuff on the stack | ||
239 | // but making it a TopLevel Dialog and ignoring | ||
240 | // cancel is not fun either... | ||
241 | // what to do? FIXME!!! -zecke | ||
237 | atConf->showMaximized(); | 242 | atConf->showMaximized(); |
238 | if ( atConf->exec() != QDialog::Accepted ) { | 243 | if ( atConf->exec() != QDialog::Accepted ) { |
239 | // reload old settings | 244 | // reload old settings |
240 | } | 245 | } |
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index 36daaef..fd04b6b 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -65,13 +65,13 @@ void ProfileEditorDialog::initUI() | |||
65 | m_tabKey = new QWidget(this); | 65 | m_tabKey = new QWidget(this); |
66 | 66 | ||
67 | m_svCon = new QScrollView( m_tabCon ); | 67 | m_svCon = new QScrollView( m_tabCon ); |
68 | m_svCon->setResizePolicy( QScrollView::AutoOneFit ); | 68 | m_svCon->setResizePolicy( QScrollView::AutoOneFit ); |
69 | m_svCon->setHScrollBarMode( QScrollView::AlwaysOff ); | 69 | //m_svCon->setHScrollBarMode( QScrollView::AlwaysOff ); |
70 | m_svCon->setFrameShape( QFrame::NoFrame ); | 70 | m_svCon->setFrameShape( QFrame::NoFrame ); |
71 | m_svTerm = new QScrollView( m_tabTerm ); | 71 | m_svTerm = new QScrollView( m_tabTerm ); |
72 | m_svTerm->setResizePolicy( QScrollView::AutoOneFit ); | 72 | m_svTerm->setResizePolicy( QScrollView::AutoOneFit ); |
73 | m_svTerm->setHScrollBarMode( QScrollView::AlwaysOff ); | 73 | //m_svTerm->setHScrollBarMode( QScrollView::AlwaysOff ); |
74 | m_svTerm->setFrameShape( QFrame::NoFrame ); | 74 | m_svTerm->setFrameShape( QFrame::NoFrame ); |
75 | 75 | ||
76 | /* base layout for tabs */ | 76 | /* base layout for tabs */ |
77 | m_layCon = new QHBoxLayout( m_tabCon , 2 ); | 77 | m_layCon = new QHBoxLayout( m_tabCon , 2 ); |