author | josef <josef> | 2002-10-15 21:10:29 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-15 21:10:29 (UTC) |
commit | fb99aec5215da635abfa28288d170f110114bba3 (patch) (unidiff) | |
tree | 68c1f662e126f578f467ccfc2c3164bc354a6790 /noncore/apps | |
parent | 6b5ccd66a36280a601d09ea0295df86c4fce1a65 (diff) | |
download | opie-fb99aec5215da635abfa28288d170f110114bba3.zip opie-fb99aec5215da635abfa28288d170f110114bba3.tar.gz opie-fb99aec5215da635abfa28288d170f110114bba3.tar.bz2 |
- io_modem must keep copy of profile, otherwise it crashes (now it works -
doh!)
- try to use key/value pairs for dialing where currently possible (init string
and dial sequence)
- when editing telephone number, try to read in, including special chars
stripping (-, /, whitespace) using QRegExp
-rw-r--r-- | noncore/apps/opie-console/dialdialog.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/dialdialog.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/dialer.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_modem.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_modem.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/modemconfigwidget.cpp | 5 |
6 files changed, 21 insertions, 9 deletions
diff --git a/noncore/apps/opie-console/dialdialog.cpp b/noncore/apps/opie-console/dialdialog.cpp index 8bf32f9..0ace8f7 100644 --- a/noncore/apps/opie-console/dialdialog.cpp +++ b/noncore/apps/opie-console/dialdialog.cpp | |||
@@ -83,13 +83,21 @@ void DialDialog::slotEnterNumber( int number ) { | |||
83 | 83 | ||
84 | m_number = ( m_number * 10 ) + number; | 84 | m_number = ( m_number * 10 ) + number; |
85 | qDebug( QString("%1").arg( m_number ) ); | 85 | qDebug( QString("%1").arg( m_number ) ); |
86 | LCD->display( m_number ); | 86 | LCD->display( m_number ); |
87 | 87 | ||
88 | } | 88 | } |
89 | 89 | ||
90 | DialDialog::~DialDialog() { | 90 | DialDialog::~DialDialog() { |
91 | } | 91 | } |
92 | 92 | ||
93 | QString DialDialog::number() { | 93 | QString DialDialog::number() { |
94 | return QString( "%1").arg( m_number ); | 94 | return QString( "%1").arg( m_number ); |
95 | |||
95 | } | 96 | } |
97 | |||
98 | void DialDialog::setNumber( int number ) | ||
99 | { | ||
100 | m_number = number; | ||
101 | LCD->display( m_number ); | ||
102 | } | ||
103 | |||
diff --git a/noncore/apps/opie-console/dialdialog.h b/noncore/apps/opie-console/dialdialog.h index 5c5b948..bec7b81 100644 --- a/noncore/apps/opie-console/dialdialog.h +++ b/noncore/apps/opie-console/dialdialog.h | |||
@@ -8,22 +8,24 @@ | |||
8 | 8 | ||
9 | class DialDialog : public QDialog { | 9 | class DialDialog : public QDialog { |
10 | 10 | ||
11 | Q_OBJECT | 11 | Q_OBJECT |
12 | 12 | ||
13 | public: | 13 | public: |
14 | DialDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 14 | DialDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
15 | 15 | ||
16 | ~DialDialog(); | 16 | ~DialDialog(); |
17 | 17 | ||
18 | QString number(); | 18 | QString number(); |
19 | 19 | ||
20 | void setNumber( int ); | ||
21 | |||
20 | private: | 22 | private: |
21 | float m_number; | 23 | float m_number; |
22 | QLCDNumber *LCD; | 24 | QLCDNumber *LCD; |
23 | 25 | ||
24 | private slots: | 26 | private slots: |
25 | void slotEnterNumber( int ); | 27 | void slotEnterNumber( int ); |
26 | }; | 28 | }; |
27 | 29 | ||
28 | 30 | ||
29 | #endif | 31 | #endif |
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp index 90e2b6c..89a0e8d 100644 --- a/noncore/apps/opie-console/dialer.cpp +++ b/noncore/apps/opie-console/dialer.cpp | |||
@@ -116,49 +116,50 @@ void Dialer::dial(const QString& number) | |||
116 | void Dialer::trydial(const QString& number) | 116 | void Dialer::trydial(const QString& number) |
117 | { | 117 | { |
118 | if(state != state_cancel) | 118 | if(state != state_cancel) |
119 | { | 119 | { |
120 | switchState(state_preinit); | 120 | switchState(state_preinit); |
121 | // ... | 121 | // ... |
122 | QString response = receive(); | 122 | QString response = receive(); |
123 | } | 123 | } |
124 | 124 | ||
125 | if(state != state_cancel) | 125 | if(state != state_cancel) |
126 | { | 126 | { |
127 | switchState(state_init); | 127 | switchState(state_init); |
128 | send("ATZ"); | 128 | //send("ATZ"); |
129 | send(m_profile.readEntry("InitString")); | ||
129 | QString response2 = receive(); | 130 | QString response2 = receive(); |
130 | } | 131 | } |
131 | 132 | ||
132 | if(state != state_cancel) | 133 | if(state != state_cancel) |
133 | { | 134 | { |
134 | switchState(state_options); | 135 | switchState(state_options); |
135 | 136 | ||
136 | send("ATM0L0"); | 137 | send("ATM0L0"); |
137 | QString response3 = receive(); | 138 | QString response3 = receive(); |
138 | } | 139 | } |
139 | 140 | ||
140 | if(state != state_cancel) | 141 | if(state != state_cancel) |
141 | { | 142 | { |
142 | switchState(state_dialtone); | 143 | switchState(state_dialtone); |
143 | 144 | ||
144 | send("ATX1"); | 145 | send("ATX1"); |
145 | QString response4 = receive(); | 146 | QString response4 = receive(); |
146 | } | 147 | } |
147 | 148 | ||
148 | if(state != state_cancel) | 149 | if(state != state_cancel) |
149 | { | 150 | { |
150 | switchState(state_dialing); | 151 | switchState(state_dialing); |
151 | 152 | ||
152 | send(QString("ATDT %1").arg(number)); | 153 | send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number)); |
153 | QString response5 = receive(); | 154 | QString response5 = receive(); |
154 | } | 155 | } |
155 | 156 | ||
156 | if(state != state_cancel) | 157 | if(state != state_cancel) |
157 | { | 158 | { |
158 | switchState(state_online); | 159 | switchState(state_online); |
159 | } | 160 | } |
160 | } | 161 | } |
161 | 162 | ||
162 | void Dialer::send(const QString& msg) | 163 | void Dialer::send(const QString& msg) |
163 | { | 164 | { |
164 | QString m = msg; | 165 | QString m = msg; |
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp index d93dc5a..22a3673 100644 --- a/noncore/apps/opie-console/io_modem.cpp +++ b/noncore/apps/opie-console/io_modem.cpp | |||
@@ -1,41 +1,39 @@ | |||
1 | 1 | ||
2 | #include "io_modem.h" | 2 | #include "io_modem.h" |
3 | 3 | ||
4 | #include "dialer.h" | 4 | #include "dialer.h" |
5 | 5 | ||
6 | IOModem::IOModem( const Profile &profile ) | 6 | IOModem::IOModem( const Profile &profile ) |
7 | : IOSerial( profile ), m_profile( profile ) { | 7 | : IOSerial( profile ) { |
8 | m_profile = profile; | ||
8 | } | 9 | } |
9 | 10 | ||
10 | 11 | ||
11 | IOModem::~IOModem() { | 12 | IOModem::~IOModem() { |
12 | 13 | ||
13 | } | 14 | } |
14 | 15 | ||
15 | 16 | ||
16 | void IOModem::close() { | 17 | void IOModem::close() { |
18 | // maybe do a hangup here just in case...? | ||
17 | 19 | ||
18 | IOSerial::close(); | 20 | IOSerial::close(); |
19 | |||
20 | } | 21 | } |
21 | 22 | ||
22 | bool IOModem::open() { | 23 | bool IOModem::open() { |
23 | bool ret = IOSerial::open(); | 24 | bool ret = IOSerial::open(); |
24 | if(!ret) return false; | 25 | if(!ret) return false; |
25 | 26 | ||
26 | qWarning("IOModem::open continues..."); | ||
27 | |||
28 | Dialer d(m_profile); | 27 | Dialer d(m_profile); |
29 | qWarning("dialer created"); | ||
30 | 28 | ||
31 | int result = d.exec(); | 29 | int result = d.exec(); |
32 | if(result == QDialog::Accepted) | 30 | if(result == QDialog::Accepted) |
33 | { | 31 | { |
34 | return true; | 32 | return true; |
35 | } | 33 | } |
36 | else return false; | 34 | else return false; |
37 | } | 35 | } |
38 | 36 | ||
39 | void IOModem::reload( const Profile &config ) { | 37 | void IOModem::reload( const Profile &config ) { |
40 | 38 | ||
41 | m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE); | 39 | m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE); |
diff --git a/noncore/apps/opie-console/io_modem.h b/noncore/apps/opie-console/io_modem.h index d681f66..8453b95 100644 --- a/noncore/apps/opie-console/io_modem.h +++ b/noncore/apps/opie-console/io_modem.h | |||
@@ -52,20 +52,20 @@ signals: | |||
52 | 52 | ||
53 | public slots: | 53 | public slots: |
54 | bool open(); | 54 | bool open(); |
55 | void close(); | 55 | void close(); |
56 | void reload(const Profile &); | 56 | void reload(const Profile &); |
57 | 57 | ||
58 | private: | 58 | private: |
59 | 59 | ||
60 | QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2, | 60 | QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2, |
61 | m_dialSuf2, m_dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel; | 61 | m_dialSuf2, m_dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel; |
62 | int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime, | 62 | int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime, |
63 | m_bpsDetect, m_dcdLines, m_multiLineUntag; | 63 | m_bpsDetect, m_dcdLines, m_multiLineUntag; |
64 | const Profile& m_profile; | 64 | Profile m_profile; |
65 | 65 | ||
66 | private slots: | 66 | private slots: |
67 | void slotExited(OProcess* proc); | 67 | void slotExited(OProcess* proc); |
68 | 68 | ||
69 | }; | 69 | }; |
70 | 70 | ||
71 | #endif | 71 | #endif |
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index 0f0ce7c..878b0cf 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp | |||
@@ -1,19 +1,19 @@ | |||
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 | #include <qregexp.h> | |
8 | 8 | ||
9 | #include "modemconfigwidget.h" | 9 | #include "modemconfigwidget.h" |
10 | #include "dialdialog.h" | 10 | #include "dialdialog.h" |
11 | 11 | ||
12 | namespace { | 12 | namespace { |
13 | void setCurrent( const QString& str, QComboBox* bo ) { | 13 | void setCurrent( const QString& str, QComboBox* bo ) { |
14 | uint b = bo->count(); | 14 | uint b = bo->count(); |
15 | for (uint i = 0; i < bo->count(); i++ ) { | 15 | for (uint i = 0; i < bo->count(); i++ ) { |
16 | if ( bo->text(i) == str ) { | 16 | if ( bo->text(i) == str ) { |
17 | bo->setCurrentItem( i ); | 17 | bo->setCurrentItem( i ); |
18 | return; | 18 | return; |
19 | } | 19 | } |
@@ -178,17 +178,20 @@ void ModemConfigWidget::save( Profile& prof ) { | |||
178 | } | 178 | } |
179 | 179 | ||
180 | void ModemConfigWidget::slotAT() { | 180 | void ModemConfigWidget::slotAT() { |
181 | // ATConfigDialog conf( this, "ATConfig", true ); | 181 | // ATConfigDialog conf( this, "ATConfig", true ); |
182 | atConf->showMaximized(); | 182 | atConf->showMaximized(); |
183 | if ( atConf->exec() == QDialog::Accepted ) { | 183 | if ( atConf->exec() == QDialog::Accepted ) { |
184 | // atConf->writeConfig(); | 184 | // atConf->writeConfig(); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | void ModemConfigWidget::slotDial() { | 188 | void ModemConfigWidget::slotDial() { |
189 | DialDialog dial( this, "DialConfig", true ); | 189 | DialDialog dial( this, "DialConfig", true ); |
190 | if(!m_telNumber->text().isEmpty()) { | ||
191 | dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ ]"), "").toInt()); | ||
192 | } | ||
190 | dial.showMaximized(); | 193 | dial.showMaximized(); |
191 | if ( dial.exec() == QDialog::Accepted ) { | 194 | if ( dial.exec() == QDialog::Accepted ) { |
192 | m_telNumber->setText( dial.number() ); | 195 | m_telNumber->setText( dial.number() ); |
193 | } | 196 | } |
194 | } | 197 | } |