author | josef <josef> | 2002-10-13 15:52:00 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-13 15:52:00 (UTC) |
commit | cb816d85c54242f8958ff77fba334b43be0dcb3d (patch) (side-by-side diff) | |
tree | 6764b80acf8789c410cdc59cb308f3f91fcd9083 /noncore/apps/opie-console/dialer.cpp | |
parent | 6a9726437a59cf3b18bf57d6e20fb2dfaaa2fc34 (diff) | |
download | opie-cb816d85c54242f8958ff77fba334b43be0dcb3d.zip opie-cb816d85c54242f8958ff77fba334b43be0dcb3d.tar.gz opie-cb816d85c54242f8958ff77fba334b43be0dcb3d.tar.bz2 |
- make dialer accessible transparently when opening a modem session
- implement sending data (currently written to stdout for debug purpose)
Diffstat (limited to 'noncore/apps/opie-console/dialer.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/dialer.cpp | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp index 8589d14..d20965a 100644 --- a/noncore/apps/opie-console/dialer.cpp +++ b/noncore/apps/opie-console/dialer.cpp @@ -8,4 +8,7 @@ #include <qtimer.h> +#include <unistd.h> +#include <string.h> + // State machine: | When an error occurs, we don't have to // | reset everything. @@ -23,5 +26,24 @@ // v | -Dialer::Dialer(const QString& number, QWidget *parent, const char *name) + +// from atconfigdialog +//initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); +//resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); +//dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); +//dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); +//dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); +//dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); +//dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); +//dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); +//connectLine->setText( config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ) ); +//hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); + +// from modemconfigwidget +//int rad_flow = prof.readNumEntry("Flow"); +//int rad_parity = prof.readNumEntry("Parity"); +//int speed = prof.readNumEntry("Speed"); +//QString number = prof.readEntry("Number"); + +Dialer::Dialer(const Profile& profile, QWidget *parent, const char *name) : QDialog(parent, name, true) { @@ -30,7 +52,7 @@ Dialer::Dialer(const QString& number, QWidget *parent, const char *name) usercancel = 0; - m_number = number; + m_profile = profile; - desc = new QLabel(QObject::tr("Dialing number: %1").arg(number), this); + desc = new QLabel(QObject::tr("Dialing number: %1").arg(m_profile.readEntry("Number")), this); progress = new QProgressBar(this); status = new QLabel("", this); @@ -57,5 +79,9 @@ Dialer::~Dialer() void Dialer::slotCancel() { - if(state != state_online) reset(); + if(state != state_online) + { + usercancel = 1; + reset(); + } else accept(); } @@ -64,5 +90,4 @@ void Dialer::reset() { switchState(state_cancel); - usercancel = 1; } @@ -70,5 +95,5 @@ void Dialer::slotAutostart() { state = state_preinit; - dial(m_number); + dial(m_profile.readEntry("Number")); } @@ -138,5 +163,18 @@ void Dialer::trydial(const QString& number) void Dialer::send(const QString& msg) { + QString m = msg; + int bytes; + QString termination; + + termination = m_profile.readEntry("Termination"); + if(termination == "\n") m = m + "\n"; + else if(termination == "\r") m = m + "\r"; + else m = m + "\r\n"; + bytes = write(0, m.local8Bit(), strlen(m.local8Bit())); + if(bytes < 0) + { + reset(); + } } |