author | josef <josef> | 2002-10-14 18:28:19 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-14 18:28:19 (UTC) |
commit | 5ada62902971fa9ac34e831259442535299f7ef6 (patch) (unidiff) | |
tree | 445974a3569d35267cb7542aefd5235ff14536dd | |
parent | e789f01a4fc6ada39809d40f8c44a6f6deec7785 (diff) | |
download | opie-5ada62902971fa9ac34e831259442535299f7ef6.zip opie-5ada62902971fa9ac34e831259442535299f7ef6.tar.gz opie-5ada62902971fa9ac34e831259442535299f7ef6.tar.bz2 |
- add modem layer so dialer can be used within Connect
-rw-r--r-- | noncore/apps/opie-console/default.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/opie-console/dialer.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/dialer.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_modem.cpp | 8 |
4 files changed, 13 insertions, 5 deletions
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp index ce5c870..5c1c05a 100644 --- a/noncore/apps/opie-console/default.cpp +++ b/noncore/apps/opie-console/default.cpp | |||
@@ -1,100 +1,105 @@ | |||
1 | #include "io_serial.h" | 1 | #include "io_serial.h" |
2 | #include "io_irda.h" | 2 | #include "io_irda.h" |
3 | #include "io_bt.h" | 3 | #include "io_bt.h" |
4 | #include "io_modem.h" | ||
4 | #include "filetransfer.h" | 5 | #include "filetransfer.h" |
5 | #include "filereceive.h" | 6 | #include "filereceive.h" |
6 | #include "serialconfigwidget.h" | 7 | #include "serialconfigwidget.h" |
7 | #include "irdaconfigwidget.h" | 8 | #include "irdaconfigwidget.h" |
8 | #include "btconfigwidget.h" | 9 | #include "btconfigwidget.h" |
9 | #include "modemconfigwidget.h" | 10 | #include "modemconfigwidget.h" |
10 | #include "terminalwidget.h" | 11 | #include "terminalwidget.h" |
11 | #include "vt102emulation.h" | 12 | #include "vt102emulation.h" |
12 | 13 | ||
13 | #include "default.h" | 14 | #include "default.h" |
14 | 15 | ||
15 | extern "C" { | 16 | extern "C" { |
16 | // FILE Transfer Stuff | 17 | // FILE Transfer Stuff |
17 | FileTransferLayer* newSZTransfer(IOLayer* lay) { | 18 | FileTransferLayer* newSZTransfer(IOLayer* lay) { |
18 | return new FileTransfer( FileTransfer::SZ, lay ); | 19 | return new FileTransfer( FileTransfer::SZ, lay ); |
19 | } | 20 | } |
20 | FileTransferLayer* newSYTransfer(IOLayer* lay) { | 21 | FileTransferLayer* newSYTransfer(IOLayer* lay) { |
21 | return new FileTransfer( FileTransfer::SY, lay ); | 22 | return new FileTransfer( FileTransfer::SY, lay ); |
22 | } | 23 | } |
23 | FileTransferLayer* newSXTransfer(IOLayer* lay) { | 24 | FileTransferLayer* newSXTransfer(IOLayer* lay) { |
24 | return new FileTransfer(FileTransfer ::SX, lay ); | 25 | return new FileTransfer(FileTransfer ::SX, lay ); |
25 | } | 26 | } |
26 | 27 | ||
27 | // FILE Transfer Receive Stuff | 28 | // FILE Transfer Receive Stuff |
28 | ReceiveLayer* newSZReceive(IOLayer* lay) { | 29 | ReceiveLayer* newSZReceive(IOLayer* lay) { |
29 | return new FileReceive( FileReceive::SZ, lay ); | 30 | return new FileReceive( FileReceive::SZ, lay ); |
30 | } | 31 | } |
31 | ReceiveLayer* newSYReceive(IOLayer* lay) { | 32 | ReceiveLayer* newSYReceive(IOLayer* lay) { |
32 | return new FileReceive( FileReceive::SY, lay ); | 33 | return new FileReceive( FileReceive::SY, lay ); |
33 | } | 34 | } |
34 | ReceiveLayer* newSXReceive(IOLayer* lay) { | 35 | ReceiveLayer* newSXReceive(IOLayer* lay) { |
35 | return new FileReceive(FileReceive::SX, lay ); | 36 | return new FileReceive(FileReceive::SX, lay ); |
36 | } | 37 | } |
37 | 38 | ||
38 | // Layer stuff | 39 | // Layer stuff |
39 | IOLayer* newSerialLayer( const Profile& prof) { | 40 | IOLayer* newSerialLayer( const Profile& prof) { |
40 | return new IOSerial( prof ); | 41 | return new IOSerial( prof ); |
41 | } | 42 | } |
42 | IOLayer* newBTLayer( const Profile& prof ) { | 43 | IOLayer* newBTLayer( const Profile& prof ) { |
43 | return new IOBt( prof ); | 44 | return new IOBt( prof ); |
44 | } | 45 | } |
45 | IOLayer* newIrDaLayer( const Profile& prof ) { | 46 | IOLayer* newIrDaLayer( const Profile& prof ) { |
46 | return new IOIrda( prof ); | 47 | return new IOIrda( prof ); |
47 | } | 48 | } |
49 | IOLayer* newModemLayer( const Profile& prof ) { | ||
50 | return new IOModem( prof ); | ||
51 | } | ||
48 | 52 | ||
49 | // Connection Widgets | 53 | // Connection Widgets |
50 | ProfileDialogWidget* newSerialWidget( const QString& str, QWidget* wid ) { | 54 | ProfileDialogWidget* newSerialWidget( const QString& str, QWidget* wid ) { |
51 | return new SerialConfigWidget( str, wid ); | 55 | return new SerialConfigWidget( str, wid ); |
52 | } | 56 | } |
53 | ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid ) { | 57 | ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid ) { |
54 | return new IrdaConfigWidget( str, wid ); | 58 | return new IrdaConfigWidget( str, wid ); |
55 | } | 59 | } |
56 | ProfileDialogWidget* newModemWidget( const QString& str, QWidget* wid ) { | 60 | ProfileDialogWidget* newModemWidget( const QString& str, QWidget* wid ) { |
57 | return new ModemConfigWidget(str, wid ); | 61 | return new ModemConfigWidget(str, wid ); |
58 | } | 62 | } |
59 | ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid ) { | 63 | ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid ) { |
60 | return new BTConfigWidget(str, wid ); | 64 | return new BTConfigWidget(str, wid ); |
61 | } | 65 | } |
62 | 66 | ||
63 | 67 | ||
64 | // Terminal Widget(s) | 68 | // Terminal Widget(s) |
65 | /* ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) { | 69 | /* ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) { |
66 | return new TerminalWidget(na, wid,0 ); | 70 | return new TerminalWidget(na, wid,0 ); |
67 | } | 71 | } |
68 | */ | 72 | */ |
69 | /* // VT Emulations | 73 | /* // VT Emulations |
70 | EmulationLayer* newVT102( WidgetLayer* wid ) { | 74 | EmulationLayer* newVT102( WidgetLayer* wid ) { |
71 | return new Vt102Emulation( wid ); | 75 | return new Vt102Emulation( wid ); |
72 | } | 76 | } |
73 | */ | 77 | */ |
74 | }; | 78 | }; |
75 | 79 | ||
76 | Default::Default( MetaFactory* fact ) { | 80 | Default::Default( MetaFactory* fact ) { |
77 | fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer ); | 81 | fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer ); |
78 | fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer ); | 82 | fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer ); |
79 | fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer ); | 83 | fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer ); |
80 | 84 | ||
81 | fact->addReceiveLayer( "SZ", QObject::tr("Z-Modem"), newSZReceive ); | 85 | fact->addReceiveLayer( "SZ", QObject::tr("Z-Modem"), newSZReceive ); |
82 | fact->addReceiveLayer( "SY", QObject::tr("Y-Modem"), newSYReceive ); | 86 | fact->addReceiveLayer( "SY", QObject::tr("Y-Modem"), newSYReceive ); |
83 | fact->addReceiveLayer( "SX", QObject::tr("X-Modem"), newSXReceive ); | 87 | fact->addReceiveLayer( "SX", QObject::tr("X-Modem"), newSXReceive ); |
84 | 88 | ||
85 | fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer ); | 89 | fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer ); |
86 | fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer ); | 90 | fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer ); |
87 | fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer ); | 91 | fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer ); |
92 | fact->addIOLayerFactory( "modem", QObject::tr("Modem"), newModemLayer ); | ||
88 | 93 | ||
89 | fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget ); | 94 | fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget ); |
90 | fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget ); | 95 | fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget ); |
91 | fact->addConnectionWidgetFactory( "modem", QObject::tr("Modem"), newModemWidget ); | 96 | fact->addConnectionWidgetFactory( "modem", QObject::tr("Modem"), newModemWidget ); |
92 | fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget ); | 97 | fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget ); |
93 | 98 | ||
94 | // fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget ); | 99 | // fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget ); |
95 | 100 | ||
96 | // fact->addEmulationLayer( "default", QObject::tr("Default Terminal"), newVT102 ); | 101 | // fact->addEmulationLayer( "default", QObject::tr("Default Terminal"), newVT102 ); |
97 | } | 102 | } |
98 | Default::~Default() { | 103 | Default::~Default() { |
99 | 104 | ||
100 | } | 105 | } |
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp index d20965a..90e2b6c 100644 --- a/noncore/apps/opie-console/dialer.cpp +++ b/noncore/apps/opie-console/dialer.cpp | |||
@@ -1,118 +1,117 @@ | |||
1 | #include "dialer.h" | 1 | #include "dialer.h" |
2 | 2 | ||
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qprogressbar.h> | 4 | #include <qprogressbar.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qpushbutton.h> | 6 | #include <qpushbutton.h> |
7 | #include <qapp.h> | 7 | #include <qapp.h> |
8 | #include <qtimer.h> | 8 | #include <qtimer.h> |
9 | 9 | ||
10 | #include <unistd.h> | 10 | #include <unistd.h> |
11 | #include <string.h> | 11 | #include <string.h> |
12 | 12 | ||
13 | // State machine: | When an error occurs, we don't have to | 13 | // State machine: | When an error occurs, we don't have to |
14 | // | reset everything. | 14 | // | reset everything. |
15 | // (init) <------+ | But if the user wants to reset, | 15 | // (init) <------+ | But if the user wants to reset, |
16 | // | | | we stop dialing immediately. | 16 | // | | | we stop dialing immediately. |
17 | // v | | | 17 | // v | | |
18 | // (options) ----+ | Following the state machine is necessary | 18 | // (options) ----+ | Following the state machine is necessary |
19 | // | \ | to get determinable results. | 19 | // | \ | to get determinable results. |
20 | // v ^ | | 20 | // v ^ | |
21 | // (dial) ----+ | | 21 | // (dial) ----+ | |
22 | // | ^ | | 22 | // | ^ | |
23 | // v | | | 23 | // v | | |
24 | // (online) --+ | | 24 | // (online) --+ | |
25 | // | | | 25 | // | | |
26 | // v | | 26 | // v | |
27 | 27 | ||
28 | 28 | ||
29 | // from atconfigdialog | 29 | // from atconfigdialog |
30 | //initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); | 30 | //initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); |
31 | //resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); | 31 | //resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); |
32 | //dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); | 32 | //dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); |
33 | //dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); | 33 | //dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); |
34 | //dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); | 34 | //dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); |
35 | //dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); | 35 | //dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); |
36 | //dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); | 36 | //dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); |
37 | //dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); | 37 | //dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); |
38 | //connectLine->setText( config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ) ); | 38 | //connectLine->setText( config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ) ); |
39 | //hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); | 39 | //hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); |
40 | 40 | ||
41 | // from modemconfigwidget | 41 | // from modemconfigwidget |
42 | //int rad_flow = prof.readNumEntry("Flow"); | 42 | //int rad_flow = prof.readNumEntry("Flow"); |
43 | //int rad_parity = prof.readNumEntry("Parity"); | 43 | //int rad_parity = prof.readNumEntry("Parity"); |
44 | //int speed = prof.readNumEntry("Speed"); | 44 | //int speed = prof.readNumEntry("Speed"); |
45 | //QString number = prof.readEntry("Number"); | 45 | //QString number = prof.readEntry("Number"); |
46 | 46 | ||
47 | Dialer::Dialer(const Profile& profile, QWidget *parent, const char *name) | 47 | Dialer::Dialer(const Profile& profile, QWidget *parent, const char *name) |
48 | : QDialog(parent, name, true) | 48 | : QDialog(parent, name, true), m_profile(profile) |
49 | { | 49 | { |
50 | QVBoxLayout *vbox; | 50 | QVBoxLayout *vbox; |
51 | QLabel *desc; | 51 | QLabel *desc; |
52 | 52 | ||
53 | usercancel = 0; | 53 | usercancel = 0; |
54 | m_profile = profile; | ||
55 | 54 | ||
56 | desc = new QLabel(QObject::tr("Dialing number: %1").arg(m_profile.readEntry("Number")), this); | 55 | desc = new QLabel(QObject::tr("Dialing number: %1").arg(m_profile.readEntry("Number")), this); |
57 | progress = new QProgressBar(this); | 56 | progress = new QProgressBar(this); |
58 | status = new QLabel("", this); | 57 | status = new QLabel("", this); |
59 | status->setFrameStyle(QFrame::Panel | QFrame::Sunken); | 58 | status->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
60 | cancel = new QPushButton(QObject::tr("Cancel"), this); | 59 | cancel = new QPushButton(QObject::tr("Cancel"), this); |
61 | 60 | ||
62 | vbox = new QVBoxLayout(this, 2); | 61 | vbox = new QVBoxLayout(this, 2); |
63 | vbox->add(desc); | 62 | vbox->add(desc); |
64 | vbox->add(progress); | 63 | vbox->add(progress); |
65 | vbox->add(status); | 64 | vbox->add(status); |
66 | vbox->add(cancel); | 65 | vbox->add(cancel); |
67 | 66 | ||
68 | connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); | 67 | connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); |
69 | 68 | ||
70 | show(); | 69 | show(); |
71 | 70 | ||
72 | QTimer::singleShot(500, this, SLOT(slotAutostart())); | 71 | QTimer::singleShot(500, this, SLOT(slotAutostart())); |
73 | } | 72 | } |
74 | 73 | ||
75 | Dialer::~Dialer() | 74 | Dialer::~Dialer() |
76 | { | 75 | { |
77 | } | 76 | } |
78 | 77 | ||
79 | void Dialer::slotCancel() | 78 | void Dialer::slotCancel() |
80 | { | 79 | { |
81 | if(state != state_online) | 80 | if(state != state_online) |
82 | { | 81 | { |
83 | usercancel = 1; | 82 | usercancel = 1; |
84 | reset(); | 83 | reset(); |
85 | } | 84 | } |
86 | else accept(); | 85 | else accept(); |
87 | } | 86 | } |
88 | 87 | ||
89 | void Dialer::reset() | 88 | void Dialer::reset() |
90 | { | 89 | { |
91 | switchState(state_cancel); | 90 | switchState(state_cancel); |
92 | } | 91 | } |
93 | 92 | ||
94 | void Dialer::slotAutostart() | 93 | void Dialer::slotAutostart() |
95 | { | 94 | { |
96 | state = state_preinit; | 95 | state = state_preinit; |
97 | dial(m_profile.readEntry("Number")); | 96 | dial(m_profile.readEntry("Number")); |
98 | } | 97 | } |
99 | 98 | ||
100 | void Dialer::dial(const QString& number) | 99 | void Dialer::dial(const QString& number) |
101 | { | 100 | { |
102 | while(state != state_online) | 101 | while(state != state_online) |
103 | { | 102 | { |
104 | if(!usercancel) | 103 | if(!usercancel) |
105 | { | 104 | { |
106 | trydial(number); | 105 | trydial(number); |
107 | } | 106 | } |
108 | else break; | 107 | else break; |
109 | } | 108 | } |
110 | 109 | ||
111 | if(usercancel) | 110 | if(usercancel) |
112 | { | 111 | { |
113 | reject(); | 112 | reject(); |
114 | } | 113 | } |
115 | } | 114 | } |
116 | 115 | ||
117 | void Dialer::trydial(const QString& number) | 116 | void Dialer::trydial(const QString& number) |
118 | { | 117 | { |
diff --git a/noncore/apps/opie-console/dialer.h b/noncore/apps/opie-console/dialer.h index 8c83bb6..09cc5ca 100644 --- a/noncore/apps/opie-console/dialer.h +++ b/noncore/apps/opie-console/dialer.h | |||
@@ -1,51 +1,51 @@ | |||
1 | #ifndef DIALER_H | 1 | #ifndef DIALER_H |
2 | #define DIALER_H | 2 | #define DIALER_H |
3 | 3 | ||
4 | #include <qdialog.h> | 4 | #include <qdialog.h> |
5 | 5 | ||
6 | #include "profile.h" | 6 | #include "profile.h" |
7 | 7 | ||
8 | class QLabel; | 8 | class QLabel; |
9 | class QProgressBar; | 9 | class QProgressBar; |
10 | 10 | ||
11 | class Dialer : public QDialog | 11 | class Dialer : public QDialog |
12 | { | 12 | { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | public: | 14 | public: |
15 | Dialer(const Profile& profile, QWidget *parent = NULL, const char *name = NULL); | 15 | Dialer(const Profile& profile, QWidget *parent = NULL, const char *name = NULL); |
16 | ~Dialer(); | 16 | ~Dialer(); |
17 | 17 | ||
18 | public slots: | 18 | public slots: |
19 | void slotCancel(); | 19 | void slotCancel(); |
20 | void slotAutostart(); | 20 | void slotAutostart(); |
21 | 21 | ||
22 | private: | 22 | private: |
23 | void switchState(int newstate); | 23 | void switchState(int newstate); |
24 | void reset(); | 24 | void reset(); |
25 | void dial(const QString& number); | 25 | void dial(const QString& number); |
26 | void trydial(const QString& number); | 26 | void trydial(const QString& number); |
27 | 27 | ||
28 | void send(const QString& msg); | 28 | void send(const QString& msg); |
29 | QString receive(); | 29 | QString receive(); |
30 | 30 | ||
31 | enum States | 31 | enum States |
32 | { | 32 | { |
33 | state_cancel, | 33 | state_cancel, |
34 | state_preinit, | 34 | state_preinit, |
35 | state_init, | 35 | state_init, |
36 | state_options, | 36 | state_options, |
37 | state_dialtone, | 37 | state_dialtone, |
38 | state_dialing, | 38 | state_dialing, |
39 | state_online | 39 | state_online |
40 | }; | 40 | }; |
41 | 41 | ||
42 | QLabel *status; | 42 | QLabel *status; |
43 | QProgressBar *progress; | 43 | QProgressBar *progress; |
44 | QPushButton *cancel; | 44 | QPushButton *cancel; |
45 | int state; | 45 | int state; |
46 | int usercancel; | 46 | int usercancel; |
47 | Profile m_profile; | 47 | const Profile& m_profile; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | #endif | 50 | #endif |
51 | 51 | ||
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp index 56147d8..28d1722 100644 --- a/noncore/apps/opie-console/io_modem.cpp +++ b/noncore/apps/opie-console/io_modem.cpp | |||
@@ -1,75 +1,79 @@ | |||
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 ), m_profile( profile ) { |
8 | } | 8 | } |
9 | 9 | ||
10 | 10 | ||
11 | IOModem::~IOModem() { | 11 | IOModem::~IOModem() { |
12 | 12 | ||
13 | } | 13 | } |
14 | 14 | ||
15 | 15 | ||
16 | void IOModem::close() { | 16 | void IOModem::close() { |
17 | 17 | ||
18 | IOSerial::close(); | 18 | IOSerial::close(); |
19 | 19 | ||
20 | } | 20 | } |
21 | 21 | ||
22 | bool IOModem::open() { | 22 | bool IOModem::open() { |
23 | qWarning("IOModem::open"); | 23 | bool ret = IOSerial::open(); |
24 | IOSerial::open(); | 24 | if(!ret) return false; |
25 | |||
26 | qWarning("IOModem::open continues..."); | ||
25 | 27 | ||
26 | Dialer d(m_profile); | 28 | Dialer d(m_profile); |
29 | qWarning("dialer created"); | ||
30 | |||
27 | int result = d.exec(); | 31 | int result = d.exec(); |
28 | if(result == QDialog::Accepted) | 32 | if(result == QDialog::Accepted) |
29 | { | 33 | { |
30 | return true; | 34 | return true; |
31 | } | 35 | } |
32 | else return false; | 36 | else return false; |
33 | } | 37 | } |
34 | 38 | ||
35 | void IOModem::reload( const Profile &config ) { | 39 | void IOModem::reload( const Profile &config ) { |
36 | m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE); | 40 | m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE); |
37 | m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD); | 41 | m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD); |
38 | m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY); | 42 | m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY); |
39 | m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS); | 43 | m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS); |
40 | m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS); | 44 | m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS); |
41 | m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW); | 45 | m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW); |
42 | 46 | ||
43 | m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ); | 47 | m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ); |
44 | m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ); | 48 | m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ); |
45 | m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ); | 49 | m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ); |
46 | m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ); | 50 | m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ); |
47 | m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ); | 51 | m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ); |
48 | m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ); | 52 | m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ); |
49 | m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ); | 53 | m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ); |
50 | m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ); | 54 | m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ); |
51 | m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ); | 55 | m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ); |
52 | m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ); | 56 | m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ); |
53 | m_cancel = config.readEntry("CancelString", MODEM_DEFAULT_CANCEL_STRING ); | 57 | m_cancel = config.readEntry("CancelString", MODEM_DEFAULT_CANCEL_STRING ); |
54 | m_dialTime = config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ); | 58 | m_dialTime = config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ); |
55 | m_delayRedial = config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ); | 59 | m_delayRedial = config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ); |
56 | m_numberTries = config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ); | 60 | m_numberTries = config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ); |
57 | m_dtrDropTime = config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ); | 61 | m_dtrDropTime = config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ); |
58 | m_bpsDetect = config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ); | 62 | m_bpsDetect = config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ); |
59 | m_dcdLines = config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ); | 63 | m_dcdLines = config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ); |
60 | m_multiLineUntag = config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ); | 64 | m_multiLineUntag = config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ); |
61 | } | 65 | } |
62 | 66 | ||
63 | 67 | ||
64 | QString IOModem::identifier() const { | 68 | QString IOModem::identifier() const { |
65 | return "modem"; | 69 | return "modem"; |
66 | } | 70 | } |
67 | 71 | ||
68 | QString IOModem::name() const { | 72 | QString IOModem::name() const { |
69 | return "Modem IO Layer"; | 73 | return "Modem IO Layer"; |
70 | } | 74 | } |
71 | 75 | ||
72 | void IOModem::slotExited(OProcess* proc ){ | 76 | void IOModem::slotExited(OProcess* proc ){ |
73 | close(); | 77 | close(); |
74 | } | 78 | } |
75 | 79 | ||