summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console
Unidiff
Diffstat (limited to 'noncore/apps/opie-console') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/btconfigwidget.cpp7
-rw-r--r--noncore/apps/opie-console/emulation_widget.cpp32
-rw-r--r--noncore/apps/opie-console/io_modem.cpp1
-rw-r--r--noncore/apps/opie-console/iolayerbase.cpp13
-rw-r--r--noncore/apps/opie-console/iolayerbase.h6
-rw-r--r--noncore/apps/opie-console/irdaconfigwidget.cpp7
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.cpp8
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp4
-rw-r--r--noncore/apps/opie-console/serialconfigwidget.cpp7
9 files changed, 62 insertions, 23 deletions
diff --git a/noncore/apps/opie-console/btconfigwidget.cpp b/noncore/apps/opie-console/btconfigwidget.cpp
index eac6a79..7673d0b 100644
--- a/noncore/apps/opie-console/btconfigwidget.cpp
+++ b/noncore/apps/opie-console/btconfigwidget.cpp
@@ -48,50 +48,52 @@ BTConfigWidget::BTConfigWidget( const QString& name,
48 48
49BTConfigWidget::~BTConfigWidget() { 49BTConfigWidget::~BTConfigWidget() {
50 50
51} 51}
52void BTConfigWidget::load( const Profile& prof ) { 52void BTConfigWidget::load( const Profile& prof ) {
53 int rad_flow = prof.readNumEntry("Flow"); 53 int rad_flow = prof.readNumEntry("Flow");
54 int rad_parity = prof.readNumEntry("Parity"); 54 int rad_parity = prof.readNumEntry("Parity");
55 int speed = prof.readNumEntry("Speed"); 55 int speed = prof.readNumEntry("Speed");
56 QString mac = prof.readEntry("Mac"); 56 QString mac = prof.readEntry("Mac");
57 57
58 if (!mac.isEmpty() ) { 58 if (!mac.isEmpty() ) {
59 m_mac->setText( mac ); 59 m_mac->setText( mac );
60 } 60 }
61 61
62 if (rad_flow == 1) { 62 if (rad_flow == 1) {
63 m_base->setFlow( IOLayerBase::Hardware ); 63 m_base->setFlow( IOLayerBase::Hardware );
64 } else if (rad_flow == 2) { 64 } else if (rad_flow == 2) {
65 m_base->setFlow( IOLayerBase::Software ); 65 m_base->setFlow( IOLayerBase::Software );
66 } else if (rad_flow == 0) { 66 } else if (rad_flow == 0) {
67 m_base->setFlow( IOLayerBase::None ); 67 m_base->setFlow( IOLayerBase::None );
68 } 68 }
69 69
70 if (rad_parity == 1) { 70 if (rad_parity == 1) {
71 m_base->setParity( IOLayerBase::Even ); 71 m_base->setParity( IOLayerBase::Even );
72 } else { 72 } else if ( rad_parity == 2 ) {
73 m_base->setParity( IOLayerBase::Odd ); 73 m_base->setParity( IOLayerBase::Odd );
74 } else {
75 m_base->setParity( IOLayerBase::NonePar );
74 } 76 }
75 77
76 switch( speed ) { 78 switch( speed ) {
77 case 115200: 79 case 115200:
78 m_base->setSpeed(IOLayerBase::Baud_115200 ); 80 m_base->setSpeed(IOLayerBase::Baud_115200 );
79 break; 81 break;
80 case 57600: 82 case 57600:
81 m_base->setSpeed( IOLayerBase::Baud_57600 ); 83 m_base->setSpeed( IOLayerBase::Baud_57600 );
82 break; 84 break;
83 case 38400: 85 case 38400:
84 m_base->setSpeed(IOLayerBase::Baud_38400 ); 86 m_base->setSpeed(IOLayerBase::Baud_38400 );
85 break; 87 break;
86 case 19200: 88 case 19200:
87 m_base->setSpeed( IOLayerBase::Baud_19200 ); 89 m_base->setSpeed( IOLayerBase::Baud_19200 );
88 break; 90 break;
89 case 9600: 91 case 9600:
90 default: 92 default:
91 m_base->setSpeed(IOLayerBase::Baud_9600 ); 93 m_base->setSpeed(IOLayerBase::Baud_9600 );
92 break; 94 break;
93 } 95 }
94 96
95 if ( prof.readEntry("Device").isEmpty() ) return; 97 if ( prof.readEntry("Device").isEmpty() ) return;
96 setCurrent( prof.readEntry("Device"), m_deviceCmb ); 98 setCurrent( prof.readEntry("Device"), m_deviceCmb );
97 99
@@ -104,48 +106,51 @@ void BTConfigWidget::load( const Profile& prof ) {
104void BTConfigWidget::save( Profile& prof ) { 106void BTConfigWidget::save( Profile& prof ) {
105 int flow, parity, speed; 107 int flow, parity, speed;
106 prof.writeEntry("Device", m_deviceCmb->currentText() ); 108 prof.writeEntry("Device", m_deviceCmb->currentText() );
107 109
108 110
109 switch( m_base->flow() ) { 111 switch( m_base->flow() ) {
110 case IOLayerBase::None: 112 case IOLayerBase::None:
111 flow = 0; 113 flow = 0;
112 break; 114 break;
113 case IOLayerBase::Software: 115 case IOLayerBase::Software:
114 flow = 2; 116 flow = 2;
115 break; 117 break;
116 case IOLayerBase::Hardware: 118 case IOLayerBase::Hardware:
117 flow = 1; 119 flow = 1;
118 break; 120 break;
119 } 121 }
120 122
121 switch( m_base->parity() ) { 123 switch( m_base->parity() ) {
122 case IOLayerBase::Odd: 124 case IOLayerBase::Odd:
123 parity = 2; 125 parity = 2;
124 break; 126 break;
125 case IOLayerBase::Even: 127 case IOLayerBase::Even:
126 parity = 1; 128 parity = 1;
127 break; 129 break;
130 case IOLayerBase::NonePar:
131 parity = 0;
132 break;
128 } 133 }
129 134
130 switch( m_base->speed() ) { 135 switch( m_base->speed() ) {
131 case IOLayerBase::Baud_115200: 136 case IOLayerBase::Baud_115200:
132 speed = 115200; 137 speed = 115200;
133 break; 138 break;
134 case IOLayerBase::Baud_57600: 139 case IOLayerBase::Baud_57600:
135 speed = 57600; 140 speed = 57600;
136 break; 141 break;
137 case IOLayerBase::Baud_38400: 142 case IOLayerBase::Baud_38400:
138 speed = 38400; 143 speed = 38400;
139 break; 144 break;
140 case IOLayerBase::Baud_19200: 145 case IOLayerBase::Baud_19200:
141 speed = 19200; 146 speed = 19200;
142 break; 147 break;
143 case IOLayerBase::Baud_9600: 148 case IOLayerBase::Baud_9600:
144 speed = 9600; 149 speed = 9600;
145 break; 150 break;
146 } 151 }
147 152
148 prof.writeEntry("Flow", flow); 153 prof.writeEntry("Flow", flow);
149 prof.writeEntry("Parity", parity); 154 prof.writeEntry("Parity", parity);
150 prof.writeEntry("Speed", speed); 155 prof.writeEntry("Speed", speed);
151 prof.writeEntry("Mac", m_mac->text() ); 156 prof.writeEntry("Mac", m_mac->text() );
diff --git a/noncore/apps/opie-console/emulation_widget.cpp b/noncore/apps/opie-console/emulation_widget.cpp
index 9138f29..d8e342b 100644
--- a/noncore/apps/opie-console/emulation_widget.cpp
+++ b/noncore/apps/opie-console/emulation_widget.cpp
@@ -1,77 +1,78 @@
1// opie-console includes 1// opie-console includes
2#include "emulation_widget.h" 2#include "emulation_widget.h"
3#include "common.h" 3#include "common.h"
4#include "widget_layer.h" 4#include "widget_layer.h"
5#include "profile.h" 5#include "profile.h"
6 6
7// qt includes 7// qt includes
8#include <qwidget.h> 8#include <qwidget.h>
9#include <qarray.h> 9#include <qarray.h>
10#include <qstring.h> 10#include <qstring.h>
11#include <qpainter.h> 11#include <qpainter.h>
12#include <qrect.h> 12#include <qrect.h>
13#include <qscrollbar.h> 13#include <qscrollbar.h>
14 14
15#define rimX 0 // left/right rim width 15#define rimX 0 // left/right rim width
16#define rimY 0 // top/bottom rim high 16#define rimY 0 // top/bottom rim high
17 17
18#define SCRWIDTH 16 // width of scrollbar 18#define SCRWIDTH 16 // width of scrollbar
19 19
20 20
21static const ColorEntry color_table[TABLE_COLORS] = 21static const ColorEntry color_table[TABLE_COLORS] =
22{ 22{
23 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback 23 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback
24 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red 24 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red
25 ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow 25 ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow
26 ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta 26 ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta
27 ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White 27 ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White
28 // intensiv 28 // intensiv
29 ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), 29 ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ),
30 ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), 30 ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ),
31 ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), 31 ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ),
32 ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), 32 ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ),
33 ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 ) 33 ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 )
34}; 34};
35 35
36EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const char* name ) : WidgetLayer( config, parent, name ) 36EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const char* name ) : WidgetLayer( config, parent, name )
37{ 37{
38 38
39 // initialize font attributes 39 // initialize font attributes
40 QFontMetrics fm( font() ); 40 QFontMetrics fm( font() );
41 f_height = fm.height(); 41 f_height = fm.height();
42 f_width = fm.maxWidth(); 42 f_width = fm.maxWidth();
43 f_ascent = fm.ascent(); 43 f_ascent = fm.ascent();
44 44
45
45 // initialize scrollbar related vars 46 // initialize scrollbar related vars
46 m_scrollbar = new QScrollBar( this ); 47 m_scrollbar = new QScrollBar( this );
47 m_scrollbar->setCursor( arrowCursor ); 48 m_scrollbar->setCursor( arrowCursor );
48 49
49 // give reasonable defaults to m_columns, m_lines 50 // give reasonable defaults to m_columns, m_lines
50 calcGeometry(); 51 calcGeometry();
51 52
52 // load config 53 // load config
53 reloadConfig( config ); 54 reloadConfig( config );
54 55
55 m_resizing = false; 56 m_resizing = false;
56} 57}
57 58
58void EmulationWidget::reloadConfig( const Profile& config ) 59void EmulationWidget::reloadConfig( const Profile& config )
59{ 60{
60 61
61 // nothing yet 62 // nothing yet
62} 63}
63 64
64EmulationWidget::~EmulationWidget() 65EmulationWidget::~EmulationWidget()
65{ 66{
66 //clean up 67 //clean up
67} 68}
68 69
69static QChar vt100extended(QChar c) 70static QChar vt100extended(QChar c)
70{ 71{
71 switch (c.unicode()) 72 switch (c.unicode())
72 { 73 {
73 case 0x25c6 : return 1; 74 case 0x25c6 : return 1;
74 case 0x2592 : return 2; 75 case 0x2592 : return 2;
75 case 0x2409 : return 3; 76 case 0x2409 : return 3;
76 case 0x240c : return 4; 77 case 0x240c : return 4;
77 case 0x240d : return 5; 78 case 0x240d : return 5;
@@ -88,48 +89,49 @@ static QChar vt100extended(QChar c)
88 case 0xf800 : return 16; 89 case 0xf800 : return 16;
89 case 0xf801 : return 17; 90 case 0xf801 : return 17;
90 case 0x2500 : return 18; 91 case 0x2500 : return 18;
91 case 0xf803 : return 19; 92 case 0xf803 : return 19;
92 case 0xf804 : return 20; 93 case 0xf804 : return 20;
93 case 0x251c : return 21; 94 case 0x251c : return 21;
94 case 0x2524 : return 22; 95 case 0x2524 : return 22;
95 case 0x2534 : return 23; 96 case 0x2534 : return 23;
96 case 0x252c : return 24; 97 case 0x252c : return 24;
97 case 0x2502 : return 25; 98 case 0x2502 : return 25;
98 case 0x2264 : return 26; 99 case 0x2264 : return 26;
99 case 0x2265 : return 27; 100 case 0x2265 : return 27;
100 case 0x03c0 : return 28; 101 case 0x03c0 : return 28;
101 case 0x2260 : return 29; 102 case 0x2260 : return 29;
102 case 0x00a3 : return 30; 103 case 0x00a3 : return 30;
103 case 0x00b7 : return 31; 104 case 0x00b7 : return 31;
104 } 105 }
105 return c; 106 return c;
106} 107}
107 108
108 109
109QSize EmulationWidget::calcSize( int cols, int lins ) const 110QSize EmulationWidget::calcSize( int cols, int lins ) const
110{ 111{
111 int frw = width() - contentsRect().width(); 112 int frw = width() - contentsRect().width();
113
112 int frh = height() - contentsRect().height(); 114 int frh = height() - contentsRect().height();
113 int scw = (scrollLoc == SCRNONE? 0 : m_scrollbar->width() ); 115 int scw = (scrollLoc == SCRNONE? 0 : m_scrollbar->width() );
114 return QSize( f_width * cols + 2 * rimX + frw + scw, f_height * lins + 2 * rimY + frh ); 116 return QSize( f_width * cols + 2 * rimX + frw + scw, f_height * lins + 2 * rimY + frh );
115} 117}
116 118
117void EmulationWidget::setImage( QArray<Character> const newimg, int lines, int columns ) 119void EmulationWidget::setImage( QArray<Character> const newimg, int lines, int columns )
118{ 120{
119 const QPixmap* pm = backgroundPixmap(); 121 const QPixmap* pm = backgroundPixmap();
120 QPainter paint; 122 QPainter paint;
121 123
122 // dont allow updates, while drawing 124 // dont allow updates, while drawing
123 setUpdatesEnabled( false ); 125 setUpdatesEnabled( false );
124 126
125 paint.begin( this ); 127 paint.begin( this );
126 128
127 QPoint tL = contentsRect().topLeft(); 129 QPoint tL = contentsRect().topLeft();
128 int tLx = tL.x(); 130 int tLx = tL.x();
129 int tLy = tL.y(); 131 int tLy = tL.y();
130 //hasBlinker = false; 132 //hasBlinker = false;
131 133
132 int cf = -1; 134 int cf = -1;
133 int cb = -1; 135 int cb = -1;
134 int cr = -1; 136 int cr = -1;
135 137
@@ -212,49 +214,53 @@ void EmulationWidget::paintEvent( QPaintEvent* pe )
212 int cb = m_image[loc(x,y)].b; 214 int cb = m_image[loc(x,y)].b;
213 int cr = m_image[loc(x,y)].r; 215 int cr = m_image[loc(x,y)].r;
214 while (x+len <= rlx && 216 while (x+len <= rlx &&
215 m_image[loc(x+len,y)].f == cf && 217 m_image[loc(x+len,y)].f == cf &&
216 m_image[loc(x+len,y)].b == cb && 218 m_image[loc(x+len,y)].b == cb &&
217 m_image[loc(x+len,y)].r == cr ) 219 m_image[loc(x+len,y)].r == cr )
218 { 220 {
219 disstrU[len] = vt100extended(m_image[loc(x+len,y)].c); 221 disstrU[len] = vt100extended(m_image[loc(x+len,y)].c);
220 len += 1; 222 len += 1;
221 } 223 }
222 QString unistr(disstrU,len); 224 QString unistr(disstrU,len);
223 225
224 drawAttrString( unistr, painter, QRect( m_blX+tLx+f_width*x,m_bY+tLy+f_height*y,f_width*len,f_height ), m_image[loc(x ,y )], pm != 0l, false ); 226 drawAttrString( unistr, painter, QRect( m_blX+tLx+f_width*x,m_bY+tLy+f_height*y,f_width*len,f_height ), m_image[loc(x ,y )], pm != 0l, false );
225 x +=len -1; 227 x +=len -1;
226 } 228 }
227 delete [] disstrU; 229 delete [] disstrU;
228 drawFrame( &painter ); 230 drawFrame( &painter );
229 painter.end(); 231 painter.end();
230} 232}
231 233
232void EmulationWidget::calcGeometry() 234void EmulationWidget::calcGeometry()
233{ 235{
234 m_scrollbar->resize(QApplication::style().scrollBarExtent().width(), contentsRect().height() ); 236 m_scrollbar->resize(QApplication::style().scrollBarExtent().width(), contentsRect().height() );
235 237
236 switch( scrollLoc ) 238 qDebug( QString(" TEST").arg( contentsRect().width() ) );
239 qDebug( QString(" TEST").arg( contentsRect().height() ) );
240 qDebug("NEUER TESTT!!!!!!!!");
241
242 switch( scrollLoc )
237 { 243 {
238 case SCRNONE : 244 case SCRNONE :
239 m_columns = ( contentsRect().width() -2 * rimX ) / f_width; 245 m_columns = ( contentsRect().width() -2 * rimX ) / f_width;
240 m_blX = ( contentsRect().width() - ( m_columns*f_width ) ) / 2; 246 m_blX = ( contentsRect().width() - ( m_columns*f_width ) ) / 2;
241 m_brX = m_blX; 247 m_brX = m_blX;
242 m_scrollbar->hide(); 248 m_scrollbar->hide();
243 break; 249 break;
244 case SCRLEFT : 250 case SCRLEFT :
245 m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width; 251 m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width;
246 m_brX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2; 252 m_brX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2;
247 m_blX = m_brX + m_scrollbar->width(); 253 m_blX = m_brX + m_scrollbar->width();
248 m_scrollbar->move( contentsRect().topLeft() ); 254 m_scrollbar->move( contentsRect().topLeft() );
249 m_scrollbar->show(); 255 m_scrollbar->show();
250 break; 256 break;
251 case SCRIGHT: 257 case SCRIGHT:
252 m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width; 258 m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width;
253 m_blX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2; 259 m_blX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2;
254 m_brX = m_blX; 260 m_brX = m_blX;
255 m_scrollbar->move( contentsRect().topRight() - QPoint (m_scrollbar->width()-1,0 ) ); 261 m_scrollbar->move( contentsRect().topRight() - QPoint (m_scrollbar->width()-1,0 ) );
256 m_scrollbar->show(); 262 m_scrollbar->show();
257 break; 263 break;
258 } 264 }
259 265
260 m_lines = ( contentsRect().height() - 2 * rimY ) / f_height; 266 m_lines = ( contentsRect().height() - 2 * rimY ) / f_height;
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp
index 28d1722..d93dc5a 100644
--- a/noncore/apps/opie-console/io_modem.cpp
+++ b/noncore/apps/opie-console/io_modem.cpp
@@ -16,48 +16,49 @@ IOModem::~IOModem() {
16void IOModem::close() { 16void IOModem::close() {
17 17
18 IOSerial::close(); 18 IOSerial::close();
19 19
20} 20}
21 21
22bool IOModem::open() { 22bool IOModem::open() {
23 bool ret = IOSerial::open(); 23 bool ret = IOSerial::open();
24 if(!ret) return false; 24 if(!ret) return false;
25 25
26 qWarning("IOModem::open continues..."); 26 qWarning("IOModem::open continues...");
27 27
28 Dialer d(m_profile); 28 Dialer d(m_profile);
29 qWarning("dialer created"); 29 qWarning("dialer created");
30 30
31 int result = d.exec(); 31 int result = d.exec();
32 if(result == QDialog::Accepted) 32 if(result == QDialog::Accepted)
33 { 33 {
34 return true; 34 return true;
35 } 35 }
36 else return false; 36 else return false;
37} 37}
38 38
39void IOModem::reload( const Profile &config ) { 39void IOModem::reload( const Profile &config ) {
40
40 m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE); 41 m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE);
41 m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD); 42 m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD);
42 m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY); 43 m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY);
43 m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS); 44 m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS);
44 m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS); 45 m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS);
45 m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW); 46 m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW);
46 47
47 m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ); 48 m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING );
48 m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ); 49 m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING );
49 m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ); 50 m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 );
50 m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ); 51 m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 );
51 m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ); 52 m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 );
52 m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ); 53 m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 );
53 m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ); 54 m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 );
54 m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ); 55 m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 );
55 m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ); 56 m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING );
56 m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ); 57 m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING );
57 m_cancel = config.readEntry("CancelString", MODEM_DEFAULT_CANCEL_STRING ); 58 m_cancel = config.readEntry("CancelString", MODEM_DEFAULT_CANCEL_STRING );
58 m_dialTime = config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ); 59 m_dialTime = config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME );
59 m_delayRedial = config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ); 60 m_delayRedial = config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL );
60 m_numberTries = config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ); 61 m_numberTries = config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES );
61 m_dtrDropTime = config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ); 62 m_dtrDropTime = config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME );
62 m_bpsDetect = config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ); 63 m_bpsDetect = config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT );
63 m_dcdLines = config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ); 64 m_dcdLines = config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES );
diff --git a/noncore/apps/opie-console/iolayerbase.cpp b/noncore/apps/opie-console/iolayerbase.cpp
index ec88b49..08acb75 100644
--- a/noncore/apps/opie-console/iolayerbase.cpp
+++ b/noncore/apps/opie-console/iolayerbase.cpp
@@ -1,159 +1,168 @@
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 <qbuttongroup.h> 4#include <qbuttongroup.h>
5#include <qhbuttongroup.h> 5#include <qhbuttongroup.h>
6#include <qradiobutton.h> 6#include <qradiobutton.h>
7 7
8#include "iolayerbase.h" 8#include "iolayerbase.h"
9 9
10namespace { 10namespace {
11 enum ParityIds { 11 enum ParityIds {
12 id_parity_none,
12 id_parity_odd, 13 id_parity_odd,
13 id_parity_even 14 id_parity_even
14 }; 15 };
15 16
16 enum FlowIds { 17 enum FlowIds {
17 id_flow_hw, 18 id_flow_hw,
18 id_flow_sw, 19 id_flow_sw,
19 id_flow_none, 20 id_flow_none,
20 }; 21 };
21 22
22 enum SpeedIds { 23 enum SpeedIds {
23 id_baud_115200, 24 id_baud_115200,
24 id_baud_57600, 25 id_baud_57600,
25 id_baud_38400, 26 id_baud_38400,
26 id_baud_19200, 27 id_baud_19200,
27 id_baud_9600 28 id_baud_9600
28 }; 29 };
29 30
30} 31}
31 32
32 33
33IOLayerBase::IOLayerBase( QWidget* par, const char* name ) 34IOLayerBase::IOLayerBase( QWidget* par, const char* name )
34 : QWidget( par, name ) 35 : QWidget( par, name )
35{ 36{
36 m_speedLabel = new QLabel(tr("Speed"), this ); 37 m_speedLabel = new QLabel(tr("Speed"), this );
37 m_speedBox = new QComboBox(this ); 38 m_speedBox = new QComboBox(this );
38 39
39 m_groupFlow = new QButtonGroup(tr("Flow control"),this ); 40 m_groupFlow = new QButtonGroup(tr("Flow control"),this );
40 m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow ); 41 m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow );
41 m_flowSw = new QRadioButton(tr("Software"), m_groupFlow ); 42 m_flowSw = new QRadioButton(tr("Software"), m_groupFlow );
42 m_flowNone = new QRadioButton( tr("None"), m_groupFlow ); 43 m_flowNone = new QRadioButton( tr("None"), m_groupFlow );
43 44
44 m_groupParity = new QButtonGroup(tr("Parity"), this ); 45 m_groupParity = new QButtonGroup(tr("Parity"), this );
46 m_parityNone = new QRadioButton(tr("None"), m_groupParity );
45 m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity ); 47 m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity );
46 m_parityEven = new QRadioButton(tr("Even"), m_groupParity ); 48 m_parityEven = new QRadioButton(tr("Even"), m_groupParity );
47 49
48 m_lroot = new QVBoxLayout( this ); 50 m_lroot = new QVBoxLayout( this );
49 m_lroot->add(m_speedLabel ); 51 m_lroot->add(m_speedLabel );
50 m_lroot->add(m_speedBox ); 52 m_lroot->add(m_speedBox );
51 m_lroot->setStretchFactor(m_speedLabel, 1); 53 m_lroot->setStretchFactor(m_speedLabel, 1);
52 m_lroot->setStretchFactor(m_speedBox, 1 ); 54 m_lroot->setStretchFactor(m_speedBox, 1 );
53 55
54 m_hbox = new QHBoxLayout(m_groupFlow, 2 ); 56 m_hbox = new QHBoxLayout(m_groupFlow, 2 );
55 m_hbox->add(m_flowHw ); 57 m_hbox->add(m_flowHw );
56 m_hbox->add(m_flowSw ); 58 m_hbox->add(m_flowSw );
57 m_hbox->add(m_flowNone ); 59 m_hbox->add(m_flowNone );
58 m_lroot->add(m_groupFlow ); 60 m_lroot->add(m_groupFlow );
59 m_lroot->setStretchFactor(m_groupFlow, 2 ); 61 m_lroot->setStretchFactor(m_groupFlow, 2 );
60 62
61 m_hboxPar = new QHBoxLayout( m_groupParity, 2 ); 63 m_hboxPar = new QHBoxLayout( m_groupParity, 2 );
62 m_hboxPar->add(m_parityOdd ); 64 m_hboxPar->add(m_parityOdd );
63 m_hboxPar->add(m_parityEven ); 65 m_hboxPar->add(m_parityEven );
66 m_hboxPar->add(m_parityNone );
64 m_lroot->add(m_groupParity ); 67 m_lroot->add(m_groupParity );
65 m_lroot->setStretchFactor(m_groupParity, 2 ); 68 m_lroot->setStretchFactor(m_groupParity, 2 );
66 69
67 // profiles 70 // profiles
68 m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 ); 71 m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 );
69 m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 ); 72 m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 );
70 m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 ); 73 m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 );
71 m_speedBox->insertItem(tr("19200 baud"), id_baud_19200 ); 74 m_speedBox->insertItem(tr("19200 baud"), id_baud_19200 );
72 m_speedBox->insertItem(tr("9600 baud"), id_baud_9600 ); 75 m_speedBox->insertItem(tr("9600 baud"), id_baud_9600 );
73}; 76};
74IOLayerBase::~IOLayerBase() { 77IOLayerBase::~IOLayerBase() {
75 78
76} 79}
77void IOLayerBase::setFlow( Flow flo ) { 80void IOLayerBase::setFlow( Flow flo ) {
78 switch ( flo ) { 81 switch ( flo ) {
79 case Software: 82 case Software:
80 m_flowSw->setChecked( true ); 83 m_flowSw->setChecked( true );
81 break; 84 break;
82 case Hardware: 85 case Hardware:
83 m_flowHw->setChecked( true ); 86 m_flowHw->setChecked( true );
84 break; 87 break;
85 case None: 88 case None:
86 m_flowNone->setChecked( true ); 89 m_flowNone->setChecked( true );
87 break; 90 break;
88 } 91 }
89} 92}
90 93
91void IOLayerBase::setParity( Parity par ) { 94void IOLayerBase::setParity( Parity par ) {
92 switch( par ) { 95 switch( par ) {
96 case NonePar:
97 m_parityNone->setChecked( true );
98 break;
93 case Odd: 99 case Odd:
94 m_parityOdd->setChecked( true ); 100 m_parityOdd->setChecked( true );
95 break; 101 break;
96 case Even: 102 case Even:
97 m_parityEven->setChecked( true ); 103 m_parityEven->setChecked( true );
98 break; 104 break;
99 } 105 }
100} 106}
101void IOLayerBase::setSpeed( Speed sp ) { 107void IOLayerBase::setSpeed( Speed sp ) {
102 int index; 108 int index;
103 switch( sp ) { 109 switch( sp ) {
104 case Baud_115200: 110 case Baud_115200:
105 index = id_baud_115200; 111 index = id_baud_115200;
106 break; 112 break;
107 case Baud_57600: 113 case Baud_57600:
108 index = id_baud_57600; 114 index = id_baud_57600;
109 break; 115 break;
110 case Baud_38400: 116 case Baud_38400:
111 index = id_baud_38400; 117 index = id_baud_38400;
112 break; 118 break;
113 case Baud_19200: 119 case Baud_19200:
114 index = id_baud_19200; 120 index = id_baud_19200;
115 break; 121 break;
116 case Baud_9600: 122 case Baud_9600:
117 index = id_baud_9600; 123 index = id_baud_9600;
118 break; 124 break;
119 } 125 }
120 m_speedBox->setCurrentItem(index ); 126 m_speedBox->setCurrentItem(index );
121} 127}
122IOLayerBase::Flow IOLayerBase::flow()const { 128IOLayerBase::Flow IOLayerBase::flow()const {
123 if (m_flowHw->isChecked() ) { 129 if (m_flowHw->isChecked() ) {
124 qWarning("Hardware flow"); 130 qWarning("Hardware flow");
125 return Hardware; 131 return Hardware;
126 }else if( m_flowSw->isChecked() ) { 132 }else if( m_flowSw->isChecked() ) {
127 qWarning("Software"); 133 qWarning("Software");
128 return Software; 134 return Software;
129 } else { 135 } else {
130 qWarning("None"); 136 qWarning("None");
131 return None; 137 return None;
132 } 138 }
133} 139}
134IOLayerBase::Parity IOLayerBase::parity()const { 140IOLayerBase::Parity IOLayerBase::parity()const {
135 if (m_parityOdd->isChecked() ) 141 if ( m_parityOdd->isChecked() ) {
136 return Odd; 142 return Odd;
137 else 143 } else if ( m_parityEven->isChecked() ) {
138 return Even; 144 return Even;
145 } else {
146 return NonePar;
147 }
139 148
140} 149}
141IOLayerBase::Speed IOLayerBase::speed()const{ 150IOLayerBase::Speed IOLayerBase::speed()const{
142 switch( m_speedBox->currentItem() ) { 151 switch( m_speedBox->currentItem() ) {
143 case id_baud_115200: 152 case id_baud_115200:
144 return Baud_115200; 153 return Baud_115200;
145 break; 154 break;
146 case id_baud_57600: 155 case id_baud_57600:
147 return Baud_57600; 156 return Baud_57600;
148 break; 157 break;
149 case id_baud_38400: 158 case id_baud_38400:
150 return Baud_38400; 159 return Baud_38400;
151 break; 160 break;
152 case id_baud_19200: 161 case id_baud_19200:
153 return Baud_19200; 162 return Baud_19200;
154 break; 163 break;
155 case id_baud_9600: 164 case id_baud_9600:
156 return Baud_9600; 165 return Baud_9600;
157 break; 166 break;
158 } 167 }
159} 168}
diff --git a/noncore/apps/opie-console/iolayerbase.h b/noncore/apps/opie-console/iolayerbase.h
index d14f334..74de46a 100644
--- a/noncore/apps/opie-console/iolayerbase.h
+++ b/noncore/apps/opie-console/iolayerbase.h
@@ -1,47 +1,49 @@
1#ifndef OPIE_IO_LAYER_BASE_H 1#ifndef OPIE_IO_LAYER_BASE_H
2#define OPIE_IO_LAYER_BASE_H 2#define OPIE_IO_LAYER_BASE_H
3 3
4 4
5#include <qwidget.h> 5#include <qwidget.h>
6 6
7class QLabel; 7class QLabel;
8class QComboBox; 8class QComboBox;
9class QVBoxLayout; 9class QVBoxLayout;
10class QButtonGroup; 10class QButtonGroup;
11class QRadioButton; 11class QRadioButton;
12class QHBoxLayout; 12class QHBoxLayout;
13class IOLayerBase : public QWidget { 13class IOLayerBase : public QWidget {
14
14 Q_OBJECT 15 Q_OBJECT
16
15public: 17public:
16 enum Flow { Hardware, Software, None }; 18 enum Flow { Hardware, Software, None };
17 enum Parity{ Odd =2 , Even =1 }; 19 enum Parity{ Odd =2 , Even =1, NonePar =0 };
18 enum Speed{ Baud_115200, 20 enum Speed{ Baud_115200,
19 Baud_57600, 21 Baud_57600,
20 Baud_38400, 22 Baud_38400,
21 Baud_19200, 23 Baud_19200,
22 Baud_9600 }; 24 Baud_9600 };
23 IOLayerBase( QWidget* base, const char* name = 0l); 25 IOLayerBase( QWidget* base, const char* name = 0l);
24 ~IOLayerBase(); 26 ~IOLayerBase();
25 27
26 void setFlow( Flow flo ); 28 void setFlow( Flow flo );
27 void setParity( Parity par ); 29 void setParity( Parity par );
28 void setSpeed( Speed speed ); 30 void setSpeed( Speed speed );
29 31
30 Flow flow()const; 32 Flow flow()const;
31 Parity parity()const; 33 Parity parity()const;
32 Speed speed()const; 34 Speed speed()const;
33private: 35private:
34 QVBoxLayout* m_lroot; 36 QVBoxLayout* m_lroot;
35 QLabel* m_speedLabel; 37 QLabel* m_speedLabel;
36 QComboBox* m_speedBox; 38 QComboBox* m_speedBox;
37 QButtonGroup* m_groupFlow; 39 QButtonGroup* m_groupFlow;
38 QRadioButton *m_flowHw, *m_flowSw, *m_flowNone; 40 QRadioButton *m_flowHw, *m_flowSw, *m_flowNone;
39 41
40 QButtonGroup* m_groupParity; 42 QButtonGroup* m_groupParity;
41 QRadioButton *m_parityOdd, *m_parityEven; 43 QRadioButton *m_parityOdd, *m_parityEven, *m_parityNone;
42 QHBoxLayout* m_hbox; 44 QHBoxLayout* m_hbox;
43 QHBoxLayout* m_hboxPar; 45 QHBoxLayout* m_hboxPar;
44}; 46};
45 47
46 48
47#endif 49#endif
diff --git a/noncore/apps/opie-console/irdaconfigwidget.cpp b/noncore/apps/opie-console/irdaconfigwidget.cpp
index 2341fd4..72e99a1 100644
--- a/noncore/apps/opie-console/irdaconfigwidget.cpp
+++ b/noncore/apps/opie-console/irdaconfigwidget.cpp
@@ -38,50 +38,52 @@ IrdaConfigWidget::IrdaConfigWidget( const QString& name,
38 m_lay->addWidget( m_base ); 38 m_lay->addWidget( m_base );
39 39
40 m_deviceCmb->insertItem( "/dev/ircomm0" ); 40 m_deviceCmb->insertItem( "/dev/ircomm0" );
41 m_deviceCmb->insertItem( "/dev/ircomm1" ); 41 m_deviceCmb->insertItem( "/dev/ircomm1" );
42} 42}
43 43
44IrdaConfigWidget::~IrdaConfigWidget() { 44IrdaConfigWidget::~IrdaConfigWidget() {
45 45
46} 46}
47void IrdaConfigWidget::load( const Profile& prof ) { 47void IrdaConfigWidget::load( const Profile& prof ) {
48 int rad_flow = prof.readNumEntry("Flow"); 48 int rad_flow = prof.readNumEntry("Flow");
49 int rad_parity = prof.readNumEntry("Parity"); 49 int rad_parity = prof.readNumEntry("Parity");
50 int speed = prof.readNumEntry("Speed"); 50 int speed = prof.readNumEntry("Speed");
51 51
52 if (rad_flow == 1) { 52 if (rad_flow == 1) {
53 m_base->setFlow( IOLayerBase::Hardware ); 53 m_base->setFlow( IOLayerBase::Hardware );
54 } else if (rad_flow == 2) { 54 } else if (rad_flow == 2) {
55 m_base->setFlow( IOLayerBase::Software ); 55 m_base->setFlow( IOLayerBase::Software );
56 } else { 56 } else {
57 m_base->setFlow( IOLayerBase::None ); 57 m_base->setFlow( IOLayerBase::None );
58 } 58 }
59 59
60 if (rad_parity == 1) { 60 if (rad_parity == 1) {
61 m_base->setParity( IOLayerBase::Even ); 61 m_base->setParity( IOLayerBase::Even );
62 } else { 62 } else if ( rad_parity == 2 ) {
63 m_base->setParity( IOLayerBase::Odd ); 63 m_base->setParity( IOLayerBase::Odd );
64 } else {
65 m_base->setParity( IOLayerBase::NonePar );
64 } 66 }
65 67
66 switch( speed ) { 68 switch( speed ) {
67 case 115200: 69 case 115200:
68 m_base->setSpeed(IOLayerBase::Baud_115200 ); 70 m_base->setSpeed(IOLayerBase::Baud_115200 );
69 break; 71 break;
70 case 57600: 72 case 57600:
71 m_base->setSpeed( IOLayerBase::Baud_57600 ); 73 m_base->setSpeed( IOLayerBase::Baud_57600 );
72 break; 74 break;
73 case 38400: 75 case 38400:
74 m_base->setSpeed(IOLayerBase::Baud_38400 ); 76 m_base->setSpeed(IOLayerBase::Baud_38400 );
75 break; 77 break;
76 case 19200: 78 case 19200:
77 m_base->setSpeed( IOLayerBase::Baud_19200 ); 79 m_base->setSpeed( IOLayerBase::Baud_19200 );
78 break; 80 break;
79 case 9600: 81 case 9600:
80 default: 82 default:
81 m_base->setSpeed(IOLayerBase::Baud_9600 ); 83 m_base->setSpeed(IOLayerBase::Baud_9600 );
82 break; 84 break;
83 } 85 }
84 86
85 if ( prof.readEntry("Device").isEmpty() ) return; 87 if ( prof.readEntry("Device").isEmpty() ) return;
86 setCurrent( prof.readEntry("Device"), m_deviceCmb ); 88 setCurrent( prof.readEntry("Device"), m_deviceCmb );
87 89
@@ -94,48 +96,51 @@ void IrdaConfigWidget::load( const Profile& prof ) {
94void IrdaConfigWidget::save( Profile& prof ) { 96void IrdaConfigWidget::save( Profile& prof ) {
95 int flow, parity, speed; 97 int flow, parity, speed;
96 prof.writeEntry("Device", m_deviceCmb->currentText() ); 98 prof.writeEntry("Device", m_deviceCmb->currentText() );
97 99
98 switch( m_base->flow() ) { 100 switch( m_base->flow() ) {
99 case IOLayerBase::None: 101 case IOLayerBase::None:
100 flow = 0; 102 flow = 0;
101 break; 103 break;
102 case IOLayerBase::Software: 104 case IOLayerBase::Software:
103 flow = 2; 105 flow = 2;
104 break; 106 break;
105 case IOLayerBase::Hardware: 107 case IOLayerBase::Hardware:
106 flow = 1; 108 flow = 1;
107 break; 109 break;
108 } 110 }
109 111
110 112
111 switch( m_base->parity() ) { 113 switch( m_base->parity() ) {
112 case IOLayerBase::Odd: 114 case IOLayerBase::Odd:
113 parity = 2; 115 parity = 2;
114 break; 116 break;
115 case IOLayerBase::Even: 117 case IOLayerBase::Even:
116 parity = 1; 118 parity = 1;
117 break; 119 break;
120 case IOLayerBase::NonePar:
121 parity = 0;
122 break;
118 } 123 }
119 124
120 switch( m_base->speed() ) { 125 switch( m_base->speed() ) {
121 case IOLayerBase::Baud_115200: 126 case IOLayerBase::Baud_115200:
122 speed = 115200; 127 speed = 115200;
123 break; 128 break;
124 case IOLayerBase::Baud_57600: 129 case IOLayerBase::Baud_57600:
125 speed = 57600; 130 speed = 57600;
126 break; 131 break;
127 case IOLayerBase::Baud_38400: 132 case IOLayerBase::Baud_38400:
128 speed = 38400; 133 speed = 38400;
129 break; 134 break;
130 case IOLayerBase::Baud_19200: 135 case IOLayerBase::Baud_19200:
131 speed = 19200; 136 speed = 19200;
132 break; 137 break;
133 case IOLayerBase::Baud_9600: 138 case IOLayerBase::Baud_9600:
134 speed = 9600; 139 speed = 9600;
135 break; 140 break;
136 } 141 }
137 142
138 prof.writeEntry("Flow", flow); 143 prof.writeEntry("Flow", flow);
139 prof.writeEntry("Parity", parity); 144 prof.writeEntry("Parity", parity);
140 prof.writeEntry("Speed", speed); 145 prof.writeEntry("Speed", speed);
141} 146}
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp
index ac62e45..0f0ce7c 100644
--- a/noncore/apps/opie-console/modemconfigwidget.cpp
+++ b/noncore/apps/opie-console/modemconfigwidget.cpp
@@ -62,52 +62,55 @@ ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent,
62} 62}
63 63
64ModemConfigWidget::~ModemConfigWidget() { 64ModemConfigWidget::~ModemConfigWidget() {
65 65
66} 66}
67void ModemConfigWidget::load( const Profile& prof ) { 67void ModemConfigWidget::load( const Profile& prof ) {
68 68
69 int rad_flow = prof.readNumEntry( "Flow" ); 69 int rad_flow = prof.readNumEntry( "Flow" );
70 int rad_parity = prof.readNumEntry( "Parity" ); 70 int rad_parity = prof.readNumEntry( "Parity" );
71 int speed = prof.readNumEntry( "Speed" ); 71 int speed = prof.readNumEntry( "Speed" );
72 QString number = prof.readEntry( "Number" ); 72 QString number = prof.readEntry( "Number" );
73 73
74 if ( !number.isEmpty() ) { 74 if ( !number.isEmpty() ) {
75 m_telNumber->setText( number ); 75 m_telNumber->setText( number );
76 } 76 }
77 77
78 if ( rad_flow == 1 ) { 78 if ( rad_flow == 1 ) {
79 m_base->setFlow( IOLayerBase::Hardware ); 79 m_base->setFlow( IOLayerBase::Hardware );
80 } else if (rad_flow == 2) { 80 } else if (rad_flow == 2) {
81 m_base->setFlow( IOLayerBase::Software ); 81 m_base->setFlow( IOLayerBase::Software );
82 } else if (rad_flow == 0) { 82 } else if (rad_flow == 0) {
83 m_base->setFlow( IOLayerBase::None ); 83 m_base->setFlow( IOLayerBase::None );
84 } 84 }
85 85
86
86 if ( rad_parity == 1 ) { 87 if ( rad_parity == 1 ) {
87 m_base->setParity( IOLayerBase::Even ); 88 m_base->setParity( IOLayerBase::Even );
88 } else { 89 } else if ( rad_parity == 2 ){
89 m_base->setParity( IOLayerBase::Odd ); 90 m_base->setParity( IOLayerBase::Odd );
91 } else {
92 m_base->setParity( IOLayerBase::NonePar );
90 } 93 }
91 94
92 switch( speed ) { 95 switch( speed ) {
93 case 115200: 96 case 115200:
94 m_base->setSpeed( IOLayerBase::Baud_115200 ); 97 m_base->setSpeed( IOLayerBase::Baud_115200 );
95 break; 98 break;
96 case 57600: 99 case 57600:
97 m_base->setSpeed( IOLayerBase::Baud_57600 ); 100 m_base->setSpeed( IOLayerBase::Baud_57600 );
98 break; 101 break;
99 case 38400: 102 case 38400:
100 m_base->setSpeed( IOLayerBase::Baud_38400 ); 103 m_base->setSpeed( IOLayerBase::Baud_38400 );
101 break; 104 break;
102 case 19200: 105 case 19200:
103 m_base->setSpeed( IOLayerBase::Baud_19200 ); 106 m_base->setSpeed( IOLayerBase::Baud_19200 );
104 break; 107 break;
105 case 9600: 108 case 9600:
106 default: 109 default:
107 m_base->setSpeed( IOLayerBase::Baud_9600 ); 110 m_base->setSpeed( IOLayerBase::Baud_9600 );
108 break; 111 break;
109 } 112 }
110 113
111 if ( prof.readEntry( "Device" ).isEmpty() ) { 114 if ( prof.readEntry( "Device" ).isEmpty() ) {
112 return; 115 return;
113 } 116 }
@@ -124,48 +127,51 @@ void ModemConfigWidget::load( const Profile& prof ) {
124void ModemConfigWidget::save( Profile& prof ) { 127void ModemConfigWidget::save( Profile& prof ) {
125 int flow, parity, speed; 128 int flow, parity, speed;
126 prof.writeEntry( "Device", m_deviceCmb->currentText() ); 129 prof.writeEntry( "Device", m_deviceCmb->currentText() );
127 130
128 131
129 switch( m_base->flow() ) { 132 switch( m_base->flow() ) {
130 case IOLayerBase::None: 133 case IOLayerBase::None:
131 flow = 0; 134 flow = 0;
132 break; 135 break;
133 case IOLayerBase::Software: 136 case IOLayerBase::Software:
134 flow = 2; 137 flow = 2;
135 break; 138 break;
136 case IOLayerBase::Hardware: 139 case IOLayerBase::Hardware:
137 flow = 1; 140 flow = 1;
138 break; 141 break;
139 } 142 }
140 143
141 switch( m_base->parity() ) { 144 switch( m_base->parity() ) {
142 case IOLayerBase::Odd: 145 case IOLayerBase::Odd:
143 parity = 2; 146 parity = 2;
144 break; 147 break;
145 case IOLayerBase::Even: 148 case IOLayerBase::Even:
146 parity = 1; 149 parity = 1;
147 break; 150 break;
151 case IOLayerBase::NonePar:
152 parity = 0;
153 break;
148 } 154 }
149 155
150 switch( m_base->speed() ) { 156 switch( m_base->speed() ) {
151 case IOLayerBase::Baud_115200: 157 case IOLayerBase::Baud_115200:
152 speed = 115200; 158 speed = 115200;
153 break; 159 break;
154 case IOLayerBase::Baud_57600: 160 case IOLayerBase::Baud_57600:
155 speed = 57600; 161 speed = 57600;
156 break; 162 break;
157 case IOLayerBase::Baud_38400: 163 case IOLayerBase::Baud_38400:
158 speed = 38400; 164 speed = 38400;
159 break; 165 break;
160 case IOLayerBase::Baud_19200: 166 case IOLayerBase::Baud_19200:
161 speed = 19200; 167 speed = 19200;
162 break; 168 break;
163 case IOLayerBase::Baud_9600: 169 case IOLayerBase::Baud_9600:
164 speed = 9600; 170 speed = 9600;
165 break; 171 break;
166 } 172 }
167 173
168 prof.writeEntry( "Flow", flow ); 174 prof.writeEntry( "Flow", flow );
169 prof.writeEntry( "Parity", parity ); 175 prof.writeEntry( "Parity", parity );
170 prof.writeEntry( "Speed", speed ); 176 prof.writeEntry( "Speed", speed );
171 prof.writeEntry( "Number", m_telNumber->text() ); 177 prof.writeEntry( "Number", m_telNumber->text() );
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index 113327c..e8bdb2e 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -57,52 +57,52 @@ void ProfileManager::clear() {
57} 57}
58Profile::ValueList ProfileManager::all()const { 58Profile::ValueList ProfileManager::all()const {
59 return m_list; 59 return m_list;
60} 60}
61/* 61/*
62 * Our goal is to create a Session 62 * Our goal is to create a Session
63 * We will load the the IOLayer and EmulationLayer 63 * We will load the the IOLayer and EmulationLayer
64 * from the factory 64 * from the factory
65 * we will generate a QWidgetStack 65 * we will generate a QWidgetStack
66 * add a dummy widget with layout 66 * add a dummy widget with layout
67 * add "Widget" to the layout 67 * add "Widget" to the layout
68 * add the dummy to the stack 68 * add the dummy to the stack
69 * raise the dummy 69 * raise the dummy
70 * call session->connect(= 70 * call session->connect(=
71 * this way we only need to reparent 71 * this way we only need to reparent
72 * in TabWidget 72 * in TabWidget
73 */ 73 */
74Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) { 74Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) {
75 Session* session = new Session(); 75 Session* session = new Session();
76 session->setName( prof.name() ); 76 session->setName( prof.name() );
77 /* translate the internal name to the external */ 77 /* translate the internal name to the external */
78 session->setIOLayer(m_fact->newIOLayer( m_fact->external(prof.ioLayerName()) , 78 session->setIOLayer(m_fact->newIOLayer( m_fact->external(prof.ioLayerName()) ,
79 prof) ); 79 prof) );
80 80
81 QWidgetStack *stack = new QWidgetStack(parent); 81 QWidgetStack *stack = new QWidgetStack( parent );
82 session->setWidgetStack( stack ); 82 session->setWidgetStack( stack );
83 QWidget* dummy = new QWidget( stack ); 83 QWidget* dummy = new QWidget( stack );
84 QHBoxLayout* lay = new QHBoxLayout(dummy ); 84 QHBoxLayout* lay = new QHBoxLayout( dummy );
85 stack->addWidget( dummy, 0 ); 85 stack->addWidget( dummy, 0 );
86 stack->raiseWidget( 0 ); 86 stack->raiseWidget( 0 );
87 EmulationHandler* handler = new EmulationHandler(prof,dummy ); 87 EmulationHandler* handler = new EmulationHandler(prof,dummy );
88 lay->addWidget( handler->widget() ); 88 lay->addWidget( handler->widget() );
89// WidgetLayer* wid = new EmulationWidget( prof, dummy ); 89// WidgetLayer* wid = new EmulationWidget( prof, dummy );
90// lay->addWidget( wid ); 90// lay->addWidget( wid );
91 91
92// session->setEmulationWidget( wid ); 92// session->setEmulationWidget( wid );
93// session->setEmulationLayer( m_fact->newEmulationLayer( m_fact->external( prof.terminalName() ), 93// session->setEmulationLayer( m_fact->newEmulationLayer( m_fact->external( prof.terminalName() ),
94// wid ) ); 94// wid ) );
95 session->connect(); 95 session->connect();
96 96
97 return session; 97 return session;
98} 98}
99void ProfileManager::save( ) { 99void ProfileManager::save( ) {
100 QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) ); 100 QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) );
101 ProfileConfig conf("opie-console-profiles"); 101 ProfileConfig conf("opie-console-profiles");
102 Profile::ValueList::Iterator it2; 102 Profile::ValueList::Iterator it2;
103 for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) { 103 for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) {
104 conf.setGroup( (*it2).name() ); 104 conf.setGroup( (*it2).name() );
105 105
106 /* now the config stuff */ 106 /* now the config stuff */
107 QMap<QString, QString> map = (*it2).conf(); 107 QMap<QString, QString> map = (*it2).conf();
108 QMap<QString, QString>::Iterator confIt; 108 QMap<QString, QString>::Iterator confIt;
diff --git a/noncore/apps/opie-console/serialconfigwidget.cpp b/noncore/apps/opie-console/serialconfigwidget.cpp
index 89acc98..d216c92 100644
--- a/noncore/apps/opie-console/serialconfigwidget.cpp
+++ b/noncore/apps/opie-console/serialconfigwidget.cpp
@@ -40,50 +40,52 @@ SerialConfigWidget::SerialConfigWidget( const QString& name,
40 m_deviceCmb->insertItem( "/dev/ttyS0" ); 40 m_deviceCmb->insertItem( "/dev/ttyS0" );
41 m_deviceCmb->insertItem( "/dev/ttyS1" ); 41 m_deviceCmb->insertItem( "/dev/ttyS1" );
42 m_deviceCmb->insertItem( "/dev/ttySA0"); 42 m_deviceCmb->insertItem( "/dev/ttySA0");
43 m_deviceCmb->insertItem( "/dev/ttySA1"); 43 m_deviceCmb->insertItem( "/dev/ttySA1");
44 44
45} 45}
46SerialConfigWidget::~SerialConfigWidget() { 46SerialConfigWidget::~SerialConfigWidget() {
47 47
48} 48}
49void SerialConfigWidget::load( const Profile& prof ) { 49void SerialConfigWidget::load( const Profile& prof ) {
50 int rad_flow = prof.readNumEntry("Flow"); 50 int rad_flow = prof.readNumEntry("Flow");
51 int rad_parity = prof.readNumEntry("Parity"); 51 int rad_parity = prof.readNumEntry("Parity");
52 int speed = prof.readNumEntry("Speed"); 52 int speed = prof.readNumEntry("Speed");
53 53
54 if (rad_flow == 1) { 54 if (rad_flow == 1) {
55 m_base->setFlow( IOLayerBase::Hardware ); 55 m_base->setFlow( IOLayerBase::Hardware );
56 } else if (rad_flow == 2) { 56 } else if (rad_flow == 2) {
57 m_base->setFlow( IOLayerBase::Software ); 57 m_base->setFlow( IOLayerBase::Software );
58 } else { 58 } else {
59 m_base->setFlow( IOLayerBase::None ); 59 m_base->setFlow( IOLayerBase::None );
60 } 60 }
61 61
62 if (rad_parity == 1) { 62 if (rad_parity == 1) {
63 m_base->setParity( IOLayerBase::Even ); 63 m_base->setParity( IOLayerBase::Even );
64 } else { 64 } else if ( rad_parity == 2 ) {
65 m_base->setParity( IOLayerBase::Odd ); 65 m_base->setParity( IOLayerBase::Odd );
66 } else {
67 m_base->setParity( IOLayerBase::NonePar );
66 } 68 }
67 69
68 switch( speed ) { 70 switch( speed ) {
69 case 115200: 71 case 115200:
70 m_base->setSpeed(IOLayerBase::Baud_115200 ); 72 m_base->setSpeed(IOLayerBase::Baud_115200 );
71 break; 73 break;
72 case 57600: 74 case 57600:
73 m_base->setSpeed( IOLayerBase::Baud_57600 ); 75 m_base->setSpeed( IOLayerBase::Baud_57600 );
74 break; 76 break;
75 case 38400: 77 case 38400:
76 m_base->setSpeed(IOLayerBase::Baud_38400 ); 78 m_base->setSpeed(IOLayerBase::Baud_38400 );
77 break; 79 break;
78 case 19200: 80 case 19200:
79 m_base->setSpeed( IOLayerBase::Baud_19200 ); 81 m_base->setSpeed( IOLayerBase::Baud_19200 );
80 break; 82 break;
81 case 9600: 83 case 9600:
82 default: 84 default:
83 m_base->setSpeed(IOLayerBase::Baud_9600 ); 85 m_base->setSpeed(IOLayerBase::Baud_9600 );
84 break; 86 break;
85 } 87 }
86 88
87 if ( prof.readEntry("Device").isEmpty() ) return; 89 if ( prof.readEntry("Device").isEmpty() ) return;
88 setCurrent( prof.readEntry("Device"), m_deviceCmb ); 90 setCurrent( prof.readEntry("Device"), m_deviceCmb );
89 91
@@ -95,48 +97,51 @@ void SerialConfigWidget::load( const Profile& prof ) {
95 */ 97 */
96void SerialConfigWidget::save( Profile& prof ) { 98void SerialConfigWidget::save( Profile& prof ) {
97 int flow, parity, speed; 99 int flow, parity, speed;
98 prof.writeEntry("Device", m_deviceCmb->currentText() ); 100 prof.writeEntry("Device", m_deviceCmb->currentText() );
99 101
100 switch( m_base->flow() ) { 102 switch( m_base->flow() ) {
101 case IOLayerBase::None: 103 case IOLayerBase::None:
102 flow = 0; 104 flow = 0;
103 break; 105 break;
104 case IOLayerBase::Software: 106 case IOLayerBase::Software:
105 flow = 2; 107 flow = 2;
106 break; 108 break;
107 case IOLayerBase::Hardware: 109 case IOLayerBase::Hardware:
108 flow = 1; 110 flow = 1;
109 break; 111 break;
110 } 112 }
111 113
112 switch( m_base->parity() ) { 114 switch( m_base->parity() ) {
113 case IOLayerBase::Odd: 115 case IOLayerBase::Odd:
114 parity = 2; 116 parity = 2;
115 break; 117 break;
116 case IOLayerBase::Even: 118 case IOLayerBase::Even:
117 parity = 1; 119 parity = 1;
118 break; 120 break;
121 case IOLayerBase::NonePar:
122 parity = 0;
123 break;
119 } 124 }
120 125
121 switch( m_base->speed() ) { 126 switch( m_base->speed() ) {
122 case IOLayerBase::Baud_115200: 127 case IOLayerBase::Baud_115200:
123 speed = 115200; 128 speed = 115200;
124 break; 129 break;
125 case IOLayerBase::Baud_57600: 130 case IOLayerBase::Baud_57600:
126 speed = 57600; 131 speed = 57600;
127 break; 132 break;
128 case IOLayerBase::Baud_38400: 133 case IOLayerBase::Baud_38400:
129 speed = 38400; 134 speed = 38400;
130 break; 135 break;
131 case IOLayerBase::Baud_19200: 136 case IOLayerBase::Baud_19200:
132 speed = 19200; 137 speed = 19200;
133 break; 138 break;
134 case IOLayerBase::Baud_9600: 139 case IOLayerBase::Baud_9600:
135 speed = 9600; 140 speed = 9600;
136 break; 141 break;
137 } 142 }
138 143
139 prof.writeEntry("Flow", flow); 144 prof.writeEntry("Flow", flow);
140 prof.writeEntry("Parity", parity); 145 prof.writeEntry("Parity", parity);
141 prof.writeEntry("Speed", speed); 146 prof.writeEntry("Speed", speed);
142} 147}