summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/atconfigdialog.cpp182
-rw-r--r--noncore/apps/opie-console/atconfigdialog.h68
-rw-r--r--noncore/apps/opie-console/btconfigwidget.cpp12
-rw-r--r--noncore/apps/opie-console/btconfigwidget.h2
-rw-r--r--noncore/apps/opie-console/default.cpp16
-rw-r--r--noncore/apps/opie-console/dialdialog.cpp95
-rw-r--r--noncore/apps/opie-console/dialdialog.h29
-rw-r--r--noncore/apps/opie-console/emulation_widget.h14
-rw-r--r--noncore/apps/opie-console/io_bt.cpp63
-rw-r--r--noncore/apps/opie-console/io_bt.h48
-rw-r--r--noncore/apps/opie-console/io_modem.cpp66
-rw-r--r--noncore/apps/opie-console/io_modem.h69
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.cpp187
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.h36
-rw-r--r--noncore/apps/opie-console/opie-console.pro20
15 files changed, 887 insertions, 20 deletions
diff --git a/noncore/apps/opie-console/atconfigdialog.cpp b/noncore/apps/opie-console/atconfigdialog.cpp
new file mode 100644
index 0000000..ef6d1ae
--- a/dev/null
+++ b/noncore/apps/opie-console/atconfigdialog.cpp
@@ -0,0 +1,182 @@
1
2#include <qlineedit.h>
3#include <qspinbox.h>
4#include <qlayout.h>
5#include <qcombobox.h>
6#include <qtabwidget.h>
7#include <qlabel.h>
8#include <qcombobox.h>
9#include <qscrollview.h>
10
11#include "atconfigdialog.h"
12
13
14ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
15 : QDialog( parent, name, modal, fl ) {
16
17
18 setCaption( tr( "Dialing parameter setup" ) );
19
20 QVBoxLayout *layout = new QVBoxLayout( this );
21 QTabWidget *tabWidget = new QTabWidget( this );
22
23 tabWidget->addTab( tab0( this ), tr("Settings1") );
24 tabWidget->addTab( tab1( this ), tr("Settings2") );
25
26 layout->addWidget( tabWidget );
27
28}
29
30QWidget* ATConfigDialog::tab0( QWidget* parent) {
31
32
33 QScrollView* sv = new QScrollView( parent );
34
35 QWidget *returnWidget = new QWidget( sv->viewport() );
36 sv->setResizePolicy( QScrollView::AutoOneFit );
37// sv->setHScrollBarMode( QScrollView::AlwaysOff );
38// sv->setFrameShape( QFrame::NoFrame );
39
40
41
42
43 QGridLayout *layout = new QGridLayout( returnWidget, 10, 2 );
44
45 QLabel *initStringLabel = new QLabel( tr("Init string "), returnWidget );
46 initStringLine = new QLineEdit( returnWidget );
47 layout->addWidget( initStringLabel, 0, 0 );
48 layout->addWidget( initStringLine, 0, 1 );
49
50 QLabel *resetStringLabel = new QLabel( tr("Reset string "), returnWidget );
51 resetStringLine = new QLineEdit( returnWidget );
52 layout->addWidget( resetStringLabel, 1, 0 );
53 layout->addWidget( resetStringLine, 1, 1 );
54
55 QLabel *dialPref1Label = new QLabel( tr("Dialing prefix #1 " ), returnWidget );
56 dialPref1Line = new QLineEdit( returnWidget );
57 layout->addWidget( dialPref1Label, 2, 0 );
58 layout->addWidget( dialPref1Line, 2, 1 );
59
60 QLabel *dialSuf1Label = new QLabel( tr("Dialing suffix #1 " ), returnWidget );
61 dialSuf1Line = new QLineEdit( returnWidget );
62 layout->addWidget( dialSuf1Label, 3, 0 );
63 layout->addWidget( dialSuf1Line, 3, 1 );
64
65 QLabel *dialPref2Label = new QLabel( tr("Dialing prefix #2 " ), returnWidget );
66 dialPref2Line = new QLineEdit( returnWidget );
67 layout->addWidget( dialPref2Label, 4, 0 );
68 layout->addWidget( dialPref2Line, 4, 1 );
69
70 QLabel *dialSuf2Label = new QLabel( tr("Dialing suffix #2 " ), returnWidget );
71 dialSuf2Line = new QLineEdit( returnWidget );
72 layout->addWidget( dialSuf2Label, 5, 0 );
73 layout->addWidget( dialSuf2Line, 5, 1 );
74
75 QLabel *dialPref3Label = new QLabel( tr("Dialing prefix #3 " ), returnWidget );
76 dialPref3Line = new QLineEdit( returnWidget );
77 layout->addWidget( dialPref3Label, 6, 0 );
78 layout->addWidget( dialPref3Line, 6, 1 );
79
80 QLabel *dialSuf3Label = new QLabel( tr("Dialing suffix #3 " ), returnWidget );
81 dialSuf3Line = new QLineEdit( returnWidget );
82 layout->addWidget( dialSuf3Label, 7, 0 );
83 layout->addWidget( dialSuf3Line, 7, 1 );
84
85 QLabel *connectLabel = new QLabel( tr("Connect string " ), returnWidget );
86 connectLine = new QLineEdit( returnWidget );
87 layout->addWidget( connectLabel, 8, 0 );
88 layout->addWidget( connectLine, 8, 1 );
89
90 QLabel *hangupLabel = new QLabel( tr("Hang-up string " ), returnWidget );
91 hangupLine = new QLineEdit( returnWidget );
92 layout->addWidget( hangupLabel, 9, 0 );
93 layout->addWidget( hangupLine, 9, 1 );
94
95 sv->addChild( returnWidget );
96
97 return sv;
98
99}
100
101QWidget* ATConfigDialog::tab1( QWidget* parent ) {
102
103
104 QWidget *returnWidget = new QWidget( parent );
105
106 QGridLayout *layout = new QGridLayout( returnWidget, 8, 2 );
107
108 QLabel *dialTimeLabel = new QLabel( tr("Dial time " ), returnWidget );
109 dialTimeSpin = new QSpinBox( returnWidget );
110 layout->addWidget( dialTimeLabel, 0, 0 );
111 layout->addWidget( dialTimeSpin, 0, 1 );
112
113 QLabel *delayRedialLabel = new QLabel( tr("Delay before redial " ), returnWidget );
114 delayRedialSpin = new QSpinBox( returnWidget );
115 layout->addWidget( delayRedialLabel, 1, 0 );
116 layout->addWidget( delayRedialSpin, 1, 1 );
117
118 QLabel *numberTriesLabel = new QLabel( tr("Number of tries " ), returnWidget );
119 numberTriesSpin = new QSpinBox( returnWidget );
120 layout->addWidget( numberTriesLabel, 2, 0 );
121 layout->addWidget( numberTriesSpin, 2, 1 );
122
123 QLabel *dtrDropTimeLabel = new QLabel( tr("DTR drop time (0=no) " ), returnWidget );
124 dtrDropTimeSpin = new QSpinBox( returnWidget );
125 layout->addWidget( dtrDropTimeLabel, 3, 0 );
126 layout->addWidget( dtrDropTimeSpin, 3, 1 );
127
128 QLabel *bpsDetectLabel = new QLabel( tr("Auto bps detect " ), returnWidget );
129 bpsDetectBox = new QComboBox( returnWidget );
130 layout->addWidget( bpsDetectLabel, 4, 0 );
131 layout->addWidget( bpsDetectBox, 4, 1 );
132 bpsDetectBox->insertItem( tr("No") );
133 bpsDetectBox->insertItem( tr("Yes") );
134
135 QLabel *dcdLinesLabel = new QLabel( tr("Modem has DCD line " ), returnWidget );
136 dcdLinesBox = new QComboBox( returnWidget );
137 layout->addWidget( dcdLinesLabel, 5, 0 );
138 layout->addWidget( dcdLinesBox, 5, 1 );
139 dcdLinesBox->insertItem( tr("No") );
140 dcdLinesBox->insertItem( tr("Yes") );
141
142 QLabel *multiLineUntagLabel = new QLabel( tr("Multi-line untag " ), returnWidget );
143 multiLineUntagBox = new QComboBox( returnWidget );
144 layout->addWidget( multiLineUntagLabel, 6, 0 );
145 layout->addWidget( multiLineUntagBox, 6, 1 );
146 multiLineUntagBox->insertItem( tr("No") );
147 multiLineUntagBox->insertItem( tr("Yes") );
148
149 return returnWidget;
150
151}
152
153
154void ATConfigDialog::readConfig() {
155/*
156 initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) );
157 resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) );
158 dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) );
159 dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
160 dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) );
161 dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
162 dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) );
163 dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
164 connectLine->setText( config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ) );
165 hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) );
166 dialTimeSpin;
167 delayRedialSpin;
168 numberTriesSpin;
169 dtrDropTimeSpin;
170 bpsDetectBox;
171 cdLinesBox;
172 multiLineUntagBox;
173*/
174}
175
176void ATConfigDialog::writeConfig() {
177
178}
179
180
181ATConfigDialog::~ATConfigDialog() {
182}
diff --git a/noncore/apps/opie-console/atconfigdialog.h b/noncore/apps/opie-console/atconfigdialog.h
new file mode 100644
index 0000000..47ff01d
--- a/dev/null
+++ b/noncore/apps/opie-console/atconfigdialog.h
@@ -0,0 +1,68 @@
1
2#ifndef ATCONFIGDIALOG_H
3#define ATCONFIGDIALOG_H
4
5#include <qdialog.h>
6
7#define MODEM_DEFAULT_INIT_STRING "~^M~ATZ^M~"
8#define MODEM_DEFAULT_RESET_STRING "~^M~ATZ^M~"
9#define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT"
10#define MODEM_DEFAULT_DIAL_SUFFIX1 "^M"
11#define MODEM_DEFAULT_DIAL_PREFIX2 "ATDP"
12#define MODEM_DEFAULT_DIAL_SUFFIX2 "^M"
13#define MODEM_DEFAULT_DIAL_PREFIX3 "ATX1DT"
14#define MODEM_DEFAULT_DIAL_SUFFIX3 ";X4D^M"
15#define MODEM_DEFAULT_CONNECT_STRING "CONNECT"
16#define MODEM_DEFAULT_HANGUP_STRING "~~+++~~ATH^M"
17#define MODEM_DEFAULT_CANCEL_STRING "^M"
18#define MODEM_DEFAULT_DIAL_TIME 45
19#define MODEM_DEFAULT_DELAY_REDIAL 2
20#define MODEM_DEFAULT_NUMBER_TRIES 10
21#define MODEM_DEFAULT_DTR_DROP_TIME 1
22#define MODEM_DEFAULT_BPS_DETECT 0 // bool
23#define MODEM_DEFAULT_DCD_LINES 1 //bool
24#define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool
25
26class QLineEdit;
27class QSpinBox;
28class QComboBox;
29
30class ATConfigDialog : public QDialog {
31
32 Q_OBJECT
33
34public:
35 ATConfigDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
36
37 ~ATConfigDialog();
38
39 void readConfig();
40 void writeConfig();
41
42private:
43 QWidget *tab0( QWidget* parent);
44 QWidget *tab1( QWidget* parent);
45
46private:
47 QLineEdit *initStringLine;
48 QLineEdit *resetStringLine;
49 QLineEdit *dialPref1Line;
50 QLineEdit *dialSuf1Line;
51 QLineEdit *dialPref2Line;
52 QLineEdit *dialSuf2Line;
53 QLineEdit *dialPref3Line;
54 QLineEdit *dialSuf3Line;
55 QLineEdit *connectLine;
56 QLineEdit *hangupLine;
57 QSpinBox *dialTimeSpin;
58 QSpinBox *delayRedialSpin;
59 QSpinBox *numberTriesSpin;
60 QSpinBox *dtrDropTimeSpin;
61 QComboBox *bpsDetectBox;
62 QComboBox *dcdLinesBox;
63 QComboBox *multiLineUntagBox;
64
65};
66
67
68#endif
diff --git a/noncore/apps/opie-console/btconfigwidget.cpp b/noncore/apps/opie-console/btconfigwidget.cpp
index acc4811..eac6a79 100644
--- a/noncore/apps/opie-console/btconfigwidget.cpp
+++ b/noncore/apps/opie-console/btconfigwidget.cpp
@@ -1,73 +1,84 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qlayout.h> 2#include <qlayout.h>
3#include <qlineedit.h>
3#include <qcombobox.h> 4#include <qcombobox.h>
4 5
5#include "iolayerbase.h" 6#include "iolayerbase.h"
6#include "btconfigwidget.h" 7#include "btconfigwidget.h"
7 8
8namespace { 9namespace {
9 void setCurrent( const QString& str, QComboBox* bo ) { 10 void setCurrent( const QString& str, QComboBox* bo ) {
10 uint b = bo->count(); 11 uint b = bo->count();
11 for (uint i = 0; i < bo->count(); i++ ) { 12 for (uint i = 0; i < bo->count(); i++ ) {
12 if ( bo->text(i) == str ) { 13 if ( bo->text(i) == str ) {
13 bo->setCurrentItem( i ); 14 bo->setCurrentItem( i );
14 return; 15 return;
15 } 16 }
16 } 17 }
17 bo->insertItem( str ); 18 bo->insertItem( str );
18 bo->setCurrentItem( b ); 19 bo->setCurrentItem( b );
19 } 20 }
20} 21}
21 22
22BTConfigWidget::BTConfigWidget( const QString& name, 23BTConfigWidget::BTConfigWidget( const QString& name,
23 QWidget* parent, 24 QWidget* parent,
24 const char* na ) 25 const char* na )
25 : ProfileDialogConnectionWidget( name, parent, na ) { 26 : ProfileDialogConnectionWidget( name, parent, na ) {
26 27
27 m_lay = new QVBoxLayout(this ); 28 m_lay = new QVBoxLayout(this );
28 m_device = new QLabel(tr("Device"), this ); 29 m_device = new QLabel(tr("Device"), this );
29 m_deviceCmb = new QComboBox(this ); 30 m_deviceCmb = new QComboBox(this );
30 m_deviceCmb->setEditable( TRUE ); 31 m_deviceCmb->setEditable( TRUE );
31 32
33 QLabel *macLabel = new QLabel( this );
34 macLabel->setText( tr("Enter peer mac address here:") );
35 m_mac = new QLineEdit( this );
36
32 m_base = new IOLayerBase(this, "base"); 37 m_base = new IOLayerBase(this, "base");
33 38
34 m_lay->addWidget( m_device ); 39 m_lay->addWidget( m_device );
35 m_lay->addWidget( m_deviceCmb ); 40 m_lay->addWidget( m_deviceCmb );
41 m_lay->addWidget( macLabel );
42 m_lay->addWidget( m_mac );
36 m_lay->addWidget( m_base ); 43 m_lay->addWidget( m_base );
37 44
38 m_deviceCmb->insertItem( "/dev/ttyU0" ); 45 m_deviceCmb->insertItem( "/dev/ttyU0" );
39 m_deviceCmb->insertItem( "/dev/ttyU1" ); 46 m_deviceCmb->insertItem( "/dev/ttyU1" );
40} 47}
41 48
42BTConfigWidget::~BTConfigWidget() { 49BTConfigWidget::~BTConfigWidget() {
43 50
44} 51}
45void BTConfigWidget::load( const Profile& prof ) { 52void BTConfigWidget::load( const Profile& prof ) {
46 int rad_flow = prof.readNumEntry("Flow"); 53 int rad_flow = prof.readNumEntry("Flow");
47 int rad_parity = prof.readNumEntry("Parity"); 54 int rad_parity = prof.readNumEntry("Parity");
48 int speed = prof.readNumEntry("Speed"); 55 int speed = prof.readNumEntry("Speed");
56 QString mac = prof.readEntry("Mac");
49 57
58 if (!mac.isEmpty() ) {
59 m_mac->setText( mac );
60 }
50 61
51 if (rad_flow == 1) { 62 if (rad_flow == 1) {
52 m_base->setFlow( IOLayerBase::Hardware ); 63 m_base->setFlow( IOLayerBase::Hardware );
53 } else if (rad_flow == 2) { 64 } else if (rad_flow == 2) {
54 m_base->setFlow( IOLayerBase::Software ); 65 m_base->setFlow( IOLayerBase::Software );
55 } else if (rad_flow == 0) { 66 } else if (rad_flow == 0) {
56 m_base->setFlow( IOLayerBase::None ); 67 m_base->setFlow( IOLayerBase::None );
57 } 68 }
58 69
59 if (rad_parity == 1) { 70 if (rad_parity == 1) {
60 m_base->setParity( IOLayerBase::Even ); 71 m_base->setParity( IOLayerBase::Even );
61 } else { 72 } else {
62 m_base->setParity( IOLayerBase::Odd ); 73 m_base->setParity( IOLayerBase::Odd );
63 } 74 }
64 75
65 switch( speed ) { 76 switch( speed ) {
66 case 115200: 77 case 115200:
67 m_base->setSpeed(IOLayerBase::Baud_115200 ); 78 m_base->setSpeed(IOLayerBase::Baud_115200 );
68 break; 79 break;
69 case 57600: 80 case 57600:
70 m_base->setSpeed( IOLayerBase::Baud_57600 ); 81 m_base->setSpeed( IOLayerBase::Baud_57600 );
71 break; 82 break;
72 case 38400: 83 case 38400:
73 m_base->setSpeed(IOLayerBase::Baud_38400 ); 84 m_base->setSpeed(IOLayerBase::Baud_38400 );
@@ -116,25 +127,26 @@ void BTConfigWidget::save( Profile& prof ) {
116 break; 127 break;
117 } 128 }
118 129
119 switch( m_base->speed() ) { 130 switch( m_base->speed() ) {
120 case IOLayerBase::Baud_115200: 131 case IOLayerBase::Baud_115200:
121 speed = 115200; 132 speed = 115200;
122 break; 133 break;
123 case IOLayerBase::Baud_57600: 134 case IOLayerBase::Baud_57600:
124 speed = 57600; 135 speed = 57600;
125 break; 136 break;
126 case IOLayerBase::Baud_38400: 137 case IOLayerBase::Baud_38400:
127 speed = 38400; 138 speed = 38400;
128 break; 139 break;
129 case IOLayerBase::Baud_19200: 140 case IOLayerBase::Baud_19200:
130 speed = 19200; 141 speed = 19200;
131 break; 142 break;
132 case IOLayerBase::Baud_9600: 143 case IOLayerBase::Baud_9600:
133 speed = 9600; 144 speed = 9600;
134 break; 145 break;
135 } 146 }
136 147
137 prof.writeEntry("Flow", flow); 148 prof.writeEntry("Flow", flow);
138 prof.writeEntry("Parity", parity); 149 prof.writeEntry("Parity", parity);
139 prof.writeEntry("Speed", speed); 150 prof.writeEntry("Speed", speed);
151 prof.writeEntry("Mac", m_mac->text() );
140} 152}
diff --git a/noncore/apps/opie-console/btconfigwidget.h b/noncore/apps/opie-console/btconfigwidget.h
index 64190ad..ceb13ee 100644
--- a/noncore/apps/opie-console/btconfigwidget.h
+++ b/noncore/apps/opie-console/btconfigwidget.h
@@ -1,29 +1,31 @@
1#ifndef OPIE_BT_CONFIG_WIDGET_H 1#ifndef OPIE_BT_CONFIG_WIDGET_H
2#define OPIE_BT_CONFIG_WIDGET_H 2#define OPIE_BT_CONFIG_WIDGET_H
3 3
4#include "profiledialogwidget.h" 4#include "profiledialogwidget.h"
5 5
6class QVBoxLayout; 6class QVBoxLayout;
7class QLabel; 7class QLabel;
8class QComboBox; 8class QComboBox;
9class QLineEdit;
9class IOLayerBase; 10class IOLayerBase;
10class BTConfigWidget : public ProfileDialogConnectionWidget { 11class BTConfigWidget : public ProfileDialogConnectionWidget {
11 12
12 Q_OBJECT 13 Q_OBJECT
13 14
14public: 15public:
15 BTConfigWidget( const QString& name, QWidget* parent, const char* name = 0l ); 16 BTConfigWidget( const QString& name, QWidget* parent, const char* name = 0l );
16 ~BTConfigWidget(); 17 ~BTConfigWidget();
17 18
18 void load( const Profile& ); 19 void load( const Profile& );
19 void save( Profile& ); 20 void save( Profile& );
20private: 21private:
21 QVBoxLayout* m_lay; 22 QVBoxLayout* m_lay;
22 QLabel* m_device; 23 QLabel* m_device;
23 QComboBox* m_deviceCmb; 24 QComboBox* m_deviceCmb;
24 IOLayerBase* m_base; 25 IOLayerBase* m_base;
26 QLineEdit* m_mac;
25 27
26}; 28};
27 29
28 30
29#endif 31#endif
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp
index b092273..4853785 100644
--- a/noncore/apps/opie-console/default.cpp
+++ b/noncore/apps/opie-console/default.cpp
@@ -1,76 +1,84 @@
1#include "io_serial.h" 1#include "io_serial.h"
2#include "io_irda.h"
3#include "io_bt.h"
2#include "filetransfer.h" 4#include "filetransfer.h"
3#include "serialconfigwidget.h" 5#include "serialconfigwidget.h"
4#include "irdaconfigwidget.h" 6#include "irdaconfigwidget.h"
5#include "btconfigwidget.h" 7#include "btconfigwidget.h"
8#include "modemconfigwidget.h"
6#include "terminalwidget.h" 9#include "terminalwidget.h"
7#include "vt102emulation.h" 10#include "vt102emulation.h"
8 11
9#include "default.h" 12#include "default.h"
10 13
11extern "C" { 14extern "C" {
12 // FILE Transfer Stuff 15 // FILE Transfer Stuff
13 FileTransferLayer* newSZTransfer(IOLayer* lay) { 16 FileTransferLayer* newSZTransfer(IOLayer* lay) {
14 return new FileTransfer( FileTransfer::SZ, lay ); 17 return new FileTransfer( FileTransfer::SZ, lay );
15 } 18 }
16 FileTransferLayer* newSYTransfer(IOLayer* lay) { 19 FileTransferLayer* newSYTransfer(IOLayer* lay) {
17 return new FileTransfer( FileTransfer::SY, lay ); 20 return new FileTransfer( FileTransfer::SY, lay );
18 } 21 }
19 FileTransferLayer* newSXTransfer(IOLayer* lay) { 22 FileTransferLayer* newSXTransfer(IOLayer* lay) {
20 return new FileTransfer(FileTransfer ::SX, lay ); 23 return new FileTransfer(FileTransfer ::SX, lay );
21 } 24 }
22 25
23 // Layer stuff 26 // Layer stuff
24 IOLayer* newSerialLayer( const Profile& prof) { 27 IOLayer* newSerialLayer( const Profile& prof) {
25 return new IOSerial( prof ); 28 return new IOSerial( prof );
26 } 29 }
27 IOLayer* newBTLayer( const Profile& ) { 30 IOLayer* newBTLayer( const Profile& prof ) {
28 return 0l; 31 return new IOBt( prof );
29 } 32 }
30 IOLayer* newIrDaLayer( const Profile& ) { 33 IOLayer* newIrDaLayer( const Profile& prof ) {
31 return 0l; 34 return new IOIrda( prof );
32 } 35 }
33 36
34 // Connection Widgets 37 // Connection Widgets
35 ProfileDialogWidget* newSerialWidget( const QString& str, QWidget* wid ) { 38 ProfileDialogWidget* newSerialWidget( const QString& str, QWidget* wid ) {
36 return new SerialConfigWidget( str, wid ); 39 return new SerialConfigWidget( str, wid );
37 } 40 }
38 ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid ) { 41 ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid ) {
39 return new IrdaConfigWidget( str, wid ); 42 return new IrdaConfigWidget( str, wid );
40 } 43 }
44 ProfileDialogWidget* newModemWidget( const QString& str, QWidget* wid ) {
45 return new ModemConfigWidget(str, wid );
46 }
41 ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid ) { 47 ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid ) {
42 return new BTConfigWidget(str, wid ); 48 return new BTConfigWidget(str, wid );
43 } 49 }
44 50
51
45 // Terminal Widget(s) 52 // Terminal Widget(s)
46 ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) { 53 ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) {
47 return new TerminalWidget(na, wid,0 ); 54 return new TerminalWidget(na, wid,0 );
48 } 55 }
49 56
50 // VT Emulations 57 // VT Emulations
51 EmulationLayer* newVT102( WidgetLayer* wid ) { 58 EmulationLayer* newVT102( WidgetLayer* wid ) {
52 return new Vt102Emulation( wid ); 59 return new Vt102Emulation( wid );
53 } 60 }
54 61
55}; 62};
56 63
57Default::Default( MetaFactory* fact ) { 64Default::Default( MetaFactory* fact ) {
58 fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer ); 65 fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer );
59 fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer ); 66 fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer );
60 fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer ); 67 fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer );
61 68
62 fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer ); 69 fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer );
63 fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer ); 70 fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer );
64 fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer ); 71 fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer );
65 72
66 fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget ); 73 fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget );
67 fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget ); 74 fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget );
75 fact->addConnectionWidgetFactory( "modem", QObject::tr("Modem"), newModemWidget );
68 fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget ); 76 fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget );
69 77
70 fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget ); 78 fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget );
71 79
72 fact->addEmulationLayer( "default", QObject::tr("Default Terminal"), newVT102 ); 80 fact->addEmulationLayer( "default", QObject::tr("Default Terminal"), newVT102 );
73} 81}
74Default::~Default() { 82Default::~Default() {
75 83
76} 84}
diff --git a/noncore/apps/opie-console/dialdialog.cpp b/noncore/apps/opie-console/dialdialog.cpp
new file mode 100644
index 0000000..8bf32f9
--- a/dev/null
+++ b/noncore/apps/opie-console/dialdialog.cpp
@@ -0,0 +1,95 @@
1
2
3#include <qlayout.h>
4#include <qlabel.h>
5#include <qcombobox.h>
6#include <qscrollview.h>
7#include <qpushbutton.h>
8#include <qfont.h>
9#include <qbuttongroup.h>
10
11#include "dialdialog.h"
12
13
14
15DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
16 : QDialog( parent, name, modal, fl ) {
17
18 m_number = 0;
19
20 setCaption( tr( "Enter number" ) );
21
22 QVBoxLayout *mainLayout = new QVBoxLayout( this );
23
24 QLabel *textLabel = new QLabel( this );
25 textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") );
26
27 LCD = new QLCDNumber( this, "LCD" );
28 QFont LCD_font( LCD->font() );
29 LCD_font.setPointSize( 7 );
30 LCD->setFont( LCD_font );
31 LCD->setNumDigits( 25 );
32 LCD->setSegmentStyle( QLCDNumber::Flat );
33 LCD->setMaximumHeight( 30 );
34
35 QGridLayout *layout = new QGridLayout( this , 4, 3 );
36
37 QButtonGroup *dialButtons = new QButtonGroup( );
38
39 QPushButton *number0 = new QPushButton( this );
40 number0->setText( QString( "0" ) );
41 QFont number0_font( number0->font() );
42 number0_font.setBold( TRUE );
43 number0->setFont( number0_font );
44 layout->addWidget( number0, 4, 1 );
45 dialButtons->insert( number0 );
46
47 int x = 0, y = 0;
48 for ( int i = 0 ; i < 9; i++ ) {
49 QPushButton *number = new QPushButton( this );
50 number->setText( QString( "%1" ).arg( i + 1 ) );
51 QFont number_font( number->font() );
52 number_font.setBold( TRUE );
53 number->setFont( number_font );
54
55 dialButtons->insert( number );
56
57 layout->addWidget( number, x, y );
58
59 if ( y < 2 ) {
60 y++;
61 } else {
62 x++;
63 y = 0;
64 }
65 }
66
67 connect( dialButtons, SIGNAL( clicked( int ) ), this, SLOT( slotEnterNumber( int ) ) );
68
69 mainLayout->addStretch( 0 );
70 mainLayout->addWidget( textLabel );
71 mainLayout->addWidget( LCD );
72 mainLayout->addStretch( 0 );
73 mainLayout->addLayout( layout );
74 mainLayout->addStretch( 0 );
75
76
77}
78
79
80void DialDialog::slotEnterNumber( int number ) {
81
82 // pretty stupid, just for testing .-)
83
84 m_number = ( m_number * 10 ) + number;
85 qDebug( QString("%1").arg( m_number ) );
86 LCD->display( m_number );
87
88}
89
90DialDialog::~DialDialog() {
91}
92
93QString DialDialog::number() {
94 return QString( "%1").arg( m_number );
95}
diff --git a/noncore/apps/opie-console/dialdialog.h b/noncore/apps/opie-console/dialdialog.h
new file mode 100644
index 0000000..5c5b948
--- a/dev/null
+++ b/noncore/apps/opie-console/dialdialog.h
@@ -0,0 +1,29 @@
1
2#ifndef DIALDIALOG_H
3#define DIALDIALOG_H
4
5#include <qdialog.h>
6#include <qstring.h>
7#include <qlcdnumber.h>
8
9class DialDialog : public QDialog {
10
11 Q_OBJECT
12
13public:
14 DialDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
15
16 ~DialDialog();
17
18 QString number();
19
20private:
21 float m_number;
22 QLCDNumber *LCD;
23
24private slots:
25 void slotEnterNumber( int );
26};
27
28
29#endif
diff --git a/noncore/apps/opie-console/emulation_widget.h b/noncore/apps/opie-console/emulation_widget.h
index a57803d..56ea15f 100644
--- a/noncore/apps/opie-console/emulation_widget.h
+++ b/noncore/apps/opie-console/emulation_widget.h
@@ -14,67 +14,67 @@
14/** 14/**
15 * EmulationWidget 15 * EmulationWidget
16 * simple implementation of EmulationLayer 16 * simple implementation of EmulationLayer
17 * (doesn't support scrollbar, history, etc, yet) 17 * (doesn't support scrollbar, history, etc, yet)
18 */ 18 */
19class EmulationWidget : public WidgetLayer 19class EmulationWidget : public WidgetLayer
20{ Q_OBJECT 20{ Q_OBJECT
21 21
22public: 22public:
23 23
24 /** 24 /**
25 * constructor 25 * constructor
26 * @param const Profile& config, the configuration 26 * @param const Profile& config, the configuration
27 * @param QWidget* parent, parent widget 27 * @param QWidget* parent, parent widget
28 * @param const char* name, the name of the widget 28 * @param const char* name, the name of the widget
29 */ 29 */
30 EmulationWidget( const Profile& config, QWidget *parent=0, const char *name =0 ); 30 EmulationWidget( const Profile& config, QWidget *parent=0, const char *name =0 );
31 31
32 /** 32 /**
33 * destructor 33 * destructor
34 */ 34 */
35 ~EmulationWidget(); 35 ~EmulationWidget();
36 36
37 /** 37 /**
38 * sets the image 38 * sets the image
39 * @param QArray<Character> const newimg, the new image 39 * @param QArray<Character> const newimg, the new image
40 * @param int lines, lines of the new image 40 * @param int lines, lines of the new image
41 * @param int columns, columns of the new image 41 * @param int columns, columns of the new image
42 */ 42 */
43 virtual void setImage( QArray<Character> const newimg, int columns, int lines ); 43 virtual void setImage( QArray<Character> const newimg, int columns, int lines ) {};
44 44
45 /** 45 /**
46 * reloads configuration 46 * reloads configuration
47 * @param const Profile& config, configuration 47 * @param const Profile& config, configuration
48 */ 48 */
49 virtual void reloadConfig( const Profile& config ); 49 virtual void reloadConfig( const Profile& config ) {};
50 50
51 /** 51 /**
52 * sets the scrollbar (not yet implemented) 52 * sets the scrollbar (not yet implemented)
53 */ 53 */
54 virtual void setScroll( int cursor, int slines ); 54 virtual void setScroll( int cursor, int slines );
55 55
56 /** 56 /**
57 * scrolls (not yet implemented) 57 * scrolls (not yet implemented)
58 * @param int value, scroll by this value 58 * @param int value, scroll by this value
59 */ 59 */
60 virtual void scroll( int value ); 60 virtual void scroll( int value );
61 61
62protected: 62protected:
63 63
64 /** 64 /**
65 * calculates current image bounds 65 * calculates current image bounds
66 */ 66 */
67 virtual void calcGeometry(); 67 virtual void calcGeometry() {};
68 68
69 /** 69 /**
70 * draws a String 70 * draws a String
71 * @param QString& string, string to be drawn 71 * @param QString& string, string to be drawn
72 * @param QPainter& painter, painter, that should draw 72 * @param QPainter& painter, painter, that should draw
73 * @param QRect rect, rect to be drawn into 73 * @param QRect rect, rect to be drawn into
74 * @param Character attr, attributes of Characters 74 * @param Character attr, attributes of Characters
75 * @param bool usePixmap, if to use the background pixmap (currently not supported) 75 * @param bool usePixmap, if to use the background pixmap (currently not supported)
76 * @param bool clear, if rect should be cleared 76 * @param bool clear, if rect should be cleared
77 */ 77 */
78 void drawAttrString( QString& string, QPainter& painter, QRect rect, Character attr, bool pm, bool clear ); 78 void drawAttrString( QString& string, QPainter& painter, QRect rect, Character attr, bool pm, bool clear );
79 79
80}; 80};
diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp
new file mode 100644
index 0000000..8bff4df
--- a/dev/null
+++ b/noncore/apps/opie-console/io_bt.cpp
@@ -0,0 +1,63 @@
1
2#include "io_bt.h"
3
4IOBt::IOBt( const Profile &config ) : IOSerial( config ) {
5 m_attach = 0;
6}
7
8
9IOBt::~IOBt() {
10 if ( m_attach ) {
11 delete m_attach;
12 }
13}
14
15
16void IOBt::close() {
17
18 IOSerial::close();
19 // still need error handling
20 delete m_attach;
21}
22
23bool IOBt::open() {
24
25 // hciattach here
26 m_attach = new OProcess();
27 *m_attach << "hciattach /dev/ttyS2 any 57600";
28
29 // then start hcid, then rcfomm handling (m_mac)
30
31 connect( m_attach, SIGNAL( processExited( OProcess* ) ),
32 this, SLOT( slotExited( OProcess* ) ) );
33
34 if ( m_attach->start() ) {
35 IOSerial::open();
36 } else {
37 qWarning("could not attach to device");
38 delete m_attach;
39 }
40}
41
42void IOBt::reload( const Profile &config ) {
43 m_device = config.readEntry("Device", BT_DEFAULT_DEVICE);
44 m_mac = config.readEntry("Mac", BT_DEFAULT_MAC);
45 m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD);
46 m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY);
47 m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS);
48 m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS);
49 m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW);
50}
51
52
53QString IOBt::identifier() const {
54 return "bluetooth";
55}
56
57QString IOBt::name() const {
58 return "BLuetooth IO Layer";
59}
60
61void IOBt::slotExited( OProcess* proc ){
62 close();
63}
diff --git a/noncore/apps/opie-console/io_bt.h b/noncore/apps/opie-console/io_bt.h
new file mode 100644
index 0000000..5e9988c
--- a/dev/null
+++ b/noncore/apps/opie-console/io_bt.h
@@ -0,0 +1,48 @@
1#ifndef OPIE_IO_BT
2#define OPIE_IO_BT
3
4#include <opie/oprocess.h>
5#include "io_serial.h"
6
7/* Default values to be used if the profile information is incomplete */
8#define BT_DEFAULT_DEVICE "/dev/ttyU0"
9#define BT_DEFAULT_BAUD 9600
10#define BT_DEFAULT_PARITY 0
11#define BT_DEFAULT_DBITS 8
12#define BT_DEFAULT_SBITS 1
13#define BT_DEFAULT_FLOW 0
14#define BT_DEFAULT_MAC 0
15
16
17/* IOSerial implements a RS232 IO Layer */
18
19class IOBt : public IOSerial {
20
21 Q_OBJECT
22
23public:
24
25 IOBt(const Profile &);
26 ~IOBt();
27
28 QString identifier() const;
29 QString name() const;
30
31signals:
32 void received(const QByteArray &);
33 void error(int, const QString &);
34
35public slots:
36 bool open();
37 void close();
38 void reload(const Profile &);
39
40private:
41 OProcess *m_attach;
42 QString m_mac;
43private slots:
44 void slotExited(OProcess* proc);
45
46};
47
48#endif /* OPIE_IO_IRDA */
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp
new file mode 100644
index 0000000..4d6035d
--- a/dev/null
+++ b/noncore/apps/opie-console/io_modem.cpp
@@ -0,0 +1,66 @@
1
2#include "io_modem.h"
3
4IOModem:IOModem( const Profile &config ) : IOSerial( config ) {
5
6}
7
8
9IOModem::~IOModem() {
10
11}
12
13
14void IOModem::close() {
15
16 IOSerial::close();
17
18}
19
20bool IOModem::open() {
21
22
23 IOSerial::open();
24
25}
26
27void IOModem::reload( const Profile &config ) {
28 m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE);
29 m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD);
30 m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY);
31 m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS);
32 m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS);
33 m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW);
34
35 m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING );
36 m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING );
37 m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 );
38 m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 );
39 m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 );
40 m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 );
41 m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 );
42 m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 );
43 m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING );
44 m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING );
45 m_cancel = config.readEntry("CancelString" MODEM_DEFAULT_CANCEL_STRING );
46 m_dialTime = config.readEntry("DialTime" MODEM_DEFAULT_DIAL_TIME );
47 m_delayRedial = config.readEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL );
48 m_numberTries = config.readEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES );
49 m_dtrDropTime = config.readEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME );
50 m_bpsDetect = config.readEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT );
51 m_dcdLines = config.readEntry("DCDLines", MODEM_DEFAULT_DCD_LINES );
52 m_multiLineUntag = config.readEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG );
53}
54
55
56QString IOModem::identifier() const {
57 return "modem";
58}
59
60QString IOModem::name() const {
61 return "Modem IO Layer";
62}
63
64void IOIrda::slotExited(OProcess* proc ){
65 close();
66}
diff --git a/noncore/apps/opie-console/io_modem.h b/noncore/apps/opie-console/io_modem.h
new file mode 100644
index 0000000..f155eb1
--- a/dev/null
+++ b/noncore/apps/opie-console/io_modem.h
@@ -0,0 +1,69 @@
1#ifndef OPIE_IO_MODEM
2#define OPIE_IO_MODEM
3
4#include <opie/oprocess.h>
5#include "io_serial.h"
6
7/* Default values to be used if the profile information is incomplete */
8#define MODEM_DEFAULT_DEVICE "/dev/ttyS0"
9#define MODEM_DEFAULT_BAUD 9600
10#define MODEM_DEFAULT_PARITY 0
11#define MODEM_DEFAULT_DBITS 8
12#define MODEM_DEFAULT_SBITS 1
13#define MODEM_DEFAULT_FLOW 0
14
15#define MODEM_DEFAULT_INIT_STRING "~^M~ATZ^M~"
16#define MODEM_DEFAULT_RESET_STRING "~^M~ATZ^M~"
17#define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT"
18#define MODEM_DEFAULT_DIAL_SUFFIX1 "^M"
19#define MODEM_DEFAULT_DIAL_PREFIX2 "ATDP"
20#define MODEM_DEFAULT_DIAL_SUFFIX2 "^M"
21#define MODEM_DEFAULT_DIAL_PREFIX3 "ATX1DT"
22#define MODEM_DEFAULT_DIAL_SUFFIX3 ";X4D^M"
23#define MODEM_DEFAULT_CONNECT_STRING "CONNECT"
24#define MODEM_DEFAULT_HANGUP_STRING "~~+++~~ATH^M"
25#define MODEM_DEFAULT_CANCEL_STRING "^M"
26#define MODEM_DEFAULT_DIAL_TIME 45
27#define MODEM_DEFAULT_DELAY_REDIAL 2
28#define MODEM_DEFAULT_NUMBER_TRIES 10
29#define MODEM_DEFAULT_DTR_DROP_TIME 1
30#define MODEM_DEFAULT_BPS_DETECT 0 // bool
31#define MODEM_DEFAULT_DCD_LINES 1 //bool
32#define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool
33
34/* IOSerial implements a RS232 IO Layer */
35
36class IOModem : public IOSerial {
37
38 Q_OBJECT
39
40public:
41
42 IOModem(const Profile &);
43 ~IOModem();
44
45 QString identifier() const;
46 QString name() const;
47
48signals:
49 void received(const QByteArray &);
50 void error(int, const QString &);
51
52public slots:
53 bool open();
54 void close();
55 void reload(const Profile &);
56
57private:
58
59 QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2,
60 m_dialSuf2, dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel;
61 int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime,
62 m_bpsDetect, m_dcdLines, m_multiLineUntag;
63
64private slots:
65 void slotExited(OProcess* proc);
66
67};
68
69#endif
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp
new file mode 100644
index 0000000..0968f62
--- a/dev/null
+++ b/noncore/apps/opie-console/modemconfigwidget.cpp
@@ -0,0 +1,187 @@
1#include <qlabel.h>
2#include <qlayout.h>
3#include <qcombobox.h>
4#include <qlineedit.h>
5#include <qpushbutton.h>
6#include <qhbox.h>
7
8#include "iolayerbase.h"
9#include "modemconfigwidget.h"
10#include "atconfigdialog.h"
11#include "dialdialog.h"
12
13namespace {
14 void setCurrent( const QString& str, QComboBox* bo ) {
15 uint b = bo->count();
16 for (uint i = 0; i < bo->count(); i++ ) {
17 if ( bo->text(i) == str ) {
18 bo->setCurrentItem( i );
19 return;
20 }
21 }
22 bo->insertItem( str );
23 bo->setCurrentItem( b );
24 }
25}
26
27ModemConfigWidget::ModemConfigWidget( const QString& name,
28 QWidget* parent,
29 const char* na )
30 : ProfileDialogConnectionWidget( name, parent, na ) {
31
32 m_lay = new QVBoxLayout(this );
33 m_device = new QLabel(tr("Modem is attached to:"), this );
34 m_deviceCmb = new QComboBox(this );
35 m_deviceCmb->setEditable( TRUE );
36
37 QLabel* telLabel = new QLabel( this );
38 telLabel->setText( tr("Enter telefon number here:") );
39 m_telNumber = new QLineEdit( this );
40 QHBox *buttonBox = new QHBox( this );
41 QPushButton *atButton = new QPushButton( buttonBox );
42 atButton->setText( tr("AT commands") );
43 connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) );
44
45 QPushButton *dialButton = new QPushButton( buttonBox );
46 dialButton->setText( tr("Enter number") );
47 connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) );
48
49
50 m_base = new IOLayerBase(this, "base");
51
52 m_lay->addWidget( m_device );
53 m_lay->addWidget( m_deviceCmb );
54 m_lay->addWidget( telLabel );
55 m_lay->addWidget( m_telNumber );
56 m_lay->addWidget( buttonBox );
57 m_lay->addWidget( m_base );
58
59 m_deviceCmb->insertItem( "/dev/ttyS0" );
60 m_deviceCmb->insertItem( "/dev/ttyS1" );
61 m_deviceCmb->insertItem( "/dev/ttyS2" );
62
63
64}
65
66ModemConfigWidget::~ModemConfigWidget() {
67
68}
69void ModemConfigWidget::load( const Profile& prof ) {
70
71 int rad_flow = prof.readNumEntry("Flow");
72 int rad_parity = prof.readNumEntry("Parity");
73 int speed = prof.readNumEntry("Speed");
74 QString number = prof.readEntry("Number");
75
76 if (!number.isEmpty() ) {
77 m_telNumber->setText( number );
78 }
79
80 if (rad_flow == 1) {
81 m_base->setFlow( IOLayerBase::Hardware );
82 } else if (rad_flow == 2) {
83 m_base->setFlow( IOLayerBase::Software );
84 } else if (rad_flow == 0) {
85 m_base->setFlow( IOLayerBase::None );
86 }
87
88 if (rad_parity == 1) {
89 m_base->setParity( IOLayerBase::Even );
90 } else {
91 m_base->setParity( IOLayerBase::Odd );
92 }
93
94 switch( speed ) {
95 case 115200:
96 m_base->setSpeed(IOLayerBase::Baud_115200 );
97 break;
98 case 57600:
99 m_base->setSpeed( IOLayerBase::Baud_57600 );
100 break;
101 case 38400:
102 m_base->setSpeed(IOLayerBase::Baud_38400 );
103 break;
104 case 19200:
105 m_base->setSpeed( IOLayerBase::Baud_19200 );
106 break;
107 case 9600:
108 default:
109 m_base->setSpeed(IOLayerBase::Baud_9600 );
110 break;
111 }
112
113 if ( prof.readEntry("Device").isEmpty() ) return;
114 setCurrent( prof.readEntry("Device"), m_deviceCmb );
115
116}
117/*
118 * save speed,
119 * flow,
120 * parity
121 */
122void ModemConfigWidget::save( Profile& prof ) {
123 int flow, parity, speed;
124 prof.writeEntry("Device", m_deviceCmb->currentText() );
125
126
127 switch( m_base->flow() ) {
128 case IOLayerBase::None:
129 flow = 0;
130 break;
131 case IOLayerBase::Software:
132 flow = 2;
133 break;
134 case IOLayerBase::Hardware:
135 flow = 1;
136 break;
137 }
138
139 switch( m_base->parity() ) {
140 case IOLayerBase::Odd:
141 parity = 2;
142 break;
143 case IOLayerBase::Even:
144 parity = 1;
145 break;
146 }
147
148 switch( m_base->speed() ) {
149 case IOLayerBase::Baud_115200:
150 speed = 115200;
151 break;
152 case IOLayerBase::Baud_57600:
153 speed = 57600;
154 break;
155 case IOLayerBase::Baud_38400:
156 speed = 38400;
157 break;
158 case IOLayerBase::Baud_19200:
159 speed = 19200;
160 break;
161 case IOLayerBase::Baud_9600:
162 speed = 9600;
163 break;
164 }
165
166 prof.writeEntry("Flow", flow);
167 prof.writeEntry("Parity", parity);
168 prof.writeEntry("Speed", speed);
169 prof.writeEntry("Number", m_telNumber->text() );
170}
171
172void ModemConfigWidget::slotAT() {
173 ATConfigDialog conf( this, "ATConfig", true );
174 conf.readConfig();
175 conf.showMaximized();
176 if ( conf.exec() == QDialog::Accepted ) {
177 conf.writeConfig();
178 }
179}
180
181void ModemConfigWidget::slotDial() {
182 DialDialog dial( this, "DialConfig", true );
183 dial.showMaximized();
184 if ( dial.exec() == QDialog::Accepted ) {
185 m_telNumber->setText( dial.number() );
186 }
187}
diff --git a/noncore/apps/opie-console/modemconfigwidget.h b/noncore/apps/opie-console/modemconfigwidget.h
new file mode 100644
index 0000000..1363f78
--- a/dev/null
+++ b/noncore/apps/opie-console/modemconfigwidget.h
@@ -0,0 +1,36 @@
1#ifndef OPIE_MODEM_CONFIG_WIDGET_H
2#define OPIE_MODEM_CONFIG_WIDGET_H
3
4#include "profiledialogwidget.h"
5
6
7class QVBoxLayout;
8class QLabel;
9class QComboBox;
10class QLineEdit;
11class IOLayerBase;
12class ModemConfigWidget : public ProfileDialogConnectionWidget {
13
14 Q_OBJECT
15
16public:
17 ModemConfigWidget( const QString& name, QWidget* parent, const char* name = 0l );
18 ~ModemConfigWidget();
19
20 void load( const Profile& );
21 void save( Profile& );
22private:
23 QVBoxLayout* m_lay;
24 QLabel* m_device;
25 QComboBox* m_deviceCmb;
26 IOLayerBase* m_base;
27 QLineEdit* m_telNumber;
28
29
30private slots:
31 void slotAT();
32 void slotDial();
33};
34
35
36#endif
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro
index 9208042..ccc3079 100644
--- a/noncore/apps/opie-console/opie-console.pro
+++ b/noncore/apps/opie-console/opie-console.pro
@@ -1,64 +1,66 @@
1TEMPLATE = app 1TEMPLATE = app
2#CONFIG = qt warn_on release 2#CONFIG = qt warn_on release
3 CONFIG = qt debug 3 CONFIG = qt debug
4DESTDIR = $(OPIEDIR)/bin 4DESTDIR = $(OPIEDIR)/bin
5HEADERS = io_layer.h io_serial.h io_irda.h \ 5HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h\
6 file_layer.h filetransfer.h \ 6 file_layer.h filetransfer.h \
7 metafactory.h \ 7 metafactory.h \
8 session.h \ 8 session.h \
9 mainwindow.h \ 9 mainwindow.h \
10 profile.h \ 10 profile.h \
11 profileconfig.h \ 11 profileconfig.h \
12 profilemanager.h \ 12 profilemanager.h \
13 configwidget.h \ 13 configwidget.h \
14 tabwidget.h \ 14 tabwidget.h \
15 configdialog.h \ 15 configdialog.h \
16 emulation_layer.h \ 16 emulation_layer.h \
17 vt102emulation.h \ 17 vt102emulation.h \
18 common.h \ 18 common.h \
19 history.h \ 19 history.h \
20 screen.h \ 20 screen.h \
21 keytrans.h \ 21 keytrans.h \
22 widget_layer.h \ 22 widget_layer.h \
23 transferdialog.h \ 23 transferdialog.h \
24 profiledialogwidget.h \ 24 profiledialogwidget.h \
25 profileeditordialog.h \ 25 profileeditordialog.h \
26 default.h \ 26 default.h \
27 terminalwidget.h \ 27 terminalwidget.h \
28 iolayerbase.h \ 28 iolayerbase.h \
29 serialconfigwidget.h irdaconfigwidget.h btconfigwidget.h \ 29 serialconfigwidget.h irdaconfigwidget.h \
30 emulation_widget.h procctl.h 30 btconfigwidget.h modemconfigwidget.h \
31 atconfigdialog.h dialdialog.h \
32 emulation_widget.h procctl.h \
31 33
32 34SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp \
33SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp \
34 file_layer.cpp filetransfer.cpp \ 35 file_layer.cpp filetransfer.cpp \
35 main.cpp \ 36 main.cpp \
36 metafactory.cpp \ 37 metafactory.cpp \
37 session.cpp \ 38 session.cpp \
38 mainwindow.cpp \ 39 mainwindow.cpp \
39 profile.cpp \ 40 profile.cpp \
40 profileconfig.cpp \ 41 profileconfig.cpp \
41 profilemanager.cpp \ 42 profilemanager.cpp \
42 tabwidget.cpp \ 43 tabwidget.cpp \
43 configdialog.cpp \ 44 configdialog.cpp \
44 emulation_layer.cpp \ 45 emulation_layer.cpp \
45 vt102emulation.cpp \ 46 vt102emulation.cpp \
46 history.cpp \ 47 history.cpp \
47 screen.cpp \ 48 screen.cpp \
48 keytrans.cpp \ 49 keytrans.cpp \
49 widget_layer.cpp \ 50 widget_layer.cpp \
50 transferdialog.cpp \ 51 transferdialog.cpp \
51 profiledialogwidget.cpp \ 52 profiledialogwidget.cpp \
52 profileeditordialog.cpp \ 53 profileeditordialog.cpp \
53 default.cpp \
54 terminalwidget.cpp \ 54 terminalwidget.cpp \
55 iolayerbase.cpp \ 55 iolayerbase.cpp \
56 serialconfigwidget.cpp irdaconfigwidget.cpp btconfigwidget.cpp \ 56 serialconfigwidget.cpp irdaconfigwidget.cpp \
57 emulation_widget.cpp procctl.cpp 57 btconfigwidget.cpp modemconfigwidget.cpp \
58 58 atconfigdialog.cpp dialdialog.cpp \
59 emulation_widget.cpp default.cpp procctl.cpp \
60
59INTERFACES = configurebase.ui editbase.ui 61INTERFACES = configurebase.ui editbase.ui
60INCLUDEPATH += $(OPIEDIR)/include 62INCLUDEPATH += $(OPIEDIR)/include
61DEPENDPATH += $(OPIEDIR)/include 63DEPENDPATH += $(OPIEDIR)/include
62LIBS += -lqpe -lopie 64LIBS += -lqpe -lopie
63TARGET = opie-console 65TARGET = opie-console
64 66