summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/btconfigwidget.cpp12
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp12
-rw-r--r--noncore/apps/opie-console/io_serial.h2
-rw-r--r--noncore/apps/opie-console/iolayerbase.cpp19
-rw-r--r--noncore/apps/opie-console/iolayerbase.h4
-rw-r--r--noncore/apps/opie-console/irdaconfigwidget.cpp12
-rw-r--r--noncore/apps/opie-console/main.cpp6
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.cpp14
-rw-r--r--noncore/apps/opie-console/serialconfigwidget.cpp12
-rw-r--r--noncore/apps/opie-console/terminalwidget.cpp70
-rw-r--r--noncore/apps/opie-console/terminalwidget.h6
11 files changed, 128 insertions, 41 deletions
diff --git a/noncore/apps/opie-console/btconfigwidget.cpp b/noncore/apps/opie-console/btconfigwidget.cpp
index 0ac337f..e1ff18a 100644
--- a/noncore/apps/opie-console/btconfigwidget.cpp
+++ b/noncore/apps/opie-console/btconfigwidget.cpp
@@ -1,190 +1,202 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qlayout.h> 2#include <qlayout.h>
3#include <qlineedit.h> 3#include <qlineedit.h>
4#include <qcombobox.h> 4#include <qcombobox.h>
5#include <qhbox.h> 5#include <qhbox.h>
6#include <qradiobutton.h> 6#include <qradiobutton.h>
7 7
8#include "iolayerbase.h" 8#include "iolayerbase.h"
9#include "btconfigwidget.h" 9#include "btconfigwidget.h"
10 10
11namespace { 11namespace {
12 void setCurrent( const QString& str, QComboBox* bo ) { 12 void setCurrent( const QString& str, QComboBox* bo ) {
13 uint b = bo->count(); 13 uint b = bo->count();
14 for (int i = 0; i < bo->count(); i++ ) { 14 for (int i = 0; i < bo->count(); i++ ) {
15 if ( bo->text(i) == str ) { 15 if ( bo->text(i) == str ) {
16 bo->setCurrentItem( i ); 16 bo->setCurrentItem( i );
17 return; 17 return;
18 } 18 }
19 } 19 }
20 bo->insertItem( str ); 20 bo->insertItem( str );
21 bo->setCurrentItem( b ); 21 bo->setCurrentItem( b );
22 } 22 }
23} 23}
24 24
25BTConfigWidget::BTConfigWidget( const QString& name, 25BTConfigWidget::BTConfigWidget( const QString& name,
26 QWidget* parent, 26 QWidget* parent,
27 const char* na ) 27 const char* na )
28 : ProfileDialogConnectionWidget( name, parent, na ) { 28 : ProfileDialogConnectionWidget( name, parent, na ) {
29 29
30 m_lay = new QVBoxLayout( this ); 30 m_lay = new QVBoxLayout( this );
31 31
32 m_device = new QLabel( tr( "Device" ), this ); 32 m_device = new QLabel( tr( "Device" ), this );
33 QHBox *deviceBox = new QHBox( this ); 33 QHBox *deviceBox = new QHBox( this );
34 m_devRadio = new QRadioButton( deviceBox ); 34 m_devRadio = new QRadioButton( deviceBox );
35 connect( m_devRadio, SIGNAL( toggled(bool) ), this, SLOT( slotDevRadio(bool) ) ); 35 connect( m_devRadio, SIGNAL( toggled(bool) ), this, SLOT( slotDevRadio(bool) ) );
36 m_deviceCmb = new QComboBox( deviceBox ); 36 m_deviceCmb = new QComboBox( deviceBox );
37 m_deviceCmb->setEditable( TRUE ); 37 m_deviceCmb->setEditable( TRUE );
38 38
39 QLabel *macLabel = new QLabel( this ); 39 QLabel *macLabel = new QLabel( this );
40 macLabel->setText( tr( "Or peer mac address" ) ); 40 macLabel->setText( tr( "Or peer mac address" ) );
41 QHBox *macBox = new QHBox( this ); 41 QHBox *macBox = new QHBox( this );
42 m_macRadio = new QRadioButton( macBox ); 42 m_macRadio = new QRadioButton( macBox );
43 connect( m_macRadio, SIGNAL( toggled(bool) ), this, SLOT( slotMacRadio(bool) ) ); 43 connect( m_macRadio, SIGNAL( toggled(bool) ), this, SLOT( slotMacRadio(bool) ) );
44 m_mac = new QLineEdit( macBox ); 44 m_mac = new QLineEdit( macBox );
45 45
46 m_base = new IOLayerBase(this, "base"); 46 m_base = new IOLayerBase(this, "base");
47 47
48 m_lay->addWidget( m_device ); 48 m_lay->addWidget( m_device );
49 m_lay->addWidget( deviceBox ); 49 m_lay->addWidget( deviceBox );
50 m_lay->addWidget( macLabel ); 50 m_lay->addWidget( macLabel );
51 m_lay->addWidget( macBox ); 51 m_lay->addWidget( macBox );
52 m_lay->addWidget( m_base ); 52 m_lay->addWidget( m_base );
53 53
54 m_deviceCmb->insertItem( "/dev/ttyU0" ); 54 m_deviceCmb->insertItem( "/dev/ttyU0" );
55 m_deviceCmb->insertItem( "/dev/ttyU1" ); 55 m_deviceCmb->insertItem( "/dev/ttyU1" );
56} 56}
57 57
58BTConfigWidget::~BTConfigWidget() { 58BTConfigWidget::~BTConfigWidget() {
59 59
60} 60}
61void BTConfigWidget::load( const Profile& prof ) { 61void BTConfigWidget::load( const Profile& prof ) {
62 int rad_flow = prof.readNumEntry("Flow"); 62 int rad_flow = prof.readNumEntry("Flow");
63 int rad_parity = prof.readNumEntry("Parity"); 63 int rad_parity = prof.readNumEntry("Parity");
64 int speed = prof.readNumEntry("Speed"); 64 int speed = prof.readNumEntry("Speed");
65 QString mac = prof.readEntry("Mac"); 65 QString mac = prof.readEntry("Mac");
66 66
67 if (!mac.isEmpty() ) { 67 if (!mac.isEmpty() ) {
68 m_mac->setText( mac ); 68 m_mac->setText( mac );
69 } else { 69 } else {
70 m_devRadio->setChecked( true ); 70 m_devRadio->setChecked( true );
71 } 71 }
72 72
73 if (rad_flow == 1) { 73 if (rad_flow == 1) {
74 m_base->setFlow( IOLayerBase::Hardware ); 74 m_base->setFlow( IOLayerBase::Hardware );
75 } else if (rad_flow == 2) { 75 } else if (rad_flow == 2) {
76 m_base->setFlow( IOLayerBase::Software ); 76 m_base->setFlow( IOLayerBase::Software );
77 } else if (rad_flow == 0) { 77 } else if (rad_flow == 0) {
78 m_base->setFlow( IOLayerBase::None ); 78 m_base->setFlow( IOLayerBase::None );
79 } 79 }
80 80
81 if (rad_parity == 1) { 81 if (rad_parity == 1) {
82 m_base->setParity( IOLayerBase::Even ); 82 m_base->setParity( IOLayerBase::Even );
83 } else if ( rad_parity == 2 ) { 83 } else if ( rad_parity == 2 ) {
84 m_base->setParity( IOLayerBase::Odd ); 84 m_base->setParity( IOLayerBase::Odd );
85 } else { 85 } else {
86 m_base->setParity( IOLayerBase::NonePar ); 86 m_base->setParity( IOLayerBase::NonePar );
87 } 87 }
88 88
89 switch( speed ) { 89 switch( speed ) {
90 case 115200: 90 case 115200:
91 m_base->setSpeed(IOLayerBase::Baud_115200 ); 91 m_base->setSpeed(IOLayerBase::Baud_115200 );
92 break; 92 break;
93 case 57600: 93 case 57600:
94 m_base->setSpeed( IOLayerBase::Baud_57600 ); 94 m_base->setSpeed( IOLayerBase::Baud_57600 );
95 break; 95 break;
96 case 38400: 96 case 38400:
97 m_base->setSpeed(IOLayerBase::Baud_38400 ); 97 m_base->setSpeed(IOLayerBase::Baud_38400 );
98 break; 98 break;
99 case 19200: 99 case 19200:
100 m_base->setSpeed( IOLayerBase::Baud_19200 ); 100 m_base->setSpeed( IOLayerBase::Baud_19200 );
101 break; 101 break;
102 case 4800:
103 m_base->setSpeed( IOLayerBase::Baud_4800 );
104 break;
105 case 2400:
106 m_base->setSpeed( IOLayerBase::Baud_2400 );
107 break;
102 case 9600: 108 case 9600:
103 default: 109 default:
104 m_base->setSpeed(IOLayerBase::Baud_9600 ); 110 m_base->setSpeed(IOLayerBase::Baud_9600 );
105 break; 111 break;
106 } 112 }
107 113
108 if ( prof.readEntry("Device").isEmpty() ) return; 114 if ( prof.readEntry("Device").isEmpty() ) return;
109 setCurrent( prof.readEntry("Device"), m_deviceCmb ); 115 setCurrent( prof.readEntry("Device"), m_deviceCmb );
110 116
111} 117}
112/* 118/*
113 * save speed, 119 * save speed,
114 * flow, 120 * flow,
115 * parity 121 * parity
116 */ 122 */
117void BTConfigWidget::save( Profile& prof ) { 123void BTConfigWidget::save( Profile& prof ) {
118 int flow, parity, speed; 124 int flow, parity, speed;
119 flow = parity = speed = 0; 125 flow = parity = speed = 0;
120 prof.writeEntry("Device", m_deviceCmb->currentText() ); 126 prof.writeEntry("Device", m_deviceCmb->currentText() );
121 127
122 128
123 switch( m_base->flow() ) { 129 switch( m_base->flow() ) {
124 case IOLayerBase::None: 130 case IOLayerBase::None:
125 flow = 0; 131 flow = 0;
126 break; 132 break;
127 case IOLayerBase::Software: 133 case IOLayerBase::Software:
128 flow = 2; 134 flow = 2;
129 break; 135 break;
130 case IOLayerBase::Hardware: 136 case IOLayerBase::Hardware:
131 flow = 1; 137 flow = 1;
132 break; 138 break;
133 } 139 }
134 140
135 switch( m_base->parity() ) { 141 switch( m_base->parity() ) {
136 case IOLayerBase::Odd: 142 case IOLayerBase::Odd:
137 parity = 2; 143 parity = 2;
138 break; 144 break;
139 case IOLayerBase::Even: 145 case IOLayerBase::Even:
140 parity = 1; 146 parity = 1;
141 break; 147 break;
142 case IOLayerBase::NonePar: 148 case IOLayerBase::NonePar:
143 parity = 0; 149 parity = 0;
144 break; 150 break;
145 } 151 }
146 152
147 switch( m_base->speed() ) { 153 switch( m_base->speed() ) {
148 case IOLayerBase::Baud_115200: 154 case IOLayerBase::Baud_115200:
149 speed = 115200; 155 speed = 115200;
150 break; 156 break;
151 case IOLayerBase::Baud_57600: 157 case IOLayerBase::Baud_57600:
152 speed = 57600; 158 speed = 57600;
153 break; 159 break;
154 case IOLayerBase::Baud_38400: 160 case IOLayerBase::Baud_38400:
155 speed = 38400; 161 speed = 38400;
156 break; 162 break;
157 case IOLayerBase::Baud_19200: 163 case IOLayerBase::Baud_19200:
158 speed = 19200; 164 speed = 19200;
159 break; 165 break;
166 case IOLayerBase::Baud_4800:
167 speed = 4800;
168 break;
169 case IOLayerBase::Baud_2400:
170 speed = 2400;
171 break;
160 default: 172 default:
161 case IOLayerBase::Baud_9600: 173 case IOLayerBase::Baud_9600:
162 speed = 9600; 174 speed = 9600;
163 break; 175 break;
164 } 176 }
165 177
166 prof.writeEntry("Flow", flow); 178 prof.writeEntry("Flow", flow);
167 prof.writeEntry("Parity", parity); 179 prof.writeEntry("Parity", parity);
168 prof.writeEntry("Speed", speed); 180 prof.writeEntry("Speed", speed);
169 prof.writeEntry("Mac", m_mac->text() ); 181 prof.writeEntry("Mac", m_mac->text() );
170} 182}
171 183
172void BTConfigWidget::slotMacRadio( bool on ) { 184void BTConfigWidget::slotMacRadio( bool on ) {
173 if ( on ) { 185 if ( on ) {
174 m_devRadio->setChecked( false ); 186 m_devRadio->setChecked( false );
175 m_deviceCmb->setEnabled( false ); 187 m_deviceCmb->setEnabled( false );
176 m_mac->setEnabled( true ); 188 m_mac->setEnabled( true );
177 } else { 189 } else {
178 m_devRadio->setChecked( true ); 190 m_devRadio->setChecked( true );
179 } 191 }
180} 192}
181 193
182void BTConfigWidget::slotDevRadio( bool on ) { 194void BTConfigWidget::slotDevRadio( bool on ) {
183 if ( on ) { 195 if ( on ) {
184 m_macRadio->setChecked( false ); 196 m_macRadio->setChecked( false );
185 m_deviceCmb->setEnabled( true ); 197 m_deviceCmb->setEnabled( true );
186 m_mac->setEnabled( false ); 198 m_mac->setEnabled( false );
187 } else { 199 } else {
188 m_macRadio->setChecked( true ); 200 m_macRadio->setChecked( true );
189 } 201 }
190} 202}
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp
index 89b70c6..1a0613f 100644
--- a/noncore/apps/opie-console/emulation_handler.cpp
+++ b/noncore/apps/opie-console/emulation_handler.cpp
@@ -1,208 +1,210 @@
1#include "TEmuVt102.h" 1#include "TEmuVt102.h"
2#include "profile.h" 2#include "profile.h"
3#include "emulation_handler.h" 3#include "emulation_handler.h"
4#include "script.h" 4#include "script.h"
5 5
6/* OPIE */ 6/* OPIE */
7#include <opie2/odebug.h> 7#include <opie2/odebug.h>
8using namespace Opie::Core; 8using namespace Opie::Core;
9 9
10EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) 10EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name )
11 : QObject(0, name ) 11 : QObject(0, name )
12{ 12{
13 m_teWid = new TEWidget( parent, "TerminalMain"); 13 m_teWid = new TEWidget( parent, "TerminalMain");
14 // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) 14 // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar)
15 // use setWrapAt(80) for normal console with scrollbar 15 // use setWrapAt(80) for normal console with scrollbar
16 setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80); 16 setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80);
17 m_teWid->setMinimumSize(150, 70 ); 17 m_teWid->setMinimumSize(150, 70 );
18 m_script = 0; 18 m_script = 0;
19 parent->resize( m_teWid->calcSize(80, 24 ) ); 19 parent->resize( m_teWid->calcSize(80, 24 ) );
20 m_teEmu = new TEmuVt102(m_teWid ); 20 m_teEmu = new TEmuVt102(m_teWid );
21 21
22 connect(m_teEmu,SIGNAL(ImageSizeChanged(int,int) ), 22 connect(m_teEmu,SIGNAL(ImageSizeChanged(int,int) ),
23 this, SIGNAL(changeSize(int,int) ) ); 23 this, SIGNAL(changeSize(int,int) ) );
24 connect(m_teEmu, SIGNAL(sndBlock(const char*,int) ), 24 connect(m_teEmu, SIGNAL(sndBlock(const char*,int) ),
25 this, SLOT(recvEmulation(const char*,int) ) ); 25 this, SLOT(recvEmulation(const char*,int) ) );
26 m_teEmu->setConnect( true ); 26 m_teEmu->setConnect( true );
27 m_teEmu->setHistory( TRUE ); 27 m_teEmu->setHistory( TRUE );
28 load( prof ); 28 load( prof );
29 29
30 30
31 31
32} 32}
33TEmulation* EmulationHandler::emulation() { 33TEmulation* EmulationHandler::emulation() {
34 return m_teEmu; 34 return m_teEmu;
35} 35}
36EmulationHandler::~EmulationHandler() { 36EmulationHandler::~EmulationHandler() {
37 if (isRecording()) 37 if (isRecording())
38 clearScript(); 38 clearScript();
39 delete m_teEmu; 39 delete m_teEmu;
40 delete m_teWid; 40 delete m_teWid;
41} 41}
42 42
43void EmulationHandler::load( const Profile& prof) { 43void EmulationHandler::load( const Profile& prof) {
44 m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); 44
45// m_teWid->setVTFont( font( prof.readNumEntry("Font") ) );
46 m_teWid->setVTFont( QFont( prof.readEntry("Font"), prof.readNumEntry( "FontSize" ), QFont::Normal ) );
45 int num = prof.readNumEntry("Color"); 47 int num = prof.readNumEntry("Color");
46 setColor( foreColor(num), backColor(num) ); 48 setColor( foreColor(num), backColor(num) );
47 m_teWid->setBackgroundColor(backColor(num) ); 49 m_teWid->setBackgroundColor(backColor(num) );
48 50
49 int term = prof.readNumEntry("Terminal", 0) ; 51 int term = prof.readNumEntry("Terminal", 0) ;
50 switch(term) { 52 switch(term) {
51 default: 53 default:
52 case Profile::VT102: 54 case Profile::VT102:
53 case Profile::VT100: 55 case Profile::VT100:
54 m_teEmu->setKeytrans("vt100.keytab"); 56 m_teEmu->setKeytrans("vt100.keytab");
55 break; 57 break;
56 case Profile::Linux: 58 case Profile::Linux:
57 m_teEmu->setKeytrans("linux.keytab"); 59 m_teEmu->setKeytrans("linux.keytab");
58 break; 60 break;
59 case Profile::XTerm: 61 case Profile::XTerm:
60 m_teEmu->setKeytrans("default.Keytab"); 62 m_teEmu->setKeytrans("default.Keytab");
61 break; 63 break;
62 } 64 }
63} 65}
64void EmulationHandler::recv( const QByteArray& ar) { 66void EmulationHandler::recv( const QByteArray& ar) {
65 m_teEmu->onRcvBlock(ar.data(), ar.count() ); 67 m_teEmu->onRcvBlock(ar.data(), ar.count() );
66} 68}
67void EmulationHandler::recvEmulation(const char* src, int len ) { 69void EmulationHandler::recvEmulation(const char* src, int len ) {
68 QByteArray ar(len); 70 QByteArray ar(len);
69 71
70 memcpy(ar.data(), src, sizeof(char) * len ); 72 memcpy(ar.data(), src, sizeof(char) * len );
71 if (isRecording()) 73 if (isRecording())
72 m_script->append(ar); 74 m_script->append(ar);
73 emit send(ar); 75 emit send(ar);
74} 76}
75QWidget* EmulationHandler::widget() { 77QWidget* EmulationHandler::widget() {
76 return m_teWid; 78 return m_teWid;
77} 79}
78/* 80/*
79 * allocate a new table of colors 81 * allocate a new table of colors
80 */ 82 */
81void EmulationHandler::setColor( const QColor& fore, const QColor& back ) { 83void EmulationHandler::setColor( const QColor& fore, const QColor& back ) {
82 ColorEntry table[TABLE_COLORS]; 84 ColorEntry table[TABLE_COLORS];
83 const ColorEntry *defaultCt = m_teWid->getdefaultColorTable(); 85 const ColorEntry *defaultCt = m_teWid->getdefaultColorTable();
84 86
85 for (int i = 0; i < TABLE_COLORS; i++ ) { 87 for (int i = 0; i < TABLE_COLORS; i++ ) {
86 if ( i == 0 || i == 10 ) { 88 if ( i == 0 || i == 10 ) {
87 table[i].color = fore; 89 table[i].color = fore;
88 }else if ( i == 1 || i == 11 ) { 90 }else if ( i == 1 || i == 11 ) {
89 table[i].color = back; 91 table[i].color = back;
90 table[i].transparent = 0; 92 table[i].transparent = 0;
91 }else { 93 }else {
92 table[i].color = defaultCt[i].color; 94 table[i].color = defaultCt[i].color;
93 } 95 }
94 } 96 }
95 m_teWid->setColorTable(table ); 97 m_teWid->setColorTable(table );
96 m_teWid->update(); 98 m_teWid->update();
97} 99}
98QFont EmulationHandler::font( int id ) { 100QFont EmulationHandler::font( int id ) {
99 QString name; 101 QString name;
100 int size = 0; 102 int size = 0;
101 switch(id ) { 103 switch(id ) {
102 default: // fall through 104 default: // fall through
103 case 0: 105 case 0:
104 name = QString::fromLatin1("Micro"); 106 name = QString::fromLatin1("Micro");
105 size = 4; 107 size = 4;
106 break; 108 break;
107 case 1: 109 case 1:
108 name = QString::fromLatin1("Fixed"); 110 name = QString::fromLatin1("Fixed");
109 size = 7; 111 size = 7;
110 break; 112 break;
111 case 2: 113 case 2:
112 name = QString::fromLatin1("Fixed"); 114 name = QString::fromLatin1("Fixed");
113 size = 12; 115 size = 12;
114 break; 116 break;
115 } 117 }
116 QFont font(name, size, QFont::Normal ); 118 QFont font(name, size, QFont::Normal );
117 font.setFixedPitch(TRUE ); 119 font.setFixedPitch(TRUE );
118 return font; 120 return font;
119} 121}
120QColor EmulationHandler::foreColor(int col) { 122QColor EmulationHandler::foreColor(int col) {
121 QColor co; 123 QColor co;
122 /* we need to switch it */ 124 /* we need to switch it */
123 switch( col ) { 125 switch( col ) {
124 default: 126 default:
125 case Profile::White: 127 case Profile::White:
126 /* color is black */ 128 /* color is black */
127 co = Qt::white; 129 co = Qt::white;
128 break; 130 break;
129 case Profile::Black: 131 case Profile::Black:
130 co = Qt::black; 132 co = Qt::black;
131 break; 133 break;
132 case Profile::Green: 134 case Profile::Green:
133 owarn << "Foreground green" << oendl; 135 owarn << "Foreground green" << oendl;
134 co = Qt::green; 136 co = Qt::green;
135 break; 137 break;
136 case Profile::Orange: 138 case Profile::Orange:
137 owarn << "Foreground orange" << oendl; 139 owarn << "Foreground orange" << oendl;
138 co.setRgb( 231, 184, 98 ); 140 co.setRgb( 231, 184, 98 );
139 break; 141 break;
140 } 142 }
141 143
142 return co; 144 return co;
143} 145}
144QColor EmulationHandler::backColor(int col ) { 146QColor EmulationHandler::backColor(int col ) {
145 QColor co; 147 QColor co;
146 /* we need to switch it */ 148 /* we need to switch it */
147 switch( col ) { 149 switch( col ) {
148 default: 150 default:
149 case Profile::White: 151 case Profile::White:
150 /* color is white */ 152 /* color is white */
151 co = Qt::black; 153 co = Qt::black;
152 break; 154 break;
153 case Profile::Black: 155 case Profile::Black:
154 co = Qt::white; 156 co = Qt::white;
155 break; 157 break;
156 case Profile::Green: 158 case Profile::Green:
157 owarn << "Background black" << oendl; 159 owarn << "Background black" << oendl;
158 co = Qt::black; 160 co = Qt::black;
159 break; 161 break;
160 case Profile::Orange: 162 case Profile::Orange:
161 owarn << "Background black" << oendl; 163 owarn << "Background black" << oendl;
162 co = Qt::black; 164 co = Qt::black;
163 break; 165 break;
164 } 166 }
165 167
166 return co; 168 return co;
167} 169}
168 170
169QPushButton* EmulationHandler::cornerButton() { 171QPushButton* EmulationHandler::cornerButton() {
170 return m_teWid->cornerButton(); 172 return m_teWid->cornerButton();
171} 173}
172 174
173 175
174Script *EmulationHandler::script() { 176Script *EmulationHandler::script() {
175 return m_script; 177 return m_script;
176} 178}
177 179
178bool EmulationHandler::isRecording() { 180bool EmulationHandler::isRecording() {
179 return (m_script != 0); 181 return (m_script != 0);
180} 182}
181 183
182void EmulationHandler::startRecording() { 184void EmulationHandler::startRecording() {
183 if (!isRecording()) 185 if (!isRecording())
184 m_script = new Script(); 186 m_script = new Script();
185} 187}
186 188
187void EmulationHandler::clearScript() { 189void EmulationHandler::clearScript() {
188 if (isRecording()) { 190 if (isRecording()) {
189 delete m_script; 191 delete m_script;
190 m_script = 0; 192 m_script = 0;
191 } 193 }
192} 194}
193 195
194void EmulationHandler::runScript(const Script *script) { 196void EmulationHandler::runScript(const Script *script) {
195 emit send(script->script()); 197 emit send(script->script());
196} 198}
197 199
198void EmulationHandler::copy() { 200void EmulationHandler::copy() {
199 m_teWid->emitSelection(); 201 m_teWid->emitSelection();
200} 202}
201void EmulationHandler::paste() { 203void EmulationHandler::paste() {
202 m_teWid->pasteClipboard(); 204 m_teWid->pasteClipboard();
203} 205}
204 206
205void EmulationHandler::setWrap(int columns) { 207void EmulationHandler::setWrap(int columns) {
206 m_teWid->setWrapAt(columns); 208 m_teWid->setWrapAt(columns);
207} 209}
208 210
diff --git a/noncore/apps/opie-console/io_serial.h b/noncore/apps/opie-console/io_serial.h
index 20c1ae1..f8b04e2 100644
--- a/noncore/apps/opie-console/io_serial.h
+++ b/noncore/apps/opie-console/io_serial.h
@@ -1,73 +1,73 @@
1#ifndef OPIE_IO_SERIAL 1#ifndef OPIE_IO_SERIAL
2#define OPIE_IO_SERIAL 2#define OPIE_IO_SERIAL
3 3
4#include <qsocketnotifier.h> 4#include <qsocketnotifier.h>
5#include "io_layer.h" 5#include "io_layer.h"
6 6
7/* Default values to be used if the profile information is incomplete */ 7/* Default values to be used if the profile information is incomplete */
8#define SERIAL_DEFAULT_DEVICE "/dev/ttyS0" 8#define SERIAL_DEFAULT_DEVICE "/dev/ttyS0"
9#define SERIAL_DEFAULT_BAUD 9600 9#define SERIAL_DEFAULT_BAUD 9600
10#define SERIAL_DEFAULT_PARITY 0 10#define SERIAL_DEFAULT_PARITY 0
11#define SERIAL_DEFAULT_DBITS 8 11#define SERIAL_DEFAULT_DBITS 8
12#define SERIAL_DEFAULT_SBITS 1 12#define SERIAL_DEFAULT_SBITS 1
13#define SERIAL_DEFAULT_FLOW 0 13#define SERIAL_DEFAULT_FLOW 0
14 14
15/* IOSerial implements a RS232 IO Layer */ 15/* IOSerial implements a RS232 IO Layer */
16 16
17class IOSerial : public IOLayer { 17class IOSerial : public IOLayer {
18 Q_OBJECT 18 Q_OBJECT
19public: 19public:
20 enum Parity { 20 enum Parity {
21 ParityNone = 0, 21 ParityNone = 0,
22 ParityEven, 22 ParityEven,
23 ParityOdd, 23 ParityOdd,
24 ParitySpace, 24 ParitySpace,
25 ParityMark 25 ParityMark
26 }; 26 };
27 27
28 enum Flow { 28 enum Flow {
29 FlowHW = 0x01, 29 FlowHW = 0x01,
30 FlowSW = 0x02 30 FlowSW = 0x02
31 }; 31 };
32 32
33 IOSerial(const Profile &); 33 IOSerial(const Profile &);
34 ~IOSerial(); 34 ~IOSerial();
35 35
36 virtual QString identifier() const; 36 virtual QString identifier() const;
37 virtual QString name() const; 37 virtual QString name() const;
38 int rawIO() const; 38 int rawIO() const;
39 void closeRawIO (int fd ); 39 void closeRawIO (int fd );
40 virtual QBitArray supports() const; 40 virtual QBitArray supports() const;
41 virtual bool isConnected(); 41 virtual bool isConnected();
42 42
43/*signals: 43/*signals:
44 void received(const QByteArray &); 44 void received(const QByteArray &);
45 void error(int, const QString &); 45 void error(int, const QString &);
46*/ 46*/
47public slots: 47public slots:
48 virtual void send(const QByteArray &); 48 virtual void send(const QByteArray &);
49 virtual bool open(); 49 virtual bool open();
50 virtual void close(); 50 virtual void close();
51 virtual void reload(const Profile &); 51 virtual void reload(const Profile &);
52protected: 52protected:
53 int baud(int baud) const; 53 int baud(int baud) const;
54 void internDetach(); 54 void internDetach();
55 void internAttach(); 55 void internAttach();
56protected slots: 56protected slots:
57 void dataArrived(); 57 void dataArrived();
58 void errorOccured(); 58 void errorOccured();
59protected: 59protected:
60 QSocketNotifier *m_read; 60 QSocketNotifier *m_read;
61 QSocketNotifier *m_error; 61 QSocketNotifier *m_error;
62 QString m_device; 62 QString m_device;
63 int m_baud; 63 int m_baud;
64 int m_parity; 64 int m_parity;
65 int m_dbits; 65 int m_dbits;
66 int m_sbits; 66 int m_sbits;
67 int m_flow; 67 int m_flow;
68 int m_fd; 68 int m_fd;
69 bool m_connected; 69 bool m_connected;
70 70
71}; 71};
72 72
73#endif /* OPIE_IO_SERIAL */ 73#endif /* OPIE_IO_SERIAL */
diff --git a/noncore/apps/opie-console/iolayerbase.cpp b/noncore/apps/opie-console/iolayerbase.cpp
index b434e66..0f64d6a 100644
--- a/noncore/apps/opie-console/iolayerbase.cpp
+++ b/noncore/apps/opie-console/iolayerbase.cpp
@@ -1,237 +1,252 @@
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 <qhbuttongroup.h> 4#include <qhbuttongroup.h>
5#include <qradiobutton.h> 5#include <qradiobutton.h>
6 6
7#include "iolayerbase.h" 7#include "iolayerbase.h"
8 8
9namespace { 9namespace {
10 enum ParityIds { 10 enum ParityIds {
11 id_parity_none, 11 id_parity_none,
12 id_parity_odd, 12 id_parity_odd,
13 id_parity_even 13 id_parity_even
14 }; 14 };
15 15
16 enum FlowIds { 16 enum FlowIds {
17 id_flow_hw, 17 id_flow_hw,
18 id_flow_sw, 18 id_flow_sw,
19 id_flow_none, 19 id_flow_none,
20 }; 20 };
21 21
22 enum SpeedIds { 22 enum SpeedIds {
23 id_baud_115200, 23 id_baud_115200,
24 id_baud_57600, 24 id_baud_57600,
25 id_baud_38400, 25 id_baud_38400,
26 id_baud_19200, 26 id_baud_19200,
27 id_baud_9600 27 id_baud_9600,
28 id_baud_4800,
29 id_baud_2400
28 }; 30 };
29 31
30 enum DataIds { 32 enum DataIds {
31 id_data_5, 33 id_data_5,
32 id_data_6, 34 id_data_6,
33 id_data_7, 35 id_data_7,
34 id_data_8 36 id_data_8
35 }; 37 };
36 38
37 enum StopIds { 39 enum StopIds {
38 id_stop_1, 40 id_stop_1,
39 id_stop_1_5, 41 id_stop_1_5,
40 id_stop_2 42 id_stop_2
41 }; 43 };
42 44
43} 45}
44 46
45 47
46IOLayerBase::IOLayerBase( QWidget* par, const char* name ) 48IOLayerBase::IOLayerBase( QWidget* par, const char* name )
47 : QWidget( par, name ) 49 : QWidget( par, name )
48{ 50{
49 m_speedLabel = new QLabel(tr("Speed"), this ); 51 m_speedLabel = new QLabel(tr("Speed"), this );
50 m_speedBox = new QComboBox(this ); 52 m_speedBox = new QComboBox(this );
51 53
52 m_groupFlow = new QHButtonGroup(tr("Flow control"),this ); 54 m_groupFlow = new QHButtonGroup(tr("Flow control"),this );
53 m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow ); 55 m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow );
54 m_flowSw = new QRadioButton(tr("Software"), m_groupFlow ); 56 m_flowSw = new QRadioButton(tr("Software"), m_groupFlow );
55 m_flowNone = new QRadioButton( tr("None"), m_groupFlow ); 57 m_flowNone = new QRadioButton( tr("None"), m_groupFlow );
56 58
57 m_groupParity = new QHButtonGroup(tr("Parity"), this ); 59 m_groupParity = new QHButtonGroup(tr("Parity"), this );
58 m_parityNone = new QRadioButton(tr("None"), m_groupParity ); 60 m_parityNone = new QRadioButton(tr("None"), m_groupParity );
59 m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity ); 61 m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity );
60 m_parityEven = new QRadioButton(tr("Even"), m_groupParity ); 62 m_parityEven = new QRadioButton(tr("Even"), m_groupParity );
61 63
62 m_groupData = new QHButtonGroup(tr("Data Bits"), this); 64 m_groupData = new QHButtonGroup(tr("Data Bits"), this);
63 m_data5 = new QRadioButton(tr("5"), m_groupData ); 65 m_data5 = new QRadioButton(tr("5"), m_groupData );
64 m_data6 = new QRadioButton(tr("6"), m_groupData ); 66 m_data6 = new QRadioButton(tr("6"), m_groupData );
65 m_data7 = new QRadioButton(tr("7"), m_groupData ); 67 m_data7 = new QRadioButton(tr("7"), m_groupData );
66 m_data8 = new QRadioButton(tr("8"), m_groupData ); 68 m_data8 = new QRadioButton(tr("8"), m_groupData );
67 69
68 m_groupStop = new QHButtonGroup(tr("Stop Bits"), this ); 70 m_groupStop = new QHButtonGroup(tr("Stop Bits"), this );
69 m_stop1 = new QRadioButton(tr("1"), m_groupStop ); 71 m_stop1 = new QRadioButton(tr("1"), m_groupStop );
70 m_stop15 = new QRadioButton(tr("1.5"), m_groupStop ); 72 m_stop15 = new QRadioButton(tr("1.5"), m_groupStop );
71 m_stop2 = new QRadioButton(tr("2"), m_groupStop ); 73 m_stop2 = new QRadioButton(tr("2"), m_groupStop );
72 74
73 75
74 m_lroot = new QVBoxLayout( this ); 76 m_lroot = new QVBoxLayout( this );
75 m_lroot->add(m_speedLabel ); 77 m_lroot->add(m_speedLabel );
76 m_lroot->add(m_speedBox ); 78 m_lroot->add(m_speedBox );
77 m_lroot->add(m_groupFlow ); 79 m_lroot->add(m_groupFlow );
78 m_lroot->add(m_groupParity ); 80 m_lroot->add(m_groupParity );
79 m_lroot->add( m_groupData ); 81 m_lroot->add( m_groupData );
80 m_lroot->add( m_groupStop ); 82 m_lroot->add( m_groupStop );
81 m_lroot->addStretch(2); 83 m_lroot->addStretch(2);
82 84
83 // profiles 85 // profiles
84 m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 ); 86 m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 );
85 m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 ); 87 m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 );
86 m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 ); 88 m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 );
87 m_speedBox->insertItem(tr("19200 baud"), id_baud_19200 ); 89 m_speedBox->insertItem(tr("19200 baud"), id_baud_19200 );
88 m_speedBox->insertItem(tr("9600 baud"), id_baud_9600 ); 90 m_speedBox->insertItem(tr("9600 baud"), id_baud_9600 );
89 91 m_speedBox->insertItem(tr("4800 baud"), id_baud_4800 );
92 m_speedBox->insertItem(tr("2400 baud"), id_baud_2400 );
90}; 93};
91IOLayerBase::~IOLayerBase() { 94IOLayerBase::~IOLayerBase() {
92 95
93} 96}
94void IOLayerBase::setFlow( Flow flo ) { 97void IOLayerBase::setFlow( Flow flo ) {
95 switch ( flo ) { 98 switch ( flo ) {
96 case Software: 99 case Software:
97 m_flowSw->setChecked( true ); 100 m_flowSw->setChecked( true );
98 break; 101 break;
99 case Hardware: 102 case Hardware:
100 m_flowHw->setChecked( true ); 103 m_flowHw->setChecked( true );
101 break; 104 break;
102 case None: 105 case None:
103 m_flowNone->setChecked( true ); 106 m_flowNone->setChecked( true );
104 break; 107 break;
105 } 108 }
106} 109}
107 110
108void IOLayerBase::setParity( Parity par ) { 111void IOLayerBase::setParity( Parity par ) {
109 switch( par ) { 112 switch( par ) {
110 case NonePar: 113 case NonePar:
111 m_parityNone->setChecked( true ); 114 m_parityNone->setChecked( true );
112 break; 115 break;
113 case Odd: 116 case Odd:
114 m_parityOdd->setChecked( true ); 117 m_parityOdd->setChecked( true );
115 break; 118 break;
116 case Even: 119 case Even:
117 m_parityEven->setChecked( true ); 120 m_parityEven->setChecked( true );
118 break; 121 break;
119 } 122 }
120} 123}
121void IOLayerBase::setSpeed( Speed sp ) { 124void IOLayerBase::setSpeed( Speed sp ) {
122 int index = -1; 125 int index = -1;
123 switch( sp ) { 126 switch( sp ) {
124 case Baud_115200: 127 case Baud_115200:
125 index = id_baud_115200; 128 index = id_baud_115200;
126 break; 129 break;
127 case Baud_57600: 130 case Baud_57600:
128 index = id_baud_57600; 131 index = id_baud_57600;
129 break; 132 break;
130 case Baud_38400: 133 case Baud_38400:
131 index = id_baud_38400; 134 index = id_baud_38400;
132 break; 135 break;
133 case Baud_19200: 136 case Baud_19200:
134 index = id_baud_19200; 137 index = id_baud_19200;
135 break; 138 break;
139 case Baud_4800:
140 index = id_baud_4800;
141 break;
142 case Baud_2400:
143 index = id_baud_2400;
144 break;
136 default: 145 default:
137 case Baud_9600: 146 case Baud_9600:
138 index = id_baud_9600; 147 index = id_baud_9600;
139 break; 148 break;
140 } 149 }
141 m_speedBox->setCurrentItem(index ); 150 m_speedBox->setCurrentItem(index );
142} 151}
143 152
144void IOLayerBase::setData( Data data ) { 153void IOLayerBase::setData( Data data ) {
145 switch( data ) { 154 switch( data ) {
146 case Data_Five: 155 case Data_Five:
147 m_data5->setChecked( true ); 156 m_data5->setChecked( true );
148 break; 157 break;
149 case Data_Six: 158 case Data_Six:
150 m_data6->setChecked( true ); 159 m_data6->setChecked( true );
151 break; 160 break;
152 case Data_Seven: 161 case Data_Seven:
153 m_data7->setChecked( true ); 162 m_data7->setChecked( true );
154 break; 163 break;
155 default: 164 default:
156 m_data8->setChecked( true ); 165 m_data8->setChecked( true );
157 break; 166 break;
158 } 167 }
159} 168}
160 169
161 170
162void IOLayerBase::setStop( Stop stop ) { 171void IOLayerBase::setStop( Stop stop ) {
163 switch( stop ) { 172 switch( stop ) {
164 case Stop_Two: 173 case Stop_Two:
165 m_stop2->setChecked( true ); 174 m_stop2->setChecked( true );
166 break; 175 break;
167 case Stop_OnePointFive: 176 case Stop_OnePointFive:
168 m_stop15->setChecked( true ); 177 m_stop15->setChecked( true );
169 break; 178 break;
170 default: 179 default:
171 m_stop1->setChecked( true ); 180 m_stop1->setChecked( true );
172 break; 181 break;
173 } 182 }
174} 183}
175 184
176 185
177 186
178IOLayerBase::Flow IOLayerBase::flow()const { 187IOLayerBase::Flow IOLayerBase::flow()const {
179 if (m_flowHw->isChecked() ) { 188 if (m_flowHw->isChecked() ) {
180 return Hardware; 189 return Hardware;
181 }else if( m_flowSw->isChecked() ) { 190 }else if( m_flowSw->isChecked() ) {
182 return Software; 191 return Software;
183 } else { 192 } else {
184 return None; 193 return None;
185 } 194 }
186} 195}
187IOLayerBase::Parity IOLayerBase::parity()const { 196IOLayerBase::Parity IOLayerBase::parity()const {
188 if ( m_parityOdd->isChecked() ) { 197 if ( m_parityOdd->isChecked() ) {
189 return Odd; 198 return Odd;
190 } else if ( m_parityEven->isChecked() ) { 199 } else if ( m_parityEven->isChecked() ) {
191 return Even; 200 return Even;
192 } else { 201 } else {
193 return NonePar; 202 return NonePar;
194 } 203 }
195 204
196} 205}
197IOLayerBase::Speed IOLayerBase::speed()const{ 206IOLayerBase::Speed IOLayerBase::speed()const{
198 switch( m_speedBox->currentItem() ) { 207 switch( m_speedBox->currentItem() ) {
199 case id_baud_115200: 208 case id_baud_115200:
200 return Baud_115200; 209 return Baud_115200;
201 break; 210 break;
202 case id_baud_57600: 211 case id_baud_57600:
203 return Baud_57600; 212 return Baud_57600;
204 break; 213 break;
205 case id_baud_38400: 214 case id_baud_38400:
206 return Baud_38400; 215 return Baud_38400;
207 break; 216 break;
208 case id_baud_19200: 217 case id_baud_19200:
209 return Baud_19200; 218 return Baud_19200;
210 break; 219 break;
220 case id_baud_4800:
221 return Baud_4800;
222 break;
223 case id_baud_2400:
224 return Baud_2400;
225 break;
211 default: 226 default:
212 case id_baud_9600: 227 case id_baud_9600:
213 return Baud_9600; 228 return Baud_9600;
214 break; 229 break;
215 } 230 }
216} 231}
217IOLayerBase::Data IOLayerBase::data()const { 232IOLayerBase::Data IOLayerBase::data()const {
218 if ( m_data5->isChecked() ) { 233 if ( m_data5->isChecked() ) {
219 return Data_Five; 234 return Data_Five;
220 } else if ( m_data6->isChecked() ) { 235 } else if ( m_data6->isChecked() ) {
221 return Data_Six; 236 return Data_Six;
222 } else if ( m_data7->isChecked() ) { 237 } else if ( m_data7->isChecked() ) {
223 return Data_Seven; 238 return Data_Seven;
224 } else { 239 } else {
225 return Data_Eight; 240 return Data_Eight;
226 } 241 }
227} 242}
228IOLayerBase::Stop IOLayerBase::stop()const { 243IOLayerBase::Stop IOLayerBase::stop()const {
229 if ( m_stop2->isChecked() ) { 244 if ( m_stop2->isChecked() ) {
230 return Stop_Two; 245 return Stop_Two;
231 } else if ( m_stop15->isChecked() ) { 246 } else if ( m_stop15->isChecked() ) {
232 return Stop_OnePointFive; 247 return Stop_OnePointFive;
233 } else { 248 } else {
234 return Stop_One; 249 return Stop_One;
235 } 250 }
236} 251}
237 252
diff --git a/noncore/apps/opie-console/iolayerbase.h b/noncore/apps/opie-console/iolayerbase.h
index e1b96df..214a35c 100644
--- a/noncore/apps/opie-console/iolayerbase.h
+++ b/noncore/apps/opie-console/iolayerbase.h
@@ -1,58 +1,60 @@
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
15 Q_OBJECT 15 Q_OBJECT
16 16
17public: 17public:
18 enum Flow { Hardware, Software, None }; 18 enum Flow { Hardware, Software, None };
19 enum Parity{ Odd =2 , Even =1, NonePar =0 }; 19 enum Parity{ Odd =2 , Even =1, NonePar =0 };
20 enum Speed{ Baud_115200, 20 enum Speed{ Baud_115200,
21 Baud_57600, 21 Baud_57600,
22 Baud_38400, 22 Baud_38400,
23 Baud_19200, 23 Baud_19200,
24 Baud_9600 }; 24 Baud_9600,
25 Baud_4800,
26 Baud_2400 };
25 enum Data { Data_Five =5, Data_Six =6, Data_Seven=7, Data_Eight=8 }; 27 enum Data { Data_Five =5, Data_Six =6, Data_Seven=7, Data_Eight=8 };
26 enum Stop { Stop_One =1, Stop_OnePointFive=15, Stop_Two=2 }; 28 enum Stop { Stop_One =1, Stop_OnePointFive=15, Stop_Two=2 };
27 29
28 IOLayerBase( QWidget* base, const char* name = 0l); 30 IOLayerBase( QWidget* base, const char* name = 0l);
29 ~IOLayerBase(); 31 ~IOLayerBase();
30 32
31 void setFlow( Flow flo ); 33 void setFlow( Flow flo );
32 void setParity( Parity par ); 34 void setParity( Parity par );
33 void setSpeed( Speed speed ); 35 void setSpeed( Speed speed );
34 void setData( Data data ); 36 void setData( Data data );
35 void setStop( Stop stop ); 37 void setStop( Stop stop );
36 38
37 Flow flow()const; 39 Flow flow()const;
38 Parity parity()const; 40 Parity parity()const;
39 Speed speed()const; 41 Speed speed()const;
40 Data data()const; 42 Data data()const;
41 Stop stop()const; 43 Stop stop()const;
42private: 44private:
43 QVBoxLayout* m_lroot; 45 QVBoxLayout* m_lroot;
44 QLabel* m_speedLabel; 46 QLabel* m_speedLabel;
45 QComboBox* m_speedBox; 47 QComboBox* m_speedBox;
46 QButtonGroup* m_groupFlow, *m_groupData, *m_groupStop ; 48 QButtonGroup* m_groupFlow, *m_groupData, *m_groupStop ;
47 QRadioButton *m_flowHw, *m_flowSw, *m_flowNone; 49 QRadioButton *m_flowHw, *m_flowSw, *m_flowNone;
48 50
49 QButtonGroup* m_groupParity; 51 QButtonGroup* m_groupParity;
50 QRadioButton *m_parityOdd, *m_parityEven, *m_parityNone; 52 QRadioButton *m_parityOdd, *m_parityEven, *m_parityNone;
51 QRadioButton *m_data5, *m_data6, *m_data7, *m_data8; 53 QRadioButton *m_data5, *m_data6, *m_data7, *m_data8;
52 QRadioButton *m_stop1, *m_stop15, *m_stop2; 54 QRadioButton *m_stop1, *m_stop15, *m_stop2;
53 QHBoxLayout* m_hbox; 55 QHBoxLayout* m_hbox;
54 QHBoxLayout* m_hboxPar; 56 QHBoxLayout* m_hboxPar;
55}; 57};
56 58
57 59
58#endif 60#endif
diff --git a/noncore/apps/opie-console/irdaconfigwidget.cpp b/noncore/apps/opie-console/irdaconfigwidget.cpp
index 059530d..4ee770d 100644
--- a/noncore/apps/opie-console/irdaconfigwidget.cpp
+++ b/noncore/apps/opie-console/irdaconfigwidget.cpp
@@ -1,148 +1,160 @@
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 4
5#include "iolayerbase.h" 5#include "iolayerbase.h"
6#include "irdaconfigwidget.h" 6#include "irdaconfigwidget.h"
7 7
8namespace { 8namespace {
9 void setCurrent( const QString& str, QComboBox* bo ) { 9 void setCurrent( const QString& str, QComboBox* bo ) {
10 uint b = bo->count(); 10 uint b = bo->count();
11 for (int i = 0; i < bo->count(); i++ ) { 11 for (int i = 0; i < bo->count(); i++ ) {
12 if ( bo->text(i) == str ) { 12 if ( bo->text(i) == str ) {
13 bo->setCurrentItem( i ); 13 bo->setCurrentItem( i );
14 return; 14 return;
15 } 15 }
16 } 16 }
17 bo->insertItem( str ); 17 bo->insertItem( str );
18 bo->setCurrentItem( b ); 18 bo->setCurrentItem( b );
19 } 19 }
20 20
21 21
22} 22}
23 23
24IrdaConfigWidget::IrdaConfigWidget( const QString& name, 24IrdaConfigWidget::IrdaConfigWidget( const QString& name,
25 QWidget* parent, 25 QWidget* parent,
26 const char* na ) 26 const char* na )
27 : ProfileDialogConnectionWidget( name, parent, na ) { 27 : ProfileDialogConnectionWidget( name, parent, na ) {
28 28
29 m_lay = new QVBoxLayout(this ); 29 m_lay = new QVBoxLayout(this );
30 m_device = new QLabel(tr("Device"), this ); 30 m_device = new QLabel(tr("Device"), this );
31 m_deviceCmb = new QComboBox(this ); 31 m_deviceCmb = new QComboBox(this );
32 m_deviceCmb->setEditable( TRUE ); 32 m_deviceCmb->setEditable( TRUE );
33 33
34 m_base = new IOLayerBase(this, "base"); 34 m_base = new IOLayerBase(this, "base");
35 35
36 m_lay->addWidget( m_device ); 36 m_lay->addWidget( m_device );
37 m_lay->addWidget( m_deviceCmb ); 37 m_lay->addWidget( m_deviceCmb );
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 if ( rad_parity == 2 ) { 62 } else if ( rad_parity == 2 ) {
63 m_base->setParity( IOLayerBase::Odd ); 63 m_base->setParity( IOLayerBase::Odd );
64 } else { 64 } else {
65 m_base->setParity( IOLayerBase::NonePar ); 65 m_base->setParity( IOLayerBase::NonePar );
66 } 66 }
67 67
68 switch( speed ) { 68 switch( speed ) {
69 case 115200: 69 case 115200:
70 m_base->setSpeed(IOLayerBase::Baud_115200 ); 70 m_base->setSpeed(IOLayerBase::Baud_115200 );
71 break; 71 break;
72 case 57600: 72 case 57600:
73 m_base->setSpeed( IOLayerBase::Baud_57600 ); 73 m_base->setSpeed( IOLayerBase::Baud_57600 );
74 break; 74 break;
75 case 38400: 75 case 38400:
76 m_base->setSpeed(IOLayerBase::Baud_38400 ); 76 m_base->setSpeed(IOLayerBase::Baud_38400 );
77 break; 77 break;
78 case 19200: 78 case 19200:
79 m_base->setSpeed( IOLayerBase::Baud_19200 ); 79 m_base->setSpeed( IOLayerBase::Baud_19200 );
80 break; 80 break;
81 case 4800:
82 m_base->setSpeed( IOLayerBase::Baud_4800 );
83 break;
84 case 2400:
85 m_base->setSpeed( IOLayerBase::Baud_2400 );
86 break;
81 case 9600: 87 case 9600:
82 default: 88 default:
83 m_base->setSpeed(IOLayerBase::Baud_9600 ); 89 m_base->setSpeed(IOLayerBase::Baud_9600 );
84 break; 90 break;
85 } 91 }
86 92
87 if ( prof.readEntry("Device").isEmpty() ) return; 93 if ( prof.readEntry("Device").isEmpty() ) return;
88 setCurrent( prof.readEntry("Device"), m_deviceCmb ); 94 setCurrent( prof.readEntry("Device"), m_deviceCmb );
89 95
90} 96}
91/* 97/*
92 * save speed, 98 * save speed,
93 * flow, 99 * flow,
94 * parity 100 * parity
95 */ 101 */
96void IrdaConfigWidget::save( Profile& prof ) { 102void IrdaConfigWidget::save( Profile& prof ) {
97 int flow, parity, speed; 103 int flow, parity, speed;
98 flow = parity = speed = 0; 104 flow = parity = speed = 0;
99 prof.writeEntry("Device", m_deviceCmb->currentText() ); 105 prof.writeEntry("Device", m_deviceCmb->currentText() );
100 106
101 switch( m_base->flow() ) { 107 switch( m_base->flow() ) {
102 case IOLayerBase::None: 108 case IOLayerBase::None:
103 flow = 0; 109 flow = 0;
104 break; 110 break;
105 case IOLayerBase::Software: 111 case IOLayerBase::Software:
106 flow = 2; 112 flow = 2;
107 break; 113 break;
108 case IOLayerBase::Hardware: 114 case IOLayerBase::Hardware:
109 flow = 1; 115 flow = 1;
110 break; 116 break;
111 } 117 }
112 118
113 119
114 switch( m_base->parity() ) { 120 switch( m_base->parity() ) {
115 case IOLayerBase::Odd: 121 case IOLayerBase::Odd:
116 parity = 2; 122 parity = 2;
117 break; 123 break;
118 case IOLayerBase::Even: 124 case IOLayerBase::Even:
119 parity = 1; 125 parity = 1;
120 break; 126 break;
121 case IOLayerBase::NonePar: 127 case IOLayerBase::NonePar:
122 parity = 0; 128 parity = 0;
123 break; 129 break;
124 } 130 }
125 131
126 switch( m_base->speed() ) { 132 switch( m_base->speed() ) {
127 case IOLayerBase::Baud_115200: 133 case IOLayerBase::Baud_115200:
128 speed = 115200; 134 speed = 115200;
129 break; 135 break;
130 case IOLayerBase::Baud_57600: 136 case IOLayerBase::Baud_57600:
131 speed = 57600; 137 speed = 57600;
132 break; 138 break;
133 case IOLayerBase::Baud_38400: 139 case IOLayerBase::Baud_38400:
134 speed = 38400; 140 speed = 38400;
135 break; 141 break;
136 case IOLayerBase::Baud_19200: 142 case IOLayerBase::Baud_19200:
137 speed = 19200; 143 speed = 19200;
138 break; 144 break;
145 case IOLayerBase::Baud_4800:
146 speed = 4800;
147 break;
148 case IOLayerBase::Baud_2400:
149 speed = 2400;
150 break;
139 default: 151 default:
140 case IOLayerBase::Baud_9600: 152 case IOLayerBase::Baud_9600:
141 speed = 9600; 153 speed = 9600;
142 break; 154 break;
143 } 155 }
144 156
145 prof.writeEntry("Flow", flow); 157 prof.writeEntry("Flow", flow);
146 prof.writeEntry("Parity", parity); 158 prof.writeEntry("Parity", parity);
147 prof.writeEntry("Speed", speed); 159 prof.writeEntry("Speed", speed);
148} 160}
diff --git a/noncore/apps/opie-console/main.cpp b/noncore/apps/opie-console/main.cpp
index 1bd4338..f61f44e 100644
--- a/noncore/apps/opie-console/main.cpp
+++ b/noncore/apps/opie-console/main.cpp
@@ -1,110 +1,110 @@
1#include <sys/types.h> 1#include <sys/types.h>
2 2
3#include <stdio.h> 3#include <stdio.h>
4#include <stdlib.h> 4#include <stdlib.h>
5#include <signal.h> 5#include <signal.h>
6 6#include <qfile.h>
7 7
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9 9
10#include "mainwindow.h" 10#include "mainwindow.h"
11 11
12//#define FSCKED_DISTRIBUTION 1 12#define FSCKED_DISTRIBUTION 1
13#ifdef FSCKED_DISTRIBUTION 13#ifdef FSCKED_DISTRIBUTION
14/* 14/*
15 * The Zaurus rom 15 * The Zaurus rom
16 */ 16 */
17class FixIt { 17class FixIt {
18public: 18public:
19 FixIt(); 19 FixIt();
20 ~FixIt(); 20 ~FixIt();
21 void fixIt(); 21 void fixIt();
22 /* no real interested in implementing it */ 22 /* no real interested in implementing it */
23 void breakIt() { 23 void breakIt() {
24 24
25 }; 25 };
26 char* m_file; 26 char* m_file;
27}; 27};
28 28
29FixIt::FixIt() { 29FixIt::FixIt() {
30 /* the new inittab */ 30 /* the new inittab */
31 m_file = "#\n# /etc/inittab" 31 m_file = "#\n# /etc/inittab"
32"#" 32"#"
33"" 33""
34"# 0 - halt (Do NOT set initdefault to this)" 34"# 0 - halt (Do NOT set initdefault to this)"
35"# 1 - Single user mode" 35"# 1 - Single user mode"
36"# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)" 36"# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)"
37"# 3 - Full multiuser mode" 37"# 3 - Full multiuser mode"
38"# 4 - JavaVM(Intent) developer mode" 38"# 4 - JavaVM(Intent) developer mode"
39"# 5 - JavaVM(Intent)" 39"# 5 - JavaVM(Intent)"
40"# 6 - reboot (Do NOT set initdefault to this)" 40"# 6 - reboot (Do NOT set initdefault to this)"
41"#" 41"#"
42"id:5:initdefault:" 42"id:5:initdefault:"
43"" 43""
44"# Specify things to do when starting" 44"# Specify things to do when starting"
45"si::sysinit:/etc/rc.d/rc.sysinit" 45"si::sysinit:/etc/rc.d/rc.sysinit"
46"" 46""
47"l0:0:wait:/root/etc/rc.d/rc 0" 47"l0:0:wait:/root/etc/rc.d/rc 0"
48"l1:1:wait:/etc/rc.d/rc 1" 48"l1:1:wait:/etc/rc.d/rc 1"
49"l2:2:wait:/etc/rc.d/rc 2" 49"l2:2:wait:/etc/rc.d/rc 2"
50"l3:3:wait:/etc/rc.d/rc 3" 50"l3:3:wait:/etc/rc.d/rc 3"
51"l4:4:wait:/etc/rc.d/rc 4" 51"l4:4:wait:/etc/rc.d/rc 4"
52"l5:5:wait:/etc/rc.d/rc 5" 52"l5:5:wait:/etc/rc.d/rc 5"
53"l6:6:wait:/root/etc/rc.d/rc 6" 53"l6:6:wait:/root/etc/rc.d/rc 6"
54"" 54""
55"# Specify things to do before rebooting" 55"# Specify things to do before rebooting"
56"um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1" 56"um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1"
57"sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1" 57"sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1"
58"" 58""
59"# Specify program to run on ttyS0" 59"# Specify program to run on ttyS0"
60"s0:24:respawn:/sbin/getty 9600 ttyS0" 60"s0:24:respawn:/sbin/getty 9600 ttyS0"
61"#pd:5:respawn:/etc/sync/serialctl" 61"#pd:5:respawn:/etc/sync/serialctl"
62"" 62""
63"# Specify program to run on tty1" 63"# Specify program to run on tty1"
64"1:2:respawn:/sbin/getty 9600 tty1" 64"1:2:respawn:/sbin/getty 9600 tty1"
65"ln:345:respawn:survive -l 6 /sbin/launch" 65"ln:345:respawn:survive -l 6 /sbin/launch"
66"#qt:5:respawn:/sbin/qt" 66"#qt:5:respawn:/sbin/qt"
67"" 67""
68"# collie sp." 68"# collie sp."
69"sy::respawn:/sbin/shsync\n"; 69"sy::respawn:/sbin/shsync\n";
70} 70}
71FixIt::~FixIt() { 71FixIt::~FixIt() {
72} 72}
73/* 73/*
74 * the retail Zaurus is broken in many ways 74 * the retail Zaurus is broken in many ways
75 * one is that pppd is listening on our port... 75 * one is that pppd is listening on our port...
76 * we've to stop it from that and then do kill(SIGHUP,1); 76 * we've to stop it from that and then do kill(SIGHUP,1);
77 */ 77 */
78void FixIt::fixIt() { 78void FixIt::fixIt() {
79 ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); 79 ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" );
80 QFile file( "/etc/inittab" ); 80 QFile file( "/etc/inittab" );
81 if ( file.open(IO_WriteOnly | IO_Raw ) ) { 81 if ( file.open(IO_WriteOnly | IO_Raw ) ) {
82 file.writeBlock(m_file,strlen(m_file) ); 82 file.writeBlock(m_file,strlen(m_file) );
83 } 83 }
84 file.close(); 84 file.close();
85 ::kill( SIGHUP, 1 ); 85 ::kill( SIGHUP, 1 );
86} 86}
87#endif 87#endif
88 88
89int main(int argc, char **argv) { 89int main(int argc, char **argv) {
90// too bad this gives us trouble the taskbar... argv[0]="embeddedkonsole"; 90// too bad this gives us trouble the taskbar... argv[0]="embeddedkonsole";
91 QPEApplication app( argc, argv ); 91 QPEApplication app( argc, argv );
92 92
93#ifdef FSCKED_DISTRIBUTION 93#ifdef FSCKED_DISTRIBUTION
94 owarn << "fscked" << oendl; 94// owarn << "fscked" << oendl;
95 FixIt it; 95 FixIt it;
96 it.fixIt(); 96 it.fixIt();
97#endif 97#endif
98 98
99 MainWindow mw; 99 MainWindow mw;
100 mw.setCaption(QObject::tr("Opie Console") ); 100 mw.setCaption(QObject::tr("Opie Console") );
101 app.showMainWidget( &mw ); 101 app.showMainWidget( &mw );
102 102
103 int ap = app.exec(); 103 int ap = app.exec();
104 104
105#ifdef FSCKED_DISTRIBUTION 105#ifdef FSCKED_DISTRIBUTION
106 /* should add a signal handler too */ 106 /* should add a signal handler too */
107 it.breakIt(); 107 it.breakIt();
108#endif 108#endif
109 return ap; 109 return ap;
110} 110}
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp
index 9fdaf73..90d0b5b 100644
--- a/noncore/apps/opie-console/modemconfigwidget.cpp
+++ b/noncore/apps/opie-console/modemconfigwidget.cpp
@@ -1,259 +1,271 @@
1#include "modemconfigwidget.h" 1#include "modemconfigwidget.h"
2#include "dialdialog.h" 2#include "dialdialog.h"
3 3
4/* OPIE */ 4/* OPIE */
5#include <opie2/odebug.h> 5#include <opie2/odebug.h>
6#include <qpe/qpeapplication.h> 6#include <qpe/qpeapplication.h>
7using namespace Opie::Core; 7using namespace Opie::Core;
8 8
9/* QT */ 9/* QT */
10#include <qlabel.h> 10#include <qlabel.h>
11#include <qlayout.h> 11#include <qlayout.h>
12#include <qcombobox.h> 12#include <qcombobox.h>
13#include <qpushbutton.h> 13#include <qpushbutton.h>
14#include <qhbox.h> 14#include <qhbox.h>
15 15
16namespace { 16namespace {
17 void setCurrent( const QString& str, QComboBox* bo ) { 17 void setCurrent( const QString& str, QComboBox* bo ) {
18 uint b = bo->count(); 18 uint b = bo->count();
19 for (int i = 0; i < bo->count(); i++ ) { 19 for (int i = 0; i < bo->count(); i++ ) {
20 if ( bo->text(i) == str ) { 20 if ( bo->text(i) == str ) {
21 bo->setCurrentItem( i ); 21 bo->setCurrentItem( i );
22 return; 22 return;
23 } 23 }
24 } 24 }
25 bo->insertItem( str ); 25 bo->insertItem( str );
26 bo->setCurrentItem( b ); 26 bo->setCurrentItem( b );
27 } 27 }
28} 28}
29 29
30ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, 30ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent,
31 const char* na ) 31 const char* na )
32 : ProfileDialogConnectionWidget( name, parent, na ) { 32 : ProfileDialogConnectionWidget( name, parent, na ) {
33 33
34 m_lay = new QVBoxLayout( this ); 34 m_lay = new QVBoxLayout( this );
35 m_device = new QLabel(tr( "Modem is attached to:" ), this ); 35 m_device = new QLabel(tr( "Modem is attached to:" ), this );
36 m_deviceCmb = new QComboBox(this ); 36 m_deviceCmb = new QComboBox(this );
37 m_deviceCmb->setEditable( TRUE ); 37 m_deviceCmb->setEditable( TRUE );
38 38
39 QLabel* telLabel = new QLabel( this ); 39 QLabel* telLabel = new QLabel( this );
40 telLabel->setText( tr( "Enter telefon number here:" ) ); 40 telLabel->setText( tr( "Enter telefon number here:" ) );
41 QHBox *buttonBox = new QHBox( this ); 41 QHBox *buttonBox = new QHBox( this );
42 m_telNumber = new QLineEdit( buttonBox ); 42 m_telNumber = new QLineEdit( buttonBox );
43 QPushButton *atButton = new QPushButton( buttonBox ); 43 QPushButton *atButton = new QPushButton( buttonBox );
44 atButton->setText( tr( "AT commands" ) ); 44 atButton->setText( tr( "AT commands" ) );
45 connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); 45 connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) );
46 46
47 QPushButton *dialButton = new QPushButton( buttonBox ); 47 QPushButton *dialButton = new QPushButton( buttonBox );
48 dialButton->setText( tr( "Enter number" ) ); 48 dialButton->setText( tr( "Enter number" ) );
49 connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); 49 connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) );
50 50
51 m_base = new IOLayerBase( this, "base" ); 51 m_base = new IOLayerBase( this, "base" );
52 52
53 m_lay->addWidget( m_device ); 53 m_lay->addWidget( m_device );
54 m_lay->addWidget( m_deviceCmb ); 54 m_lay->addWidget( m_deviceCmb );
55 m_lay->addWidget( telLabel ); 55 m_lay->addWidget( telLabel );
56 m_lay->addWidget( buttonBox ); 56 m_lay->addWidget( buttonBox );
57 m_lay->addWidget( m_base ); 57 m_lay->addWidget( m_base );
58 m_lay->addStretch( 0 ); 58 m_lay->addStretch( 0 );
59 59
60 m_deviceCmb->insertItem( "/dev/ttyS0" ); 60 m_deviceCmb->insertItem( "/dev/ttyS0" );
61 m_deviceCmb->insertItem( "/dev/ttyS1" ); 61 m_deviceCmb->insertItem( "/dev/ttyS1" );
62 m_deviceCmb->insertItem( "/dev/ttyS2" ); 62 m_deviceCmb->insertItem( "/dev/ttyS2" );
63 63
64 atConf = new ATConfigDialog( this, "ATConfig", true ); 64 atConf = new ATConfigDialog( this, "ATConfig", true );
65} 65}
66 66
67ModemConfigWidget::~ModemConfigWidget() { 67ModemConfigWidget::~ModemConfigWidget() {
68 68
69} 69}
70void ModemConfigWidget::load( const Profile& prof ) { 70void ModemConfigWidget::load( const Profile& prof ) {
71 71
72 int rad_flow = prof.readNumEntry( "Flow" ); 72 int rad_flow = prof.readNumEntry( "Flow" );
73 int rad_parity = prof.readNumEntry( "Parity" ); 73 int rad_parity = prof.readNumEntry( "Parity" );
74 int speed = prof.readNumEntry( "Speed" ); 74 int speed = prof.readNumEntry( "Speed" );
75 int dbits = prof.readNumEntry("DataBits"); 75 int dbits = prof.readNumEntry("DataBits");
76 int sbits = prof.readNumEntry("StopBits"); 76 int sbits = prof.readNumEntry("StopBits");
77 QString number = prof.readEntry( "Number" ); 77 QString number = prof.readEntry( "Number" );
78 78
79 if ( !number.isEmpty() ) { 79 if ( !number.isEmpty() ) {
80 m_telNumber->setText( number ); 80 m_telNumber->setText( number );
81 } 81 }
82 82
83 if ( rad_flow == 1 ) { 83 if ( rad_flow == 1 ) {
84 m_base->setFlow( IOLayerBase::Hardware ); 84 m_base->setFlow( IOLayerBase::Hardware );
85 } else if (rad_flow == 2) { 85 } else if (rad_flow == 2) {
86 m_base->setFlow( IOLayerBase::Software ); 86 m_base->setFlow( IOLayerBase::Software );
87 } else if (rad_flow == 0) { 87 } else if (rad_flow == 0) {
88 m_base->setFlow( IOLayerBase::None ); 88 m_base->setFlow( IOLayerBase::None );
89 } 89 }
90 90
91 91
92 if ( rad_parity == 1 ) { 92 if ( rad_parity == 1 ) {
93 m_base->setParity( IOLayerBase::Even ); 93 m_base->setParity( IOLayerBase::Even );
94 } else if ( rad_parity == 2 ){ 94 } else if ( rad_parity == 2 ){
95 m_base->setParity( IOLayerBase::Odd ); 95 m_base->setParity( IOLayerBase::Odd );
96 } else { 96 } else {
97 m_base->setParity( IOLayerBase::NonePar ); 97 m_base->setParity( IOLayerBase::NonePar );
98 } 98 }
99 99
100 switch( speed ) { 100 switch( speed ) {
101 case 115200: 101 case 115200:
102 m_base->setSpeed( IOLayerBase::Baud_115200 ); 102 m_base->setSpeed( IOLayerBase::Baud_115200 );
103 break; 103 break;
104 case 57600: 104 case 57600:
105 m_base->setSpeed( IOLayerBase::Baud_57600 ); 105 m_base->setSpeed( IOLayerBase::Baud_57600 );
106 break; 106 break;
107 case 38400: 107 case 38400:
108 m_base->setSpeed( IOLayerBase::Baud_38400 ); 108 m_base->setSpeed( IOLayerBase::Baud_38400 );
109 break; 109 break;
110 case 19200: 110 case 19200:
111 m_base->setSpeed( IOLayerBase::Baud_19200 ); 111 m_base->setSpeed( IOLayerBase::Baud_19200 );
112 break; 112 break;
113 case 4800:
114 m_base->setSpeed( IOLayerBase::Baud_4800 );
115 break;
116 case 2400:
117 m_base->setSpeed( IOLayerBase::Baud_2400 );
118 break;
113 case 9600: 119 case 9600:
114 default: 120 default:
115 m_base->setSpeed( IOLayerBase::Baud_9600 ); 121 m_base->setSpeed( IOLayerBase::Baud_9600 );
116 break; 122 break;
117 } 123 }
118 124
119 125
120 if ( dbits == 5) { 126 if ( dbits == 5) {
121 m_base->setData( IOLayerBase::Data_Five ); 127 m_base->setData( IOLayerBase::Data_Five );
122 } else if (rad_flow == 6) { 128 } else if (rad_flow == 6) {
123 m_base->setData( IOLayerBase::Data_Six ); 129 m_base->setData( IOLayerBase::Data_Six );
124 } else if (rad_flow == 7) { 130 } else if (rad_flow == 7) {
125 m_base->setData( IOLayerBase::Data_Seven ); 131 m_base->setData( IOLayerBase::Data_Seven );
126 } else { 132 } else {
127 m_base->setData( IOLayerBase::Data_Eight ); 133 m_base->setData( IOLayerBase::Data_Eight );
128 } 134 }
129 135
130 if ( sbits == 2) { 136 if ( sbits == 2) {
131 m_base->setStop( IOLayerBase::Stop_Two ); 137 m_base->setStop( IOLayerBase::Stop_Two );
132 } else if ( sbits == 15 ) { 138 } else if ( sbits == 15 ) {
133 m_base->setStop( IOLayerBase::Stop_OnePointFive ); 139 m_base->setStop( IOLayerBase::Stop_OnePointFive );
134 } else { 140 } else {
135 m_base->setStop( IOLayerBase::Stop_One ); 141 m_base->setStop( IOLayerBase::Stop_One );
136 } 142 }
137 143
138 144
139 atConf->readConfig( prof ); 145 atConf->readConfig( prof );
140 if ( prof.readEntry( "Device" ).isEmpty() ) { 146 if ( prof.readEntry( "Device" ).isEmpty() ) {
141 owarn << "device empty!" << oendl; 147 owarn << "device empty!" << oendl;
142 return; 148 return;
143 } 149 }
144 setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); 150 setCurrent( prof.readEntry( "Device" ), m_deviceCmb );
145 151
146 152
147} 153}
148 154
149/* 155/*
150 * save speed, 156 * save speed,
151 * flow, 157 * flow,
152 * parity 158 * parity
153 */ 159 */
154void ModemConfigWidget::save( Profile& prof ) { 160void ModemConfigWidget::save( Profile& prof ) {
155 int flow, parity, speed, data, stop; 161 int flow, parity, speed, data, stop;
156 flow = parity = speed = data = stop = 0; 162 flow = parity = speed = data = stop = 0;
157 prof.writeEntry( "Device", m_deviceCmb->currentText() ); 163 prof.writeEntry( "Device", m_deviceCmb->currentText() );
158 164
159 165
160 switch( m_base->flow() ) { 166 switch( m_base->flow() ) {
161 case IOLayerBase::None: 167 case IOLayerBase::None:
162 flow = 0; 168 flow = 0;
163 break; 169 break;
164 case IOLayerBase::Software: 170 case IOLayerBase::Software:
165 flow = 2; 171 flow = 2;
166 break; 172 break;
167 case IOLayerBase::Hardware: 173 case IOLayerBase::Hardware:
168 flow = 1; 174 flow = 1;
169 break; 175 break;
170 } 176 }
171 177
172 switch( m_base->parity() ) { 178 switch( m_base->parity() ) {
173 case IOLayerBase::Odd: 179 case IOLayerBase::Odd:
174 parity = 2; 180 parity = 2;
175 break; 181 break;
176 case IOLayerBase::Even: 182 case IOLayerBase::Even:
177 parity = 1; 183 parity = 1;
178 break; 184 break;
179 case IOLayerBase::NonePar: 185 case IOLayerBase::NonePar:
180 parity = 0; 186 parity = 0;
181 break; 187 break;
182 } 188 }
183 189
184 switch( m_base->speed() ) { 190 switch( m_base->speed() ) {
185 case IOLayerBase::Baud_115200: 191 case IOLayerBase::Baud_115200:
186 speed = 115200; 192 speed = 115200;
187 break; 193 break;
188 case IOLayerBase::Baud_57600: 194 case IOLayerBase::Baud_57600:
189 speed = 57600; 195 speed = 57600;
190 break; 196 break;
191 case IOLayerBase::Baud_38400: 197 case IOLayerBase::Baud_38400:
192 speed = 38400; 198 speed = 38400;
193 break; 199 break;
194 case IOLayerBase::Baud_19200: 200 case IOLayerBase::Baud_19200:
195 speed = 19200; 201 speed = 19200;
196 break; 202 break;
197 case IOLayerBase::Baud_9600: 203 case IOLayerBase::Baud_9600:
198 speed = 9600; 204 speed = 9600;
199 break; 205 break;
206 case IOLayerBase::Baud_4800:
207 speed = 4800;
208 break;
209 case IOLayerBase::Baud_2400:
210 speed = 2400;
211 break;
200 } 212 }
201 213
202 switch( m_base->data() ) { 214 switch( m_base->data() ) {
203 case IOLayerBase::Data_Five: 215 case IOLayerBase::Data_Five:
204 data = 5; 216 data = 5;
205 break; 217 break;
206 case IOLayerBase::Data_Six: 218 case IOLayerBase::Data_Six:
207 data = 6; 219 data = 6;
208 break; 220 break;
209 case IOLayerBase::Data_Seven: 221 case IOLayerBase::Data_Seven:
210 data = 7; 222 data = 7;
211 break; 223 break;
212 case IOLayerBase::Data_Eight: 224 case IOLayerBase::Data_Eight:
213 data = 8; 225 data = 8;
214 break; 226 break;
215 } 227 }
216 228
217 switch( m_base->stop() ) { 229 switch( m_base->stop() ) {
218 case IOLayerBase::Stop_One: 230 case IOLayerBase::Stop_One:
219 stop = 1; 231 stop = 1;
220 break; 232 break;
221 case IOLayerBase::Stop_OnePointFive: 233 case IOLayerBase::Stop_OnePointFive:
222 stop = 15; 234 stop = 15;
223 break; 235 break;
224 case IOLayerBase::Stop_Two: 236 case IOLayerBase::Stop_Two:
225 stop = 2; 237 stop = 2;
226 break; 238 break;
227 } 239 }
228 240
229 prof.writeEntry( "Flow", flow ); 241 prof.writeEntry( "Flow", flow );
230 prof.writeEntry( "Parity", parity ); 242 prof.writeEntry( "Parity", parity );
231 prof.writeEntry( "Speed", speed ); 243 prof.writeEntry( "Speed", speed );
232 prof.writeEntry("DataBits", data); 244 prof.writeEntry("DataBits", data);
233 prof.writeEntry("StopBits", stop); 245 prof.writeEntry("StopBits", stop);
234 prof.writeEntry( "Number", m_telNumber->text() ); 246 prof.writeEntry( "Number", m_telNumber->text() );
235 247
236 248
237 atConf->writeConfig(prof); 249 atConf->writeConfig(prof);
238} 250}
239 251
240void ModemConfigWidget::slotAT() { 252void ModemConfigWidget::slotAT() {
241 // ATConfigDialog conf( this, "ATConfig", true ); 253 // ATConfigDialog conf( this, "ATConfig", true );
242 // josef/Max I know why don't you create the stuff on the stack 254 // josef/Max I know why don't you create the stuff on the stack
243 // but making it a TopLevel Dialog and ignoring 255 // but making it a TopLevel Dialog and ignoring
244 // cancel is not fun either... 256 // cancel is not fun either...
245 // what to do? FIXME!!! -zecke 257 // what to do? FIXME!!! -zecke
246 if ( QPEApplication::execDialog( atConf ) != QDialog::Accepted ) { 258 if ( QPEApplication::execDialog( atConf ) != QDialog::Accepted ) {
247 // reload old settings 259 // reload old settings
248 } 260 }
249} 261}
250 262
251void ModemConfigWidget::slotDial() { 263void ModemConfigWidget::slotDial() {
252 DialDialog dial( this, "DialConfig", true ); 264 DialDialog dial( this, "DialConfig", true );
253 if(!m_telNumber->text().isEmpty()) { 265 if(!m_telNumber->text().isEmpty()) {
254 dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ \\.\\,]"), "")); 266 dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ \\.\\,]"), ""));
255 } 267 }
256 if ( QPEApplication::execDialog( &dial ) == QDialog::Accepted ) { 268 if ( QPEApplication::execDialog( &dial ) == QDialog::Accepted ) {
257 m_telNumber->setText( dial.number() ); 269 m_telNumber->setText( dial.number() );
258 } 270 }
259} 271}
diff --git a/noncore/apps/opie-console/serialconfigwidget.cpp b/noncore/apps/opie-console/serialconfigwidget.cpp
index 3edf723..5f3547a 100644
--- a/noncore/apps/opie-console/serialconfigwidget.cpp
+++ b/noncore/apps/opie-console/serialconfigwidget.cpp
@@ -1,198 +1,210 @@
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 4
5#include "iolayerbase.h" 5#include "iolayerbase.h"
6#include "serialconfigwidget.h" 6#include "serialconfigwidget.h"
7 7
8namespace { 8namespace {
9 void setCurrent( const QString& str, QComboBox* bo ) { 9 void setCurrent( const QString& str, QComboBox* bo ) {
10 uint b = bo->count(); 10 uint b = bo->count();
11 for (int i = 0; i < bo->count(); i++ ) { 11 for (int i = 0; i < bo->count(); i++ ) {
12 if ( bo->text(i) == str ) { 12 if ( bo->text(i) == str ) {
13 bo->setCurrentItem( i ); 13 bo->setCurrentItem( i );
14 return; 14 return;
15 } 15 }
16 } 16 }
17 bo->insertItem( str ); 17 bo->insertItem( str );
18 bo->setCurrentItem( b ); 18 bo->setCurrentItem( b );
19 } 19 }
20 20
21 21
22} 22}
23 23
24SerialConfigWidget::SerialConfigWidget( const QString& name, 24SerialConfigWidget::SerialConfigWidget( const QString& name,
25 QWidget* parent, 25 QWidget* parent,
26 const char* na ) 26 const char* na )
27 : ProfileDialogConnectionWidget( name, parent, na ) { 27 : ProfileDialogConnectionWidget( name, parent, na ) {
28 28
29 m_lay = new QVBoxLayout(this ); 29 m_lay = new QVBoxLayout(this );
30 m_device = new QLabel(tr("Device"), this ); 30 m_device = new QLabel(tr("Device"), this );
31 m_deviceCmb = new QComboBox(this ); 31 m_deviceCmb = new QComboBox(this );
32 m_deviceCmb->setEditable( TRUE ); 32 m_deviceCmb->setEditable( TRUE );
33 33
34 m_base = new IOLayerBase(this, "base"); 34 m_base = new IOLayerBase(this, "base");
35 35
36 m_lay->addWidget( m_device ); 36 m_lay->addWidget( m_device );
37 m_lay->addWidget( m_deviceCmb ); 37 m_lay->addWidget( m_deviceCmb );
38 m_lay->addWidget( m_base ); 38 m_lay->addWidget( m_base );
39 39
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 int dbits = prof.readNumEntry("DataBits"); 53 int dbits = prof.readNumEntry("DataBits");
54 int sbits = prof.readNumEntry("StopBits"); 54 int sbits = prof.readNumEntry("StopBits");
55 55
56 if (rad_flow == 1) { 56 if (rad_flow == 1) {
57 m_base->setFlow( IOLayerBase::Hardware ); 57 m_base->setFlow( IOLayerBase::Hardware );
58 } else if (rad_flow == 2) { 58 } else if (rad_flow == 2) {
59 m_base->setFlow( IOLayerBase::Software ); 59 m_base->setFlow( IOLayerBase::Software );
60 } else { 60 } else {
61 m_base->setFlow( IOLayerBase::None ); 61 m_base->setFlow( IOLayerBase::None );
62 } 62 }
63 63
64 if (rad_parity == 1) { 64 if (rad_parity == 1) {
65 m_base->setParity( IOLayerBase::Even ); 65 m_base->setParity( IOLayerBase::Even );
66 } else if ( rad_parity == 2 ) { 66 } else if ( rad_parity == 2 ) {
67 m_base->setParity( IOLayerBase::Odd ); 67 m_base->setParity( IOLayerBase::Odd );
68 } else { 68 } else {
69 m_base->setParity( IOLayerBase::NonePar ); 69 m_base->setParity( IOLayerBase::NonePar );
70 } 70 }
71 71
72 switch( speed ) { 72 switch( speed ) {
73 case 115200: 73 case 115200:
74 m_base->setSpeed(IOLayerBase::Baud_115200 ); 74 m_base->setSpeed(IOLayerBase::Baud_115200 );
75 break; 75 break;
76 case 57600: 76 case 57600:
77 m_base->setSpeed( IOLayerBase::Baud_57600 ); 77 m_base->setSpeed( IOLayerBase::Baud_57600 );
78 break; 78 break;
79 case 38400: 79 case 38400:
80 m_base->setSpeed(IOLayerBase::Baud_38400 ); 80 m_base->setSpeed(IOLayerBase::Baud_38400 );
81 break; 81 break;
82 case 19200: 82 case 19200:
83 m_base->setSpeed( IOLayerBase::Baud_19200 ); 83 m_base->setSpeed( IOLayerBase::Baud_19200 );
84 break; 84 break;
85 case 4800:
86 m_base->setSpeed( IOLayerBase::Baud_4800 );
87 break;
88 case 2400:
89 m_base->setSpeed( IOLayerBase::Baud_2400 );
90 break;
85 case 9600: 91 case 9600:
86 default: 92 default:
87 m_base->setSpeed(IOLayerBase::Baud_9600 ); 93 m_base->setSpeed(IOLayerBase::Baud_9600 );
88 break; 94 break;
89 } 95 }
90 96
91 if ( dbits == 5) { 97 if ( dbits == 5) {
92 m_base->setData( IOLayerBase::Data_Five ); 98 m_base->setData( IOLayerBase::Data_Five );
93 } else if (rad_flow == 6) { 99 } else if (rad_flow == 6) {
94 m_base->setData( IOLayerBase::Data_Six ); 100 m_base->setData( IOLayerBase::Data_Six );
95 } else if (rad_flow == 7) { 101 } else if (rad_flow == 7) {
96 m_base->setData( IOLayerBase::Data_Seven ); 102 m_base->setData( IOLayerBase::Data_Seven );
97 } else { 103 } else {
98 m_base->setData( IOLayerBase::Data_Eight ); 104 m_base->setData( IOLayerBase::Data_Eight );
99 } 105 }
100 106
101 if ( sbits == 2) { 107 if ( sbits == 2) {
102 m_base->setStop( IOLayerBase::Stop_Two ); 108 m_base->setStop( IOLayerBase::Stop_Two );
103 } else if ( sbits == 15 ) { 109 } else if ( sbits == 15 ) {
104 m_base->setStop( IOLayerBase::Stop_OnePointFive ); 110 m_base->setStop( IOLayerBase::Stop_OnePointFive );
105 } else { 111 } else {
106 m_base->setStop( IOLayerBase::Stop_One ); 112 m_base->setStop( IOLayerBase::Stop_One );
107 } 113 }
108 114
109 if ( prof.readEntry("Device").isEmpty() ) return; 115 if ( prof.readEntry("Device").isEmpty() ) return;
110 setCurrent( prof.readEntry("Device"), m_deviceCmb ); 116 setCurrent( prof.readEntry("Device"), m_deviceCmb );
111 117
112} 118}
113/* 119/*
114 * save speed, 120 * save speed,
115 * flow, 121 * flow,
116 * parity 122 * parity
117 */ 123 */
118void SerialConfigWidget::save( Profile& prof ) { 124void SerialConfigWidget::save( Profile& prof ) {
119 int flow, parity, speed, data, stop; 125 int flow, parity, speed, data, stop;
120 flow = parity = speed = data = stop = 0; 126 flow = parity = speed = data = stop = 0;
121 prof.writeEntry("Device", m_deviceCmb->currentText() ); 127 prof.writeEntry("Device", m_deviceCmb->currentText() );
122 128
123 switch( m_base->flow() ) { 129 switch( m_base->flow() ) {
124 case IOLayerBase::None: 130 case IOLayerBase::None:
125 flow = 0; 131 flow = 0;
126 break; 132 break;
127 case IOLayerBase::Software: 133 case IOLayerBase::Software:
128 flow = 2; 134 flow = 2;
129 break; 135 break;
130 case IOLayerBase::Hardware: 136 case IOLayerBase::Hardware:
131 flow = 1; 137 flow = 1;
132 break; 138 break;
133 } 139 }
134 140
135 switch( m_base->parity() ) { 141 switch( m_base->parity() ) {
136 case IOLayerBase::Odd: 142 case IOLayerBase::Odd:
137 parity = 2; 143 parity = 2;
138 break; 144 break;
139 case IOLayerBase::Even: 145 case IOLayerBase::Even:
140 parity = 1; 146 parity = 1;
141 break; 147 break;
142 case IOLayerBase::NonePar: 148 case IOLayerBase::NonePar:
143 parity = 0; 149 parity = 0;
144 break; 150 break;
145 } 151 }
146 152
147 switch( m_base->speed() ) { 153 switch( m_base->speed() ) {
148 case IOLayerBase::Baud_115200: 154 case IOLayerBase::Baud_115200:
149 speed = 115200; 155 speed = 115200;
150 break; 156 break;
151 case IOLayerBase::Baud_57600: 157 case IOLayerBase::Baud_57600:
152 speed = 57600; 158 speed = 57600;
153 break; 159 break;
154 case IOLayerBase::Baud_38400: 160 case IOLayerBase::Baud_38400:
155 speed = 38400; 161 speed = 38400;
156 break; 162 break;
157 case IOLayerBase::Baud_19200: 163 case IOLayerBase::Baud_19200:
158 speed = 19200; 164 speed = 19200;
159 break; 165 break;
166 case IOLayerBase::Baud_4800:
167 speed = 4800;
168 break;
169 case IOLayerBase::Baud_2400:
170 speed = 2400;
171 break;
160 default: 172 default:
161 case IOLayerBase::Baud_9600: 173 case IOLayerBase::Baud_9600:
162 speed = 9600; 174 speed = 9600;
163 break; 175 break;
164 } 176 }
165 177
166 switch( m_base->data() ) { 178 switch( m_base->data() ) {
167 case IOLayerBase::Data_Five: 179 case IOLayerBase::Data_Five:
168 data = 5; 180 data = 5;
169 break; 181 break;
170 case IOLayerBase::Data_Six: 182 case IOLayerBase::Data_Six:
171 data = 6; 183 data = 6;
172 break; 184 break;
173 case IOLayerBase::Data_Seven: 185 case IOLayerBase::Data_Seven:
174 data = 7; 186 data = 7;
175 break; 187 break;
176 case IOLayerBase::Data_Eight: 188 case IOLayerBase::Data_Eight:
177 data = 8; 189 data = 8;
178 break; 190 break;
179 } 191 }
180 192
181 switch( m_base->stop() ) { 193 switch( m_base->stop() ) {
182 case IOLayerBase::Stop_One: 194 case IOLayerBase::Stop_One:
183 stop = 1; 195 stop = 1;
184 break; 196 break;
185 case IOLayerBase::Stop_OnePointFive: 197 case IOLayerBase::Stop_OnePointFive:
186 stop = 15; 198 stop = 15;
187 break; 199 break;
188 case IOLayerBase::Stop_Two: 200 case IOLayerBase::Stop_Two:
189 stop = 2; 201 stop = 2;
190 break; 202 break;
191 } 203 }
192 204
193 prof.writeEntry("Flow", flow); 205 prof.writeEntry("Flow", flow);
194 prof.writeEntry("Parity", parity); 206 prof.writeEntry("Parity", parity);
195 prof.writeEntry("Speed", speed); 207 prof.writeEntry("Speed", speed);
196 prof.writeEntry("DataBits", data); 208 prof.writeEntry("DataBits", data);
197 prof.writeEntry("StopBits", stop); 209 prof.writeEntry("StopBits", stop);
198} 210}
diff --git a/noncore/apps/opie-console/terminalwidget.cpp b/noncore/apps/opie-console/terminalwidget.cpp
index 087476b..3e3b8a6 100644
--- a/noncore/apps/opie-console/terminalwidget.cpp
+++ b/noncore/apps/opie-console/terminalwidget.cpp
@@ -1,226 +1,242 @@
1#include "terminalwidget.h" 1#include "terminalwidget.h"
2 2
3/* OPIE */ 3/* OPIE */
4#include <opie2/odebug.h> 4#include <opie2/odebug.h>
5
5using namespace Opie::Core; 6using namespace Opie::Core;
6 7
7/* QT */ 8/* QT */
8#include <qlabel.h> 9#include <qlabel.h>
9#include <qcheckbox.h> 10#include <qcheckbox.h>
10#include <qcombobox.h> 11#include <qcombobox.h>
11#include <qradiobutton.h> 12#include <qradiobutton.h>
12#include <qhgroupbox.h> 13#include <qhgroupbox.h>
13#include <qhbuttongroup.h> 14#include <qhbuttongroup.h>
14#include <qlayout.h> 15#include <qlayout.h>
16#include <qhbox.h>
15 17
16namespace { 18namespace {
17 enum TermIds { 19 enum TermIds {
18 id_term_vt100 = 0, 20 id_term_vt100 = 0,
19 id_term_vt102, 21 id_term_vt102,
20 id_term_linux, 22 id_term_linux,
21 id_term_xterm 23 id_term_xterm
22 }; 24 };
23 25
24 enum ColourIds { 26 enum ColourIds {
25 id_term_black, 27 id_term_black,
26 id_term_white, 28 id_term_white,
27 id_term_green, 29 id_term_green,
28 id_term_orange 30 id_term_orange
29 }; 31 };
30 32
31 enum FontIds { 33 enum FontIds {
32 id_size_small, 34 id_size_small,
33 id_size_medium, 35 id_size_medium,
34 id_size_large 36 id_size_large
35 }; 37 };
36}; 38};
37 39
38TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, 40TerminalWidget::TerminalWidget( const QString& name, QWidget* parent,
39 const char* na ) 41 const char* na )
40 : ProfileDialogTerminalWidget( name, parent, na ) { 42 : ProfileDialogTerminalWidget( name, parent, na ) {
41 43
42 m_terminal = new QLabel(tr("Terminal Type"), this ); 44 m_terminal = new QLabel(tr("Terminal Type"), this );
43 m_terminalBox = new QComboBox(this); 45 m_terminalBox = new QComboBox(this);
44 m_colorLabel = new QLabel(tr("Color scheme"), this); 46 m_colorLabel = new QLabel(tr("Color scheme"), this);
45 m_colorCmb = new QComboBox(this ); 47 m_colorCmb = new QComboBox(this );
46 48
47 m_groupSize = new QHButtonGroup(tr("Font size"), this ); 49// m_groupSize = new QHButtonGroup(tr("Font size"), this );
48 m_sizeSmall = new QRadioButton(tr("small"), m_groupSize ); 50 m_groupSize = new QHBox( this );
49 m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize ); 51 m_fontSelector = new Opie::Ui::OFontSelector( false, m_groupSize );
50 m_sizeLarge = new QRadioButton(tr("large"), m_groupSize ); 52
53// m_sizeSmall = new QRadioButton(tr("small"), m_groupSize );
54// m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize );
55// m_sizeLarge = new QRadioButton(tr("large"), m_groupSize );
51 56
52 m_groupConv = new QHGroupBox( tr("Line-break conversions"), this ); 57 m_groupConv = new QHGroupBox( tr("Line-break conversions"), this );
53 m_convInbound = new QCheckBox( tr("Inbound"), m_groupConv ); 58 m_convInbound = new QCheckBox( tr("Inbound"), m_groupConv );
54 m_convOutbound = new QCheckBox( tr("Outbound"), m_groupConv ); 59 m_convOutbound = new QCheckBox( tr("Outbound"), m_groupConv );
55 60
61
56 m_groupOptions = new QHGroupBox( tr("Options"), this ); 62 m_groupOptions = new QHGroupBox( tr("Options"), this );
57 m_optionEcho = new QCheckBox( tr("Local echo"), m_groupOptions ); 63 m_optionEcho = new QCheckBox( tr("Local echo"), m_groupOptions );
58 m_optionWrap = new QCheckBox( tr("Line wrap"), m_groupOptions ); 64 m_optionWrap = new QCheckBox( tr("Line wrap"), m_groupOptions );
59 65
60 m_lroot = new QVBoxLayout( this ); 66 m_lroot = new QVBoxLayout( this );
61 m_typeBox = new QVBoxLayout( m_lroot ); 67 m_typeBox = new QVBoxLayout( m_lroot );
62 m_colorBox = new QVBoxLayout( m_lroot ); 68 m_colorBox = new QVBoxLayout( m_lroot );
63 69
64 // Layout 70 // Layout
65 m_typeBox->add( m_terminal ); 71 m_typeBox->add( m_terminal );
66 m_typeBox->add( m_terminalBox ); 72 m_typeBox->add( m_terminalBox );
67 m_lroot->add( m_groupSize ); 73 m_lroot->add( m_groupSize );
68 74
69 m_colorBox->add( m_colorLabel ); 75 m_colorBox->add( m_colorLabel );
70 m_colorBox->add( m_colorCmb ); 76 m_colorBox->add( m_colorCmb );
71 77
72 m_lroot->add( m_groupConv ); 78 m_lroot->add( m_groupConv );
73 m_lroot->add( m_groupOptions ); 79 m_lroot->add( m_groupOptions );
74 m_lroot->addStretch( 0 ); 80 m_lroot->addStretch( 0 );
75 81
76 // Fill in some options 82 // Fill in some options
77 owarn << "Options for terminal box" << oendl; 83 owarn << "Options for terminal box" << oendl;
78 m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ ); 84 m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ );
79 m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */); 85 m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */);
80 m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux ); 86 m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux );
81 m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm ); 87 m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm );
82 //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); 88 //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi );
83 89
84 m_colorCmb->insertItem( tr("black on white"), id_term_black ); 90 m_colorCmb->insertItem( tr("black on white"), id_term_black );
85 m_colorCmb->insertItem( tr("white on black"), id_term_white ); 91 m_colorCmb->insertItem( tr("white on black"), id_term_white );
86 m_colorCmb->insertItem( tr("green on black"), id_term_green ); 92 m_colorCmb->insertItem( tr("green on black"), id_term_green );
87 m_colorCmb->insertItem( tr("orange on black"), id_term_orange ); 93 m_colorCmb->insertItem( tr("orange on black"), id_term_orange );
88 94
89 // signals + slots 95 // signals + slots
90 /* 96 /*
91 connect(m_terminalBox, SIGNAL(activated(int) ), 97 connect(m_terminalBox, SIGNAL(activated(int) ),
92 this, SLOT(slotTermTerm(int) ) ); 98 this, SLOT(slotTermTerm(int) ) );
93 connect(m_colorBox, SIGNAL(activated(int) ), 99 connect(m_colorBox, SIGNAL(activated(int) ),
94 tis, SLOT(slotTermColor(int) ) ); 100 tis, SLOT(slotTermColor(int) ) );
95 connect(m_groupSize, SIGNAL(activated(int) ), 101 connect(m_groupSize, SIGNAL(activated(int) ),
96 this, SLOT(slotTermFont(int) ) ); 102 this, SLOT(slotTermFont(int) ) );
97 103
98 connect(m_optionEcho, SIGNAL(toggled(bool) ), 104 connect(m_optionEcho, SIGNAL(toggled(bool) ),
99 this, SLOT(slotTermEcho(bool) ) ); 105 this, SLOT(slotTermEcho(bool) ) );
100 connect(m_optionWrap, SIGNAL(toggled(bool) ), 106 connect(m_optionWrap, SIGNAL(toggled(bool) ),
101 this, SLOT(slotTermWrap(bool) ) ); 107 this, SLOT(slotTermWrap(bool) ) );
102 connect(m_convInbound, SIGNAL(toggled(bool) ), 108 connect(m_convInbound, SIGNAL(toggled(bool) ),
103 this, SLOT(slotTermInbound(bool) ) ); 109 this, SLOT(slotTermInbound(bool) ) );
104 connect(m_convOutbound, SIGNAL(toggled(bool) ), 110 connect(m_convOutbound, SIGNAL(toggled(bool) ),
105 this, SLOT(slotTermOutbound(bool) ) ); 111 this, SLOT(slotTermOutbound(bool) ) );
106*/ 112*/
107} 113}
108TerminalWidget::~TerminalWidget() { 114TerminalWidget::~TerminalWidget() {
109} 115}
110void TerminalWidget::load( const Profile& prof ) { 116void TerminalWidget::load( const Profile& prof ) {
111 int term = prof.readNumEntry("Terminal"); 117 int term = prof.readNumEntry("Terminal");
112 int color = prof.readNumEntry("Color"); 118 int color = prof.readNumEntry("Color");
113 int fontsize = prof.readNumEntry("Font"); 119// int fontsize = prof.readNumEntry("Font");
114 int opt_echo = prof.readNumEntry("Echo"); 120 int opt_echo = prof.readNumEntry("Echo");
115 int opt_wrap = prof.readNumEntry("Wrap"); 121 int opt_wrap = prof.readNumEntry("Wrap");
116 int opt_inbound = prof.readNumEntry("Inbound"); 122 int opt_inbound = prof.readNumEntry("Inbound");
117 int opt_outbound = prof.readNumEntry("Outbound"); 123 int opt_outbound = prof.readNumEntry("Outbound");
118 124
119 switch( term ) { 125 switch( term ) {
120 case Profile::VT100: 126 case Profile::VT100:
121 m_terminalBox->setCurrentItem(id_term_vt100 ); 127 m_terminalBox->setCurrentItem(id_term_vt100 );
122 break; 128 break;
123 case Profile::VT102: 129 case Profile::VT102:
124 m_terminalBox->setCurrentItem(id_term_vt102 ); 130 m_terminalBox->setCurrentItem(id_term_vt102 );
125 break; 131 break;
126 case Profile::Linux: 132 case Profile::Linux:
127 m_terminalBox->setCurrentItem(id_term_linux ); 133 m_terminalBox->setCurrentItem(id_term_linux );
128 break; 134 break;
129 case Profile::XTerm: 135 case Profile::XTerm:
130 m_terminalBox->setCurrentItem(id_term_xterm ); 136 m_terminalBox->setCurrentItem(id_term_xterm );
131 break; 137 break;
132 default: 138 default:
133 m_terminalBox->setCurrentItem(id_term_vt102 ); 139 m_terminalBox->setCurrentItem(id_term_vt102 );
134 break; 140 break;
135 }; 141 };
136 142
137 switch( color ) { 143 switch( color ) {
138 case Profile::Black: 144 case Profile::Black:
139 m_colorCmb->setCurrentItem(id_term_black ); 145 m_colorCmb->setCurrentItem(id_term_black );
140 break; 146 break;
141 case Profile::White: 147 case Profile::White:
142 m_colorCmb->setCurrentItem(id_term_white ); 148 m_colorCmb->setCurrentItem(id_term_white );
143 break; 149 break;
144 case Profile::Green: 150 case Profile::Green:
145 m_colorCmb->setCurrentItem(id_term_green ); 151 m_colorCmb->setCurrentItem(id_term_green );
146 break; 152 break;
147 case Profile::Orange: 153 case Profile::Orange:
148 m_colorCmb->setCurrentItem(id_term_orange ); 154 m_colorCmb->setCurrentItem(id_term_orange );
149 break; 155 break;
150 default: 156 default:
151 break; 157 break;
152 }; 158 };
153 159
154 switch( fontsize ) { 160
155 case Profile::Micro: 161 m_fontSelector->setSelectedFont( prof.readEntry( "Font"), prof.readEntry( "FontStyle"), prof.readNumEntry( "FontSize" ), prof.readEntry( "FontCharset") );
156 m_sizeSmall->setChecked(true ); 162
157 break; 163// switch( fontsize ) {
158 case Profile::Small: 164// case Profile::Micro:
159 m_sizeMedium->setChecked(true ); 165// m_sizeSmall->setChecked(true );
160 break; 166// break;
161 case Profile::Medium: 167// case Profile::Small:
162 m_sizeLarge->setChecked( true ); 168// m_sizeMedium->setChecked(true );
163 break; 169// break;
164 default: 170// case Profile::Medium:
165 m_sizeMedium->setChecked(true ); 171// m_sizeLarge->setChecked( true );
166 break; 172// break;
167 }; 173// default:
174// m_sizeMedium->setChecked(true );
175// break;
176// };
168 177
169 if (opt_echo) m_optionEcho->setChecked( true ); 178 if (opt_echo) m_optionEcho->setChecked( true );
170 if (opt_wrap) m_optionWrap->setChecked( true ); 179 if (opt_wrap) m_optionWrap->setChecked( true );
171 if (opt_inbound) m_convInbound->setChecked( true ); 180 if (opt_inbound) m_convInbound->setChecked( true );
172 if (opt_outbound) m_convOutbound->setChecked( true ); 181 if (opt_outbound) m_convOutbound->setChecked( true );
173 182
174} 183}
175void TerminalWidget::save( Profile& profile ) { 184void TerminalWidget::save( Profile& profile ) {
176 switch(m_terminalBox->currentItem() ) { 185 switch(m_terminalBox->currentItem() ) {
177 case id_term_vt100: 186 case id_term_vt100:
178 profile.writeEntry("Terminal", Profile::VT100 ); 187 profile.writeEntry("Terminal", Profile::VT100 );
179 break; 188 break;
180 case id_term_vt102: 189 case id_term_vt102:
181 profile.writeEntry("Terminal", Profile::VT102 ); 190 profile.writeEntry("Terminal", Profile::VT102 );
182 break; 191 break;
183 case id_term_linux: 192 case id_term_linux:
184 profile.writeEntry("Terminal", Profile::Linux ); 193 profile.writeEntry("Terminal", Profile::Linux );
185 break; 194 break;
186 case id_term_xterm: 195 case id_term_xterm:
187 profile.writeEntry("Terminal", Profile::XTerm ); 196 profile.writeEntry("Terminal", Profile::XTerm );
188 break; 197 break;
189 //case id_term_ansi: 198 //case id_term_ansi:
190 // profile.writeEntry("Terminal", Profile::VT102 ); 199 // profile.writeEntry("Terminal", Profile::VT102 );
191 // break; 200 // break;
192 default: 201 default:
193 break; 202 break;
194 }; 203 };
195 204
196 // color 205 // color
197 switch(m_colorCmb->currentItem() ) { 206 switch(m_colorCmb->currentItem() ) {
198 case id_term_black: 207 case id_term_black:
199 profile.writeEntry("Color", Profile::Black ); 208 profile.writeEntry("Color", Profile::Black );
200 break; 209 break;
201 case id_term_white: 210 case id_term_white:
202 profile.writeEntry("Color", Profile::White ); 211 profile.writeEntry("Color", Profile::White );
203 break; 212 break;
204 case id_term_green: 213 case id_term_green:
205 profile.writeEntry("Color", Profile::Green ); 214 profile.writeEntry("Color", Profile::Green );
206 break; 215 break;
207 case id_term_orange: 216 case id_term_orange:
208 profile.writeEntry("Color", Profile::Orange ); 217 profile.writeEntry("Color", Profile::Orange );
209 break; 218 break;
210 default: 219 default:
211 break; 220 break;
212 }; 221 };
213 222
214 if (m_sizeSmall->isChecked() ) { 223
215 profile.writeEntry("Font", Profile::Micro ); 224 profile.writeEntry( "FontSize", m_fontSelector->fontSize() );
216 }else if (m_sizeMedium->isChecked() ) { 225 profile.writeEntry( "FontStyle", m_fontSelector->fontStyle() );
217 profile.writeEntry("Font", Profile::Small ); 226 profile.writeEntry( "FontCharset", m_fontSelector->fontCharSet() );
218 }else { 227 profile.writeEntry( "Font", m_fontSelector->fontFamily() );
219 profile.writeEntry("Font", Profile::Medium ); 228
220 } 229
230// if (m_sizeSmall->isChecked() ) {
231// profile.writeEntry("Font", Profile::Micro );
232// }else if (m_sizeMedium->isChecked() ) {
233// profile.writeEntry("Font", Profile::Small );
234// }else {
235// profile.writeEntry("Font", Profile::Medium );
236// }
221 237
222 profile.writeEntry("Echo", m_optionEcho->isChecked() ); 238 profile.writeEntry("Echo", m_optionEcho->isChecked() );
223 profile.writeEntry("Wrap", m_optionWrap->isChecked() ); 239 profile.writeEntry("Wrap", m_optionWrap->isChecked() );
224 profile.writeEntry("Inbound", m_convInbound->isChecked() ); 240 profile.writeEntry("Inbound", m_convInbound->isChecked() );
225 profile.writeEntry("Outbound",m_convOutbound->isChecked() ); 241 profile.writeEntry("Outbound",m_convOutbound->isChecked() );
226} 242}
diff --git a/noncore/apps/opie-console/terminalwidget.h b/noncore/apps/opie-console/terminalwidget.h
index 217fea7..2bd38d6 100644
--- a/noncore/apps/opie-console/terminalwidget.h
+++ b/noncore/apps/opie-console/terminalwidget.h
@@ -1,48 +1,52 @@
1#ifndef OPIE_TERMINAL_WIDGET_H 1#ifndef OPIE_TERMINAL_WIDGET_H
2#define OPIE_TERMINAL_WIDGET_H 2#define OPIE_TERMINAL_WIDGET_H
3 3
4#include "profiledialogwidget.h" 4#include "profiledialogwidget.h"
5 5
6#include <opie2/ofontselector.h>
7
6class QComboBox; 8class QComboBox;
7class QLabel; 9class QLabel;
8class QVBoxLayout; 10class QVBoxLayout;
9class QHBoxLayout; 11class QHBoxLayout;
10class QButtonGroup; 12class QButtonGroup;
11class QRadioButton; 13class QRadioButton;
12class QCheckBox; 14class QCheckBox;
13class QHGroupBox; 15class QHGroupBox;
14class QHBox; 16class QHBox;
15 17
18
16class TerminalWidget : public ProfileDialogTerminalWidget { 19class TerminalWidget : public ProfileDialogTerminalWidget {
17 20
18 Q_OBJECT 21 Q_OBJECT
19 22
20public: 23public:
21 TerminalWidget(const QString& name, QWidget* wid, 24 TerminalWidget(const QString& name, QWidget* wid,
22 const char* na ) ; 25 const char* na ) ;
23 ~TerminalWidget(); 26 ~TerminalWidget();
24 27
25 void load( const Profile& ); 28 void load( const Profile& );
26 void save( Profile& ); 29 void save( Profile& );
27 30
28private: 31private:
29 QVBoxLayout* m_lroot, *m_typeBox, *m_colorBox; 32 QVBoxLayout* m_lroot, *m_typeBox, *m_colorBox;
30 33
31 QLabel* m_terminal, *m_colorLabel; 34 QLabel* m_terminal, *m_colorLabel;
32 35
33 QComboBox* m_terminalBox, *m_colorCmb; 36 QComboBox* m_terminalBox, *m_colorCmb;
34 37
35 QButtonGroup* m_groupSize; 38 QHBox* m_groupSize;
36 39
37 QRadioButton* m_sizeSmall, *m_sizeMedium, 40 QRadioButton* m_sizeSmall, *m_sizeMedium,
38 *m_sizeLarge; 41 *m_sizeLarge;
39 42
40 QHGroupBox *m_groupConv, *m_groupOptions; 43 QHGroupBox *m_groupConv, *m_groupOptions;
41 44
42 QCheckBox *m_convInbound, 45 QCheckBox *m_convInbound,
43 *m_convOutbound, *m_optionEcho, 46 *m_convOutbound, *m_optionEcho,
44 *m_optionWrap; 47 *m_optionWrap;
45 48
49 Opie::Ui::OFontSelector *m_fontSelector;
46}; 50};
47 51
48#endif 52#endif